Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: split output clients by capabilities and base dir #34135

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pavelfeldman
Copy link
Member

Fixes #34125

This comment has been minimized.

This comment has been minimized.

githubLogger = new GitHubLogger();

constructor(options: { omitFailures?: boolean } = {}) {
super(options);
this.screen.colors = noColors;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid changing the global terminalScreen.colors and messing up other reporters:

Suggested change
this.screen.colors = noColors;
this.screen = { ...this.screen, colors: noColors };

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch

@@ -222,7 +222,7 @@ class JSONReporter implements ReporterV2 {
}

private _serializeError(error: TestError): JSONReportError {
return formatError(error, true);
return formatError(nonTerminalScreen, error);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a behavior change. Previously, we were always coloring the code snippet, and now we do it conditionally based on isTTY/PLAYWRIGHT_FORCE_TTY/FORCE_COLOR/DEBUG_COLORS.

Noticing here to figure out whether this is intentional.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this changed - previously formatError was using colors (not realColors), so it was respecting the env variables.


type MarkdownReporterOptions = {
configDir: string,
outputFile?: string;
};


class MarkdownReporter extends BaseReporter {
class MarkdownReporter extends TerminalReporter {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reporter seems to be a non-terminal one. I think it is more like the json/junit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, but it inherited BaseReporter, which was a Terminal reporter. I can change it in a follow-up.

@@ -160,6 +160,6 @@ class ListModeReporter implements ReporterV2 {

onError(error: TestError) {
// eslint-disable-next-line no-console
console.error('\n' + formatError(error, false).message);
console.error('\n' + formatError(terminalScreen, error).message);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we did not want colors here at all, which seems consistent with plain console.log() above instead of using formatTitle(). Should we have a separate noColorsScreen?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ListModeReporter is a kind of a terminal reporter, so why not keep it colorful?

@@ -95,7 +95,7 @@ export function createErrorCollectingReporter(writeToConsole?: boolean): ErrorCo
onError(error: TestError) {
errors.push(error);
if (writeToConsole)
process.stdout.write(formatError(error, colors.enabled).message + '\n');
process.stdout.write(formatError(terminalScreen, error).message + '\n');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be nonTerminalScreen instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

writeToConsole is true only for run-dev-server and clear-cache, which both are terminal. But I'm happy to make it accept the screen since it depends on the call context.

Copy link
Contributor

github-actions bot commented Jan 4, 2025

Test results for "tests 1"

3 failed
❌ [installation tests] › playwright-electron-should-work.spec.ts:21:5 › electron should work @package-installations-ubuntu-latest
❌ [installation tests] › playwright-electron-should-work.spec.ts:31:5 › electron should work with special characters in path @package-installations-ubuntu-latest
❌ [installation tests] › playwright-electron-should-work.spec.ts:44:5 › should work when wrapped inside @playwright/test and trace is enabled @package-installations-ubuntu-latest

7 flaky ⚠️ [firefox-page] › page/page-evaluate.spec.ts:403:3 › should throw for too deep reference chain @firefox-ubuntu-22.04-node18
⚠️ [chromium-library] › library/popup.spec.ts:264:3 › should not throw when click closes popup @ubuntu-20.04-chromium-tip-of-tree
⚠️ [webkit-library] › library/browsertype-connect.spec.ts:492:5 › launchServer › should saveAs videos from remote browser @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › library/trace-viewer.spec.ts:169:1 › should complain about newer version of trace in old viewer @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › library/trace-viewer.spec.ts:1447:1 › should not record network actions @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › library/tracing.spec.ts:28:5 › should collect trace with resources, but no js @webkit-ubuntu-22.04-node18
⚠️ [webkit-page] › page/page-set-input-files.spec.ts:147:3 › should upload large file @webkit-ubuntu-22.04-node18

37512 passed, 654 skipped
✔️✔️✔️

Merge workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Playwright does not append testDir to the error location
2 participants