run([options])#>>>>>>


  • options <Object> Configuration options for running tests. The following properties are supported:
    • 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 run os.availableParallelism() - 1 test files in parallel. If false, it would only run one test file at a time. Default: false.
    • files: <Array> An array containing the list of files to run. Default matching files from test runner execution model.
    • 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.
    • only: <boolean> If truthy, the test context will only run tests that have the only option set
    • 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.
    • testNamePatterns <string> | <RegExp> | <Array> A String, RegExp or a RegExp Array, that can be used to only run 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. Default: undefined.
    • timeout <number> A number of milliseconds the test execution will fail after. If unspecified, subtests inherit this value from their parent. Default: Infinity.
    • watch <boolean> Whether to run in watch mode or not. Default: false.
    • shard <Object> Running tests in a specific shard. Default: undefined.
      • index <number> is a positive integer between 1 and <total> that specifies the index of the shard to run. This option is required.
      • total <number> is a positive integer that specifies the total number of shards to split the test files to. This option is required.
  • Returns: <TestsStream>
import { tap } from 'node:test/reporters';
import process from 'node:process';

run({ files: [path.resolve('./tests/test.js')] })
  .compose(tap)
  .pipe(process.stdout);const { tap } = require('node:test/reporters');

run({ files: [path.resolve('./tests/test.js')] })
  .compose(tap)
  .pipe(process.stdout);