run([options])
-
options<Object> 运行测试的配置选项。支持以下属性:¥
options<Object> Configuration options for running tests. The following properties are supported:-
concurrency<number> | <boolean> 如果提供了一个数字,那么那么多文件将并行运行。如果为真,它将并行运行(CPU 核心数 - 1)个文件。如果为假,它一次只会运行一个文件。如果未指定,则子测试从其父测试继承此值。默认值:true。¥
concurrency<number> | <boolean> If a number is provided, then that many files would run in parallel. If truthy, it would run (number of cpu cores - 1) files in parallel. If falsy, it would only run one file at a time. If unspecified, subtests inherit this value from their parent. Default:true. -
files:<Array> 包含要运行的文件列表的数组。测试运行器执行模型 中的默认匹配文件。¥
files: <Array> An array containing the list of files to run. Default matching files from test runner execution model. -
signal<AbortSignal> 允许中止正在进行的测试执行。¥
signal<AbortSignal> Allows aborting an in-progress test execution. -
timeout<number> 测试执行将在几毫秒后失败。如果未指定,则子测试从其父测试继承此值。默认值:Infinity。¥
timeout<number> A number of milliseconds the test execution will fail after. If unspecified, subtests inherit this value from their parent. Default:Infinity. -
inspectPort<number> | <Function> 设置测试子进程的检查器端口。这可以是数字,也可以是不带参数并返回数字的函数。如果提供了一个空值,每个进程都有自己的端口,从主进程的process.debugPort递增。默认值:undefined。¥
inspectPort<number> | <Function> Sets inspector port of test child process. This can be a number, or a function that takes no arguments and returns a number. If a nullish value is provided, each process gets its own port, incremented from the primary'sprocess.debugPort. Default:undefined.
-
-
返回:<TapStream>
¥Returns: <TapStream>
run({ files: [path.resolve('./tests/test.js')] })
.pipe(process.stdout);