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 上编辑此页
上一页pool
下一页testEnvironment

#isolate

  • 类型: boolean
  • 默认值: true
  • CLI: --isolate=false

是否运行每个测试在一个独立的环境。

默认情况下, Rstest 会运行每个测试在一个独立的环境,这会使其避免受到一些模块副作用的影响,从而有助于提升测试的稳定性。

如果你的代码没有副作用影响,关闭这个选项将有助于提升性能因为可以在不同的测试文件间复用模块缓存。

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

export default defineConfig({
  isolate: false,
});