diff --git a/packages/utils/src/source-map.ts b/packages/utils/src/source-map.ts index e57be5cdf..8e358c566 100644 --- a/packages/utils/src/source-map.ts +++ b/packages/utils/src/source-map.ts @@ -261,7 +261,14 @@ export function parseStacktrace( } const traceMap = new DecodedMap(map, stack.file) - const position = getOriginalPosition(traceMap, stack) + if (stack.line <= 0 || stack.column <= 0) { + return stack + } + const position = getOriginalPosition(traceMap, { + line: stack.line, + // stacktrace's column is 1-indexed, but sourcemap's one is 0-indexed + column: stack.column - 1, + }) if (!position) { return stack } @@ -279,7 +286,7 @@ export function parseStacktrace( if (line != null && column != null) { return { line, - column, + column: column + 1, file, method: name || stack.method, } diff --git a/test/browser/specs/aria-snapshot.test.ts b/test/browser/specs/aria-snapshot.test.ts index 5ed69418a..b2af81716 100644 --- a/test/browser/specs/aria-snapshot.test.ts +++ b/test/browser/specs/aria-snapshot.test.ts @@ -1,7 +1,6 @@ import fs, { readFileSync } from 'node:fs' import { join } from 'node:path' import { expect, test } from 'vitest' -import { rolldownVersion } from 'vitest/node' import { editFile } from '../../test-utils' import { instances, runBrowserTests } from './utils' @@ -116,110 +115,38 @@ test.for(instances.map(i => i.browser))('aria snapshot %s', async (browser) => { project: [browser], update: 'none', }) - if (browser === 'webkit') { - if (rolldownVersion) { - expect(result.errorTree({ stackTrace: true, diff: true })).toMatchInlineSnapshot(` - { - "basic.test.ts": { - "expect.element aria once": "passed", - "expect.element aria retry": "passed", - "poll aria once": "passed", - "toMatchAriaInlineSnapshot simple": [ - "Snapshot \`toMatchAriaInlineSnapshot simple 1\` mismatched - - Expected - + Received - - - - paragraph: Original - + - paragraph: Changed - - button /\\d+/: Pattern - at basic.test.ts:22:50", - ], - "toMatchAriaSnapshot simple": [ - "Snapshot \`toMatchAriaSnapshot simple 1\` mismatched - - Expected - + Received - - - main: - - heading "Dashboard" [level=1] - - - navigation /A\\w+/: - + - navigation "EDITED": - - button "Save" - - button "Cancel" - at basic.test.ts:14:24", - ], - }, - } - `) - } - else { - expect(result.errorTree({ stackTrace: true, diff: true })).toMatchInlineSnapshot(` - { - "basic.test.ts": { - "expect.element aria once": "passed", - "expect.element aria retry": "passed", - "poll aria once": "passed", - "toMatchAriaInlineSnapshot simple": [ - "Snapshot \`toMatchAriaInlineSnapshot simple 1\` mismatched - - Expected - + Received - - - - paragraph: Original - + - paragraph: Changed - - button /\\d+/: Pattern - at basic.test.ts:22:50", - ], - "toMatchAriaSnapshot simple": [ - "Snapshot \`toMatchAriaSnapshot simple 1\` mismatched - - Expected - + Received - - - main: - - heading "Dashboard" [level=1] - - - navigation /A\\w+/: - + - navigation "EDITED": - - button "Save" - - button "Cancel" - at basic.test.ts:14:44", - ], - }, - } - `) + expect(result.errorTree({ stackTrace: true, diff: true })).toMatchInlineSnapshot(` + { + "basic.test.ts": { + "expect.element aria once": "passed", + "expect.element aria retry": "passed", + "poll aria once": "passed", + "toMatchAriaInlineSnapshot simple": [ + "Snapshot \`toMatchAriaInlineSnapshot simple 1\` mismatched + - Expected + + Received + + - - paragraph: Original + + - paragraph: Changed + - button /\\d+/: Pattern + at basic.test.ts:22:25", + ], + "toMatchAriaSnapshot simple": [ + "Snapshot \`toMatchAriaSnapshot simple 1\` mismatched + - Expected + + Received + + - main: + - heading "Dashboard" [level=1] + - - navigation /A\\w+/: + + - navigation "EDITED": + - button "Save" + - button "Cancel" + at basic.test.ts:14:25", + ], + }, } - } - else { - expect(result.errorTree({ stackTrace: true, diff: true })).toMatchInlineSnapshot(` - { - "basic.test.ts": { - "expect.element aria once": "passed", - "expect.element aria retry": "passed", - "poll aria once": "passed", - "toMatchAriaInlineSnapshot simple": [ - "Snapshot \`toMatchAriaInlineSnapshot simple 1\` mismatched - - Expected - + Received - - - - paragraph: Original - + - paragraph: Changed - - button /\\d+/: Pattern - at basic.test.ts:22:24", - ], - "toMatchAriaSnapshot simple": [ - "Snapshot \`toMatchAriaSnapshot simple 1\` mismatched - - Expected - + Received - - - main: - - heading "Dashboard" [level=1] - - - navigation /A\\w+/: - + - navigation "EDITED": - - button "Save" - - button "Cancel" - at basic.test.ts:14:24", - ], - }, - } - `) - } + `) // run with update: all — should pass, preserve regex, update mismatched literal result = await runBrowserTests({ diff --git a/test/browser/specs/assertion-helper.test.ts b/test/browser/specs/assertion-helper.test.ts index befd819a2..9cf7bbef1 100644 --- a/test/browser/specs/assertion-helper.test.ts +++ b/test/browser/specs/assertion-helper.test.ts @@ -16,19 +16,19 @@ test('vi.defineHelper hides internal stack traces', async () => { "basic.test.ts": { "async": [ "expected 'async' to deeply equal 'x' - at basic.test.ts:26:8", + at basic.test.ts:26:9", ], "soft": [ "expected 'soft' to deeply equal 'x' - at basic.test.ts:30:14", + at basic.test.ts:30:3", ], "soft async": [ "expected 'soft async' to deeply equal 'x' - at basic.test.ts:34:8", + at basic.test.ts:34:9", ], "sync": [ "expected 'sync' to deeply equal 'x' - at basic.test.ts:22:10", + at basic.test.ts:22:3", ], }, } @@ -40,19 +40,19 @@ test('vi.defineHelper hides internal stack traces', async () => { "basic.test.ts": { "async": [ "expected 'async' to deeply equal 'x' - at basic.test.ts:26:21", + at basic.test.ts:26:9", ], "soft": [ "expected 'soft' to deeply equal 'x' - at basic.test.ts:30:14", + at basic.test.ts:30:3", ], "soft async": [ "expected 'soft async' to deeply equal 'x' - at basic.test.ts:34:25", + at basic.test.ts:34:9", ], "sync": [ "expected 'sync' to deeply equal 'x' - at basic.test.ts:22:10", + at basic.test.ts:22:3", ], }, } @@ -64,19 +64,19 @@ test('vi.defineHelper hides internal stack traces', async () => { "basic.test.ts": { "async": [ "expected 'async' to deeply equal 'x' - at basic.test.ts:26:2", + at basic.test.ts:26:3", ], "soft": [ "expected 'soft' to deeply equal 'x' - at basic.test.ts:30:2", + at basic.test.ts:30:3", ], "soft async": [ "expected 'soft async' to deeply equal 'x' - at basic.test.ts:34:2", + at basic.test.ts:34:3", ], "sync": [ "expected 'sync' to deeply equal 'x' - at basic.test.ts:22:2", + at basic.test.ts:22:3", ], }, } diff --git a/test/browser/specs/error-watch.test.ts b/test/browser/specs/error-watch.test.ts index 11b7c2dd3..5d37d6e6b 100644 --- a/test/browser/specs/error-watch.test.ts +++ b/test/browser/specs/error-watch.test.ts @@ -23,7 +23,7 @@ test('keeps browser stack trace source maps fresh after watch rerun', async () = "basic.test.ts": { "basic": [ "boom - at basic.test.ts:5:8", + at basic.test.ts:5:9", ], }, } @@ -51,7 +51,7 @@ test('keeps browser stack trace source maps fresh after watch rerun', async () = "basic.test.ts": { "basic": [ "boom - at basic.test.ts:9:8", + at basic.test.ts:9:9", ], }, } diff --git a/test/browser/specs/errors.test.ts b/test/browser/specs/errors.test.ts index 01ca7779c..3b1b47d58 100644 --- a/test/browser/specs/errors.test.ts +++ b/test/browser/specs/errors.test.ts @@ -1,6 +1,5 @@ import path from 'pathe' import { expect, test } from 'vitest' -import { rolldownVersion } from 'vitest/node' import { buildTestProjectTree } from '../../test-utils' import { instances, provider, runBrowserTests, runInlineBrowserTests } from './utils' @@ -9,12 +8,12 @@ test('prints correct unhandled error stack', async () => { root: './fixtures/unhandled', }) - expect(stderr).toContain('throw-unhandled-error.test.ts:9:10') + expect(stderr).toContain('throw-unhandled-error.test.ts:9:11') expect(stderr).toContain('This error originated in "throw-unhandled-error.test.ts" test file.') expect(stderr).toContain('The last test to run before this error was "unhandled exception".') if (instances.some(({ browser }) => browser === 'webkit')) { - expect(stderr).toContain('throw-unhandled-error.test.ts:9:20') + expect(stderr).toContain('throw-unhandled-error.test.ts:9:15') } }) @@ -162,40 +161,21 @@ test('prints source-mapped stack for optimized dependency', async () => { for (const [name, tree] of Object.entries(projectTree)) { if (name === 'webkit') { - if (rolldownVersion) { - expect(tree).toMatchInlineSnapshot(` - { - "basic.test.ts": { - "fail": [ - { - "message": "this is test dependency error", - "stacks": [ - "throwDepError at ../../../../node_modules/.pnpm//node_modules/test-dep-error/index.js:2:18", - " at basic.test.ts:5:2", - ], - }, - ], - }, - } - `) - } - else { - expect(tree).toMatchInlineSnapshot(` - { - "basic.test.ts": { - "fail": [ - { - "message": "this is test dependency error", - "stacks": [ - "throwDepError at ../../../../node_modules/.pnpm//node_modules/test-dep-error/index.js:2:18", - " at basic.test.ts:5:16", - ], - }, - ], - }, - } - `) - } + expect(tree).toMatchInlineSnapshot(` + { + "basic.test.ts": { + "fail": [ + { + "message": "this is test dependency error", + "stacks": [ + "throwDepError at ../../../../node_modules/.pnpm//node_modules/test-dep-error/index.js:2:13", + " at basic.test.ts:5:3", + ], + }, + ], + }, + } + `) } else { expect(tree).toMatchInlineSnapshot(` @@ -205,8 +185,8 @@ test('prints source-mapped stack for optimized dependency', async () => { { "message": "this is test dependency error", "stacks": [ - "throwDepError at ../../../../node_modules/.pnpm//node_modules/test-dep-error/index.js:2:8", - " at basic.test.ts:5:2", + "throwDepError at ../../../../node_modules/.pnpm//node_modules/test-dep-error/index.js:2:9", + " at basic.test.ts:5:3", ], }, ], diff --git a/test/browser/specs/playwright-trace-mark.test.ts b/test/browser/specs/playwright-trace-mark.test.ts index a1f1f5e3e..7f4ad4aa8 100644 --- a/test/browser/specs/playwright-trace-mark.test.ts +++ b/test/browser/specs/playwright-trace-mark.test.ts @@ -3,7 +3,6 @@ import path from 'node:path' import { stripVTControlCharacters } from 'node:util' import { resolve } from 'pathe' import { afterEach, describe, expect, test } from 'vitest' -import { rolldownVersion } from 'vitest/node' import * as yauzl from 'yauzl' import { buildTestProjectTree } from '../../test-utils' import { instances, provider, runBrowserTests } from './utils' @@ -106,12 +105,7 @@ describe.runIf(provider.name === 'playwright')('playwright trace marks', () => { ) const markerEvent = events.find(e => e.title === 'button rendered - locator') const formattedFrame = formatStack(markerEvent) - if (name === 'webkit') { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:10:38"`) - } - else { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:10:33"`) - } + expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:10:34"`) } if (traceFile.includes('page-mark') && !traceFile.includes('custom-stack')) { @@ -128,12 +122,7 @@ describe.runIf(provider.name === 'playwright')('playwright trace marks', () => { ) const markerEvent = events.find(e => e.title === 'button rendered - page') const formattedFrame = formatStack(markerEvent) - if (name === 'webkit') { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:15:18"`) - } - else { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:15:13"`) - } + expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:15:14"`) } if (traceFile.includes('expect-element-pass')) { @@ -153,12 +142,7 @@ describe.runIf(provider.name === 'playwright')('playwright trace marks', () => { ) const markerEvent = events.find(e => e.title === 'toHaveTextContent') const formattedFrame = formatStack(markerEvent) - if (name === 'webkit') { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:20:23"`) - } - else { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:20:15"`) - } + expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:20:16"`) } if (traceFile.includes('expect-element-fail')) { @@ -182,22 +166,17 @@ describe.runIf(provider.name === 'playwright')('playwright trace marks', () => { ) const markerEvent = events.find(e => e.title === 'toHaveTextContent [ERROR]') const formattedFrame = formatStack(markerEvent) - if (name === 'webkit') { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:26:23"`) - } - else { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:26:15"`) - } + expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:26:16"`) } if (traceFile.includes('failure')) { const markerEvent = events.find(e => e.title === 'onAfterRetryTask [fail]') const formattedFrame = formatStack(markerEvent) if (name === 'webkit') { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:31:18"`) + expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:31:13"`) } else { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:31:8"`) + expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:31:9"`) } } @@ -220,17 +199,7 @@ describe.runIf(provider.name === 'playwright')('playwright trace marks', () => { ) const markerEvent = events.find(e => e.title === 'vitest:click') const formattedFrame = formatStack(markerEvent) - if (name === 'webkit') { - if (rolldownVersion) { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:36:33"`) - } - else { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:36:39"`) - } - } - else { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:36:33"`) - } + expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:36:34"`) } if (traceFile.includes('helper')) { @@ -243,12 +212,7 @@ describe.runIf(provider.name === 'playwright')('playwright trace marks', () => { ) const markerEvent = events.find(e => e.title === 'render helper') const formattedFrame = formatStack(markerEvent) - if (name === 'webkit') { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:45:17"`) - } - else { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:45:8"`) - } + expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:45:9"`) } if (traceFile.includes('stack')) { @@ -262,10 +226,10 @@ describe.runIf(provider.name === 'playwright')('playwright trace marks', () => { const markerEvent = events.find(e => e.title === 'button rendered - stack') const formattedFrame = formatStack(markerEvent) if (name === 'webkit') { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:50:26"`) + expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:50:21"`) } else { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:50:16"`) + expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:50:17"`) } } @@ -279,12 +243,7 @@ describe.runIf(provider.name === 'playwright')('playwright trace marks', () => { ) const markerEvent = events.find(e => e.title === 'render group') const formattedFrame = formatStack(markerEvent) - if (name === 'webkit') { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:55:18"`) - } - else { - expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:55:13"`) - } + expect(formattedFrame).toMatchInlineSnapshot(`"basic.test.ts:55:14"`) } } } diff --git a/test/browser/specs/runner.test.ts b/test/browser/specs/runner.test.ts index 50b9ee807..b5e2d37ee 100644 --- a/test/browser/specs/runner.test.ts +++ b/test/browser/specs/runner.test.ts @@ -3,7 +3,6 @@ import type { JsonTestResult, JsonTestResults, Vitest } from 'vitest/node' import { readdirSync } from 'node:fs' import { readFile } from 'node:fs/promises' import { beforeAll, describe, expect, onTestFailed, test } from 'vitest' -import { rolldownVersion } from 'vitest/node' import { buildTestTree } from '../../test-utils' import { instances, provider, runBrowserTests } from './utils' @@ -230,28 +229,14 @@ describe('console logging tests', async () => { test(`logs have stack traces`, () => { expect(stdout).toMatch(` log with a stack - ❯ test/logs.test.ts:58:10 + ❯ test/logs.test.ts:58:11 `.trim()) expect(stderr).toMatch(` error with a stack - ❯ test/logs.test.ts:59:10 + ❯ test/logs.test.ts:59:11 `.trim()) // console.trace processes the stack trace correctly - expect(stderr).toMatch('test/logs.test.ts:60:10') - - if (instances.some(({ browser }) => browser === 'webkit')) { - // safari print stack trace in a different place - expect(stdout).toMatch(` -log with a stack - ❯ test/logs.test.ts:58:14 - `.trim()) - expect(stderr).toMatch(` -error with a stack - ❯ test/logs.test.ts:59:16 - `.trim()) - // console.trace processes the stack trace correctly - expect(stderr).toMatch('test/logs.test.ts:60:16') - } + expect(stderr).toMatch('test/logs.test.ts:60:11') }) test('popup apis should log a warning', () => { @@ -287,7 +272,7 @@ test(`stack trace points to correct file in every browser when failed`, async () expect(testCase.result().errors?.[0].stacks).toEqual([ { line: 11, - column: 12, + column: 13, file: testCase.module.moduleId, method: '', }, @@ -307,36 +292,35 @@ test(`stack trace points to correct file in every browser when failed`, async () expect(stderr).toContain('Access denied to "/inaccessible/path".') - // depending on the browser it references either `.toBe()` or `expect()` - expect(stderr).toMatch(/failing.test.ts:11:(12|17)/) + expect(stderr).toMatch(/failing.test.ts:11:13/) - // column is 18 in safari, 8 in others - expect(stderr).toMatch(/throwError src\/error.ts:8:(18|8)/) + // column is 13 in safari, 9 in others + expect(stderr).toMatch(/throwError src\/error.ts:8:(13|9)/) expect(stderr).toContain('The call was not awaited. This method is asynchronous and must be awaited; otherwise, the call will not start to avoid unhandled rejections.') - expect(stderr).toMatch(/failing.test.ts:19:(27|36)/) - expect(stderr).toMatch(/failing.test.ts:20:(27|33)/) - expect(stderr).toMatch(/failing.test.ts:21:(27|39)/) - expect(stderr).toMatch(/failing.test.ts:22:(12|17)/) - expect(stderr).toMatch(/failing.test.ts:23:(12|21)/) - expect(stderr).toMatch(/failing.test.ts:24:(12|17)/) - expect(stderr).toMatch(/failing.test.ts:25:(12|16)/) - expect(stderr).toMatch(/failing.test.ts:26:(12|18)/) - expect(stderr).toMatch(/failing.test.ts:27:(12|16)/) - expect(stderr).toMatch(/failing.test.ts:28:(12|24)/) - expect(stderr).toMatch(/failing.test.ts:29:(12|17)/) - expect(stderr).toMatch(/failing.test.ts:30:(12|19)/) - expect(stderr).toMatch(/failing.test.ts:31:(12|20)/) - expect(stderr).toMatch(/failing.test.ts:32:(12|18)/) - expect(stderr).toMatch(/failing.test.ts:33:(12|18)/) - expect(stderr).toMatch(/failing.test.ts:34:(12|26)/) - expect(stderr).toMatch(/failing.test.ts:35:(12|18)/) - - expect(stderr).toMatch(/bundled-lib\/src\/b.js:2:(9|19)/) - expect(stderr).toMatch(/bundled-lib\/src\/index.js:5:(16|18)/) + expect(stderr).toMatch(/failing.test.ts:19:28/) + expect(stderr).toMatch(/failing.test.ts:20:28/) + expect(stderr).toMatch(/failing.test.ts:21:28/) + expect(stderr).toMatch(/failing.test.ts:22:13/) + expect(stderr).toMatch(/failing.test.ts:23:13/) + expect(stderr).toMatch(/failing.test.ts:24:13/) + expect(stderr).toMatch(/failing.test.ts:25:13/) + expect(stderr).toMatch(/failing.test.ts:26:13/) + expect(stderr).toMatch(/failing.test.ts:27:13/) + expect(stderr).toMatch(/failing.test.ts:28:13/) + expect(stderr).toMatch(/failing.test.ts:29:13/) + expect(stderr).toMatch(/failing.test.ts:30:13/) + expect(stderr).toMatch(/failing.test.ts:31:13/) + expect(stderr).toMatch(/failing.test.ts:32:13/) + expect(stderr).toMatch(/failing.test.ts:33:13/) + expect(stderr).toMatch(/failing.test.ts:34:13/) + expect(stderr).toMatch(/failing.test.ts:35:13/) + + expect(stderr).toMatch(/bundled-lib\/src\/b.js:2:(9|18)/) + expect(stderr).toMatch(/bundled-lib\/src\/index.js:5:(16|17)/) // index() is called from a bundled file - expect(stderr).toMatch(/failing.test.ts:39:(2|8)/) + expect(stderr).toMatch(/failing.test.ts:39:3/) // "not awaited but with then/catch/finally" test should not produce warnings expect(stderr).not.toMatch(/failing.test.ts:4[3-8]/) @@ -443,236 +427,122 @@ test.runIf(provider.name === 'playwright')('timeout hooks', async ({ onTestFaile ].join('\n') }).sort().join('\n\n') - // rolldown has better source maps - if (rolldownVersion) { - expect(snapshot).toMatchInlineSnapshot(` - " FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > afterAll - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:39:45 + expect(snapshot).toMatchInlineSnapshot(` + " FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > afterAll + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:39:46 - FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > afterEach > skipped - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:23:45 + FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > afterEach > skipped + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:23:46 - FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > beforeAll - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:31:45 + FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > beforeAll + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:31:46 - FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > beforeEach > skipped - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:15:45 + FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > beforeEach > skipped + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:15:46 - FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > click on non-existing element fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:6:33 + FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > click on non-existing element fails + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:6:34 - FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:62:47 + FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:62:48 - FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails global - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:70:47 + FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails global + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:70:48 - FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:48:47 + FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:48:48 - FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails global - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:54:47 + FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails global + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:54:48 - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > afterAll - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:39:45 + FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > afterAll + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:39:46 - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > afterEach > skipped - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:23:45 + FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > afterEach > skipped + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:23:46 - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > beforeAll - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:31:45 + FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > beforeAll + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:31:46 - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > beforeEach > skipped - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:15:45 + FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > beforeEach > skipped + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:15:46 - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > click on non-existing element fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:6:33 + FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > click on non-existing element fails + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:6:34 - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:62:47 + FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:62:48 - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails global - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:70:47 + FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails global + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:70:48 - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:48:47 + FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:48:48 - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails global - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:54:47 + FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails global + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:54:48 - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > afterAll - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:39:45 + FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > afterAll + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:39:46 - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > afterEach > skipped - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:23:45 + FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > afterEach > skipped + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:23:46 - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > beforeAll - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:31:45 + FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > beforeAll + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:31:46 - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > beforeEach > skipped - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:15:45 + FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > beforeEach > skipped + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:15:46 - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > click on non-existing element fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:6:33 + FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > click on non-existing element fails + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:6:34 - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:62:47 + FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:62:48 - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails global - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:70:47 - - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:48:47 + FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails global + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:70:48 - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails global - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:54:47" - `) - } - else { - expect(snapshot).toMatchInlineSnapshot(` - " FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > afterAll - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:39:45 - - FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > afterEach > skipped - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:23:45 - - FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > beforeAll - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:31:45 - - FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > beforeEach > skipped - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:15:45 - - FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > click on non-existing element fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:6:33 - - FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:62:47 - - FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails global - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:70:47 - - FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:48:47 - - FAIL |chromium| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails global - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:54:47 - - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > afterAll - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:39:45 - - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > afterEach > skipped - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:23:45 - - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > beforeAll - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:31:45 - - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > beforeEach > skipped - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:15:45 - - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > click on non-existing element fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:6:33 - - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:62:47 - - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails global - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:70:47 - - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:48:47 - - FAIL |firefox| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails global - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:54:47 - - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > afterAll - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:39:51 - - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > afterEach > skipped - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:23:51 - - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > beforeAll - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:31:51 - - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > beforeEach > skipped - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:15:51 - - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > click on non-existing element fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:6:39 - - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:62:53 - - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > onTestFailed > fails global - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:70:53 - - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:48:53 + FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:48:48 - FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails global - TimeoutError: locator.click: Timeout exceeded. - ❯ hooks-timeout.test.ts:54:53" - `) - } + FAIL |webkit| hooks-timeout.test.ts > timeouts are failing correctly > onTestFinished > fails global + TimeoutError: locator.click: Timeout exceeded. + ❯ hooks-timeout.test.ts:54:48" + `) // page.getByRole('code').click() expect(stderr).toContain('locator.click: Timeout') // playwright error is proxied from the server to the client and back correctly expect(stderr).toContain('waiting for locator(\'[data-vitest="true"]\').contentFrame().getByRole(\'code\')') - expect(stderr).toMatch(/hooks-timeout.test.ts:6:(33|39)/) + expect(stderr).toMatch(/hooks-timeout.test.ts:6:34/) // await expect.element().toBeVisible() expect(stderr).toContain('Cannot find element with locator: getByRole(\'code\')') - expect(stderr).toMatch(/hooks-timeout.test.ts:10:(49|61)/) + expect(stderr).toMatch(/hooks-timeout.test.ts:10:50/) }, 120_000 * 3) diff --git a/test/coverage-test/test/source-maps.test.ts b/test/coverage-test/test/source-maps.test.ts index a25b53d41..b5e549071 100644 --- a/test/coverage-test/test/source-maps.test.ts +++ b/test/coverage-test/test/source-maps.test.ts @@ -1,5 +1,5 @@ import { expect } from 'vitest' -import { isBrowser, runVitest, test } from '../utils' +import { runVitest, test } from '../utils' test('errors point to correct location', async () => { const { stderr } = await runVitest({ @@ -7,18 +7,7 @@ test('errors point to correct location', async () => { coverage: { reporter: 'json' }, }, { throwOnError: false }) - if (isBrowser()) { - expect(stderr).toMatch(` -❯ throws fixtures/src/throws-error.ts:29:11 - 27| */ - 28| function throws() { - 29| throw new Error("Expected error") - | ^ - 30| } - `.trim()) - } - else { - expect(stderr).toMatch(` + expect(stderr).toMatch(` ❯ throws fixtures/src/throws-error.ts:29:12 27| */ 28| function throws() { @@ -26,5 +15,4 @@ test('errors point to correct location', async () => { | ^ 30| } `.trim()) - } }) diff --git a/test/e2e/snapshots/domain-aria-inline.test.ts b/test/e2e/snapshots/domain-aria-inline.test.ts index 1cced1096..5c771dbbf 100644 --- a/test/e2e/snapshots/domain-aria-inline.test.ts +++ b/test/e2e/snapshots/domain-aria-inline.test.ts @@ -103,11 +103,11 @@ test('aria inline snapshot', async () => { + - paragraph: Changed - button /\\d+/: Pattern - ❯ basic.test.ts:19:24 + ❯ basic.test.ts:19:25 17| 18| \` 19| expect(document.body).toMatchAriaInlineSnapshot(\` - | ^ + | ^ 20| - paragraph: Original 21| - button /\\\\d+/: Pattern @@ -246,11 +246,11 @@ test('basic', () => { + - paragraph: count - 1 - ❯ basic.test.ts:7:26 + ❯ basic.test.ts:7:27 5| for (let i = 0; i < 3; i++) { 6| document.body.innerHTML = "

count - " + i + "

"; 7| expect(document.body).toMatchAriaInlineSnapshot(); - | ^ + | ^ 8| } 9| }); @@ -310,11 +310,11 @@ test('basic', () => { FAIL |chromium| basic.test.ts > basic Error: Aria snapshot must be a YAML sequence, elements starting with " -" - ❯ basic.test.ts:5:24 + ❯ basic.test.ts:5:25 3| 4| test('basic', () => { 5| expect(document.body).toMatchAriaInlineSnapshot(\`x: y\`); - | ^ + | ^ 6| }); 7| diff --git a/test/e2e/snapshots/domain-aria.test.ts b/test/e2e/snapshots/domain-aria.test.ts index b54fa422a..1499acfe8 100644 --- a/test/e2e/snapshots/domain-aria.test.ts +++ b/test/e2e/snapshots/domain-aria.test.ts @@ -119,11 +119,11 @@ test('aria snapshot', { tags: ['browser'] }, async () => { + - paragraph: Changed - button /\\d+/: Pattern - ❯ basic.test.ts:20:24 + ❯ basic.test.ts:20:25 18| 19| \` 20| expect(document.body).toMatchAriaSnapshot() - | ^ + | ^ 21| }) 22| diff --git a/test/e2e/test/__snapshots__/stacktraces.test.ts.snap b/test/e2e/test/__snapshots__/stacktraces.test.ts.snap index f90b35fe2..4dec14ff2 100644 --- a/test/e2e/test/__snapshots__/stacktraces.test.ts.snap +++ b/test/e2e/test/__snapshots__/stacktraces.test.ts.snap @@ -56,8 +56,8 @@ Error: __TEST_STACK_TS__ FAIL error-in-package.test.js > transpiled Error: __TEST_STACK_TRANSPILED__ - ❯ innerTestStack (NODE_MODULES)/@test/test-dep-error/transpiled.ts:22:8 - ❯ testStack (NODE_MODULES)/@test/test-dep-error/transpiled.ts:12:2 + ❯ innerTestStack (NODE_MODULES)/@test/test-dep-error/transpiled.ts:22:9 + ❯ testStack (NODE_MODULES)/@test/test-dep-error/transpiled.ts:12:3 ❯ error-in-package.test.js:16:22 14| 15| test('transpiled', () => { @@ -70,8 +70,8 @@ Error: __TEST_STACK_TRANSPILED__ FAIL error-in-package.test.js > transpiled inline Error: __TEST_STACK_TRANSPILED_INLINE__ - ❯ innerTestStack (NODE_MODULES)/@test/test-dep-error/transpiled-inline.ts:22:8 - ❯ testStack (NODE_MODULES)/@test/test-dep-error/transpiled-inline.ts:12:2 + ❯ innerTestStack (NODE_MODULES)/@test/test-dep-error/transpiled-inline.ts:22:9 + ❯ testStack (NODE_MODULES)/@test/test-dep-error/transpiled-inline.ts:12:3 ❯ error-in-package.test.js:20:28 18| 19| test('transpiled inline', () => { diff --git a/test/e2e/test/reporters/merge-reports.test.ts b/test/e2e/test/reporters/merge-reports.test.ts index 23b8c5396..83f2b275d 100644 --- a/test/e2e/test/reporters/merge-reports.test.ts +++ b/test/e2e/test/reporters/merge-reports.test.ts @@ -912,11 +912,11 @@ test("works on browser", () => { Expected: "undefined" Received: "object" - ❯ basic.test.ts:7:24 + ❯ basic.test.ts:7:25 5| 6| test("works on node", () => { 7| expect(typeof window).toBe('undefined') - | ^ + | ^ 8| }) 9| @@ -928,11 +928,11 @@ test("works on browser", () => { Expected: "undefined" Received: "object" - ❯ basic.test.ts:7:24 + ❯ basic.test.ts:7:25 5| 6| test("works on node", () => { 7| expect(typeof window).toBe('undefined') - | ^ + | ^ 8| }) 9| diff --git a/test/ui/test/trace.spec.ts b/test/ui/test/trace.spec.ts index cc9147153..c25a969eb 100644 --- a/test/ui/test/trace.spec.ts +++ b/test/ui/test/trace.spec.ts @@ -154,7 +154,7 @@ async function testBasic(page: Page) { // verify editor cursor position const getEditorCursor = () => evaluateEditor(page, editor => editor.getCursor()) - await expect.poll(() => getEditorCursor()).toEqual({ line: 9, ch: 32 }) + await expect.poll(() => getEditorCursor()).toEqual({ line: 9, ch: 33 }) // markers ordered by 'test finished' > 'Render simple' > 'Render another' const traceEditorMarkers = page.getByTestId('editor').getByTestId('trace-editor-marker') @@ -172,7 +172,7 @@ async function testBasic(page: Page) { // selecting 2nd trace step and verify again await traceStepNames.getByText('Render another').click() await expect(traceFrame.getByRole('button', { name: 'Another' })).toBeVisible() - await expect.poll(() => getEditorCursor()).toEqual({ line: 12, ch: 32 }) + await expect.poll(() => getEditorCursor()).toEqual({ line: 12, ch: 33 }) await expect(traceSteps.nth(1)).toHaveAttribute('aria-current', 'step') await expect(traceEditorMarkers.nth(1)).not.toHaveAttribute('aria-current', 'step') await expect(traceEditorMarkers.nth(2)).toHaveAttribute('aria-current', 'step')