Describe the bug
For example, updating expect.element assertion to fail in examples/lit
it('should show name props', async () => {
await expect.element(page.getByRole('heading'), { timeout: 2000 }).toHaveTextContent('foo')
})
then running UI, the terminal errors are not duplicated:
$ pnpm -C examples/lit test --browser.headless --browser.traceView --ui
> @vitest/example-lit@ test /home/hiroshi/code/others/vitest-wt2/examples/lit
> vitest --browser.headless --browser.traceView --ui
DEV v5.0.0-beta.1 /home/hiroshi/code/others/vitest-wt2/examples/lit
UI started at http://localhost:51204/__vitest__/
stderr | unknown test
Lit is in dev mode. Not recommended for production! See https://lit.dev/msg/dev-mode for more information.
❯ chromium test/basic.test.ts (2 tests | 1 failed) 2220ms
❯ Button with increment (2)
✓ should increment the count on each click 104ms
× should show name props 2115ms
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
FAIL chromium test/basic.test.ts > Button with increment > should show name props
Error: expect(element).toHaveTextContent()
Expected element to have text content:
foo
Received:
Hello, World!
Failure screenshot:
- test/__screenshots__/basic.test.ts/Button-with-increment-should-show-name-props-1.png
❯ test/basic.test.ts:27:71
25| it('should show name props', async () => {
26| // await expect.element(page.getByRole('heading')).toHaveTextContent('World')
27| await expect.element(page.getByRole('heading'), { timeout: 2000 }).toHaveTextConten…
| ^
28| })
29|
Caused by: Error: Matcher did not succeed in time.
❯ test/basic.test.ts:27:4
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
Test Files 1 failed (1)
Tests 1 failed | 1 passed (2)
Start at 11:24:51
Duration 3.05s (transform 0ms, setup 0ms, import 16ms, tests 2.22s, environment 0ms)
FAIL Tests failed. Watching for file changes...
press h to show help, press q to quit
But, UI shows Error: expect(element).toHaveTextContent() twice as below:
Reproduction
See above
System Info
$ pnpm dlx envinfo --system --npmPackages '{vitest*,@vitest/*,vite,@vitejs/*,playwright,webdriverio}' --binaries --browsers
Packages: +1
+
Progress: resolved 1, reused 1, downloaded 0, added 1, done
System:
OS: Linux 7.0 Arch Linux
CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-12650H
Memory: 15.18 GB / 31.05 GB
Container: Yes
Shell: 5.3.9 - /usr/bin/bash
Binaries:
Node: 24.15.0 - /home/hiroshi/.vite-plus/js_runtime/node/24.15.0/bin/node
npm: 11.12.1 - /home/hiroshi/.vite-plus/js_runtime/node/24.15.0/bin/npm
pnpm: 10.31.0 - /home/hiroshi/.vite-plus/bin/pnpm
bun: 1.3.9 - /home/hiroshi/.bun/bin/bun
Deno: 2.6.6 - /home/hiroshi/.local/bin/deno
Browsers:
Firefox: 150.0.1
Firefox Developer Edition: 150.0.1
npmPackages:
@vitest/browser: workspace:* => 5.0.0-beta.1
@vitest/coverage-istanbul: workspace:* => 5.0.0-beta.1
@vitest/coverage-v8: workspace:* => 5.0.0-beta.1
@vitest/ui: workspace:* => 5.0.0-beta.1
vite: 7.1.5 => 7.1.5
vitest: workspace:* => 5.0.0-beta.1
Used Package Manager
pnpm
Validations
Describe the bug
For example, updating
expect.elementassertion to fail inexamples/litthen running UI, the terminal errors are not duplicated:
But, UI shows
Error: expect(element).toHaveTextContent()twice as below:Reproduction
See above
System Info
Used Package Manager
pnpm
Validations