Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vitest simply exits when met process exit #2615

Closed
6 tasks done
ulivz opened this issue Jan 5, 2023 · 0 comments · Fixed by #2643
Closed
6 tasks done

vitest simply exits when met process exit #2615

ulivz opened this issue Jan 5, 2023 · 0 comments · Fixed by #2643
Labels
enhancement New feature or request pr welcome

Comments

@ulivz
Copy link

ulivz commented Jan 5, 2023

Describe the bug

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.

Reproduction

minimal reproduction: vitest-simply-exits-when-met-process-exit-repro, see following repro steps:

  1. git clone https://github.com/ulivz/vitest-simply-exits-when-met-process-exit-repro
  2. pnpm i
  3. 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:

System Info

System:
    OS: macOS 12.3
    CPU: (10) arm64 Apple M1 Max
    Memory: 169.31 MB / 64.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.18.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.19.2 - /usr/local/bin/npm
  Browsers:
    Chrome: 108.0.5359.124
    Safari: 15.4
  npmPackages:
    vitest: 0.26.3 => 0.26.3

Relevant Information

I am currently locating that the problem is that vitest will exit directly when the Worker process driving the test exits:

onWorkerExit(code) {
process.exit(code || 1)
},

Used Package Manager

pnpm

Validations

@sheremet-va sheremet-va added enhancement New feature or request pr welcome labels Jan 5, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jun 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request pr welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants