https://github.com/ulivz/vitest-simply-exits-when-met-process-exit-repro
https://github.com/ulivz/vitest-simply-exits-when-met-process-exit-repro
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ulivz/vitest-simply-exits-when-met-process-exit-repro
- Owner: ulivz
- Created: 2023-01-05T15:30:30.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-05T16:23:43.000Z (almost 3 years ago)
- Last Synced: 2025-03-27T20:41:33.675Z (7 months ago)
- Language: TypeScript
- Size: 1.31 MB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# vitest-simply-exits-when-met-process-exit-repro
Reproduction of [vitest#2615](https://github.com/vitest-dev/vitest/issues/2615).
## Summary
`vitest` will simply exit if the test contains an unexpected `process.exit` call, this may be very bad for troubleshooting some asynchronous tasks from from dependencies.
## Step to reproduce
1. `git clone https://github.com/ulivz/vitest-simply-exits-when-met-process-exit-repro`
1. `pnpm i`
1. Run `npm run test`, you will notice that `vitest` process will exit and not give you any logs:
1. Run `npm run test:jest` to execute same test with `jest`, you'll find that jest is able to tell you what went wrong:

## Relevant Information
I am currently locating that the problem is that vitest will exit directly when the **Worker** process driving the test exits:
https://github.com/vitest-dev/vitest/blob/199776767a10bcd9f241e36a5cdd578c7d7c0dc2/packages/vitest/src/node/pool.ts#L141-L143