Skip to content

Vite plugin sometimes causes vitest run --coverage to hang after execution #1661

@mdickopp

Description

@mdickopp

Describe the bug

The vanilla-extract vite plugin sometimes causes vitest run --coverage to hang after execution and display the messsage

close timed out after 10000ms
Tests closed successfully but something prevents Vite server from exiting
You can try to identify the cause by enabling "hanging-process" reporter. See https://vitest.dev/config/#reporters

after 10 seconds.

To reproduce the bug, download the StackBlitz project linked below, then run npm install, then npm test or npx vitest run --coverage.

Observations:

  • The issue does not occur every time, but only sometimes. Even when it does not occur, there is about a one second delay between the time the coverage report is printed and the time the process exits.
  • Note that the vanilla-extract vite plugin does not do anything. The bug is triggered by it mere presence, i.e. it being configured in vite.config.ts.
  • It seems the bug is only triggered if there are at least two test files.
  • The bug is triggered only if coverage is used.

Note that I do not run in a container. envinfo seems to have misidentified this.

I will work further on finding the cause for this issue, and add any new insights to this report.

Reproduction

https://stackblitz.com/edit/vanilla-extract-vitest-coverage-t26gqw1f?view=editor

System Info

System:
  OS: Linux 6.17 Debian GNU/Linux forky/sid
  CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
  Memory: 27.73 GB / 31.28 GB
  Container: Yes
  Shell: 5.3.3 - /bin/bash
Binaries:
  Node: 22.21.1 - /usr/bin/node
  npm: 11.6.4 - /home/martin/.npm/bin/npm
Browsers:
  Chromium: 142.0.7444.175
  Firefox: 145.0.1
  Firefox Developer Edition: 145.0.1
npmPackages:
  @vanilla-extract/vite-plugin: ^5.1.3 => 5.1.3 
  vite: ^7.2.4 => 7.2.6

Used Package Manager

npm

Logs

close timed out after 10000ms
Tests closed successfully but something prevents Vite server from exiting
You can try to identify the cause by enabling "hanging-process" reporter. See https://vitest.dev/config/#reporters

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions