An array of CLI flags to pass to each test file when spawning the subprocesses. This option has no effect when isolation
is 'none'
.
interface
test.default.RunOptions
interface RunOptions
- argv?: readonly string[]
- branchCoverage?: number
Require a minimum percent of covered branches. If code coverage does not reach the threshold specified, the process will exit with code
1
. - concurrency?: number | boolean
If a number is provided, then that many test processes would run in parallel, where each process corresponds to one test file. If
true
, it would runos.availableParallelism() - 1
test files in parallel. Iffalse
, it would only run one test file at a time. - coverageExcludeGlobs?: string | readonly string[]
Excludes specific files from code coverage using a glob pattern, which can match both absolute and relative file paths. This property is only applicable when
coverage
was set totrue
. If bothcoverageExcludeGlobs
andcoverageIncludeGlobs
are provided, files must meet both criteria to be included in the coverage report. - coverageIncludeGlobs?: string | readonly string[]
Includes specific files in code coverage using a glob pattern, which can match both absolute and relative file paths. This property is only applicable when
coverage
was set totrue
. If bothcoverageExcludeGlobs
andcoverageIncludeGlobs
are provided, files must meet both criteria to be included in the coverage report. - cwd?: string
Specifies the current working directory to be used by the test runner. Serves as the base path for resolving files according to the test runner execution model.
- execArgv?: readonly string[]
An array of CLI flags to pass to the
node
executable when spawning the subprocesses. This option has no effect whenisolation
is'none
'. - files?: readonly string[]
An array containing the list of files to run. If omitted, files are run according to the test runner execution model.
- forceExit?: boolean
Configures the test runner to exit the process once all known tests have finished executing even if the event loop would otherwise remain active.
- functionCoverage?: number
Require a minimum percent of covered functions. If code coverage does not reach the threshold specified, the process will exit with code
1
. - globPatterns?: readonly string[]
An array containing the list of glob patterns to match test files. This option cannot be used together with
files
. If omitted, files are run according to the test runner execution model. - inspectPort?: number | () => number
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
. This option is ignored if theisolation
option is set to'none'
as no child processes are spawned. - isolation?: 'process' | 'none'
Configures the type of test isolation. If set to
'process'
, each test file is run in a separate child process. If set to'none'
, all test files run in the current process. - lineCoverage?: number
Require a minimum percent of covered lines. If code coverage does not reach the threshold specified, the process will exit with code
1
. - setup?: (reporter: TestsStream) => void | Promise<void>
A function that accepts the
TestsStream
instance and can be used to setup listeners before any tests are run. - testNamePatterns?: string | RegExp | readonly string | RegExp[]
If provided, only run tests whose name matches the provided pattern. Strings are interpreted as JavaScript regular expressions.
- testSkipPatterns?: string | RegExp | readonly string | RegExp[]
A String, RegExp or a RegExp Array, that can be used to exclude running tests whose name matches the provided pattern. Test name patterns are interpreted as JavaScript regular expressions. For each test that is executed, any corresponding test hooks, such as
beforeEach()
, are also run. - timeout?: number
The number of milliseconds after which the test execution will fail. If unspecified, subtests inherit this value from their parent.