cherry-pick(#27103): fix: list tests only once (#27107)

Fixes #27087
This commit is contained in:
Yury Semikhatsky 2023-09-14 21:33:29 -07:00 committed by GitHub
parent 0861364c28
commit 476b74f7c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View file

@ -104,4 +104,8 @@ class ListModeReporter extends EmptyReporter {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error('\n' + formatError(error, false).message); console.error('\n' + formatError(error, false).message);
} }
override printsToStdio(): boolean {
return true;
}
} }

View file

@ -196,3 +196,21 @@ test('should report errors with location', async ({ runInlineTest }) => {
column: 9, 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
`);
});