close
logo
Rstest
指南
配置
API
English
简体中文
指南
配置
API
English
简体中文
logo
Rstest
Overview

Test Configurations

root
name
include
exclude
setupFiles
projects
update
globals
passWithNoTests
includeSource
testNamePattern
env
retry
testTimeout
hookTimeout
maxConcurrency
pool
isolate
testEnvironment
clearMocks
resetMocks
restoreMocks
unstubEnvs
unstubGlobals
coverage
reporters
hideSkippedTests
slowTestThreshold
snapshotFormat
resolveSnapshotPath
printConsoleTrace
onConsoleLog
disableConsoleIntercept

Build Configurations

plugins
source
output
resolve
tools
dev
performance
📝 在 GitHub 上编辑此页
上一页maxConcurrency
下一页isolate

#pool

  • 类型:
export type RstestPoolOptions = {
  /** 用于运行测试的线程池 */
  type?: 'fork';
  /** 最大运行的线程池的数量或百分比 */
  maxWorkers?: number | string;
  /** 最小运行的线程池的数量或百分比 */
  minWorkers?: number | string;
  /** 向子进程中的 node 进程传递附加参数。 */
  execArgv?: string[];
};
  • 默认值:
const defaultPool = {
  type: 'fork'
  maxWorkers: available CPUs
  minWorkers: available CPUs
}

用于运行测试的线程池的选项。

#示例

在单个子进程中运行所有测试。

rstest.config.ts
import { defineConfig } from '@rstest/core';

export default defineConfig({
  pool: {
    type: 'forks',
    maxWorkers: 1,
    minWorkers: 1,
  },
});