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

fix: list tests only once #27103

Merged
merged 2 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/playwright/src/runner/reporters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,8 @@ class ListModeReporter extends EmptyReporter {
// eslint-disable-next-line no-console
console.error('\n' + formatError(error, false).message);
}

override printsToStdio(): boolean {
return true;
}
}
18 changes: 18 additions & 0 deletions tests/playwright-test/list-mode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,21 @@ test('should report errors with location', async ({ runInlineTest }) => {
column: 9,
});
});

test('should list tests once', async ({ runInlineTest }) => {
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/27087' });
const result = await runInlineTest({
'playwright.config.ts': `
module.exports = { };
`,
'a.test.js': `
const { test, expect } = require('@playwright/test');
test('test 1', ({}) => {});
`
}, { 'list': true });
expect(result.exitCode).toBe(0);
expect(result.output).toEqual(`Listing tests:
a.test.js:3:7 › test 1
Total: 1 test in 1 file
`);
});
Loading