Skip to content

CTRL+C does not exit tests in watch mode #4956

@floratmin

Description

@floratmin

Describe the bug

When I am running tests in watch mode and make some minor changes in the test files, after a while, vitest can not exit watch mode. Hitting CTRL+C multiple times does not work either. I tried to isolate the problem, but strangely this only happens when some tests are run together.
Running vitest with pnpm run test:server or pnpm run test:native does not make vitest hang. But running pnpm run test:only which is a combination of both previous tests makes vitest hang after a while. In the only-native.spec.ts file I am using Fastify native, in the only-server.spec.ts file Fastify is completely mocked out.

Reproduction

fastify-vitest-shutdown

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 5700G with Radeon Graphics
    Memory: 15.87 GB / 30.73 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.8.0 - ~/.nvm/versions/node/v20.8.0/bin/node
    npm: 10.1.0 - ~/.nvm/versions/node/v20.8.0/bin/npm
    pnpm: 8.14.0 - ~/.local/share/pnpm/pnpm
  Browsers:
    Chrome: 120.0.6099.216
  npmPackages:
    vite: ^5.0.11 => 5.0.11 
    vitest: ^1.2.0 => 1.2.0

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededp2-edge-caseBug, but has workaround or limited in scope (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions