string
-r=<path>
--root=<path>
指定项目根目录。可以是绝对路径,也可以是相对于 process.cwd() 的路径。 root 将决定配置文件加载的起点,测试文件被搜索的起点等。
process.cwd()
root
在任何基于路径的配置设置中使用 <rootDir> 将会引用此值。
<rootDir>
import { defineConfig } from 'rstest'; export default defineConfig({ setupFiles: ['<rootDir>/setup.js'], include: ['<rootDir>/**/*.{test,spec}.?(c|m)[jt]s?(x)'], root: './my-project', });