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 crashes silently with long async test on windows #2045

Closed
6 tasks done
dkent600 opened this issue Sep 14, 2022 · 6 comments
Closed
6 tasks done

vitest crashes silently with long async test on windows #2045

dkent600 opened this issue Sep 14, 2022 · 6 comments

Comments

@dkent600
Copy link

dkent600 commented Sep 14, 2022

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
Copy link
Author

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

@mrspartak
Copy link

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

@kaminskypavel
Copy link

might be related #2415

@moishinetzer
Copy link

Same issue happening to me - Any updates?

@enzoferey
Copy link

Since this is appeared at the top of the Google search, I'm leaving the two things that were causing issues on my side:

  1. Not using it.each or test.each and just looping through an array creating it / test statements on the fly.
  2. My project is not using Vite and I did not have a vitest.config.ts, it seems to be one of the three possible options to configure Vitest. I find the get started docs not very clear about this, it should be mentioned right below the installation command if you ask me.

@sheremet-va
Copy link
Member

The worker threads incompatibilities might cause this. Vitest 2.0 switches to using child_processes by default, which makes it more stable. If you are seeing unexpected segfaults or exits, check your configured pool.

@sheremet-va sheremet-va closed this as not planned Won't fix, can't repro, duplicate, stale Oct 1, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants