Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(test-runner): map imported call locations to the callee start (#43237)
Pavel Feldmanfae5fab597ef
diff --git a/packages/playwright/src/transform/babelBundle.ts b/packages/playwright/src/transform/babelBundle.tsindex 69309367e3..eae34054b4 100644--- a/packages/playwright/src/transform/babelBundle.ts+++ b/packages/playwright/src/transform/babelBundle.ts@@ -121,6 +121,22 @@ function babelTransformOptions(isTypeScript: boolean, isModule: boolean, pluginsif (!isModule) {plugins.push([require('@babel/plugin-transform-modules-commonjs')]);+ plugins.push([+ (): PluginObj => ({+ name: 'map-interop-calls-to-callee-start',+ visitor: {},+ post(file) {+ // Otherwise V8 reports test('foo') in (0, _test.test)('foo') at the paren instead of the callee.+ file.path.traverse({+ CallExpression(path) {+ const callee = path.node.callee;+ if (callee.type === 'SequenceExpression' && !callee.loc)+ callee.expressions[callee.expressions.length - 1].loc = null;+ }+ });+ }+ })+ ]);// Note: we used to include '@babel/plugin-transform-dynamic-import' to convert async imports// into require(), so that pirates can intercept them. With the ESM loader enabled by default,// there is no need for this.diff --git a/tests/mcp/test-debug.spec.ts b/tests/mcp/test-debug.spec.tsindex 4389d04434..4e088cf242 100644--- a/tests/mcp/test-debug.spec.ts+++ b/tests/mcp/test-debug.spec.ts@@ -41,7 +41,7 @@ test('test_debug (passed)', async ({ startClient }) => {},})).toHaveTextResponse(`Running 1 test using 1 worker- ok 1 [id=<ID>] a.test.ts:3:11 › pass (XXms)+ ok 1 [id=<ID>] a.test.ts:3:7 › pass (XXms)1 passed (XXms)`);});@@ -84,7 +84,7 @@ Try recovering from the error prior to continuing`);arguments: {locations: ['a.test.ts'],},- })).toHaveTextResponse(expect.stringContaining(`1) [id=<ID>] a.test.ts:3:11 › fail`));+ })).toHaveTextResponse(expect.stringContaining(`1) [id=<ID>] a.test.ts:3:7 › fail`));});test('test_debug (browser_snapshot/network/console)', async ({ startClient, server }) => {@@ -209,7 +209,7 @@ Try recovering from the error prior to continuing`);arguments: {locations: ['a.test.ts'],},- })).toHaveTextResponse(expect.stringContaining(`1) [id=<ID>] a.test.ts:3:11 › fail`));+ })).toHaveTextResponse(expect.stringContaining(`1) [id=<ID>] a.test.ts:3:7 › fail`));});test('test_debug / evaluate', async ({ startClient }) => {diff --git a/tests/mcp/test-list.spec.ts b/tests/mcp/test-list.spec.tsindex 561e9bea84..1ef56c0560 100644--- a/tests/mcp/test-list.spec.ts+++ b/tests/mcp/test-list.spec.ts@@ -39,10 +39,10 @@ test('test_list', async ({ startClient }) => {name: 'test_list',arguments: {},})).toHaveTextResponse(`Listing tests:- [id=<ID>] [project=foo] › a.test.ts:3:11 › example1- [id=<ID>] [project=foo] › a.test.ts:6:11 › example2- [id=<ID>] a.test.ts:3:11 › example1- [id=<ID>] a.test.ts:6:11 › example2+ [id=<ID>] [project=foo] › a.test.ts:3:7 › example1+ [id=<ID>] [project=foo] › a.test.ts:6:7 › example2+ [id=<ID>] a.test.ts:3:7 › example1+ [id=<ID>] a.test.ts:6:7 › example2Total: 4 tests in 1 file`);});@@ -60,6 +60,6 @@ test('test_list config in cwd', async ({ startClient }) => {expect(await client.callTool({name: 'test_list',})).toHaveTextResponse(`Listing tests:- [id=<ID>] a.test.ts:3:11 › passes+ [id=<ID>] a.test.ts:3:7 › passesTotal: 1 test in 1 file`);});diff --git a/tests/mcp/test-run.spec.ts b/tests/mcp/test-run.spec.tsindex 6aaf21a24e..ae5da5c392 100644--- a/tests/mcp/test-run.spec.ts+++ b/tests/mcp/test-run.spec.ts@@ -52,14 +52,14 @@ test('test_run', async ({ startClient }) => {expect(text).toContain(`1 skipped`);expect(text).toContain(`4 passed`);- expect(text).toContain(`a.test.ts:3:11 › passes`);- expect(text).toContain(`c.test.ts:3:11 › passes`);+ expect(text).toContain(`a.test.ts:3:7 › passes`);+ expect(text).toContain(`c.test.ts:3:7 › passes`);expect(text).toContain(`c.test.ts:4:12 › skipped`);- expect(text).toContain(`b.test.ts:3:11 › passes`);- expect(text).toContain(`a.test.ts:4:11 › fails`);- expect(text).toContain(`b.test.ts:4:11 › fails`);- expect(text).toContain(`a.test.ts:6:13 › suite › inner passes`);- expect(text).toContain(`a.test.ts:7:13 › suite › inner fails`);+ expect(text).toContain(`b.test.ts:3:7 › passes`);+ expect(text).toContain(`a.test.ts:4:7 › fails`);+ expect(text).toContain(`b.test.ts:4:7 › fails`);+ expect(text).toContain(`a.test.ts:6:9 › suite › inner passes`);+ expect(text).toContain(`a.test.ts:7:9 › suite › inner fails`);expect(text).not.toContain(`../../test-results`);});@@ -118,8 +118,8 @@ test('test_run filters', async ({ startClient }) => {},})).toHaveTextResponse(`Running 2 tests using 1 worker- ok 1 [id=<ID>] [project=foo] › b.test.ts:3:11 › example1 (XXms)- ok 2 [id=<ID>] [project=foo] › b.test.ts:6:11 › example2 (XXms)+ ok 1 [id=<ID>] [project=foo] › b.test.ts:3:7 › example1 (XXms)+ ok 2 [id=<ID>] [project=foo] › b.test.ts:6:7 › example2 (XXms)2 passed (XXms)`);});@@ -197,8 +197,8 @@ test('test_run should include dependencies', async ({ startClient }) => {},})).toHaveTextResponse(`Running 3 tests using 1 worker- ok 1 [id=<ID>] [project=setup] › auth.setup.ts:3:12 › auth (XXms)- ok 2 [id=<ID>] [project=chromium] › example.test.ts:3:11 › example1 (XXms)- ok 3 [id=<ID>] [project=chromium] › example.test.ts:6:11 › example2 (XXms)+ ok 1 [id=<ID>] [project=setup] › auth.setup.ts:3:7 › auth (XXms)+ ok 2 [id=<ID>] [project=chromium] › example.test.ts:3:7 › example1 (XXms)+ ok 3 [id=<ID>] [project=chromium] › example.test.ts:6:7 › example2 (XXms)3 passed (XXms)`);});diff --git a/tests/mcp/test-setup.spec.ts b/tests/mcp/test-setup.spec.tsindex 455b1fcb38..4d2d7bce13 100644--- a/tests/mcp/test-setup.spec.ts+++ b/tests/mcp/test-setup.spec.ts@@ -96,7 +96,7 @@ global setupRunning 1 test using 1 workertest[err] test- ok 1 [id=<ID>] [project=chromium] › a.test.ts:3:9 › test (XXms)+ ok 1 [id=<ID>] [project=chromium] › a.test.ts:3:5 › test (XXms)1 passed (XXms)global teardown[err] global teardown`);@@ -124,7 +124,7 @@ global setupRunning 1 test using 1 workertest[err] test- ok 1 [id=<ID>] [project=chromium] › a.test.ts:3:9 › test (XXms)+ ok 1 [id=<ID>] [project=chromium] › a.test.ts:3:5 › test (XXms)1 passed (XXms)global teardown[err] global teardown`);diff --git a/tests/playwright-test/basic.spec.ts b/tests/playwright-test/basic.spec.tsindex 67be47310f..94d6644f57 100644--- a/tests/playwright-test/basic.spec.ts+++ b/tests/playwright-test/basic.spec.ts@@ -408,7 +408,7 @@ test('should support describe() without a title', async ({ runInlineTest }) => {}, { reporter: 'list' });expect(result.exitCode).toBe(0);expect(result.passed).toBe(1);- expect(result.output).toContain('a.spec.ts:6:17 › suite1 › suite2 › my test');+ expect(result.output).toContain('a.spec.ts:6:13 › suite1 › suite2 › my test');});test('should hint at async describe() callbacks when test() is called too late', async ({ runInlineTest }) => {diff --git a/tests/playwright-test/command-line-filter.spec.ts b/tests/playwright-test/command-line-filter.spec.tsindex 7d9ee14294..8a3ff275c2 100644--- a/tests/playwright-test/command-line-filter.spec.ts+++ b/tests/playwright-test/command-line-filter.spec.ts@@ -85,7 +85,7 @@ test('should filter by line and column', async ({ runInlineTest }) => {test('no-match', () => { expect(1).toBe(1); });test('yes-full-match-with-dirname', () => { expect(1).toBe(1); });`,- }, undefined, undefined, { additionalArgs: ['x.spec.ts:3:11', 'x.spec.ts:4:99999', 'x.spec.ts:5', 'foo/x.spec.ts:7:11'] });+ }, undefined, undefined, { additionalArgs: ['x.spec.ts:3:7', 'x.spec.ts:4:99999', 'x.spec.ts:5', 'foo/x.spec.ts:7:7'] });expect(result.exitCode).toBe(0);expect(result.skipped).toBe(0);expect(result.passed).toBe(3);diff --git a/tests/playwright-test/config.spec.ts b/tests/playwright-test/config.spec.tsindex 1b1d10286e..c85e03041d 100644--- a/tests/playwright-test/config.spec.ts+++ b/tests/playwright-test/config.spec.ts@@ -231,7 +231,7 @@ test('should allow root testDir and use it for relative paths', async ({ runInliexpect(result.passed).toBe(0);expect(result.skipped).toBe(0);expect(result.failed).toBe(1);- expect(result.output).toContain(`1) ${path.join('dir', 'a.test.ts')}:3:11 › fails`);+ expect(result.output).toContain(`1) ${path.join('dir', 'a.test.ts')}:3:7 › fails`);});test('should throw when test() is called in config file', async ({ runInlineTest }) => {diff --git a/tests/playwright-test/deps.spec.ts b/tests/playwright-test/deps.spec.tsindex e1900f9e1a..09bd481b0b 100644--- a/tests/playwright-test/deps.spec.ts+++ b/tests/playwright-test/deps.spec.ts@@ -207,7 +207,7 @@ test('should not filter dependency by file name', async ({ runInlineTest }) => {}, undefined, undefined, { additionalArgs: ['two.spec.ts'] });expect(result.exitCode).toBe(1);expect(result.failed).toBe(1);- expect(result.output).toContain('1) [A] › one.spec.ts:3:11 › fails');+ expect(result.output).toContain('1) [A] › one.spec.ts:3:7 › fails');});test('should filter dependency by only', async ({ runInlineTest }) => {diff --git a/tests/playwright-test/hooks.spec.ts b/tests/playwright-test/hooks.spec.tsindex 60a8700b82..2c53ef4a65 100644--- a/tests/playwright-test/hooks.spec.ts+++ b/tests/playwright-test/hooks.spec.ts@@ -685,7 +685,7 @@ test('should not hang and report results when worker process suddenly exits duriexpect(result.passed).toBe(0);expect(result.failed).toBe(1);expect(result.output).toContain('Error: worker process exited unexpectedly');- expect(result.output).toContain('[1/1] a.spec.js:3:11 › failing due to afterall');+ expect(result.output).toContain('[1/1] a.spec.js:3:7 › failing due to afterall');});test('unhandled rejection during beforeAll should be reported and prevent more tests', async ({ runInlineTest }) => {diff --git a/tests/playwright-test/reporter-base.spec.ts b/tests/playwright-test/reporter-base.spec.tsindex fb8b8176b7..aa7fdef8e3 100644--- a/tests/playwright-test/reporter-base.spec.ts+++ b/tests/playwright-test/reporter-base.spec.ts@@ -110,7 +110,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {expect(result.failed).toBe(1);const output = result.output;expect(output).toContain('Error: Assertion error');- expect(output).toContain('a.spec.ts:4:15 › fail');+ expect(output).toContain('a.spec.ts:4:11 › fail');expect(output).toContain(` 4 | test('fail', async ({}) => {`);expect(output).toContain(`> 5 | assert(false);`);expect(output).toContain(` | ^`);diff --git a/tests/playwright-test/reporter-blob.spec.ts b/tests/playwright-test/reporter-blob.spec.tsindex d6899c5204..cd3ba802f7 100644--- a/tests/playwright-test/reporter-blob.spec.ts+++ b/tests/playwright-test/reporter-blob.spec.ts@@ -513,32 +513,32 @@ test('merge into list report by default', async ({ runInlineTest, mergeReports }expect(text).toContain('Running 10 tests using 3 workers');const lines = text.split('\n').filter(l => l.match(/^#.* :/)).map(l => l.replace(/[.\d]+m?s/, 'Xms'));expect(lines).toEqual([- `#0 : 1 a.test.js:3:11 › math 1`,- `#0 : ${POSITIVE_STATUS_MARK} 1 a.test.js:3:11 › math 1 (Xms)`,- `#1 : 2 a.test.js:6:11 › failing 1`,- `#1 : ${NEGATIVE_STATUS_MARK} 2 a.test.js:6:11 › failing 1 (Xms)`,- `#2 : 3 a.test.js:6:11 › failing 1 (retry #1)`,- `#2 : ${NEGATIVE_STATUS_MARK} 3 a.test.js:6:11 › failing 1 (retry #1) (Xms)`,- `#3 : 4 a.test.js:9:11 › flaky 1`,- `#3 : ${NEGATIVE_STATUS_MARK} 4 a.test.js:9:11 › flaky 1 (Xms)`,- `#4 : 5 a.test.js:9:11 › flaky 1 (retry #1)`,- `#4 : ${POSITIVE_STATUS_MARK} 5 a.test.js:9:11 › flaky 1 (retry #1) (Xms)`,+ `#0 : 1 a.test.js:3:7 › math 1`,+ `#0 : ${POSITIVE_STATUS_MARK} 1 a.test.js:3:7 › math 1 (Xms)`,+ `#1 : 2 a.test.js:6:7 › failing 1`,+ `#1 : ${NEGATIVE_STATUS_MARK} 2 a.test.js:6:7 › failing 1 (Xms)`,+ `#2 : 3 a.test.js:6:7 › failing 1 (retry #1)`,+ `#2 : ${NEGATIVE_STATUS_MARK} 3 a.test.js:6:7 › failing 1 (retry #1) (Xms)`,+ `#3 : 4 a.test.js:9:7 › flaky 1`,+ `#3 : ${NEGATIVE_STATUS_MARK} 4 a.test.js:9:7 › flaky 1 (Xms)`,+ `#4 : 5 a.test.js:9:7 › flaky 1 (retry #1)`,+ `#4 : ${POSITIVE_STATUS_MARK} 5 a.test.js:9:7 › flaky 1 (retry #1) (Xms)`,`#5 : 6 a.test.js:12:12 › skipped 1`,`#5 : - 6 a.test.js:12:12 › skipped 1`,- `#6 : 7 b.test.js:3:11 › math 2`,- `#6 : ${POSITIVE_STATUS_MARK} 7 b.test.js:3:11 › math 2 (Xms)`,- `#7 : 8 b.test.js:6:11 › failing 2`,- `#7 : ${NEGATIVE_STATUS_MARK} 8 b.test.js:6:11 › failing 2 (Xms)`,- `#8 : 9 b.test.js:6:11 › failing 2 (retry #1)`,- `#8 : ${NEGATIVE_STATUS_MARK} 9 b.test.js:6:11 › failing 2 (retry #1) (Xms)`,+ `#6 : 7 b.test.js:3:7 › math 2`,+ `#6 : ${POSITIVE_STATUS_MARK} 7 b.test.js:3:7 › math 2 (Xms)`,+ `#7 : 8 b.test.js:6:7 › failing 2`,+ `#7 : ${NEGATIVE_STATUS_MARK} 8 b.test.js:6:7 › failing 2 (Xms)`,+ `#8 : 9 b.test.js:6:7 › failing 2 (retry #1)`,+ `#8 : ${NEGATIVE_STATUS_MARK} 9 b.test.js:6:7 › failing 2 (retry #1) (Xms)`,`#9 : 10 b.test.js:9:12 › skipped 2`,`#9 : - 10 b.test.js:9:12 › skipped 2`,- `#10 : 11 c.test.js:3:11 › math 3`,- `#10 : ${POSITIVE_STATUS_MARK} 11 c.test.js:3:11 › math 3 (Xms)`,- `#11 : 12 c.test.js:6:11 › flaky 2`,- `#11 : ${NEGATIVE_STATUS_MARK} 12 c.test.js:6:11 › flaky 2 (Xms)`,- `#12 : 13 c.test.js:6:11 › flaky 2 (retry #1)`,- `#12 : ${POSITIVE_STATUS_MARK} 13 c.test.js:6:11 › flaky 2 (retry #1) (Xms)`,+ `#10 : 11 c.test.js:3:7 › math 3`,+ `#10 : ${POSITIVE_STATUS_MARK} 11 c.test.js:3:7 › math 3 (Xms)`,+ `#11 : 12 c.test.js:6:7 › flaky 2`,+ `#11 : ${NEGATIVE_STATUS_MARK} 12 c.test.js:6:7 › flaky 2 (Xms)`,+ `#12 : 13 c.test.js:6:7 › flaky 2 (retry #1)`,+ `#12 : ${POSITIVE_STATUS_MARK} 13 c.test.js:6:7 › flaky 2 (retry #1) (Xms)`,`#13 : 14 c.test.js:9:12 › skipped 3`,`#13 : - 14 c.test.js:9:12 › skipped 3`,]);@@ -863,8 +863,8 @@ test('multiple output reports', async ({ runInlineTest, mergeReports, showReport// Check that line reporter was called.const text = stripAnsi(output);expect(text).toContain('Running 3 tests using 1 worker');- expect(text).toContain('[1/3] a.test.js:5:11 › first');- expect(text).toContain('a.test.js:13:11 › failing 1 (retry #1)');+ expect(text).toContain('[1/3] a.test.js:5:7 › first');+ expect(text).toContain('a.test.js:13:7 › failing 1 (retry #1)');// Check html report presence.await showReport();@@ -927,8 +927,8 @@ test('multiple output reports based on config', async ({ runInlineTest, mergeRep// Check that line reporter was called.const text = stripAnsi(output);expect(text).toContain('Running 6 tests using 2 workers');- expect(text).toContain('[1/6] a.test.js:5:11 › first');- expect(text).toContain('a.test.js:13:11 › failing 1 (retry #1)');+ expect(text).toContain('[1/6] a.test.js:5:7 › first');+ expect(text).toContain('a.test.js:13:7 › failing 1 (retry #1)');// Check html report presence.expect((await fs.promises.stat(test.info().outputPath('merged/html/index.html'))).isFile).toBeTruthy();diff --git a/tests/playwright-test/reporter-line.spec.ts b/tests/playwright-test/reporter-line.spec.tsindex 61b20cde9b..7abf29c3ae 100644--- a/tests/playwright-test/reporter-line.spec.ts+++ b/tests/playwright-test/reporter-line.spec.ts@@ -121,7 +121,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {}, { reporter: 'line' });expect(result.exitCode).toBe(0);expect(result.output).toContain([- 'a.spec.ts:3:15 › foobar',+ 'a.spec.ts:3:11 › foobar','one','','two',@@ -148,7 +148,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {`,}, { reporter: 'line' }, { PLAYWRIGHT_FORCE_TTY: '1' });const text = result.output;- expect(text).toContain('[1/1] a.test.ts:3:15 › passes › outer › inner');+ expect(text).toContain('[1/1] a.test.ts:3:11 › passes › outer › inner');expect(result.exitCode).toBe(0);});@@ -166,7 +166,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {`,}, { reporter: 'line' });const text = result.output;- expect(text).toContain('1) a.test.ts:3:15 › passes › outer 1.0 › inner 1.1 ──');+ expect(text).toContain('1) a.test.ts:3:11 › passes › outer 1.0 › inner 1.1 ──');expect(result.exitCode).toBe(1);});@@ -187,7 +187,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {`,}, { reporter: 'line' });const text = result.output;- expect(text).toContain('1) a.test.ts:3:15 › passes › outer 1.0 ──');+ expect(text).toContain('1) a.test.ts:3:11 › passes › outer 1.0 ──');expect(result.exitCode).toBe(1);});@@ -206,7 +206,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {`,}, { reporter: 'line' });const text = result.output;- expect(text).toContain('1) a.test.ts:3:15 › passes ──');+ expect(text).toContain('1) a.test.ts:3:11 › passes ──');expect(result.exitCode).toBe(1);});@@ -239,7 +239,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {});`,}, { reporter: 'line' });- expect(result.output).toContain('[1/1] a.test.ts:3:15 › passes\n');+ expect(result.output).toContain('[1/1] a.test.ts:3:11 › passes\n');expect(result.output).not.toContain('@global');expect(result.exitCode).toBe(0);});@@ -269,22 +269,22 @@ test.describe('onTestPaused', () => {expect(stripAnsi(runner.output)).toEqual(`Running 1 test using 1 worker-[1/1] a.test.ts:3:13 › foo- a.test.ts:3:13 › foo ─────────────────────────────────────────────────────────────────────────────+[1/1] a.test.ts:3:9 › foo+ a.test.ts:3:9 › foo ──────────────────────────────────────────────────────────────────────────────Paused at test end. Press Ctrl+C to end.-[1/1] a.test.ts:3:13 › foo-a.test.ts:3:13 › foo+[1/1] a.test.ts:3:9 › foo+a.test.ts:3:9 › fooRunning teardown- 1) a.test.ts:3:13 › foo ──────────────────────────────────────────────────────────────────────────+ 1) a.test.ts:3:9 › foo ───────────────────────────────────────────────────────────────────────────Test was interrupted.1 interrupted- a.test.ts:3:13 › foo ───────────────────────────────────────────────────────────────────────────+ a.test.ts:3:9 › foo ────────────────────────────────────────────────────────────────────────────`);});@@ -308,13 +308,13 @@ Running teardownexpect(stripAnsi(runner.output)).toEqual(`Running 1 test using 1 worker-[1/1] a.test.ts:3:13 › foo- a.test.ts:3:13 › foo ─────────────────────────────────────────────────────────────────────────────+[1/1] a.test.ts:3:9 › foo+ a.test.ts:3:9 › foo ──────────────────────────────────────────────────────────────────────────────Paused at test end. Press Ctrl+C to end.-[1/1] a.test.ts:3:13 › foo- 1) a.test.ts:3:13 › foo ──────────────────────────────────────────────────────────────────────────+[1/1] a.test.ts:3:9 › foo+ 1) a.test.ts:3:9 › foo ───────────────────────────────────────────────────────────────────────────Test was interrupted.@@ -332,7 +332,7 @@ Running 1 test using 1 worker1 interrupted- a.test.ts:3:13 › foo ───────────────────────────────────────────────────────────────────────────+ a.test.ts:3:9 › foo ────────────────────────────────────────────────────────────────────────────`);});@@ -354,8 +354,8 @@ Running 1 test using 1 workerexpect(stripAnsi(runner.output)).toEqual(`Running 1 test using 1 worker-[1/1] a.test.ts:3:13 › fails- 1) a.test.ts:3:13 › fails ────────────────────────────────────────────────────────────────────────+[1/1] a.test.ts:3:9 › fails+ 1) a.test.ts:3:9 › fails ─────────────────────────────────────────────────────────────────────────Error: expect(received).toBe(expected) // Object.is equality@@ -387,11 +387,11 @@ Running 1 test using 1 workerPaused on error. Press Ctrl+C to end.-[1/1] a.test.ts:3:13 › fails+[1/1] a.test.ts:3:9 › fails1 failed- a.test.ts:3:13 › fails ─────────────────────────────────────────────────────────────────────────+ a.test.ts:3:9 › fails ──────────────────────────────────────────────────────────────────────────`);});});diff --git a/tests/playwright-test/reporter-list.spec.ts b/tests/playwright-test/reporter-list.spec.tsindex dcda138cb8..d3b22c332f 100644--- a/tests/playwright-test/reporter-list.spec.ts+++ b/tests/playwright-test/reporter-list.spec.ts@@ -75,7 +75,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {const lines = text.split('\n').filter(l => l.match(/^#.* :/)).map(l => l.replace(/[.\d]+m?s/, 'Xms'));lines.pop(); // Remove last item that contains [v] and time in ms.expect(lines).toEqual([- '#0 : 1 a.test.ts:3:15 › passes',+ '#0 : 1 a.test.ts:3:11 › passes','#1 : 1.1 passes › outer 1.0','#2 : 1.2 passes › outer 1.0 › inner 1.1','#2 : 1.2 passes › outer 1.0 › inner 1.1 (Xms)',@@ -110,19 +110,19 @@ for (const useIntermediateMergeReport of [false, true] as const) {const lines = text.split('\n').filter(l => l.match(/^#.* :/)).map(l => l.replace(/[.\d]+m?s/, 'Xms'));lines.pop(); // Remove last item that contains [v] and time in ms.expect(lines).toEqual([- '#0 : 1 a.test.ts:3:11 › passes',- '#0 : 1 a.test.ts:3:11 › passes › outer 1.0',- '#0 : 1 a.test.ts:3:11 › passes › outer 1.0 › inner 1.1',- '#0 : 1 a.test.ts:3:11 › passes › outer 1.0',- '#0 : 1 a.test.ts:3:11 › passes › outer 1.0 › inner 1.2',- '#0 : 1 a.test.ts:3:11 › passes › outer 1.0',- '#0 : 1 a.test.ts:3:11 › passes',- '#0 : 1 a.test.ts:3:11 › passes › outer 2.0',- '#0 : 1 a.test.ts:3:11 › passes › outer 2.0 › inner 2.1',- '#0 : 1 a.test.ts:3:11 › passes › outer 2.0',- '#0 : 1 a.test.ts:3:11 › passes › outer 2.0 › inner 2.2',- '#0 : 1 a.test.ts:3:11 › passes › outer 2.0',- '#0 : 1 a.test.ts:3:11 › passes',+ '#0 : 1 a.test.ts:3:7 › passes',+ '#0 : 1 a.test.ts:3:7 › passes › outer 1.0',+ '#0 : 1 a.test.ts:3:7 › passes › outer 1.0 › inner 1.1',+ '#0 : 1 a.test.ts:3:7 › passes › outer 1.0',+ '#0 : 1 a.test.ts:3:7 › passes › outer 1.0 › inner 1.2',+ '#0 : 1 a.test.ts:3:7 › passes › outer 1.0',+ '#0 : 1 a.test.ts:3:7 › passes',+ '#0 : 1 a.test.ts:3:7 › passes › outer 2.0',+ '#0 : 1 a.test.ts:3:7 › passes › outer 2.0 › inner 2.1',+ '#0 : 1 a.test.ts:3:7 › passes › outer 2.0',+ '#0 : 1 a.test.ts:3:7 › passes › outer 2.0 › inner 2.2',+ '#0 : 1 a.test.ts:3:7 › passes › outer 2.0',+ '#0 : 1 a.test.ts:3:7 › passes',]);});@@ -145,13 +145,13 @@ for (const useIntermediateMergeReport of [false, true] as const) {const text = result.output;const lines = text.split('\n').filter(l => l.match(/^#.* :/)).map(l => l.replace(/[.\d]+m?s/, 'Xms'));expect(lines).toEqual([- '#0 : 1.1 a.test.ts:3:15 › passes › outer 1.0 › inner 1.1 (Xms)',- '#1 : 1.2 a.test.ts:3:15 › passes › outer 1.0 › inner 1.2 (Xms)',- '#2 : 1.3 a.test.ts:3:15 › passes › outer 1.0 (Xms)',- '#3 : 1.4 a.test.ts:3:15 › passes › outer 2.0 › inner 2.1 (Xms)',- '#4 : 1.5 a.test.ts:3:15 › passes › outer 2.0 › inner 2.2 (Xms)',- '#5 : 1.6 a.test.ts:3:15 › passes › outer 2.0 (Xms)',- `#6 : ${POSITIVE_STATUS_MARK} 1 a.test.ts:3:15 › passes (Xms)`,+ '#0 : 1.1 a.test.ts:3:11 › passes › outer 1.0 › inner 1.1 (Xms)',+ '#1 : 1.2 a.test.ts:3:11 › passes › outer 1.0 › inner 1.2 (Xms)',+ '#2 : 1.3 a.test.ts:3:11 › passes › outer 1.0 (Xms)',+ '#3 : 1.4 a.test.ts:3:11 › passes › outer 2.0 › inner 2.1 (Xms)',+ '#4 : 1.5 a.test.ts:3:11 › passes › outer 2.0 › inner 2.2 (Xms)',+ '#5 : 1.6 a.test.ts:3:11 › passes › outer 2.0 (Xms)',+ `#6 : ${POSITIVE_STATUS_MARK} 1 a.test.ts:3:11 › passes (Xms)`,]);});@@ -168,10 +168,10 @@ for (const useIntermediateMergeReport of [false, true] as const) {const renderedText = simpleAnsiRenderer(result.rawOutput, TTY_WIDTH);if (process.platform === 'win32')- expect(renderedText).toContain(' ok 1 a.test.ts:3:15 › passes');+ expect(renderedText).toContain(' ok 1 a.test.ts:3:11 › passes');else- expect(renderedText).toContain(' ✓ 1 a.test.ts:3:15 › passes');- expect(renderedText).not.toContain(' 1 a.test.ts:3:15 › passes');+ expect(renderedText).toContain(' ✓ 1 a.test.ts:3:11 › passes');+ expect(renderedText).not.toContain(' 1 a.test.ts:3:11 › passes');expect(renderedText).toContain('a'.repeat(80) + '\n' + 'b'.repeat(20));});@@ -188,10 +188,10 @@ for (const useIntermediateMergeReport of [false, true] as const) {const lines = text.split('\n').filter(l => l.startsWith('#0 :') || l.startsWith('#1 :')).map(l => l.replace(/\d+(\.\d+)?m?s/, 'XXms'));expect(lines).toEqual([- `#0 : 1 a.test.ts:3:15 › flaky`,- `#0 : ${NEGATIVE_STATUS_MARK} 1 a.test.ts:3:15 › flaky (XXms)`,- `#1 : 2 a.test.ts:3:15 › flaky (retry #1)`,- `#1 : ${POSITIVE_STATUS_MARK} 2 a.test.ts:3:15 › flaky (retry #1) (XXms)`,+ `#0 : 1 a.test.ts:3:11 › flaky`,+ `#0 : ${NEGATIVE_STATUS_MARK} 1 a.test.ts:3:11 › flaky (XXms)`,+ `#1 : 2 a.test.ts:3:11 › flaky (retry #1)`,+ `#1 : ${POSITIVE_STATUS_MARK} 2 a.test.ts:3:11 › flaky (retry #1) (XXms)`,]);});@@ -220,20 +220,20 @@ for (const useIntermediateMergeReport of [false, true] as const) {const lines = result.rawOutput.split('\n').map(line => line.split('\x1B[22m\x1B[1E')).flat().map(line => stripAnsi(line)).filter(line => line.trim()).slice(1, 9);expect(lines.every(line => line.length <= 50)).toBe(true);- expect(lines[0]).toBe(` 1 …a.test.ts:3:15 › failure in very long name`);+ expect(lines[0]).toBe(` 1 …a.test.ts:3:11 › failure in very long name`);expect(lines[1]).toContain(`${NEGATIVE_STATUS_MARK} 1 …`);- expect(lines[1]).toContain(`:3:15 › failure in very long name (`);+ expect(lines[1]).toContain(`:3:11 › failure in very long name (`);expect(lines[1].length).toBe(50);- expect(lines[2]).toBe(` 2 [foo] › a.test.ts:6:15 › passes`);+ expect(lines[2]).toBe(` 2 [foo] › a.test.ts:6:11 › passes`);- expect(lines[3]).toContain(`${POSITIVE_STATUS_MARK} 2 [foo] › a.test.ts:6:15 › passes (`);+ expect(lines[3]).toContain(`${POSITIVE_STATUS_MARK} 2 [foo] › a.test.ts:6:11 › passes (`);- expect(lines[4]).toBe(` 3 [foo] › a.test.ts:8:15 › passes 2 long name`);+ expect(lines[4]).toBe(` 3 [foo] › a.test.ts:8:11 › passes 2 long name`);expect(lines[5]).toContain(`${POSITIVE_STATUS_MARK} 3 …`);- expect(lines[5]).toContain(`test.ts:8:15 › passes 2 long name (`);+ expect(lines[5]).toContain(`test.ts:8:11 › passes 2 long name (`);expect(lines[5].length).toBe(50);expect(lines[6]).toBe(` 4 …› a.test.ts:10:16 › skipped very long name`);@@ -255,7 +255,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {`,}, { reporter: 'list' });const text = result.output;- expect(text).toContain('1) a.test.ts:3:15 › passes › outer 1.0 › inner 1.1 ──');+ expect(text).toContain('1) a.test.ts:3:11 › passes › outer 1.0 › inner 1.1 ──');expect(result.exitCode).toBe(1);});@@ -277,8 +277,8 @@ for (const useIntermediateMergeReport of [false, true] as const) {`,});const text = result.output;- const failureHeader = '1) a.test.ts:3:15 › fails early';- const laterTestStatus = `${POSITIVE_STATUS_MARK} 2 a.test.ts:6:15 › runs later`;+ const failureHeader = '1) a.test.ts:3:11 › fails early';+ const laterTestStatus = `${POSITIVE_STATUS_MARK} 2 a.test.ts:6:11 › runs later`;const failureIndex = text.indexOf(failureHeader);const laterTestIndex = text.indexOf(laterTestStatus);expect(failureIndex).toBeGreaterThan(-1);@@ -307,7 +307,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {`,});const text = result.output;- const failureHeader = '1) a.test.ts:3:15 › missing snapshot';+ const failureHeader = '1) a.test.ts:3:11 › missing snapshot';const failureIndex = text.indexOf(failureHeader);expect(failureIndex, 'failure should be printed inline').not.toBe(-1);expect(text.indexOf(`A snapshot doesn't exist`, failureIndex)).toBeGreaterThan(failureIndex);@@ -333,10 +333,10 @@ for (const useIntermediateMergeReport of [false, true] as const) {`,});const text = result.output;- const failureHeader = '1) a.test.ts:3:15 › fails';+ const failureHeader = '1) a.test.ts:3:11 › fails';// Each attempt is printed once, under the same failure index.expect(text.split(failureHeader).length - 1).toBe(3);- expect(text).not.toContain('2) a.test.ts:3:15 › fails');+ expect(text).not.toContain('2) a.test.ts:3:11 › fails');for (const attempt of ['attempt 0', 'attempt 1', 'attempt 2'])expect(text.split('Error: ' + attempt).length - 1).toBe(1);expect(text.split('Retry #1').length - 1).toBe(1);@@ -365,7 +365,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {`,});const text = result.output;- const failureHeader = '1) a.test.ts:3:15 › flaky';+ const failureHeader = '1) a.test.ts:3:11 › flaky';expect(text.split(failureHeader).length - 1).toBe(1);expect(text.split('Error: attempt 0').length - 1).toBe(1);expect(text).not.toContain('Retry #1');@@ -398,18 +398,18 @@ for (const useIntermediateMergeReport of [false, true] as const) {expect(result.exitCode).toBe(0);expect(result.passed).toBe(4);const expected = [- '#0 : 1 a.test.ts:3:15 › passes',+ '#0 : 1 a.test.ts:3:11 › passes','line1line2',- `#0 : ${POSITIVE_STATUS_MARK} 1 a.test.ts:3:15 › passes`,+ `#0 : ${POSITIVE_STATUS_MARK} 1 a.test.ts:3:11 › passes`,'',- '#3 : 2 a.test.ts:9:15 › passes 2',- `partial#3 : ${POSITIVE_STATUS_MARK} 2 a.test.ts:9:15 › passes 2`,+ '#3 : 2 a.test.ts:9:11 › passes 2',+ `partial#3 : ${POSITIVE_STATUS_MARK} 2 a.test.ts:9:11 › passes 2`,'',- '#5 : 3 a.test.ts:13:15 › passes 3',+ '#5 : 3 a.test.ts:13:11 › passes 3','full',- `#5 : ${POSITIVE_STATUS_MARK} 3 a.test.ts:13:15 › passes 3`,- '#7 : 4 a.test.ts:17:15 › passes 4',- `#7 : ${POSITIVE_STATUS_MARK} 4 a.test.ts:17:15 › passes 4`,+ `#5 : ${POSITIVE_STATUS_MARK} 3 a.test.ts:13:11 › passes 3`,+ '#7 : 4 a.test.ts:17:11 › passes 4',+ `#7 : ${POSITIVE_STATUS_MARK} 4 a.test.ts:17:11 › passes 4`,];const lines = result.output.split('\n');const firstIndex = lines.indexOf(expected[0]);@@ -453,24 +453,24 @@ for (const useIntermediateMergeReport of [false, true] as const) {expect(result.exitCode).toBe(0);expect(result.passed).toBe(2);const expected = [- '#0 : 1 a.test.ts:3:15 › A',+ '#0 : 1 a.test.ts:3:11 › A',];for (let i = 0; i < 20; ++i)expected.push(`line ${i}`);// Update to initial test status row- expected.push(`#0 : ${POSITIVE_STATUS_MARK} 1 a.test.ts:3:15 › A`);- expected.push(`#21 : 2 a.test.ts:9:15 › B`);+ expected.push(`#0 : ${POSITIVE_STATUS_MARK} 1 a.test.ts:3:11 › A`);+ expected.push(`#21 : 2 a.test.ts:9:11 › B`);for (let i = 20; i < 60; ++i)expected.push(`line ${i}`);- expected.push(`#62 : 2 a.test.ts:9:15 › B › First step`);+ expected.push(`#62 : 2 a.test.ts:9:11 › B › First step`);expected.push(`step 1`);- expected.push(`#62 : 2 a.test.ts:9:15 › B`);+ expected.push(`#62 : 2 a.test.ts:9:11 › B`);for (let i = 60; i < 80; ++i)expected.push(`line ${i}`);- expected.push(`#62 : 2 a.test.ts:9:15 › B › Second step`);+ expected.push(`#62 : 2 a.test.ts:9:11 › B › Second step`);expected.push(`step 2`);- expected.push(`#62 : 2 a.test.ts:9:15 › B`);- expected.push(`#62 : ${POSITIVE_STATUS_MARK} 2 a.test.ts:9:15 › B`);+ expected.push(`#62 : 2 a.test.ts:9:11 › B`);+ expected.push(`#62 : ${POSITIVE_STATUS_MARK} 2 a.test.ts:9:11 › B`);const lines = result.output.split('\n');const firstIndex = lines.indexOf(expected[0]);expect(firstIndex, 'first line should be there').not.toBe(-1);@@ -507,20 +507,20 @@ for (const useIntermediateMergeReport of [false, true] as const) {expect(result.exitCode).toBe(0);expect(result.passed).toBe(1);const expected = [- '#0 : 1 a.test.ts:3:15 › A',+ '#0 : 1 a.test.ts:3:11 › A',];for (let i = 0; i < 60; ++i)expected.push(`line ${i}`);// Update to initial test status row- expected.push(`#0 : 1 a.test.ts:3:15 › A › First step`);+ expected.push(`#0 : 1 a.test.ts:3:11 › A › First step`);expected.push(`step 1`);- expected.push(`#0 : 1 a.test.ts:3:15 › A`);+ expected.push(`#0 : 1 a.test.ts:3:11 › A`);for (let i = 60; i < 120; ++i)expected.push(`line ${i}`);- expected.push(`#122 : 1 a.test.ts:3:15 › A › Second step`);+ expected.push(`#122 : 1 a.test.ts:3:11 › A › Second step`);expected.push(`step 2`);- expected.push(`#122 : 1 a.test.ts:3:15 › A`);- expected.push(`#122 : ${POSITIVE_STATUS_MARK} 1 a.test.ts:3:15 › A`);+ expected.push(`#122 : 1 a.test.ts:3:11 › A`);+ expected.push(`#122 : ${POSITIVE_STATUS_MARK} 1 a.test.ts:3:11 › A`);const lines = result.output.split('\n');const firstIndex = lines.indexOf(expected[0]);expect(firstIndex, 'first line should be there').not.toBe(-1);@@ -554,12 +554,12 @@ test.describe('onTestPaused', () => {expect(output).toEqual(`Running 1 test using 1 worker-#0 : ${POSITIVE_STATUS_MARK} 1 a.test.ts:3:13 › foo (Xms)+#0 : ${POSITIVE_STATUS_MARK} 1 a.test.ts:3:9 › foo (Xms)#1 : Paused at test end. Press Ctrl+C to end.Running teardown1 interrupted- a.test.ts:3:13 › foo ───────────────────────────────────────────────────────────────────────────+ a.test.ts:3:9 › foo ────────────────────────────────────────────────────────────────────────────`);});@@ -584,11 +584,11 @@ Running teardownexpect(output).toEqual(`Running 1 test using 1 worker-#0 : ${POSITIVE_STATUS_MARK} 1 a.test.ts:3:13 › foo (Xms)+#0 : ${POSITIVE_STATUS_MARK} 1 a.test.ts:3:9 › foo (Xms)#1 : Paused at test end. Press Ctrl+C to end.- 1) a.test.ts:3:13 › foo ──────────────────────────────────────────────────────────────────────────+ 1) a.test.ts:3:9 › foo ───────────────────────────────────────────────────────────────────────────Test was interrupted.@@ -605,7 +605,7 @@ Running 1 test using 1 workerError Context: test-results/a-foo/error-context.md1 interrupted- a.test.ts:3:13 › foo ───────────────────────────────────────────────────────────────────────────+ a.test.ts:3:9 › foo ────────────────────────────────────────────────────────────────────────────`);});@@ -628,7 +628,7 @@ Running 1 test using 1 workerexpect(output).toEqual(`Running 1 test using 1 worker-#0 : ${NEGATIVE_STATUS_MARK} 1 a.test.ts:3:13 › fails (Xms)+#0 : ${NEGATIVE_STATUS_MARK} 1 a.test.ts:3:9 › fails (Xms)Error: expect(received).toBe(expected) // Object.is equality@@ -662,7 +662,7 @@ Running 1 test using 1 worker1 failed- a.test.ts:3:13 › fails ─────────────────────────────────────────────────────────────────────────+ a.test.ts:3:9 › fails ──────────────────────────────────────────────────────────────────────────`);});});diff --git a/tests/playwright-test/reporter.spec.ts b/tests/playwright-test/reporter.spec.tsindex 3199c45c18..12f5bb5eaf 100644--- a/tests/playwright-test/reporter.spec.ts+++ b/tests/playwright-test/reporter.spec.ts@@ -640,7 +640,7 @@ test('should report annotations from test declaration', async ({ runInlineTest }expect(test.info().annotations).toEqual([]);});test('foo', { annotation: { type: 'foo' } }, () => {- expect(test.info().annotations).toEqual([{ type: 'foo', location: { file: expect.any(String), line: 6, column: 11 } }]);+ expect(test.info().annotations).toEqual([{ type: 'foo', location: { file: expect.any(String), line: 6, column: 7 } }]);});test('foo-bar', {annotation: [@@ -649,8 +649,8 @@ test('should report annotations from test declaration', async ({ runInlineTest }],}, () => {expect(test.info().annotations).toEqual([- { type: 'foo', description: 'desc', location: { file: expect.any(String), line: 9, column: 11 } },- { type: 'bar', location: { file: expect.any(String), line: 9, column: 11 } },+ { type: 'foo', description: 'desc', location: { file: expect.any(String), line: 9, column: 7 } },+ { type: 'bar', location: { file: expect.any(String), line: 9, column: 7 } },]);});test.skip('skip-foo', { annotation: { type: 'foo' } }, () => {@@ -691,8 +691,8 @@ test('should report annotations from test declaration', async ({ runInlineTest }expect(result.exitCode).toBe(0);expect(result.outputLines).toEqual([`title=none, annotations=`,- `title=foo, annotations=foo(6:11)`,- `title=foo-bar, annotations=foo=desc(9:11),bar(9:11)`,+ `title=foo, annotations=foo(6:7)`,+ `title=foo-bar, annotations=foo=desc(9:7),bar(9:7)`,`title=skip-foo, annotations=foo(20:12),skip(20:12)`,`title=fixme-bar, annotations=bar(22:12),fixme(22:12)`,`title=fail-foo-bar, annotations=foo(24:12),bar=desc(24:12),fail(24:12)`,diff --git a/tests/playwright-test/runner.spec.ts b/tests/playwright-test/runner.spec.tsindex 812f6cade2..6013116b7a 100644--- a/tests/playwright-test/runner.spec.ts+++ b/tests/playwright-test/runner.spec.ts@@ -936,15 +936,15 @@ test('should run last failed tests in a shard', async ({ runInlineTest }) => {expect(result1.exitCode).toBe(1);expect(result1.passed).toBe(1);expect(result1.failed).toBe(1);- expect(result1.output).toContain('b.spec.js:3:11 › pass-b');- expect(result1.output).toContain('b.spec.js:4:11 › fail-b');+ expect(result1.output).toContain('b.spec.js:3:7 › pass-b');+ expect(result1.output).toContain('b.spec.js:4:7 › fail-b');const result2 = await runInlineTest(workspace, { shard: '2/2' }, {}, { additionalArgs: ['--last-failed'] });expect(result2.exitCode).toBe(1);expect(result2.passed).toBe(0);expect(result2.failed).toBe(1);- expect(result2.output).not.toContain('b.spec.js:3:11 › pass-b');- expect(result2.output).toContain('b.spec.js:4:11 › fail-b');+ expect(result2.output).not.toContain('b.spec.js:3:7 › pass-b');+ expect(result2.output).toContain('b.spec.js:4:7 › fail-b');});test('should run last failed tests in a shard with PLAYWRIGHT_LAST_RUN_OUTPUT_FILE', async ({ runInlineTest }, testInfo) => {@@ -974,15 +974,15 @@ test('should run last failed tests in a shard with PLAYWRIGHT_LAST_RUN_OUTPUT_FIexpect(result1.failed).toBe(1);expect(fs.existsSync(customAbs)).toBe(true);expect(fs.existsSync(defaultLastRun)).toBe(false);- expect(result1.output).toContain('b.spec.js:3:11 › pass-b');- expect(result1.output).toContain('b.spec.js:4:11 › fail-b');+ expect(result1.output).toContain('b.spec.js:3:7 › pass-b');+ expect(result1.output).toContain('b.spec.js:4:7 › fail-b');const result2 = await runInlineTest(workspace, { shard: '2/2' }, env, { additionalArgs: ['--last-failed'] });expect(result2.exitCode).toBe(1);expect(result2.passed).toBe(0);expect(result2.failed).toBe(1);- expect(result2.output).not.toContain('b.spec.js:3:11 › pass-b');- expect(result2.output).toContain('b.spec.js:4:11 › fail-b');+ expect(result2.output).not.toContain('b.spec.js:3:7 › pass-b');+ expect(result2.output).toContain('b.spec.js:4:7 › fail-b');});test('should run last failed tests in a shard with --last-failed-file', async ({ runInlineTest }, testInfo) => {@@ -1012,13 +1012,13 @@ test('should run last failed tests in a shard with --last-failed-file', async ({expect(result1.failed).toBe(1);expect(fs.existsSync(customAbs)).toBe(true);expect(fs.existsSync(defaultLastRun)).toBe(false);- expect(result1.output).toContain('b.spec.js:3:11 › pass-b');- expect(result1.output).toContain('b.spec.js:4:11 › fail-b');+ expect(result1.output).toContain('b.spec.js:3:7 › pass-b');+ expect(result1.output).toContain('b.spec.js:4:7 › fail-b');const result2 = await runInlineTest(workspace, { shard: '2/2' }, {}, { additionalArgs: lastRunArgs });expect(result2.exitCode).toBe(1);expect(result2.passed).toBe(0);expect(result2.failed).toBe(1);- expect(result2.output).not.toContain('b.spec.js:3:11 › pass-b');- expect(result2.output).toContain('b.spec.js:4:11 › fail-b');+ expect(result2.output).not.toContain('b.spec.js:3:7 › pass-b');+ expect(result2.output).toContain('b.spec.js:4:7 › fail-b');});diff --git a/tests/playwright-test/test-modifiers.spec.ts b/tests/playwright-test/test-modifiers.spec.tsindex 71db551b0c..8ab98cc47a 100644--- a/tests/playwright-test/test-modifiers.spec.ts+++ b/tests/playwright-test/test-modifiers.spec.ts@@ -764,15 +764,15 @@ test('should contain only one slow modifier', async ({ runInlineTest }) => {expect(result.passed).toBe(1);expect(result.report.suites[0].specs[0].tests[0].annotations).toEqual([{ type: 'fixme', location: { file: expect.any(String), line: 3, column: 12 } },- { type: 'issue', description: 'my-value', location: { file: expect.any(String), line: 4, column: 11 } }+ { type: 'issue', description: 'my-value', location: { file: expect.any(String), line: 4, column: 7 } }]);expect(result.report.suites[1].specs[0].tests[0].annotations).toEqual([{ type: 'skip', location: { file: expect.any(String), line: 3, column: 12 } },- { type: 'issue', description: 'my-value', location: { file: expect.any(String), line: 4, column: 11 } }+ { type: 'issue', description: 'my-value', location: { file: expect.any(String), line: 4, column: 7 } }]);expect(result.report.suites[2].specs[0].tests[0].annotations).toEqual([{ type: 'slow', location: { file: expect.any(String), line: 3, column: 12 } },- { type: 'issue', description: 'my-value', location: { file: expect.any(String), line: 4, column: 11 } }+ { type: 'issue', description: 'my-value', location: { file: expect.any(String), line: 4, column: 7 } }]);});diff --git a/tests/playwright-test/ui-mode-test-update.spec.ts b/tests/playwright-test/ui-mode-test-update.spec.tsindex 67d0626a5f..4933fe6c29 100644--- a/tests/playwright-test/ui-mode-test-update.spec.ts+++ b/tests/playwright-test/ui-mode-test-update.spec.ts@@ -226,7 +226,7 @@ test('should update test locations', async ({ runUITest, writeFiles }) => {location: {file: expect.stringContaining('a.test.ts'),line: 3,- column: 11,+ column: 7,}},}]);@@ -257,7 +257,7 @@ test('should update test locations', async ({ runUITest, writeFiles }) => {location: {file: expect.stringContaining('a.test.ts'),line: 5,- column: 11,+ column: 7,}},}]);diff --git a/tests/playwright-test/watch.spec.ts b/tests/playwright-test/watch.spec.tsindex 02c6e0bbb9..d8db08d945 100644--- a/tests/playwright-test/watch.spec.ts+++ b/tests/playwright-test/watch.spec.ts@@ -210,7 +210,7 @@ test('should run tests on Enter', async ({ runWatchTest }) => {testProcess.clearOutput();testProcess.write('\r\n');await testProcess.waitForOutput('npx playwright test #1');- await testProcess.waitForOutput('a.test.ts:3:11 › passes');+ await testProcess.waitForOutput('a.test.ts:3:7 › passes');await testProcess.waitForOutput('Waiting for file changes.');});@@ -243,7 +243,7 @@ test('should run tests on R', async ({ runWatchTest }) => {testProcess.clearOutput();testProcess.write('r');await testProcess.waitForOutput('npx playwright test (re-running tests) #1');- await testProcess.waitForOutput('a.test.ts:3:11 › passes');+ await testProcess.waitForOutput('a.test.ts:3:7 › passes');await testProcess.waitForOutput('Waiting for file changes.');});@@ -266,16 +266,16 @@ test('should run failed tests on F', async ({ runWatchTest }) => {testProcess.write('\r\n');await testProcess.waitForOutput('npx playwright test #1');- await testProcess.waitForOutput('a.test.ts:3:11 › passes');- await testProcess.waitForOutput('b.test.ts:3:11 › passes');- await testProcess.waitForOutput('c.test.ts:3:11 › fails');+ await testProcess.waitForOutput('a.test.ts:3:7 › passes');+ await testProcess.waitForOutput('b.test.ts:3:7 › passes');+ await testProcess.waitForOutput('c.test.ts:3:7 › fails');await testProcess.waitForOutput('Error: expect(received).toBe(expected)');await testProcess.waitForOutput('Waiting for file changes.');testProcess.clearOutput();testProcess.write('f');await testProcess.waitForOutput('npx playwright test (running failed tests) #2');- await testProcess.waitForOutput('c.test.ts:3:11 › fails');- expect(testProcess.output).not.toContain('a.test.ts:3:11');+ await testProcess.waitForOutput('c.test.ts:3:7 › fails');+ expect(testProcess.output).not.toContain('a.test.ts:3:7');});test('should respect file filter P', async ({ runWatchTest }) => {@@ -295,8 +295,8 @@ test('should respect file filter P', async ({ runWatchTest }) => {await testProcess.waitForOutput('Input filename pattern (regex)');testProcess.write('b.test\r\n');await testProcess.waitForOutput('npx playwright test b.test #1');- await testProcess.waitForOutput('b.test.ts:3:11 › passes');- expect(testProcess.output).not.toContain('a.test.ts:3:11');+ await testProcess.waitForOutput('b.test.ts:3:7 › passes');+ expect(testProcess.output).not.toContain('a.test.ts:3:7');await testProcess.waitForOutput('Waiting for file changes.');});@@ -317,7 +317,7 @@ test('should respect project filter C', async ({ runWatchTest, writeFiles }) =>testProcess.write('\r\n');await testProcess.waitForOutput('npx playwright test --project foo #1');- await testProcess.waitForOutput('[foo] › a.test.ts:3:11 › passes');+ await testProcess.waitForOutput('[foo] › a.test.ts:3:7 › passes');await testProcess.waitForOutput('Waiting for file changes.');testProcess.clearOutput();testProcess.write('c');@@ -327,14 +327,14 @@ test('should respect project filter C', async ({ runWatchTest, writeFiles }) =>testProcess.write(' ');testProcess.write('\r\n');await testProcess.waitForOutput('npx playwright test --project foo #2');- await testProcess.waitForOutput('[foo] › a.test.ts:3:11 › passes');- expect(testProcess.output).not.toContain('[bar] › a.test.ts:3:11 › passes');+ await testProcess.waitForOutput('[foo] › a.test.ts:3:7 › passes');+ expect(testProcess.output).not.toContain('[bar] › a.test.ts:3:7 › passes');await testProcess.waitForOutput('Waiting for file changes.');testProcess.clearOutput();await writeFiles(files); // file change triggers listTests with project filter- await testProcess.waitForOutput('[foo] › a.test.ts:3:11 › passes');+ await testProcess.waitForOutput('[foo] › a.test.ts:3:7 › passes');testProcess.clearOutput();await testProcess.waitForOutput('Waiting for file changes.');@@ -363,8 +363,8 @@ test('should respect file filter P and split files', async ({ runWatchTest }) =>await testProcess.waitForOutput('Input filename pattern (regex)');testProcess.write('a.test b.test\r\n');await testProcess.waitForOutput('npx playwright test a.test b.test #1');- await testProcess.waitForOutput('a.test.ts:3:11 › passes');- await testProcess.waitForOutput('b.test.ts:3:11 › passes');+ await testProcess.waitForOutput('a.test.ts:3:7 › passes');+ await testProcess.waitForOutput('b.test.ts:3:7 › passes');await testProcess.waitForOutput('Waiting for file changes.');});@@ -385,8 +385,8 @@ test('should respect title filter T', async ({ runWatchTest }) => {await testProcess.waitForOutput('Input test name pattern (regex)');testProcess.write('title 2\r\n');await testProcess.waitForOutput('npx playwright test --grep title 2 #1');- await testProcess.waitForOutput('b.test.ts:3:11 › title 2');- expect(testProcess.output).not.toContain('a.test.ts:3:11');+ await testProcess.waitForOutput('b.test.ts:3:7 › title 2');+ expect(testProcess.output).not.toContain('a.test.ts:3:7');await testProcess.waitForOutput('Waiting for file changes.');});@@ -410,22 +410,22 @@ test('should re-run failed tests on F > R', async ({ runWatchTest }) => {testProcess.write('\r\n');await testProcess.waitForOutput('npx playwright test #1');- await testProcess.waitForOutput('a.test.ts:3:11 › passes');- await testProcess.waitForOutput('b.test.ts:3:11 › passes');- await testProcess.waitForOutput('c.test.ts:3:11 › fails');+ await testProcess.waitForOutput('a.test.ts:3:7 › passes');+ await testProcess.waitForOutput('b.test.ts:3:7 › passes');+ await testProcess.waitForOutput('c.test.ts:3:7 › fails');await testProcess.waitForOutput('Error: expect(received).toBe(expected)');await testProcess.waitForOutput('Waiting for file changes.');testProcess.clearOutput();testProcess.write('f');await testProcess.waitForOutput('npx playwright test (running failed tests) #2');- await testProcess.waitForOutput('c.test.ts:3:11 › fails');- expect(testProcess.output).not.toContain('a.test.ts:3:11');+ await testProcess.waitForOutput('c.test.ts:3:7 › fails');+ expect(testProcess.output).not.toContain('a.test.ts:3:7');await testProcess.waitForOutput('Waiting for file changes.');testProcess.clearOutput();testProcess.write('r');await testProcess.waitForOutput('npx playwright test (re-running tests) #3');- await testProcess.waitForOutput('c.test.ts:3:11 › fails');- expect(testProcess.output).not.toContain('a.test.ts:3:11');+ await testProcess.waitForOutput('c.test.ts:3:7 › fails');+ expect(testProcess.output).not.toContain('a.test.ts:3:7');});test('should run on changed files', async ({ runWatchTest, writeFiles }) => {@@ -451,9 +451,9 @@ test('should run on changed files', async ({ runWatchTest, writeFiles }) => {test('passes', () => {});`,});- await testProcess.waitForOutput('c.test.ts:3:11 › passes');- expect(testProcess.output).not.toContain('a.test.ts:3:11 › passes');- expect(testProcess.output).not.toContain('b.test.ts:3:11 › passes');+ await testProcess.waitForOutput('c.test.ts:3:7 › passes');+ expect(testProcess.output).not.toContain('a.test.ts:3:7 › passes');+ expect(testProcess.output).not.toContain('b.test.ts:3:7 › passes');await testProcess.waitForOutput('Waiting for file changes.');testProcess.clearOutput();@@ -464,8 +464,8 @@ test('should run on changed files', async ({ runWatchTest, writeFiles }) => {`,});- await testProcess.waitForOutput('b.test.ts:3:11 › passes');- expect(testProcess.output).not.toContain('c.test.ts:3:11 › passes');+ await testProcess.waitForOutput('b.test.ts:3:7 › passes');+ expect(testProcess.output).not.toContain('c.test.ts:3:7 › passes');});test('should run on changed deps', async ({ runWatchTest, writeFiles }) => {@@ -490,8 +490,8 @@ test('should run on changed deps', async ({ runWatchTest, writeFiles }) => {console.log('new helper');`,});- await testProcess.waitForOutput('b.test.ts:4:11 › passes');- expect(testProcess.output).not.toContain('a.test.ts:3:11 › passes');+ await testProcess.waitForOutput('b.test.ts:4:7 › passes');+ expect(testProcess.output).not.toContain('a.test.ts:3:7 › passes');await testProcess.waitForOutput('new helper');await testProcess.waitForOutput('Waiting for file changes.');});@@ -549,15 +549,15 @@ test('should re-run changed files on R', async ({ runWatchTest, writeFiles }) =>test('passes', () => {});`,});- await testProcess.waitForOutput('c.test.ts:3:11 › passes');- expect(testProcess.output).not.toContain('a.test.ts:3:11 › passes');- expect(testProcess.output).not.toContain('b.test.ts:3:11 › passes');+ await testProcess.waitForOutput('c.test.ts:3:7 › passes');+ expect(testProcess.output).not.toContain('a.test.ts:3:7 › passes');+ expect(testProcess.output).not.toContain('b.test.ts:3:7 › passes');await testProcess.waitForOutput('Waiting for file changes.');testProcess.clearOutput();testProcess.write('r');- await testProcess.waitForOutput('c.test.ts:3:11 › passes');- expect(testProcess.output).not.toContain('a.test.ts:3:11 › passes');- expect(testProcess.output).not.toContain('b.test.ts:3:11 › passes');+ await testProcess.waitForOutput('c.test.ts:3:7 › passes');+ expect(testProcess.output).not.toContain('a.test.ts:3:7 › passes');+ expect(testProcess.output).not.toContain('b.test.ts:3:7 › passes');await testProcess.waitForOutput('Waiting for file changes.');});@@ -601,7 +601,7 @@ test('should only watch selected projects', async ({ runWatchTest, writeFiles })testProcess.write('\r\n');await testProcess.waitForOutput('npx playwright test --project foo');- await testProcess.waitForOutput('[foo] › a.test.ts:3:11 › passes');+ await testProcess.waitForOutput('[foo] › a.test.ts:3:7 › passes');expect(testProcess.output).not.toContain('[bar]');await testProcess.waitForOutput('Waiting for file changes.');@@ -614,7 +614,7 @@ test('should only watch selected projects', async ({ runWatchTest, writeFiles })});await testProcess.waitForOutput('npx playwright test --project foo');- await testProcess.waitForOutput('[foo] › a.test.ts:3:11 › passes');+ await testProcess.waitForOutput('[foo] › a.test.ts:3:7 › passes');await testProcess.waitForOutput('Waiting for file changes.');expect(testProcess.output).not.toContain('[bar]');});@@ -635,7 +635,7 @@ test('should watch filtered files', async ({ runWatchTest, writeFiles }) => {testProcess.write('\r\n');await testProcess.waitForOutput('npx playwright test a.test.ts');- await testProcess.waitForOutput('a.test.ts:3:11 › passes');+ await testProcess.waitForOutput('a.test.ts:3:7 › passes');expect(testProcess.output).not.toContain('b.test');await testProcess.waitForOutput('Waiting for file changes.');@@ -667,7 +667,7 @@ test('should not watch unfiltered files', async ({ runWatchTest, writeFiles }) =testProcess.write('\r\n');await testProcess.waitForOutput('npx playwright test a.test.ts');- await testProcess.waitForOutput('a.test.ts:3:11 › passes');+ await testProcess.waitForOutput('a.test.ts:3:7 › passes');expect(testProcess.output).not.toContain('b.test');await testProcess.waitForOutput('Waiting for file changes.');@@ -681,7 +681,7 @@ test('should not watch unfiltered files', async ({ runWatchTest, writeFiles }) =testProcess.clearOutput();await testProcess.waitForOutput('npx playwright test a.test.ts (files changed)');- await testProcess.waitForOutput('a.test.ts:3:11 › passes');+ await testProcess.waitForOutput('a.test.ts:3:7 › passes');expect(testProcess.output).not.toContain('b.test');await testProcess.waitForOutput('Waiting for file changes.');});@@ -708,7 +708,7 @@ test('should run global teardown before exiting', async ({ runWatchTest }) => {testProcess.clearOutput();testProcess.write('\r\n');- await testProcess.waitForOutput('a.test.ts:3:11 › passes');+ await testProcess.waitForOutput('a.test.ts:3:7 › passes');await testProcess.waitForOutput('Waiting for file changes.');testProcess.write('\x1B');await testProcess.waitForOutput('running teardown');@@ -775,6 +775,6 @@ test('buffer mode', async ({ runWatchTest, writeFiles }) => {testProcess.clearOutput();testProcess.write('\r\n');- await testProcess.waitForOutput('a.test.ts:3:11 › passes');- await testProcess.waitForOutput('b.test.ts:3:11 › passes');+ await testProcess.waitForOutput('a.test.ts:3:7 › passes');+ await testProcess.waitForOutput('b.test.ts:3:7 › passes');});