vitest icon indicating copy to clipboard operation
vitest copied to clipboard

vitest crashes silently with long async test on windows

Open dkent600 opened this issue 1 year ago • 1 comments

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):

  1. clone this: https://github.com/Kolektivo/kolektivo-dapp/tree/vitest-crash
  2. run npm ci
  3. 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

dkent600 avatar Sep 14 '22 21:09 dkent600

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" "$@"

dkent600 avatar Sep 14 '22 22:09 dkent600

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" "$@"

mrspartak avatar Oct 30 '22 20:10 mrspartak