Options for t.spawn()

All of the normal Base and Extra options are also allowed.

interface SpawnOpts {
    args?: string[];
    at?: null | CallSiteLike | CallSiteLikeJSON;
    bail?: boolean;
    buffered?: boolean;
    childId?: number;
    command?: string;
    context?: any;
    cwd?: string;
    debug?: boolean;
    diagnostic?: boolean;
    diff?: string;
    doNotWant?: any;
    env?: {
        [k: string]: string;
    } | ProcessEnv;
    error?: any;
    errorOrigin?: {
        at?: null | CallSiteLike | CallSiteLikeJSON;
        source?: string;
        stack?: string;
    };
    exitCode?: null | number;
    expired?: string;
    failSkip?: boolean;
    failTodo?: boolean;
    found?: any;
    indent?: string;
    message?: string;
    name?: string;
    omitVersion?: boolean;
    parent?: Base<TapBaseEvents> | TestBase;
    parser?: Parser;
    passes?: boolean;
    pattern?: any;
    preserveWhitespace?: boolean;
    signal?: null | string;
    silent?: boolean;
    skip?: string | boolean;
    source?: string;
    stack?: string;
    stdio?: StdioOptions;
    strict?: boolean;
    tapChildBuffer?: string;
    test?: string;
    time?: number;
    timeout?: number;
    todo?: string | boolean;
    type?: string;
    wanted?: any;
}

Hierarchy (view full)

Properties

args?: string[]

arguments to subprocess (set by second argument to t.spawn)

bail?: boolean

Bail out on the first failure

buffered?: boolean

True if this test should be buffered, and only processed once complete.

Defaults to true when t.jobs is set to a value greater than 1.

If set false in that case, then the test will NOT be run in parallel, so this provides a way to control the parallelism within a test suite.

childId?: number

Numeric identifier attached to child tests. Most of the time, this is set based on the TAP_CHILD_ID environment variable.

command?: string

the command to run (set by first argument to t.spawn)

context?: any

Any arbitrary data that is provided to this test object. Often, this is set in a t.before() or t.beforeEach() method. Scalar values are inherited by child tests. Object values are extended in child tests using Object.create().

If not set in the options, this is initialized to a null-prototyped object, so that usage like t.context.foo = 'bar' will work as expected.

This is initialized and set on the Test object in the runMain method, not at construction time. If set explicitly on the Test object in a before hook, then any context specified on options or inherited from the parent test will be ignored.

cwd?: string

the current working directory of the subprocess

debug?: boolean

True to output LOTS AND LOTS of noisy debugging information. Set at the top level by the TAP_DEBUG environment variable.

diagnostic?: boolean
diff?: string
doNotWant?: any
env?: {
    [k: string]: string;
} | ProcessEnv

Environment variables for the subprocess Defaults to process.env

Type declaration

  • [k: string]: string
error?: any
errorOrigin?: {
    at?: null | CallSiteLike | CallSiteLikeJSON;
    source?: string;
    stack?: string;
}

Type declaration

exitCode?: null | number

Set on exit. The exit code of the process, or null if terminated with a signal.

expired?: string
failSkip?: boolean

treat skip tests as failures, default false

failTodo?: boolean

treat todo tests as failures, default false

found?: any
message?: string
name?: string

The name of this test

omitVersion?: boolean

Do not emit the TAP version 14 line.

Parent test of this test

passes?: boolean

track passes in the results lists, default false

pattern?: any
preserveWhitespace?: boolean

Do not elide empty lines and other unnecessary whitespace

signal?: null | string

Set on exit. Terminating signal, or null of not terminated with a signal.

silent?: boolean

Setting silent:true in a subtest option makes it completely excluded from test output, UNLESS it fails.

This was used historically for a few things which are now implemented with a more sophisticated promise management system, but can be handy in some rare situations.

skip?: string | boolean

Skip this test entirely, emitting a # SKIP directive

source?: string
stack?: string

The stack where this test was initiated

stdio?: StdioOptions

ChildProcess stdio option. Standard output is always set to 'pipe', because that's how it communicates test results, and file descriptor 3 is set to an IPC channel for sending timeout signals.

strict?: boolean

Treat any unknown non-TAP data as an error May be set at run-time by the TAP stream using pragma +strict

test?: string
time?: number

The amount of time that this test took to complete.

Typically, this is not set explicitly, but inferred from the actual time spent. However in some cases, it may be reported by the top-level # time=... comment in a TAP subprocess stream.

timeout?: number

Amount of time in milliseconds before this test times out

todo?: string | boolean

Mark this test as to be done later, emitting a # TODO directive

type?: string
wanted?: any

Internal Machinery

indent?: string

Number of spaces that this test is indented.

parser?: Parser

Parser to use for this TAP stream.

tapChildBuffer?: string

The TAP data from a buffered test.

Generated using TypeDoc