-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Describe the bug
I wasn't sure if this is a feature, but it looks a little confusing at first sight at least.
Minimal reproduction with example log and comparison with non-browser pools is here https://github.com/hi-ogawa/repro-vitest-browser-error-log-redundant.
This can be also quickly reproduced on Vitest repo:
$ pnpm -C test/browser exec vitest run test/failing.test.ts
RUN v1.1.3 /home/hiroshi/code/others/vitest/test/browser
Browser runner started at http://localhost:5173
stderr | unknown test //// <--- redundant automatic stderr log
expected 1 to be 2 // Object.is equality //// because test failure gets reported below anyway
❯ test/failing.test.ts (1)
× correctly fails and prints a diff
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
FAIL test/failing.test.ts > correctly fails and prints a diff
AssertionError: expected 1 to be 2 // Object.is equality
...This log is coming from console.error in BrowserTestRunner.onAfterRunTask:
vitest/packages/browser/src/client/runner.ts
Lines 28 to 32 in a73c1c2
| async onAfterRunTask(task: Test) { | |
| await super.onAfterRunTask?.(task) | |
| task.result?.errors?.forEach((error) => { | |
| console.error(error.message) | |
| }) |
The code runs on browser, so this essentially allows error.message to show up on browser devtools, but for default reporter, spied console is also redirected to terminal and it looks redundant there.
I suspect this could be a unintended debug logging, but I would appreciate if someone can confirm that's really the case.
Reproduction
https://github.com/hi-ogawa/repro-vitest-browser-error-log-redundant
System Info
System:
OS: Linux 6.6 Arch Linux
CPU: (12) x64 AMD Ryzen 5 5625U with Radeon Graphics
Memory: 2.68 GB / 14.98 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 18.19.0 - ~/.volta/tools/image/node/18.19.0/bin/node
Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
npm: 10.2.3 - ~/.volta/tools/image/node/18.19.0/bin/npm
pnpm: 8.12.0 - ~/.volta/tools/image/node/18.19.0/bin/pnpm
Browsers:
Chromium: 120.0.6099.199
npmPackages:
@vitest/browser: latest => 1.1.3
vite: latest => 5.0.11
vitest: latest => 1.1.3Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.