devtools icon indicating copy to clipboard operation
devtools copied to clipboard

devtools makes vitest hang

Open jendrikw opened this issue 3 months ago • 0 comments

Describe the bug

After adding @vitejs/devtools and enabling the devtools plugin, vitest runs into a timeout after finishing all tests:


 Test Files  9 passed (9)
      Tests  113 passed | 1 expected fail (114)
   Start at  13:04:01
   Duration  15.67s (transform 1.20s, setup 3.16s, import 2.90s, tests 13.86s, environment 3.10s)

...

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/guide/reporters.html#hanging-process-reporter

The hanging-process reporter was not helpful, but using wtfnode, I got this output by preccing ctrl-c after all tests finished:

^C[WTF Node?] open handles:
- File descriptors: (note: stdio always exists)
  - fd 2 (tty) (stdio)
  - fd 1 (tty) (stdio)
  - fd 0 (tty)
- Servers:
  - ::1:7812 (HTTP)
    - Listeners:
      - request: attachWsRpcTransport @ file:///home/USER/src/dccviewer-js/node_modules/devframe/dist/rpc/transports/ws-server.mjs:146

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-c1cevyww?file=vite.config.ts

  1. Note that vitest outputs close timed out after 10000ms.
  2. Remvoe the DevTools() from the plugins.
  3. The issue disappears

System Info

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 22.22.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm

Used Package Manager

npm

Validations

  • [x] Follow our Code of Conduct
  • [x] Read the Contributing Guide.
  • [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, please open a GitHub Discussion instead.
  • [x] The provided reproduction is a minimal reproducible of the bug.

jendrikw avatar Aug 05 '26 11:08 jendrikw