···750750751751Maximum number or percentage of threads. You can also use `VITEST_MAX_THREADS` environment variable.
752752753753-##### poolOptions.threads.minThreads<NonProjectOption />
754754-755755-- **Type:** `number | string`
756756-- **Default:** _available CPUs_
757757-758758-Minimum number or percentage of threads. You can also use `VITEST_MIN_THREADS` environment variable.
759759-760753##### poolOptions.threads.singleThread
761754762755- **Type:** `boolean`
···822815823816Maximum number or percentage of forks. You can also use `VITEST_MAX_FORKS` environment variable.
824817825825-##### poolOptions.forks.minForks<NonProjectOption />
826826-827827-- **Type:** `number | string`
828828-- **Default:** _available CPUs_
829829-830830-Minimum number or percentage of forks. You can also use `VITEST_MIN_FORKS` environment variable.
831831-832818##### poolOptions.forks.isolate
833819834820- **Type:** `boolean`
···884870- **Default:** _available CPUs_
885871886872Maximum number or percentage of threads. You can also use `VITEST_MAX_THREADS` environment variable.
887887-888888-##### poolOptions.vmThreads.minThreads<NonProjectOption />
889889-890890-- **Type:** `number | string`
891891-- **Default:** _available CPUs_
892892-893893-Minimum number or percentage of threads. You can also use `VITEST_MIN_THREADS` environment variable.
894873895874##### poolOptions.vmThreads.memoryLimit<NonProjectOption />
896875···966945967946Maximum number or percentage of forks. You can also use `VITEST_MAX_FORKS` environment variable.
968947969969-##### poolOptions.vmForks.minForks<NonProjectOption />
970970-971971-- **Type:** `number | string`
972972-- **Default:** _available CPUs_
973973-974974-Minimum number or percentage of forks. You can also use `VITEST_MIN_FORKS` environment variable.
975975-976948##### poolOptions.vmForks.memoryLimit<NonProjectOption />
977949978950- **Type:** `string | number`
···997969- **Default:** `true`
998970- **CLI:** `--no-file-parallelism`, `--fileParallelism=false`
99997110001000-Should all test files run in parallel. Setting this to `false` will override `maxWorkers` and `minWorkers` options to `1`.
972972+Should all test files run in parallel. Setting this to `false` will override `maxWorkers` option to `1`.
10019731002974::: tip
1003975This option doesn't affect tests running in the same file. If you want to run those in parallel, use `concurrent` option on [describe](/api/#describe-concurrent) or via [a config](#sequence-concurrent).
···1008980- **Type:** `number | string`
10099811010982Maximum number or percentage of workers to run tests in. `poolOptions.{threads,vmThreads}.maxThreads`/`poolOptions.forks.maxForks` has higher priority.
10111011-10121012-### minWorkers<NonProjectOption /> {#minworkers}
10131013-10141014-- **Type:** `number | string`
10151015-10161016-Minimum number or percentage of workers to run tests in. `poolOptions.{threads,vmThreads}.minThreads`/`poolOptions.forks.minForks` has higher priority.
10179831018984### testTimeout
1019985
-35
docs/guide/cli-generated.md
···411411412412Maximum number or percentage of threads to run tests in
413413414414-### poolOptions.threads.minThreads
415415-416416-- **CLI:** `--poolOptions.threads.minThreads <workers>`
417417-- **Config:** [poolOptions.threads.minThreads](/config/#pooloptions-threads-minthreads)
418418-419419-Minimum number or percentage of threads to run tests in
420420-421414### poolOptions.threads.useAtomics
422415423416- **CLI:** `--poolOptions.threads.useAtomics`
···445438- **Config:** [poolOptions.vmThreads.maxThreads](/config/#pooloptions-vmthreads-maxthreads)
446439447440Maximum number or percentage of threads to run tests in
448448-449449-### poolOptions.vmThreads.minThreads
450450-451451-- **CLI:** `--poolOptions.vmThreads.minThreads <workers>`
452452-- **Config:** [poolOptions.vmThreads.minThreads](/config/#pooloptions-vmthreads-minthreads)
453453-454454-Minimum number or percentage of threads to run tests in
455441456442### poolOptions.vmThreads.useAtomics
457443···488474489475Maximum number or percentage of processes to run tests in
490476491491-### poolOptions.forks.minForks
492492-493493-- **CLI:** `--poolOptions.forks.minForks <workers>`
494494-- **Config:** [poolOptions.forks.minForks](/config/#pooloptions-forks-minforks)
495495-496496-Minimum number or percentage of processes to run tests in
497497-498477### poolOptions.vmForks.isolate
499478500479- **CLI:** `--poolOptions.vmForks.isolate`
···516495517496Maximum number or percentage of processes to run tests in
518497519519-### poolOptions.vmForks.minForks
520520-521521-- **CLI:** `--poolOptions.vmForks.minForks <workers>`
522522-- **Config:** [poolOptions.vmForks.minForks](/config/#pooloptions-vmforks-minforks)
523523-524524-Minimum number or percentage of processes to run tests in
525525-526498### poolOptions.vmForks.memoryLimit
527499528500- **CLI:** `--poolOptions.vmForks.memoryLimit <limit>`
···543515- **Config:** [maxWorkers](/config/#maxworkers)
544516545517Maximum number or percentage of workers to run tests in
546546-547547-### minWorkers
548548-549549-- **CLI:** `--minWorkers <workers>`
550550-- **Config:** [minWorkers](/config/#minworkers)
551551-552552-Minimum number or percentage of workers to run tests in
553518554519### environment
555520
+1
docs/guide/migration.md
···238238- Reporter APIs `onCollected`, `onSpecsCollected`, `onPathsCollected`, `onTaskUpdate` and `onFinished`. See [`Reporters API`](/advanced/api/reporters) for new alternatives. These APIs were introduced in Vitest `v3.0.0`.
239239- `deps.external`, `deps.inline`, `deps.fallbackCJS` config options. Use `server.deps.external`, `server.deps.inline`, or `server.deps.fallbackCJS` instead.
240240- `browser.testerScripts` config option. Use [`browser.testerHtmlPath`](/guide/browser/config#browser-testerhtmlpath) instead.
241241+- `minWorkers` config option. Only `maxWorkers` has any effect on how tests are running, so we are removing this public option.
241242242243This release also removes all deprecated types. This finally fixes an issue where Vitest accidentally pulled in `@types/node` (see [#5481](https://github.com/vitest-dev/vitest/issues/5481) and [#6141](https://github.com/vitest-dev/vitest/issues/6141)).
243244
+1-1
docs/guide/parallelism.md
···1212- `forks` (the default) and `vmForks` run tests in different [child processes](https://nodejs.org/api/child_process.html)
1313- `threads` and `vmThreads` run tests in different [worker threads](https://nodejs.org/api/worker_threads.html)
14141515-Both "child processes" and "worker threads" are refered to as "workers". You can configure the number of running workers with [`minWorkers`](/config/#minworkers) and [`maxWorkers`](/config/#maxworkers) options. Or more granually with [`poolOptions`](/config/#pooloptions) configuration.
1515+Both "child processes" and "worker threads" are refered to as "workers". You can configure the number of running workers with [`maxWorkers`](/config/#maxworkers) option. Or more granually with [`poolOptions`](/config/#pooloptions) configuration.
16161717If you have a lot of tests, it is usually faster to run them in parallel, but it also depends on the project, the environment and [isolation](/config/#isolate) state. To disable file parallelisation, you can set [`fileParallelism`](/config/#fileparallelism) to `false`. To learn more about possible performance improvements, read the [Performance Guide](/guide/improving-performance).
1818
-2
test/test-utils/index.ts
···7979 ctx = await startVitest(mode, cliFilters, {
8080 // Test cases are already run with multiple forks/threads
8181 maxWorkers: 1,
8282- minWorkers: 1,
83828483 watch: false,
8584 // "none" can be used to disable passing "reporter" option so that default value is used (it's not same as reporters: ["default"])
···164163165164 if (command === 'vitest') {
166165 args.push('--maxWorkers=1')
167167- args.push('--minWorkers=1')
168166 }
169167170168 const subprocess = x(command, args, options as Options).process!
···6666 description: 'Maximum number or percentage of threads to run tests in',
6767 argument: '<workers>',
6868 },
6969- minThreads: {
7070- description: 'Minimum number or percentage of threads to run tests in',
7171- argument: '<workers>',
7272- },
7369 useAtomics: {
7470 description:
7571 'Use Atomics to synchronize threads. This can improve performance in some cases, but might cause segfault in older Node versions (default: `false`)',
···8682 },
8783 maxForks: {
8884 description: 'Maximum number or percentage of processes to run tests in',
8989- argument: '<workers>',
9090- },
9191- minForks: {
9292- description: 'Minimum number or percentage of processes to run tests in',
9385 argument: '<workers>',
9486 },
9587 execArgv: null,
···479471 },
480472 maxWorkers: {
481473 description: 'Maximum number or percentage of workers to run tests in',
482482- argument: '<workers>',
483483- },
484484- minWorkers: {
485485- description: 'Minimum number or percentage of workers to run tests in',
486474 argument: '<workers>',
487475 },
488476 environment: {
···304304 * Maximum number or percentage of workers to run tests in. `poolOptions.{threads,vmThreads}.maxThreads`/`poolOptions.forks.maxForks` has higher priority.
305305 */
306306 maxWorkers?: number | string
307307- /**
308308- * Minimum number or percentage of workers to run tests in. `poolOptions.{threads,vmThreads}.minThreads`/`poolOptions.forks.minForks` has higher priority.
309309- */
310310- minWorkers?: number | string
311307312308 /**
313309 * Should all test files run in parallel. Doesn't affect tests running in the same file.
314314- * Setting this to `false` will override `maxWorkers` and `minWorkers` options to `1`.
310310+ * Setting this to `false` will override `maxWorkers` option to `1`.
315311 *
316312 * @default true
317313 */
···10141010 runner?: string
1015101110161012 maxWorkers: number
10171017- minWorkers: number
10181013}
1019101410201015type NonProjectOptions
···10441039 | 'inspectBrk'
10451040 | 'coverage'
10461041 | 'maxWorkers'
10471047- | 'minWorkers'
10481042 | 'fileParallelism'
10491043 | 'watchTriggerPatterns'
10501044
-8
packages/vitest/src/node/types/pool-options.ts
···5050}
51515252export interface ThreadsOptions {
5353- /** Minimum amount of threads to use */
5454- minThreads?: number | string
5555-5653 /** Maximum amount of threads to use */
5754 maxThreads?: number | string
5855···7471}
75727673export interface ResolvedThreadsOptions extends ThreadsOptions {
7777- minThreads?: number
7874 maxThreads?: number
7975}
80768177export interface ForksOptions {
8282- /** Minimum amount of child processes to use */
8383- minForks?: number | string
8484-8578 /** Maximum amount of child processes to use */
8679 maxForks?: number | string
8780···9487}
95889689export interface ResolvedForksOptions extends ForksOptions {
9797- minForks?: number
9890 maxForks?: number
9991}
10092