Skip to content

Commit 9a5bfc5

Browse files
committed
fix: respect .only in --list mode
Fixes #28709
1 parent a1a4133 commit 9a5bfc5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/playwright/src/runner/tasks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function addRunTasks(taskRunner: TaskRunner<TestRun>, config: FullConfigInternal
102102

103103
export function createTaskRunnerForList(config: FullConfigInternal, reporter: ReporterV2, mode: 'in-process' | 'out-of-process', options: { failOnLoadErrors: boolean }): TaskRunner<TestRun> {
104104
const taskRunner = new TaskRunner<TestRun>(reporter, config.config.globalTimeout);
105-
taskRunner.addTask('load tests', createLoadTask(mode, { ...options, filterOnly: false }));
105+
taskRunner.addTask('load tests', createLoadTask(mode, { ...options, filterOnly: true }));
106106
taskRunner.addTask('report begin', createReportBeginTask());
107107
return taskRunner;
108108
}

tests/playwright-test/list-mode.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ test('should report errors', async ({ runInlineTest }) => {
152152
expect(result.output).toContain('> 3 | oh = 2;');
153153
});
154154

155-
test('should ignore .only', async ({ runInlineTest }) => {
155+
test('should respect .only', async ({ runInlineTest }) => {
156+
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/28709' });
156157
const result = await runInlineTest({
157158
'a.test.js': `
158159
const { test, expect } = require('@playwright/test');
@@ -167,9 +168,8 @@ test('should ignore .only', async ({ runInlineTest }) => {
167168
expect(result.exitCode).toBe(0);
168169
expect(result.output).toContain([
169170
`Listing tests:`,
170-
` a.test.js:3:7 › example1`,
171171
` a.test.js:6:12 › example2`,
172-
`Total: 2 tests in 1 file`
172+
`Total: 1 test in 1 file`
173173
].join('\n'));
174174
});
175175

0 commit comments

Comments
 (0)