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 上编辑此页
上一页Overview
下一页name

#root

  • 类型: string
  • 默认值: process.cwd()
  • CLI: -r=<path>, --root=<path>

指定项目根目录。可以是绝对路径,也可以是相对于 process.cwd() 的路径。 root 将决定配置文件加载的起点,测试文件被搜索的起点等。

在任何基于路径的配置设置中使用 <rootDir> 将会引用此值。

rstest.config.ts
import { defineConfig } from 'rstest';

export default defineConfig({
  setupFiles: ['<rootDir>/setup.js'],
  include: ['<rootDir>/**/*.{test,spec}.?(c|m)[jt]s?(x)'],
  root: './my-project',
});