Options that can be passed to TestBase objects

interface TestBaseOpts {
    at?: null | CallSiteLike | CallSiteLikeJSON;
    bail?: boolean;
    buffered?: boolean;
    cb?: ((...args: any[]) => any);
    childId?: number;
    context?: any;
    debug?: boolean;
    diagnostic?: boolean;
    diff?: string;
    doNotWant?: any;
    error?: any;
    errorOrigin?: {
        at?: null | CallSiteLike | CallSiteLikeJSON;
        source?: string;
        stack?: string;
    };
    expired?: string;
    failOnly?: boolean;
    failSkip?: boolean;
    failTodo?: boolean;
    found?: any;
    indent?: string;
    jobs?: number;
    message?: string;
    name?: string;
    omitVersion?: boolean;
    parent?: Base<TapBaseEvents> | TestBase;
    parser?: Parser;
    passes?: boolean;
    pattern?: any;
    preserveWhitespace?: boolean;
    silent?: boolean;
    skip?: string | boolean;
    source?: string;
    stack?: string;
    strict?: boolean;
    tapChildBuffer?: string;
    test?: string;
    time?: number;
    timeout?: number;
    todo?: string | boolean;
    type?: string;
    wanted?: any;
}

Hierarchy (view full)

Properties

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.

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.

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
error?: any
errorOrigin?: {
    at?: null | CallSiteLike | CallSiteLikeJSON;
    source?: string;
    stack?: string;
}
expired?: string
failOnly?: boolean

treat only:true tests as failures, default false

failSkip?: boolean

treat skip tests as failures, default false

failTodo?: boolean

treat todo tests as failures, default false

found?: any
jobs?: number

The number of jobs to run in parallel. Defaults to 1

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

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

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

cb?: ((...args: any[]) => any)

Test function called when this Test is executed This is usually not set on the extra object, but as an argument to the t.test(..) method, just defined here so TS doesn't complain when we reference it in the various flow control 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.