fix(browser): don't add v=
queries to setup files imports
#11841
ci.yml
on: pull_request
Diff: node-latest, ubuntu-latest
7s
Lint: node-latest, ubuntu-latest
2m 33s
Matrix: test-browser
Matrix: test
Annotations
49 errors
Lint: node-latest, ubuntu-latest:
packages/browser/src/client/tester/tester.ts#L78
Argument of type '(string | boolean)[]' is not assignable to parameter of type 'string'.
|
Lint: node-latest, ubuntu-latest
Process completed with exit code 2.
|
Build&Test: node-20, macos-latest
Process completed with exit code 1.
|
specs/runner.test.ts > running browser tests > tests are actually running:
test/browser/specs/runner.test.ts#L35
AssertionError: expected [ { …(6) }, { …(6) }, { …(6) }, …(13) ] to have a length of 17 but got 16
- Expected
+ Received
- 17
+ 16
❯ specs/runner.test.ts:35:25
|
specs/runner.test.ts > running browser tests > runs in-source tests:
test/browser/specs/runner.test.ts#L46
AssertionError: expected undefined to be defined
❯ specs/runner.test.ts:46:25
|
specs/runner.test.ts > running browser tests > logs have stack traces in safari:
test/browser/specs/runner.test.ts#L110
AssertionError: expected '\n RUN v2.1.3 /Users/runner/work/vit…' to match 'log with a stack\n ❯ test/logs.test.t…'
- Expected
+ Received
+
+ RUN v2.1.3 /Users/runner/work/vitest/vitest/test/browser
+ Browser runner started by playwright at http://localhost:63315/
+
+ ✓ test/basic.test.ts (4 tests) 14ms
+ ✓ test/dialog.test.ts (3 tests) 6ms
+ ✓ test/polyfill-lib.test.ts (1 test) 1ms
+ ❯ src/actions.ts (0 test)
+ ❯ test/failing.test.ts (2 tests | 2 failed) 171ms
+ × correctly fails and prints a diff 124ms
+ → expected 1 to be 2 // Object.is equality
+ × correctly print error in another file 45ms
+ → error
+ ✓ test/another.test.ts (2 tests) 4ms
+ ✓ test/server-headers.test.ts (1 test) 5ms
+ ❯ test/failing.snaphot.test.ts (1 test | 1 failed) 73ms
+ × file snapshot 72ms
+ → Access denied to "/inaccesible/path". See Vite config documentation for "server.fs": https://vitejs.dev/config/server-options.html#server-fs-strict.
+ ✓ test/injected.test.ts (1 test) 3ms
+ ✓ test/userEvent.test.ts (54 tests) 5860ms
+ ✓ userEvent.click > correctly clicks a button 495ms
+ ✓ userEvent.click > clicks with x/y coords 397ms
+ ✓ userEvent.type > types into an input 617ms
+ ✓ userEvent.keyboard > should not auto release 1234ms
+ ✓ test/dom.test.ts (6 tests) 363ms
+ ↓ test/cdp.test.ts (3 tests | 3 skipped)
+ ✓ test/commands.test.ts (2 tests) 18ms
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.log
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.info
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.debug
+ stdout | test/logs.test.ts > logging to stdout
+ {
+ "hello": "from dir",
+ }
+ stdout | test/logs.test.ts > logging to stdout
+ {
+ "hello": "from dirxml",
+ }
+ stdout | test/logs.test.ts > logging DOM element
+ dom <div />
+ stdout | test/logs.test.ts > logging default counter
+ default: 1
+ stdout | test/logs.test.ts > logging default counter
+ default: 2
+ stdout | test/logs.test.ts > logging default counter
+ default: 3
+ stdout | test/logs.test.ts > logging default counter
+ default: 1
+ stdout | test/logs.test.ts > logging custom counter
+ count: 1
+ stdout | test/logs.test.ts > logging custom counter
+ count: 2
+ stdout | test/logs.test.ts > logging custom counter
+ count: 3
+ stdout | test/logs.test.ts > logging custom counter
+ count: 1
+ stdout | test/logs.test.ts > logging default time
+ default: 115 ms
+ stdout | test/logs.test.ts > logging default time
+ default: 0 ms
+ stdout | test/logs.test.ts > logging custom time
+ time: 116 ms
+ stdout | test/logs.test.ts > logging custom time
+ time: 0 ms
+ stdout | test/logs.test.ts > logging the stack
log with a stack
- ❯ test/logs.test.ts:58:14
+ ❯ test/logs.test.ts:48:14
+
+ ✓ test/logs.test.ts (9 tests) 28ms
+ ✓ test/utils.test.ts (4 tests) 18ms
+ ✓ test/viewport.test.ts (2 tests | 1 skipped) 2ms
+ ✓ test/cjs-lib.test.ts (3 tests) 7ms
+ ✓ test/timers.test.ts (1 test) 6ms
+ ✓ test/snapshot.test.ts (3 tests) 9ms
+
+ Test Files 3 failed | 15 passed | 1 skipped (19)
+ Tests 3 failed | 95 passed | 4 skipped (102)
+ Start at 15:30:10
+ Duration 10.89s (transform 0ms, setup 0ms, collect 198ms, tests 6.59s, environment 0ms, prepare 439ms)
+
+ JSON report written to /Users/runner/work/vitest/vitest/test/browser/browser.json
+
❯ specs/runner.test.ts:110:20
|
specs/runner.test.ts > running browser tests > stack trace points to correct file in every browser:
test/browser/specs/runner.test.ts#L124
AssertionError: expected 'stderr | test/dialog.test.ts > alert\…' to match /test\/failin…/failing.test.ts:5:(12|17)
- Expected:
/test\/failing.test.ts:5:(12|17)/
+ Received:
"stderr | test/dialog.test.ts > alert
Vitest encountered a `alert(\"test\")` call that it cannot handle by default, so it returned `undefined`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `alert` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"alert\")
alert(\"test\")
expect(alert).toHaveBeenCalledWith(\"test\")
```
stderr | test/dialog.test.ts > prompt
Vitest encountered a `prompt(\"test\")` call that it cannot handle by default, so it returned `null`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `prompt` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"prompt\").mockReturnValue(\"your value\")
prompt(\"test\")
expect(prompt).toHaveBeenCalledWith(\"test\")
```
stderr | test/dialog.test.ts > confirm
Vitest encountered a `confirm(\"test\")` call that it cannot handle by default, so it returned `false`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `confirm` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"confirm\").mockReturnValue(true)
confirm(\"test\")
expect(confirm).toHaveBeenCalledWith(\"test\")
```
stderr | test/logs.test.ts > logging to stdout
hello from console.trace
@http://localhost:63315/Users/runner/work/vitest/vitest/test/browser/test/logs.test.ts:8:16
@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:533:13
@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:532:19
runWithTimeout@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:61:9
@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:988:19
stderr | test/logs.test.ts > logging to stderr
hello from console.error
stderr | test/logs.test.ts > logging to stderr
hello from console.warn
stderr | test/logs.test.ts > logging invalid time
Timer \"invalid timeLog\" does not exist
stderr | test/logs.test.ts > logging invalid time
Timer \"invalid timeEnd\" does not exist
stderr | test/logs.test.ts > logging the stack
error with a stack
❯ test/logs.test.ts:49:16
stderr | test/logs.test.ts > logging the stack
trace with a stack
@http://localhost:63315/Users/runner/work/vitest/vitest/test/browser/test/logs.test.ts:50:16
@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:533:13
@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:532:19
runWithTimeout@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:61:9
@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:988:19
⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯
FAIL src/actions.ts [ src/actions.ts ]
Error: No test suite found in file /Users/runner/work/vitest/vitest/test/browser/src/actions.ts
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/4]⎯
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 3 ⎯⎯⎯⎯⎯⎯⎯
FAIL test/failing.snaphot.test.ts > file snapshot
Error: Access denied to \"/inaccesible/path\". See Vite config documentation for \"server.fs\": https://vitejs.dev/config/server-options.html#server-fs-strict.
Failure screenshot:
- test/__screenshots__/failing.snaphot.test.ts/file-snapshot-1.png
❯ Receiver.receiverOnMessage ../../node_modules/.pnpm/[email protected]/node_modules/ws/lib/websocket.js:1220:20
❯ Receiver.dataMessage ../../node_modules/.pnpm/[email protected]/node_modules/ws/lib/receiver.js:596:14
❯ Receiver.getData ../../node_modules/.pnpm/[email protected]/node_modules/ws/lib/receiver.js:496:10
❯ Receiver.startLoop ../../node_modules/.pnpm/[email protected]/node_modules/ws/lib/receiver.js:167:16
❯ Receiver._write ../../node_modules/.pnpm/[email protected]/node_modules/ws/lib/receiver.js:94:10
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/4]⎯
FAIL test/failing.test.ts > correctly fails and prints
|
specs/unhandled.test.ts > prints correct unhandled error stack:
test/browser/specs/unhandled.test.ts#L10
AssertionError: expected '\n⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯\nErr…' to contain 'throw-unhandled-error.test.ts:9:20'
- Expected
+ Received
- throw-unhandled-error.test.ts:9:20
+
+ ⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯
+ Error: custom_unhandled_error
+ ❯ throw-unhandled-error.test.ts:5:20
+ ❯ throw-unhandled-error.test.ts:4:13
+ ❯ throw-unhandled-error.test.ts:6:5
+
+
+
❯ specs/unhandled.test.ts:10:20
|
specs/update-snapshot.test.ts > update snapshot:
test/browser/specs/update-snapshot.test.ts#L48
AssertionError: expected 'import { expect, test, vi } from \'vi…' to contain 'expect(fn).toMatchInlineSnapshot(`[Mo…'
- Expected
+ Received
- expect(fn).toMatchInlineSnapshot(`[MockFunction spy]`)
+ import { expect, test, vi } from 'vitest'
+
+ interface _BasicInterface {
+ willBeRemoved: boolean
+ leavingSourceMapIncorrect: boolean
+ }
+
+ test('inline snapshot', () => {
+ expect(1).toMatchInlineSnapshot('1')
+ })
+
+ test('basic', () => {
+ expect(1).toMatchSnapshot()
+ })
+
+ test('renders inline mock snapshot', () => {
+ const fn = vi.fn()
+ expect(fn).toMatchInlineSnapshot(`[MockFunction spy]``
+ [MockFunction spy] {
+ "calls": [
+ [
+ "hello",
+ "world",
+ 2,
+ ],
+ ],
+ "results": [
+ {
+ "type": "return",
+ "value": undefined,
+ },
+ ],
+ }
+ `)
+ fn('hello', 'world', 2)
+ expect(fn).toMatchInlineSnapshot()
+ })
+
+ test('file snapshot', async () => {
+ await expect('my snapshot content')
+ .toMatchFileSnapshot('./__snapshots__/custom/my_snapshot')
+ })
+
+
❯ specs/update-snapshot.test.ts:48:20
|
Browser: webkit, macos-latest
Process completed with exit code 1.
|
Build&Test: node-22, ubuntu-latest
Process completed with exit code 1.
|
Build&Test: node-20, ubuntu-latest
Process completed with exit code 1.
|
Build&Test: node-18, ubuntu-latest
Process completed with exit code 1.
|
specs/runner.test.ts > running browser tests > tests are actually running:
test/browser/specs/runner.test.ts#L35
AssertionError: expected [ { …(6) }, { …(6) }, { …(6) }, …(13) ] to have a length of 17 but got 16
- Expected
+ Received
- 17
+ 16
❯ specs/runner.test.ts:35:25
|
specs/runner.test.ts > running browser tests > runs in-source tests:
test/browser/specs/runner.test.ts#L46
AssertionError: expected undefined to be defined
❯ specs/runner.test.ts:46:25
|
specs/runner.test.ts > running browser tests > logs have stack traces in non-safari:
test/browser/specs/runner.test.ts#L96
AssertionError: expected '\n RUN v2.1.3 /Users/runner/work/vit…' to match 'log with a stack\n ❯ test/logs.test.t…'
- Expected
+ Received
+
+ RUN v2.1.3 /Users/runner/work/vitest/vitest/test/browser
+ Browser runner started by playwright at http://localhost:63315/
+
+ ✓ test/basic.test.ts (4 tests) 9ms
+ ✓ test/dialog.test.ts (3 tests) 4ms
+ ✓ test/polyfill-lib.test.ts (1 test) 1ms
+ ❯ src/actions.ts (0 test)
+ ❯ test/failing.test.ts (2 tests | 2 failed) 574ms
+ × correctly fails and prints a diff 333ms
+ → expected 1 to be 2 // Object.is equality
+ × correctly print error in another file 240ms
+ → error
+ ✓ test/another.test.ts (2 tests) 6ms
+ ✓ test/server-headers.test.ts (1 test) 9ms
+ ❯ test/failing.snaphot.test.ts (1 test | 1 failed) 204ms
+ × file snapshot 203ms
+ → Access denied to "/inaccesible/path". See Vite config documentation for "server.fs": https://vitejs.dev/config/server-options.html#server-fs-strict.
+ ✓ test/injected.test.ts (1 test) 1ms
+ ✓ test/userEvent.test.ts (54 tests) 3643ms
+ ✓ userEvent.hover, userEvent.unhover > hover, unhover correctly pass options 378ms
+ ✓ userEvent.hover, userEvent.unhover > hover works with shadow root 365ms
+ ✓ test/dom.test.ts (6 tests) 1083ms
+ ✓ dom related activity > renders div 307ms
+ ✓ dom related activity > resolves base64 screenshot 313ms
+ ✓ test/cdp.test.ts (3 tests) 192ms
+ ✓ test/commands.test.ts (2 tests) 8ms
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.log
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.info
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.debug
+ stdout | test/logs.test.ts > logging to stdout
+ {
+ "hello": "from dir",
+ }
+ stdout | test/logs.test.ts > logging to stdout
+ {
+ "hello": "from dirxml",
+ }
+ stdout | test/logs.test.ts > logging DOM element
+ dom <div />
+ stdout | test/logs.test.ts > logging default counter
+ default: 1
+ stdout | test/logs.test.ts > logging default counter
+ default: 2
+ stdout | test/logs.test.ts > logging default counter
+ default: 3
+ stdout | test/logs.test.ts > logging default counter
+ default: 1
+ stdout | test/logs.test.ts > logging custom counter
+ count: 1
+ stdout | test/logs.test.ts > logging custom counter
+ count: 2
+ stdout | test/logs.test.ts > logging custom counter
+ count: 3
+ stdout | test/logs.test.ts > logging custom counter
+ count: 1
+ stdout | test/logs.test.ts > logging default time
+ default: 77.39999999996508 ms
+ stdout | test/logs.test.ts > logging default time
+ default: 0.20000000001164153 ms
+ stdout | test/logs.test.ts > logging custom time
+ time: 78.69999999995343 ms
+ stdout | test/logs.test.ts > logging custom time
+ time: 0.1000000000349246 ms
+ stdout | test/logs.test.ts > logging the stack
log with a stack
- ❯ test/logs.test.ts:58:10
+ ❯ test/logs.test.ts:48:11
+
+ ✓ test/logs.test.ts (9 tests) 20ms
+ ✓ test/utils.test.ts (4 tests) 9ms
+ ✓ test/viewport.test.ts (2 tests | 1 skipped) 1ms
+ ✓ test/cjs-lib.test.ts (3 tests) 3ms
+ ✓ test/timers.test.ts (1 test) 2ms
+ ✓ test/snapshot.test.ts (3 tests) 6ms
+
+ Test Files 3 failed | 16 passed (19)
+ Tests 3 failed | 98 passed | 1 skipped (102)
+ Start at 15:31:01
+ Duration 8.69s (transform 0ms, setup 0ms, collect 177ms, tests 5.77s, environment 0ms, prepare 486ms)
+
+ JSON report written to /Users/runner/work/vitest/vitest/test/browser/browser.json
+
❯ specs/runner.test.ts:96:20
|
specs/runner.test.ts > running browser tests > stack trace points to correct file in every browser:
test/browser/specs/runner.test.ts#L124
AssertionError: expected 'stderr | test/dialog.test.ts > alert\…' to match /test\/failin…/failing.test.ts:5:(12|17)
- Expected:
/test\/failing.test.ts:5:(12|17)/
+ Received:
"stderr | test/dialog.test.ts > alert
Vitest encountered a `alert(\"test\")` call that it cannot handle by default, so it returned `undefined`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `alert` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"alert\")
alert(\"test\")
expect(alert).toHaveBeenCalledWith(\"test\")
```
stderr | test/dialog.test.ts > prompt
Vitest encountered a `prompt(\"test\")` call that it cannot handle by default, so it returned `null`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `prompt` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"prompt\").mockReturnValue(\"your value\")
prompt(\"test\")
expect(prompt).toHaveBeenCalledWith(\"test\")
```
stderr | test/dialog.test.ts > confirm
Vitest encountered a `confirm(\"test\")` call that it cannot handle by default, so it returned `false`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `confirm` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"confirm\").mockReturnValue(true)
confirm(\"test\")
expect(confirm).toHaveBeenCalledWith(\"test\")
```
stderr | test/cdp.test.ts > cdp in chromium browsers > cdp sends events correctly
MESSAGE ADDED
stderr | test/logs.test.ts > logging to stdout
hello from console.trace
at http://localhost:63315/Users/runner/work/vitest/vitest/test/browser/test/logs.test.ts?import&browserv=true,:8:11
at http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:146:14
at http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:533:11
at runWithTimeout (http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:61:7)
at runTest (http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:988:17)
at async runSuite (http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:1144:15)
at async runFiles (http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:1201:5)
at async startTests (http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:1210:3)
at async executeTests (http://localhost:63315/__vitest_browser__/tester-Bf_yM4Dd.js:12183:9)
stderr | test/logs.test.ts > logging to stderr
hello from console.error
stderr | test/logs.test.ts > logging to stderr
hello from console.warn
stderr | test/logs.test.ts > logging invalid time
Timer \"invalid timeLog\" does not exist
stderr | test/logs.test.ts > logging invalid time
Timer \"invalid timeEnd\" does not exist
stderr | test/logs.test.ts > logging the stack
error with a stack
❯ test/logs.test.ts:49:11
stderr | test/logs.test.ts > logging the stack
trace with a stack
at http://localhost:63315/Users/runner/work/vitest/vitest/test/browser/test/logs.test.ts?import&browserv=true,:50:11
at http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:146:14
at http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:533:11
at runWithTimeout (http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:61:7)
at runTest (http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:988:17)
at async runSuite (http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:1144:15)
at async runFiles (http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:1201:5)
at async startTests (http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:1210:3)
at async executeTests (http://localhost:63315/__vitest_brow
|
specs/unhandled.test.ts > prints correct unhandled error stack:
test/browser/specs/unhandled.test.ts#L13
AssertionError: expected '\n⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯\nErr…' to contain 'throw-unhandled-error.test.ts:9:10'
- Expected
+ Received
- throw-unhandled-error.test.ts:9:10
+
+ ⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯
+ Error: custom_unhandled_error
+ ❯ throw-unhandled-error.test.ts:5:11
+ ❯ throw-unhandled-error.test.ts:6:5
+
+
+
❯ specs/unhandled.test.ts:13:20
|
specs/update-snapshot.test.ts > update snapshot:
test/browser/specs/update-snapshot.test.ts#L48
AssertionError: expected 'import { expect, test, vi } from \'vi…' to contain 'expect(fn).toMatchInlineSnapshot(`[Mo…'
- Expected
+ Received
- expect(fn).toMatchInlineSnapshot(`[MockFunction spy]`)
+ import { expect, test, vi } from 'vitest'
+
+ interface _BasicInterface {
+ willBeRemoved: boolean
+ leavingSourceMapIncorrect: boolean
+ }
+
+ test('inline snapshot', () => {
+ expect(1).toMatchInlineSnapshot('1')
+ })
+
+ test('basic', () => {
+ expect(1).toMatchSnapshot()
+ })
+
+ test('renders inline mock snapshot', () => {
+ const fn = vi.fn()
+ expect(fn).toMatchInlineSnapshot(`[MockFunction spy]``
+ [MockFunction spy] {
+ "calls": [
+ [
+ "hello",
+ "world",
+ 2,
+ ],
+ ],
+ "results": [
+ {
+ "type": "return",
+ "value": undefined,
+ },
+ ],
+ }
+ `)
+ fn('hello', 'world', 2)
+ expect(fn).toMatchInlineSnapshot()
+ })
+
+ test('file snapshot', async () => {
+ await expect('my snapshot content')
+ .toMatchFileSnapshot('./__snapshots__/custom/my_snapshot')
+ })
+
+
❯ specs/update-snapshot.test.ts:48:20
|
Browser: chromium, macos-latest
Process completed with exit code 1.
|
specs/runner.test.ts > running browser tests > tests are actually running:
test/browser/specs/runner.test.ts#L35
AssertionError: expected [ { …(6) }, { …(6) }, { …(6) }, …(13) ] to have a length of 17 but got 16
- Expected
+ Received
- 17
+ 16
❯ specs/runner.test.ts:35:25
|
specs/runner.test.ts > running browser tests > runs in-source tests:
test/browser/specs/runner.test.ts#L46
AssertionError: expected undefined to be defined
❯ specs/runner.test.ts:46:25
|
specs/runner.test.ts > running browser tests > logs have stack traces in safari:
test/browser/specs/runner.test.ts#L110
AssertionError: expected '\n RUN v2.1.3 D:/a/vitest/vitest/tes…' to match 'log with a stack\n ❯ test/logs.test.t…'
- Expected
+ Received
+
+ RUN v2.1.3 D:/a/vitest/vitest/test/browser
+ Browser runner started by playwright at http://localhost:63315/
+
+ ✓ test/cjs-lib.test.ts (3 tests) 67ms
+ ✓ test/timers.test.ts (1 test) 21ms
+ ✓ test/snapshot.test.ts (3 tests) 104ms
+ ❯ test/failing.test.ts (2 tests | 2 failed) 690ms
+ × correctly fails and prints a diff 429ms
+ → expected 1 to be 2 // Object.is equality
+ × correctly print error in another file 236ms
+ → error
+ ✓ test/another.test.ts (2 tests) 43ms
+ ✓ test/basic.test.ts (4 tests) 83ms
+ ✓ test/server-headers.test.ts (1 test) 20ms
+ ✓ test/dialog.test.ts (3 tests) 54ms
+ ✓ test/polyfill-lib.test.ts (1 test) 19ms
+ ❯ test/failing.snaphot.test.ts (1 test | 1 failed) 338ms
+ × file snapshot 316ms
+ → Access denied to "/inaccesible/path". See Vite config documentation for "server.fs": https://vitejs.dev/config/server-options.html#server-fs-strict.
+ ❯ src/actions.ts (0 test)
+ ✓ test/injected.test.ts (1 test) 21ms
+ ✓ test/userEvent.test.ts (54 tests) 9309ms
+ ✓ userEvent.click > correctly clicks a button 783ms
+ ✓ userEvent.hover, userEvent.unhover > hover, unhover works correctly 536ms
+ ✓ userEvent.hover, userEvent.unhover > hover, unhover correctly pass options 483ms
+ ✓ userEvent.hover, userEvent.unhover > hover works with shadow root 475ms
+ ✓ userEvent.hover, userEvent.unhover > hover works with svg 489ms
+ ✓ userEvent.type > types into an input 550ms
+ ✓ userEvent.dragAndDrop > drag and drop works 477ms
+ ✓ test/dom.test.ts (6 tests) 1631ms
+ ✓ dom related activity > renders div 669ms
+ ✓ dom related activity > shadow dom screenshot 320ms
+ ↓ test/cdp.test.ts (3 tests | 3 skipped)
+ ✓ test/commands.test.ts (2 tests) 168ms
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.log
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.info
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.debug
+ stdout | test/logs.test.ts > logging to stdout
+ {
+ "hello": "from dir",
+ }
+ stdout | test/logs.test.ts > logging to stdout
+ {
+ "hello": "from dirxml",
+ }
+ stdout | test/logs.test.ts > logging DOM element
+ dom <div />
+ stdout | test/logs.test.ts > logging default counter
+ default: 1
+ stdout | test/logs.test.ts > logging default counter
+ default: 2
+ stdout | test/logs.test.ts > logging default counter
+ default: 3
+ stdout | test/logs.test.ts > logging default counter
+ default: 1
+ stdout | test/logs.test.ts > logging custom counter
+ count: 1
+ stdout | test/logs.test.ts > logging custom counter
+ count: 2
+ stdout | test/logs.test.ts > logging custom counter
+ count: 3
+ stdout | test/logs.test.ts > logging custom counter
+ count: 1
+ stdout | test/logs.test.ts > logging default time
+ default: 298 ms
+ stdout | test/logs.test.ts > logging default time
+ default: 1 ms
+ stdout | test/logs.test.ts > logging custom time
+ time: 320 ms
+ stdout | test/logs.test.ts > logging custom time
+ time: 0 ms
+ stdout | test/logs.test.ts > logging the stack
log with a stack
- ❯ test/logs.test.ts:58:14
+ ❯ test/logs.test.ts:48:14
+
+ ✓ test/logs.test.ts (9 tests) 196ms
+ ✓ test/utils.test.ts (4 tests) 163ms
+ ✓ test/viewport.test.ts (2 tests | 1 skipped) 21ms
+
+ Test Files 3 failed | 15 passed | 1 skipped (19)
+ Tests 3 failed | 95 passed | 4 skipped (102)
+ Start at 15:31:21
+ Duration 15.73s (transform 0ms, setup 0ms, collect 205ms, tests 12.95s, environment 0ms, prepare 899ms)
+
+ JSON report written to D:/a/vitest/vitest/test/browser/browser.json
+
❯ specs/runner.test.ts:110:20
|
specs/runner.test.ts > running browser tests > stack trace points to correct file in every browser:
test/browser/specs/runner.test.ts#L124
AssertionError: expected 'stderr | test/dialog.test.ts > alert\…' to match /test\/failin…/failing.test.ts:5:(12|17)
- Expected:
/test\/failing.test.ts:5:(12|17)/
+ Received:
"stderr | test/dialog.test.ts > alert
Vitest encountered a `alert(\"test\")` call that it cannot handle by default, so it returned `undefined`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `alert` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"alert\")
alert(\"test\")
expect(alert).toHaveBeenCalledWith(\"test\")
```
stderr | test/dialog.test.ts > prompt
Vitest encountered a `prompt(\"test\")` call that it cannot handle by default, so it returned `null`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `prompt` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"prompt\").mockReturnValue(\"your value\")
prompt(\"test\")
expect(prompt).toHaveBeenCalledWith(\"test\")
```
stderr | test/dialog.test.ts > confirm
Vitest encountered a `confirm(\"test\")` call that it cannot handle by default, so it returned `false`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `confirm` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"confirm\").mockReturnValue(true)
confirm(\"test\")
expect(confirm).toHaveBeenCalledWith(\"test\")
```
stderr | test/logs.test.ts > logging to stdout
hello from console.trace
@http://localhost:63315/@fs/D:/a/vitest/vitest/test/browser/test/logs.test.ts:8:16
@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:533:13
@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:532:19
runWithTimeout@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:61:9
@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:988:19
stderr | test/logs.test.ts > logging to stderr
hello from console.error
stderr | test/logs.test.ts > logging to stderr
hello from console.warn
stderr | test/logs.test.ts > logging invalid time
Timer \"invalid timeLog\" does not exist
stderr | test/logs.test.ts > logging invalid time
Timer \"invalid timeEnd\" does not exist
stderr | test/logs.test.ts > logging the stack
error with a stack
❯ test/logs.test.ts:49:16
stderr | test/logs.test.ts > logging the stack
trace with a stack
@http://localhost:63315/@fs/D:/a/vitest/vitest/test/browser/test/logs.test.ts:50:16
@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:533:13
@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:532:19
runWithTimeout@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:61:9
@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:988:19
⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯
FAIL src/actions.ts [ src/actions.ts ]
Error: No test suite found in file D:/a/vitest/vitest/test/browser/src/actions.ts
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/4]⎯
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 3 ⎯⎯⎯⎯⎯⎯⎯
FAIL test/failing.snaphot.test.ts > file snapshot
Error: Access denied to \"/inaccesible/path\". See Vite config documentation for \"server.fs\": https://vitejs.dev/config/server-options.html#server-fs-strict.
Failure screenshot:
- test/__screenshots__/failing.snaphot.test.ts/file-snapshot-1.png
❯ Receiver.receiverOnMessage ../../node_modules/.pnpm/[email protected]/node_modules/ws/lib/websocket.js:1220:20
❯ Receiver.dataMessage ../../node_modules/.pnpm/[email protected]/node_modules/ws/lib/receiver.js:596:14
❯ Receiver.getData ../../node_modules/.pnpm/[email protected]/node_modules/ws/lib/receiver.js:496:10
❯ Receiver.startLoop ../../node_modules/.pnpm/[email protected]/node_modules/ws/lib/receiver.js:167:16
❯ Receiver._write ../../node_modules/.pnpm/[email protected]/node_modules/ws/lib/receiver.js:94:10
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/4]⎯
FAIL test/failing.test.ts > correctly fails and prints a diff
AssertionError: expected 1 to be 2 // Object.is equality
Failure screenshot:
- test/__screenshots__/failing.test.ts/correctly-
|
specs/unhandled.test.ts > prints correct unhandled error stack:
test/browser/specs/unhandled.test.ts#L10
AssertionError: expected '\n⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯\nErr…' to contain 'throw-unhandled-error.test.ts:9:20'
- Expected
+ Received
- throw-unhandled-error.test.ts:9:20
+
+ ⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯
+ Error: custom_unhandled_error
+ ❯ throw-unhandled-error.test.ts:5:20
+ ❯ throw-unhandled-error.test.ts:4:13
+ ❯ throw-unhandled-error.test.ts:6:5
+
+
+
❯ specs/unhandled.test.ts:10:20
|
specs/update-snapshot.test.ts > update snapshot:
test/browser/specs/update-snapshot.test.ts#L48
AssertionError: expected 'import { expect, test, vi } from \'vi…' to contain 'expect(fn).toMatchInlineSnapshot(`[Mo…'
- Expected
+ Received
- expect(fn).toMatchInlineSnapshot(`[MockFunction spy]`)
+ import { expect, test, vi } from 'vitest'
+
+ interface _BasicInterface {
+ willBeRemoved: boolean
+ leavingSourceMapIncorrect: boolean
+ }
+
+ test('inline snapshot', () => {
+ expect(1).toMatchInlineSnapshot('1')
+ })
+
+ test('basic', () => {
+ expect(1).toMatchSnapshot()
+ })
+
+ test('renders inline mock snapshot', () => {
+ const fn = vi.fn()
+ expect(fn).toMatchInlineSnapshot(`[MockFunction spy]``
+ [MockFunction spy] {
+ "calls": [
+ [
+ "hello",
+ "world",
+ 2,
+ ],
+ ],
+ "results": [
+ {
+ "type": "return",
+ "value": undefined,
+ },
+ ],
+ }
+ `)
+ fn('hello', 'world', 2)
+ expect(fn).toMatchInlineSnapshot()
+ })
+
+ test('file snapshot', async () => {
+ await expect('my snapshot content')
+ .toMatchFileSnapshot('./__snapshots__/custom/my_snapshot')
+ })
+
+
❯ specs/update-snapshot.test.ts:48:20
|
Browser: webkit, windows-latest
Process completed with exit code 1.
|
specs/runner.test.ts > running browser tests > tests are actually running:
test/browser/specs/runner.test.ts#L35
AssertionError: expected [ { …(6) }, { …(6) }, { …(6) }, …(13) ] to have a length of 17 but got 16
- Expected
+ Received
- 17
+ 16
❯ specs/runner.test.ts:35:25
|
specs/runner.test.ts > running browser tests > runs in-source tests:
test/browser/specs/runner.test.ts#L46
AssertionError: expected undefined to be defined
❯ specs/runner.test.ts:46:25
|
specs/runner.test.ts > running browser tests > logs have stack traces in non-safari:
test/browser/specs/runner.test.ts#L96
AssertionError: expected '\n RUN v2.1.3 D:/a/vitest/vitest/tes…' to match 'log with a stack\n ❯ test/logs.test.t…'
- Expected
+ Received
+
+ RUN v2.1.3 D:/a/vitest/vitest/test/browser
+ Browser runner started by playwright at http://localhost:63315/
+
+ ✓ test/cjs-lib.test.ts (3 tests) 10ms
+ ✓ test/timers.test.ts (1 test) 3ms
+ ✓ test/snapshot.test.ts (3 tests) 20ms
+ ❯ test/failing.test.ts (2 tests | 2 failed) 455ms
+ × correctly fails and prints a diff 310ms
+ → expected 1 to be 2 // Object.is equality
+ × correctly print error in another file 140ms
+ → error
+ ✓ test/basic.test.ts (4 tests) 33ms
+ ✓ test/another.test.ts (2 tests) 5ms
+ ✓ test/dialog.test.ts (3 tests) 33ms
+ ✓ test/server-headers.test.ts (1 test) 15ms
+ ✓ test/polyfill-lib.test.ts (1 test) 6ms
+ ❯ src/actions.ts (0 test)
+ ❯ test/failing.snaphot.test.ts (1 test | 1 failed) 118ms
+ × file snapshot 117ms
+ → Access denied to "/inaccesible/path". See Vite config documentation for "server.fs": https://vitejs.dev/config/server-options.html#server-fs-strict.
+ ✓ test/injected.test.ts (1 test) 2ms
+ ✓ test/userEvent.test.ts (54 tests) 3011ms
+ ✓ test/dom.test.ts (6 tests) 432ms
+ ✓ test/cdp.test.ts (3 tests) 91ms
+ ✓ test/commands.test.ts (2 tests) 20ms
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.log
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.info
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.debug
+ stdout | test/logs.test.ts > logging to stdout
+ {
+ "hello": "from dir",
+ }
+ stdout | test/logs.test.ts > logging to stdout
+ {
+ "hello": "from dirxml",
+ }
+ stdout | test/logs.test.ts > logging DOM element
+ dom <div />
+ stdout | test/logs.test.ts > logging default counter
+ default: 1
+ stdout | test/logs.test.ts > logging default counter
+ default: 2
+ stdout | test/logs.test.ts > logging default counter
+ default: 3
+ stdout | test/logs.test.ts > logging default counter
+ default: 1
+ stdout | test/logs.test.ts > logging custom counter
+ count: 1
+ stdout | test/logs.test.ts > logging custom counter
+ count: 2
+ stdout | test/logs.test.ts > logging custom counter
+ count: 3
+ stdout | test/logs.test.ts > logging custom counter
+ count: 1
+ stdout | test/logs.test.ts > logging default time
+ default: 124.09999999997672 ms
+ stdout | test/logs.test.ts > logging default time
+ default: 0.5 ms
+ stdout | test/logs.test.ts > logging custom time
+ time: 125.80000000004657 ms
+ stdout | test/logs.test.ts > logging custom time
+ time: 0.2999999999301508 ms
+ stdout | test/logs.test.ts > logging the stack
log with a stack
- ❯ test/logs.test.ts:58:10
+ ❯ test/logs.test.ts:48:11
+
+ ✓ test/logs.test.ts (9 tests) 24ms
+ ✓ test/utils.test.ts (4 tests) 9ms
+ ✓ test/viewport.test.ts (2 tests | 1 skipped) 2ms
+
+ Test Files 3 failed | 16 passed (19)
+ Tests 3 failed | 98 passed | 1 skipped (102)
+ Start at 15:33:01
+ Duration 7.43s (transform 0ms, setup 0ms, collect 386ms, tests 4.29s, environment 0ms, prepare 1.40s)
+
+ JSON report written to D:/a/vitest/vitest/test/browser/browser.json
+
❯ specs/runner.test.ts:96:20
|
specs/runner.test.ts > running browser tests > stack trace points to correct file in every browser:
test/browser/specs/runner.test.ts#L124
AssertionError: expected 'stderr | test/dialog.test.ts > alert\…' to match /test\/failin…/failing.test.ts:5:(12|17)
- Expected:
/test\/failing.test.ts:5:(12|17)/
+ Received:
"stderr | test/dialog.test.ts > alert
Vitest encountered a `alert(\"test\")` call that it cannot handle by default, so it returned `undefined`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `alert` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"alert\")
alert(\"test\")
expect(alert).toHaveBeenCalledWith(\"test\")
```
stderr | test/dialog.test.ts > prompt
Vitest encountered a `prompt(\"test\")` call that it cannot handle by default, so it returned `null`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `prompt` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"prompt\").mockReturnValue(\"your value\")
prompt(\"test\")
expect(prompt).toHaveBeenCalledWith(\"test\")
```
stderr | test/dialog.test.ts > confirm
Vitest encountered a `confirm(\"test\")` call that it cannot handle by default, so it returned `false`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `confirm` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"confirm\").mockReturnValue(true)
confirm(\"test\")
expect(confirm).toHaveBeenCalledWith(\"test\")
```
stderr | test/cdp.test.ts > cdp in chromium browsers > cdp sends events correctly
MESSAGE ADDED
stderr | test/logs.test.ts > logging to stdout
hello from console.trace
at http://localhost:63315/@fs/D:/a/vitest/vitest/test/browser/test/logs.test.ts?import&browserv=true,:8:11
at http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:146:14
at http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:533:11
at runWithTimeout (http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:61:7)
at runTest (http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:988:17)
at async runSuite (http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:1144:15)
at async runFiles (http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:1201:5)
at async startTests (http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:1210:3)
at async executeTests (http://localhost:63315/__vitest_browser__/tester-Bf_yM4Dd.js:12183:9)
stderr | test/logs.test.ts > logging to stderr
hello from console.error
stderr | test/logs.test.ts > logging to stderr
hello from console.warn
stderr | test/logs.test.ts > logging invalid time
Timer \"invalid timeLog\" does not exist
stderr | test/logs.test.ts > logging invalid time
Timer \"invalid timeEnd\" does not exist
stderr | test/logs.test.ts > logging the stack
error with a stack
❯ test/logs.test.ts:49:11
stderr | test/logs.test.ts > logging the stack
trace with a stack
at http://localhost:63315/@fs/D:/a/vitest/vitest/test/browser/test/logs.test.ts?import&browserv=true,:50:11
at http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:146:14
at http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:533:11
at runWithTimeout (http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:61:7)
at runTest (http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:988:17)
at async runSuite (http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:1144:15)
at async runFiles (http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:1201:5)
at async startTests (http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:1210:3)
at async executeTests (http://localhost:63315/__vitest_browser__/tester-Bf_yM4Dd.js:12183:9)
⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯
FAIL src/actions.ts [ src/actions.ts ]
Error: No test suite found in file D:/a/vitest/vitest/test/browser/src/actions.ts
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
|
specs/unhandled.test.ts > prints correct unhandled error stack:
test/browser/specs/unhandled.test.ts#L13
AssertionError: expected '\n⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯\nErr…' to contain 'throw-unhandled-error.test.ts:9:10'
- Expected
+ Received
- throw-unhandled-error.test.ts:9:10
+
+ ⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯
+ Error: custom_unhandled_error
+ ❯ throw-unhandled-error.test.ts:5:11
+ ❯ throw-unhandled-error.test.ts:6:5
+
+
+
❯ specs/unhandled.test.ts:13:20
|
specs/update-snapshot.test.ts > update snapshot:
test/browser/specs/update-snapshot.test.ts#L48
AssertionError: expected 'import { expect, test, vi } from \'vi…' to contain 'expect(fn).toMatchInlineSnapshot(`[Mo…'
- Expected
+ Received
- expect(fn).toMatchInlineSnapshot(`[MockFunction spy]`)
+ import { expect, test, vi } from 'vitest'
+
+ interface _BasicInterface {
+ willBeRemoved: boolean
+ leavingSourceMapIncorrect: boolean
+ }
+
+ test('inline snapshot', () => {
+ expect(1).toMatchInlineSnapshot('1')
+ })
+
+ test('basic', () => {
+ expect(1).toMatchSnapshot()
+ })
+
+ test('renders inline mock snapshot', () => {
+ const fn = vi.fn()
+ expect(fn).toMatchInlineSnapshot(`[MockFunction spy]``
+ [MockFunction spy] {
+ "calls": [
+ [
+ "hello",
+ "world",
+ 2,
+ ],
+ ],
+ "results": [
+ {
+ "type": "return",
+ "value": undefined,
+ },
+ ],
+ }
+ `)
+ fn('hello', 'world', 2)
+ expect(fn).toMatchInlineSnapshot()
+ })
+
+ test('file snapshot', async () => {
+ await expect('my snapshot content')
+ .toMatchFileSnapshot('./__snapshots__/custom/my_snapshot')
+ })
+
+
❯ specs/update-snapshot.test.ts:48:20
|
Browser: chromium, windows-latest
Process completed with exit code 1.
|
specs/runner.test.ts > running browser tests > tests are actually running:
test/browser/specs/runner.test.ts#L35
AssertionError: expected [ { …(6) }, { …(6) }, { …(6) }, …(13) ] to have a length of 17 but got 16
- Expected
+ Received
- 17
+ 16
❯ specs/runner.test.ts:35:25
|
specs/runner.test.ts > running browser tests > runs in-source tests:
test/browser/specs/runner.test.ts#L46
AssertionError: expected undefined to be defined
❯ specs/runner.test.ts:46:25
|
specs/runner.test.ts > running browser tests > logs have stack traces in non-safari:
test/browser/specs/runner.test.ts#L96
AssertionError: expected '\n RUN v2.1.3 D:/a/vitest/vitest/tes…' to match 'log with a stack\n ❯ test/logs.test.t…'
- Expected
+ Received
+
+ RUN v2.1.3 D:/a/vitest/vitest/test/browser
+ Browser runner started by playwright at http://localhost:63315/
+
+ ✓ test/cjs-lib.test.ts (3 tests) 25ms
+ ✓ test/timers.test.ts (1 test) 6ms
+ ❯ test/failing.test.ts (2 tests | 2 failed) 644ms
+ × correctly fails and prints a diff 376ms
+ → expected 1 to be 2 // Object.is equality
+ × correctly print error in another file 249ms
+ → error
+ ✓ test/snapshot.test.ts (3 tests) 60ms
+ ✓ test/another.test.ts (2 tests) 8ms
+ ✓ test/basic.test.ts (4 tests) 16ms
+ ✓ test/server-headers.test.ts (1 test) 92ms
+ ✓ test/dialog.test.ts (3 tests) 33ms
+ ✓ test/polyfill-lib.test.ts (1 test) 3ms
+ ❯ test/failing.snaphot.test.ts (1 test | 1 failed) 398ms
+ × file snapshot 363ms
+ → Access denied to "/inaccesible/path". See Vite config documentation for "server.fs": https://vitejs.dev/config/server-options.html#server-fs-strict.
+ ❯ src/actions.ts (0 test)
+ ✓ test/injected.test.ts (1 test) 17ms
+ ✓ test/userEvent.test.ts (54 tests) 5255ms
+ ✓ userEvent.click > correctly clicks a button 541ms
+ ✓ userEvent.click > click inside shadow dom 380ms
+ ✓ userEvent.click > clicks inside svg 350ms
+ ✓ userEvent.click > clicks a button with complex HTML ID 401ms
+ ✓ userEvent.click > clicks with x/y coords 321ms
+ ✓ userEvent.dblClick > correctly clicks a button 341ms
+ ✓ userEvent.type > types into an input 310ms
+ ✓ test/dom.test.ts (6 tests) 419ms
+ ↓ test/cdp.test.ts (3 tests | 3 skipped)
+ ✓ test/commands.test.ts (2 tests) 26ms
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.log
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.info
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.debug
+ stdout | test/logs.test.ts > logging to stdout
+ {
+ "hello": "from dir",
+ }
+ stdout | test/logs.test.ts > logging to stdout
+ {
+ "hello": "from dirxml",
+ }
+ stdout | test/logs.test.ts > logging DOM element
+ dom <div />
+ stdout | test/logs.test.ts > logging default counter
+ default: 1
+ stdout | test/logs.test.ts > logging default counter
+ default: 2
+ stdout | test/logs.test.ts > logging default counter
+ default: 3
+ stdout | test/logs.test.ts > logging default counter
+ default: 1
+ stdout | test/logs.test.ts > logging custom counter
+ count: 1
+ stdout | test/logs.test.ts > logging custom counter
+ count: 2
+ stdout | test/logs.test.ts > logging custom counter
+ count: 3
+ stdout | test/logs.test.ts > logging custom counter
+ count: 1
+ stdout | test/logs.test.ts > logging default time
+ default: 267 ms
+ stdout | test/logs.test.ts > logging default time
+ default: 0 ms
+ stdout | test/logs.test.ts > logging custom time
+ time: 271 ms
+ stdout | test/logs.test.ts > logging custom time
+ time: 1 ms
+ stdout | test/logs.test.ts > logging the stack
log with a stack
- ❯ test/logs.test.ts:58:10
+ ❯ test/logs.test.ts:48:11
+
+ ✓ test/logs.test.ts (9 tests) 60ms
+ ✓ test/utils.test.ts (4 tests) 14ms
+ ✓ test/viewport.test.ts (2 tests | 1 skipped) 3ms
+
+ Test Files 3 failed | 15 passed | 1 skipped (19)
+ Tests 3 failed | 95 passed | 4 skipped (102)
+ Start at 15:31:35
+ Duration 15.33s (transform 0ms, setup 0ms, collect 511ms, tests 7.08s, environment 0ms, prepare 2.70s)
+
+ JSON report written to D:/a/vitest/vitest/test/browser/browser.json
+
❯ specs/runner.test.ts:96:20
|
specs/runner.test.ts > running browser tests > stack trace points to correct file in every browser:
test/browser/specs/runner.test.ts#L124
AssertionError: expected 'stderr | test/dialog.test.ts > alert\…' to match /test\/failin…/failing.test.ts:5:(12|17)
- Expected:
/test\/failing.test.ts:5:(12|17)/
+ Received:
"stderr | test/dialog.test.ts > alert
Vitest encountered a `alert(\"test\")` call that it cannot handle by default, so it returned `undefined`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `alert` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"alert\")
alert(\"test\")
expect(alert).toHaveBeenCalledWith(\"test\")
```
stderr | test/dialog.test.ts > prompt
Vitest encountered a `prompt(\"test\")` call that it cannot handle by default, so it returned `null`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `prompt` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"prompt\").mockReturnValue(\"your value\")
prompt(\"test\")
expect(prompt).toHaveBeenCalledWith(\"test\")
```
stderr | test/dialog.test.ts > confirm
Vitest encountered a `confirm(\"test\")` call that it cannot handle by default, so it returned `false`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `confirm` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"confirm\").mockReturnValue(true)
confirm(\"test\")
expect(confirm).toHaveBeenCalledWith(\"test\")
```
stderr | test/logs.test.ts > logging to stdout
hello from console.trace
@http://localhost:63315/@fs/D:/a/vitest/vitest/test/browser/test/logs.test.ts?import&browserv=true,:8:11
withFixtures/<@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:146:14
withAwaitAsyncAssetions/<@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:533:11
runWithTimeout@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:61:7
runTest@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:988:17
async*runSuiteChild/<@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:1181:45
limitConcurrency/</<@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/chunk-tasks.js:44:14
promise callback*limitConcurrency/<@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/chunk-tasks.js:43:8
runSuiteChild@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:1181:12
runSuite@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:1144:21
async*runFiles@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:1201:11
startTests@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:1210:9
async*executeTests@http://localhost:63315/__vitest_browser__/tester-Bf_yM4Dd.js:12183:15
async*window.__vitest_browser_runner__.runTests@http://localhost:63315/__vitest_browser__/tester-Bf_yM4Dd.js:12213:68
@http://localhost:63315/__vitest_test__/__test__/9004239f-b6b6-4dfd-8d60-a367f7a7f320/D%3A%2Fa%2Fvitest%2Fvitest%2Ftest%2Fbrowser%2Ftest%2Flogs.test.ts:87:27
stderr | test/logs.test.ts > logging to stderr
hello from console.error
stderr | test/logs.test.ts > logging to stderr
hello from console.warn
stderr | test/logs.test.ts > logging invalid time
Timer \"invalid timeLog\" does not exist
stderr | test/logs.test.ts > logging invalid time
Timer \"invalid timeEnd\" does not exist
stderr | test/logs.test.ts > logging the stack
error with a stack
❯ test/logs.test.ts:49:11
stderr | test/logs.test.ts > logging the stack
trace with a stack
@http://localhost:63315/@fs/D:/a/vitest/vitest/test/browser/test/logs.test.ts?import&browserv=true,:50:11
withFixtures/<@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:146:14
withAwaitAsyncAssetions/<@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:533:11
runWithTimeout@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:61:7
runTest@http://localhost:63315/@fs/D:/a/vitest/vitest/packages/runner/dist/index.js:988:17
async*runS
|
specs/unhandled.test.ts > prints correct unhandled error stack:
test/browser/specs/unhandled.test.ts#L13
AssertionError: expected '\n⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯\nErr…' to contain 'throw-unhandled-error.test.ts:9:10'
- Expected
+ Received
- throw-unhandled-error.test.ts:9:10
+
+ ⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯
+ Error: custom_unhandled_error
+ ❯ throw-unhandled-error.test.ts:5:11
+ ❯ throw-unhandled-error.test.ts:6:5
+
+
+
❯ specs/unhandled.test.ts:13:20
|
specs/update-snapshot.test.ts > update snapshot:
test/browser/specs/update-snapshot.test.ts#L48
AssertionError: expected 'import { expect, test, vi } from \'vi…' to contain 'expect(fn).toMatchInlineSnapshot(`[Mo…'
- Expected
+ Received
- expect(fn).toMatchInlineSnapshot(`[MockFunction spy]`)
+ import { expect, test, vi } from 'vitest'
+
+ interface _BasicInterface {
+ willBeRemoved: boolean
+ leavingSourceMapIncorrect: boolean
+ }
+
+ test('inline snapshot', () => {
+ expect(1).toMatchInlineSnapshot('1')
+ })
+
+ test('basic', () => {
+ expect(1).toMatchSnapshot()
+ })
+
+ test('renders inline mock snapshot', () => {
+ const fn = vi.fn()
+ expect(fn).toMatchInlineSnapshot(`[MockFunction spy]``
+ [MockFunction spy] {
+ "calls": [
+ [
+ "hello",
+ "world",
+ 2,
+ ],
+ ],
+ "results": [
+ {
+ "type": "return",
+ "value": undefined,
+ },
+ ],
+ }
+ `)
+ fn('hello', 'world', 2)
+ expect(fn).toMatchInlineSnapshot()
+ })
+
+ test('file snapshot', async () => {
+ await expect('my snapshot content')
+ .toMatchFileSnapshot('./__snapshots__/custom/my_snapshot')
+ })
+
+
❯ specs/update-snapshot.test.ts:48:20
|
Browser: firefox, windows-latest
Process completed with exit code 1.
|
Build&Test: node-20, windows-latest
Process completed with exit code 1.
|
specs/runner.test.ts > running browser tests > tests are actually running:
test/browser/specs/runner.test.ts#L35
AssertionError: expected [ { …(6) }, { …(6) }, { …(6) }, …(13) ] to have a length of 17 but got 16
- Expected
+ Received
- 17
+ 16
❯ specs/runner.test.ts:35:25
|
specs/runner.test.ts > running browser tests > runs in-source tests:
test/browser/specs/runner.test.ts#L46
AssertionError: expected undefined to be defined
❯ specs/runner.test.ts:46:25
|
specs/runner.test.ts > running browser tests > logs have stack traces in non-safari:
test/browser/specs/runner.test.ts#L96
AssertionError: expected '\n RUN v2.1.3 /Users/runner/work/vit…' to match 'log with a stack\n ❯ test/logs.test.t…'
- Expected
+ Received
+
+ RUN v2.1.3 /Users/runner/work/vitest/vitest/test/browser
+ Browser runner started by playwright at http://localhost:63315/
+
+ ✓ test/basic.test.ts (4 tests) 22ms
+ ✓ test/dialog.test.ts (3 tests) 11ms
+ ✓ test/polyfill-lib.test.ts (1 test) 2ms
+ ❯ src/actions.ts (0 test)
+ ❯ test/failing.test.ts (2 tests | 2 failed) 236ms
+ × correctly fails and prints a diff 159ms
+ → expected 1 to be 2 // Object.is equality
+ × correctly print error in another file 74ms
+ → error
+ ✓ test/another.test.ts (2 tests) 2ms
+ ✓ test/server-headers.test.ts (1 test) 20ms
+ ❯ test/failing.snaphot.test.ts (1 test | 1 failed) 201ms
+ × file snapshot 191ms
+ → Access denied to "/inaccesible/path". See Vite config documentation for "server.fs": https://vitejs.dev/config/server-options.html#server-fs-strict.
+ ✓ test/injected.test.ts (1 test) 4ms
+ ✓ test/userEvent.test.ts (54 tests) 7354ms
+ ✓ userEvent.click > correctly clicks a button 436ms
+ ✓ userEvent.click > clicks with x/y coords 347ms
+ ✓ userEvent.tripleClick > correctly doesn't click on a disabled button 381ms
+ ✓ userEvent.hover, userEvent.unhover > hover, unhover works correctly 532ms
+ ✓ userEvent.hover, userEvent.unhover > hover, unhover correctly pass options 544ms
+ ✓ userEvent.type > types into an input 657ms
+ ✓ userEvent.type > types into a shadow root input 470ms
+ ✓ test/dom.test.ts (6 tests) 330ms
+ ↓ test/cdp.test.ts (3 tests | 3 skipped)
+ ✓ test/commands.test.ts (2 tests) 27ms
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.log
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.info
+ stdout | test/logs.test.ts > logging to stdout
+ hello from console.debug
+ stdout | test/logs.test.ts > logging to stdout
+ {
+ "hello": "from dir",
+ }
+ stdout | test/logs.test.ts > logging to stdout
+ {
+ "hello": "from dirxml",
+ }
+ stdout | test/logs.test.ts > logging DOM element
+ dom <div />
+ stdout | test/logs.test.ts > logging default counter
+ default: 1
+ stdout | test/logs.test.ts > logging default counter
+ default: 2
+ stdout | test/logs.test.ts > logging default counter
+ default: 3
+ stdout | test/logs.test.ts > logging default counter
+ default: 1
+ stdout | test/logs.test.ts > logging custom counter
+ count: 1
+ stdout | test/logs.test.ts > logging custom counter
+ count: 2
+ stdout | test/logs.test.ts > logging custom counter
+ count: 3
+ stdout | test/logs.test.ts > logging custom counter
+ count: 1
+ stdout | test/logs.test.ts > logging default time
+ default: 395 ms
+ stdout | test/logs.test.ts > logging default time
+ default: 0 ms
+ stdout | test/logs.test.ts > logging custom time
+ time: 399 ms
+ stdout | test/logs.test.ts > logging custom time
+ time: 1 ms
+ stdout | test/logs.test.ts > logging the stack
log with a stack
- ❯ test/logs.test.ts:58:10
+ ❯ test/logs.test.ts:48:11
+
+ ✓ test/logs.test.ts (9 tests) 93ms
+ ✓ test/utils.test.ts (4 tests) 34ms
+ ✓ test/viewport.test.ts (2 tests | 1 skipped) 6ms
+ ✓ test/cjs-lib.test.ts (3 tests) 10ms
+ ✓ test/timers.test.ts (1 test) 4ms
+ ✓ test/snapshot.test.ts (3 tests) 20ms
+
+ Test Files 3 failed | 15 passed | 1 skipped (19)
+ Tests 3 failed | 95 passed | 4 skipped (102)
+ Start at 15:32:28
+ Duration 17.67s (transform 0ms, setup 0ms, collect 400ms, tests 8.38s, environment 0ms, prepare 1.18s)
+
+ JSON report written to /Users/runner/work/vitest/vitest/test/browser/browser.json
+
❯ specs/runner.test.ts:96:20
|
specs/runner.test.ts > running browser tests > stack trace points to correct file in every browser:
test/browser/specs/runner.test.ts#L124
AssertionError: expected 'stderr | test/dialog.test.ts > alert\…' to match /test\/failin…/failing.test.ts:5:(12|17)
- Expected:
/test\/failing.test.ts:5:(12|17)/
+ Received:
"stderr | test/dialog.test.ts > alert
Vitest encountered a `alert(\"test\")` call that it cannot handle by default, so it returned `undefined`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `alert` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"alert\")
alert(\"test\")
expect(alert).toHaveBeenCalledWith(\"test\")
```
stderr | test/dialog.test.ts > prompt
Vitest encountered a `prompt(\"test\")` call that it cannot handle by default, so it returned `null`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `prompt` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"prompt\").mockReturnValue(\"your value\")
prompt(\"test\")
expect(prompt).toHaveBeenCalledWith(\"test\")
```
stderr | test/dialog.test.ts > confirm
Vitest encountered a `confirm(\"test\")` call that it cannot handle by default, so it returned `false`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the `confirm` call manually like:
```
import { expect, vi } from \"vitest\"
vi.spyOn(window, \"confirm\").mockReturnValue(true)
confirm(\"test\")
expect(confirm).toHaveBeenCalledWith(\"test\")
```
stderr | test/logs.test.ts > logging to stdout
hello from console.trace
@http://localhost:63315/Users/runner/work/vitest/vitest/test/browser/test/logs.test.ts?import&browserv=true,:8:11
withFixtures/<@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:146:14
withAwaitAsyncAssetions/<@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:533:11
runWithTimeout@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:61:7
runTest@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:988:17
async*runSuiteChild/<@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:1181:45
limitConcurrency/</<@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/chunk-tasks.js:44:14
promise callback*limitConcurrency/<@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/chunk-tasks.js:43:8
runSuiteChild@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:1181:12
runSuite@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:1144:21
async*runFiles@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:1201:11
startTests@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:1210:9
async*executeTests@http://localhost:63315/__vitest_browser__/tester-Bf_yM4Dd.js:12183:15
async*window.__vitest_browser_runner__.runTests@http://localhost:63315/__vitest_browser__/tester-Bf_yM4Dd.js:12213:68
@http://localhost:63315/__vitest_test__/__test__/9f8e897c-28ba-40b3-8a73-1f4217948d04/%2FUsers%2Frunner%2Fwork%2Fvitest%2Fvitest%2Ftest%2Fbrowser%2Ftest%2Flogs.test.ts:87:27
stderr | test/logs.test.ts > logging to stderr
hello from console.error
stderr | test/logs.test.ts > logging to stderr
hello from console.warn
stderr | test/logs.test.ts > logging invalid time
Timer \"invalid timeLog\" does not exist
stderr | test/logs.test.ts > logging invalid time
Timer \"invalid timeEnd\" does not exist
stderr | test/logs.test.ts > logging the stack
error with a stack
❯ test/logs.test.ts:49:11
stderr | test/logs.test.ts > logging the stack
trace with a stack
@http://localhost:63315/Users/runner/work/vitest/vitest/test/browser/test/logs.test.ts?import&browserv=true,:50:11
withFixtures/<@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:146:14
withAwaitAsyncAssetions/<@http://localhost:63315/@fs/Users/runner/work/vitest/vitest/packages/runner/dist/index.js:5
|
specs/unhandled.test.ts > prints correct unhandled error stack:
test/browser/specs/unhandled.test.ts#L13
AssertionError: expected '\n⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯\nErr…' to contain 'throw-unhandled-error.test.ts:9:10'
- Expected
+ Received
- throw-unhandled-error.test.ts:9:10
+
+ ⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯
+ Error: custom_unhandled_error
+ ❯ throw-unhandled-error.test.ts:5:11
+ ❯ throw-unhandled-error.test.ts:6:5
+
+
+
❯ specs/unhandled.test.ts:13:20
|
specs/update-snapshot.test.ts > update snapshot:
test/browser/specs/update-snapshot.test.ts#L48
AssertionError: expected 'import { expect, test, vi } from \'vi…' to contain 'expect(fn).toMatchInlineSnapshot(`[Mo…'
- Expected
+ Received
- expect(fn).toMatchInlineSnapshot(`[MockFunction spy]`)
+ import { expect, test, vi } from 'vitest'
+
+ interface _BasicInterface {
+ willBeRemoved: boolean
+ leavingSourceMapIncorrect: boolean
+ }
+
+ test('inline snapshot', () => {
+ expect(1).toMatchInlineSnapshot('1')
+ })
+
+ test('basic', () => {
+ expect(1).toMatchSnapshot()
+ })
+
+ test('renders inline mock snapshot', () => {
+ const fn = vi.fn()
+ expect(fn).toMatchInlineSnapshot(`[MockFunction spy]``
+ [MockFunction spy] {
+ "calls": [
+ [
+ "hello",
+ "world",
+ 2,
+ ],
+ ],
+ "results": [
+ {
+ "type": "return",
+ "value": undefined,
+ },
+ ],
+ }
+ `)
+ fn('hello', 'world', 2)
+ expect(fn).toMatchInlineSnapshot()
+ })
+
+ test('file snapshot', async () => {
+ await expect('my snapshot content')
+ .toMatchFileSnapshot('./__snapshots__/custom/my_snapshot')
+ })
+
+
❯ specs/update-snapshot.test.ts:48:20
|
Browser: firefox, macos-latest
Process completed with exit code 1.
|