@nuxt/test-utils -- setup() clobbers console.log() functionality
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 437
- Forks
- 120
- Avg merge
- 22h 52m
- Merged PRs (30d)
- 23
Description
Environment
- Operating System:
Darwin - Node Version:
v18.16.0 - Nuxt Version:
3.5.2 - Nitro Version:
2.4.1 - Package Manager:
yarn@1.22.17 - Builder:
vite - User Config:
- - Runtime Modules:
- - Build Modules:
-
Reproduction
https://stackblitz.com/edit/github-kp3tnj?file=test%2Fmyhello.test.ts
Describe the bug
When setup() is called at the beginning of a vitest test file (as described in the docs https://nuxt.com/docs/getting-started/testing), console.log() no longer displays text on the console during the test run.
When setup() is commented out, console.log() works as expected.
Additional context
No response
Logs
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the linked StackBlitz reproduction and compare the Vitest output with setup() enabled and commented out; the example test is test/myhello.test.ts. Then trace the @nuxt/test-utils setup() path to identify where console.log is affected. Done means console.log output remains visible during the test run while setup() is used.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100