• options <Object> 运行测试的配置选项。 支持以下属性:
    • concurrency <number> | <boolean> 如果提供了一个数字,那么那么多文件将并行运行。 如果是真的,它将并行运行 (cpu cores - 1) 文件。 如果是虚假的,它一次只会运行一个文件。 如果未指定,则子测试从其父测试继承此值。 默认值: true
    • files: <Array> 包含要运行的文件列表的数组。 默认来自 测试运行器执行模型 的匹配文件。
    • setup <Function> 接受 TestsStream 实例并可用于在运行任何测试之前设置侦听器的函数。 默认值: undefined
    • signal <AbortSignal> 允许中止正在进行的测试执行。
    • timeout <number> 测试执行将在几毫秒后失败。 如果未指定,则子测试从其父测试继承此值。 默认值: Infinity
    • inspectPort <number> | <Function> 设置测试子进程的检查器端口。 这可以是数字,也可以是不带参数并返回数字的函数。 如果提供了一个空值,每个进程都有自己的端口,从主进程的 process.debugPort 递增。 默认值: undefined
  • 返回: <TestsStream>
run({ files: [path.resolve('./tests/test.js')] })
  • options <Object> Configuration options for running tests. The following properties are supported:
    • 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> An array containing the list of files to run. Default matching files from test runner execution model.
    • setup <Function> A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run. Default: undefined.
    • signal <AbortSignal> Allows aborting an in-progress test execution.
    • 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> 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's process.debugPort. Default: undefined.
  • Returns: <TestsStream>
run({ files: [path.resolve('./tests/test.js')] })