Skip to content

Always need to specify --minWokers when --maxWorkers used #7974

@macko911

Description

@macko911

Describe the bug

When running vitest with the --maxWorkers option only, we get an error

> RangeError: options.minThreads and options.maxThreads must not conflict

I believe this is because the default for minThreads is number of available CPUs, which can be higher than what we set as maxWorkers.

Perhaps the solution would be to keep minThreads as undefined by default, or limit it to Math.max(maxThreads)?

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-abe49vgn

npx vitest run --maxWorkers 3

> RangeError: options.minThreads and options.maxThreads must not conflict

System Info

System:
    OS: macOS 15.4
    CPU: (8) arm64 Apple M1 Pro
    Memory: 91.27 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.8.0 - ~/.nvm/versions/node/v20.8.0/bin/node
    npm: 10.5.0 - ~/.nvm/versions/node/v20.8.0/bin/npm
    pnpm: 9.15.5 - ~/Library/pnpm/pnpm
    Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 136.0.7103.93
    Safari: 18.4
  npmPackages:
    @vitejs/plugin-react: 4.3.4 => 4.3.4
    vite: 5.4.18 => 5.4.18
    vitest: 3.0.9 => 3.0.9

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2-edge-caseBug, but has workaround or limited in scope (priority)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions