Skip to content

Performance regression when upgrading from Vitest v3 to v4 with single worker thread #8808

Description

@bpetetot

Describe the bug

After upgrading from Vitest v3 to v4, I’m seeing a consistent ~2× slowdown in our test suite when running with a single worker thread.

Prior behavior (v3)
Using the following config:

export default defineConfig({
  test: {
    globals: true,
    environment: 'node',
    pool: 'threads',
    poolOptions: { threads: { singleThread: true } },
  },
})

Execution time:

Duration 846ms
(transform 137ms, setup 0ms, collect 153ms, tests 9ms, environment 0ms, prepare 193ms)

After upgrade (v4)
Updated config per migration guide, replacing deprecated poolOptions:

export default defineConfig({
  test: {
    globals: true,
    environment: 'node',
    pool: 'threads',
    maxWorkers: 1,
  },
})

Execution time:

Duration 1.79s
(transform 122ms, setup 0ms, collect 193ms, tests 15ms, environment 0ms, prepare 35ms)

Observations

  • Test execution time is nearly doubled from 846ms to 1.79s. (results from the minimal reproductions on StackBlitz)
  • On my main project, I have almost the same difference (from 54s to 138s)

Thanks for vitest, it is awesome 😊

Reproduction

System Info

System:
    OS: macOS 15.6.1
    CPU: (12) arm64 Apple M3 Pro
    Memory: 405.28 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.18.0 - /Users/benjamin_petetot/.local/share/mise/installs/node/22.18.0/bin/node
    npm: 10.9.3 - /Users/benjamin_petetot/.local/share/mise/installs/node/22.18.0/bin/npm
    pnpm: 10.18.3 - /opt/homebrew/bin/pnpm
    Watchman: 2025.10.13.00 - /opt/homebrew/bin/watchman
  Browsers:
    Brave Browser: 141.1.83.118
    Chrome: 139.0.7258.155
    Firefox: 137.0
    Safari: 18.6
  npmPackages:
    vitest: ^4.0.3 => 4.0.3

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions