vitest
vitest copied to clipboard
vitest crashes silently with long async test on windows
Describe the bug
vitest crashes silently with long async test. Such a test looks like the one provided below. The test run includes this test plus others. It is only with the inclusion of this test that the crash happens. The test run aborts without reporting an error nor any other kind of result. The crash is intermittent and does not always happen at the same place during the run.
The testTimeout
config setting should be set high enough to easily allow the "simple example" test given below to run without timing out.
import { describe, expect, it } from 'vitest';
describe('simple example', () => {
it('sleeps for 10 seconds', () => {
return new Promise((resolve: (args: unknown[]) => void): unknown => setTimeout(resolve, 10000)).then(() => expect(true));
});
});
Reproduction
On Windows PowerShell (I haven't tried elsewhere):
- clone this: https://github.com/Kolektivo/kolektivo-dapp/tree/vitest-crash
- run
npm ci
- run
npm run test
If it doesn't reproduce the first time, try a few more times. It is intermittent, maybe 50-50. When it fails it will stop without reporting the final summary results of the run.
System Info
System:
OS: Windows 10 10.0.22000
CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
Memory: 14.90 GB / 31.68 GB
Binaries:
Node: 16.17.0 - C:\Program Files\nodejs\node.EXE
npm: 8.15.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.22000.120.0), Chromium (105.0.1343.33)
Internet Explorer: 11.0.22000.120
npmPackages:
vite: ^3.1.0 => 3.1.0
vitest: ^0.23.1 => 0.23.1
Used Package Manager
npm
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
When I run in Git Bash I often see this being issued upon abort in the same place where the abort happens in PowerShell:
/c/Program Files/nodejs/npx: line 48: 1860 Segmentation fault "$NODE_EXE" "$NPX_CLI_JS" "$@"
Have kinda same issue. Tests were developed on Mac and running fine, but on Windows server 2022 I get 'Segmentation fault' This is the only message I get
> vitest run --dir=./test/
RUN v0.24.3 C:/Users/***
/c/Program Files/nodejs/npm: line 37: 2046 Segmentation fault "$NODE_EXE" "$NPM_CLI_JS" "$@"