Skip to content

Commit

Permalink
fix: list tests only once (#27103)
Browse files Browse the repository at this point in the history
Fixes #27087
  • Loading branch information
yury-s authored Sep 15, 2023
1 parent 26cbe69 commit ebf6a08
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
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
`);
});

0 comments on commit ebf6a08

Please sign in to comment.