Skip to content

Regression: vitest 3.2 hangs when using workspaces, bail and single threaded #8484

@nicojs

Description

@nicojs

Describe the bug

When the following conditions are met, the process lives forever:

  • Using the latest vitest (3.2)
  • With workspaces
  • Programmatic API (node API)
  • Bail
  • Single threaded
  • And a test fails in one of the projects

See reproduction example.

Reproduction

reproduction.zip

Run with node run-vitest.ts. See that the process hangs forever. Reverting back solves this problem npm i -D [email protected].

The run-vitest.ts file looks like this:

import { createVitest } from "vitest/node";

async function runVitest() {
  const vitest = await createVitest("test", {
    pool: "threads",
    poolOptions: {
      threads: {
        maxThreads: 1,
        minThreads: 1,
      },
    },
    bail: 1,
  });
  await vitest.start();
  await vitest.close();
}

runVitest().catch((err) => {
  console.error("Vitest run failed:", err);
  process.exit(1);
});

I would expect the process to always exit, since we're calling vitest.close() (or process.exit(1) in case of an error).

System Info

System:
    OS: macOS 15.6.1
    CPU: (14) arm64 Apple M4 Pro
    Memory: 730.77 MB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.18.0 - ~/.nvm/versions/node/v22.18.0/bin/node
    npm: 11.5.2 - ~/.nvm/versions/node/v22.18.0/bin/npm
  Browsers:
    Chrome: 139.0.7258.154
    Edge: 139.0.3405.111
    Safari: 18.6
  npmPackages:
    playwright: ^1.55.0 => 1.55.0 
    vitest: ^3.2.4 => 3.2.4

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions