Create a new test with an optional name string. cb(t) fires with the new test object t once all preceeding tests have finished. Tests execute serially.
public assert(value: any, msg?: string)
Parameters
-
value: any
-
msg?: string optional
public deepEqual(a: any, b: any, msg?: string)
Assert that a and b have the same structure and nested values using node's deepEqual() algorithm with strict comparisons (===) on leaf nodes and an optional description msg.
Parameters
-
a: any
-
b: any
-
msg?: string optional
public deepEquals(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public deepLooseEqual(a: any, b: any, msg?: string)
Assert that a and b have the same structure and nested values using node's deepEqual() algorithm with loose comparisons (==) on leaf nodes and an optional description msg.
Parameters
-
a: any
-
b: any
-
msg?: string optional
public doesNotEqual(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public doesNotThrow(fn: () => void, expected: any, msg?: string)
Assert that the function call fn() does not throw an exception.
Parameters
-
fn: () => void
-
expected: any
-
msg?: string optional
public end()
Declare the end of a test explicitly.
public equal(a: any, b: any, msg?: string)
Assert that a === b with an optional description msg.
Parameters
-
a: any
-
b: any
-
msg?: string optional
public equals(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public error(err: any, msg?: string)
Assert that err is falsy. If err is non-falsy, use its err.message as the description message.
Parameters
-
err: any
-
msg?: string optional
public fail(msg?: string)
Generate a failing assertion with a message msg.
Parameters
public false(value: any, msg?: string)
Parameters
-
value: any
-
msg?: string optional
public ifErr(err: any, msg?: string)
Parameters
-
err: any
-
msg?: string optional
public ifError(err: any, msg?: string)
Parameters
-
err: any
-
msg?: string optional
public iferror(err: any, msg?: string)
Parameters
-
err: any
-
msg?: string optional
public is(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public isEqual(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public isEquivalent(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public isInequal(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public isInequivalent(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public isNot(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public isNotDeepEqual(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public isNotDeeply(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public isNotEqual(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public isNotEquivalent(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public looseEqual(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public looseEquals(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public not(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public notDeepEqual(a: any, b: any, msg?: string)
Assert that a and b do not have the same structure and nested values using node's deepEqual() algorithm with strict comparisons (===) on leaf nodes and an optional description msg.
Parameters
-
a: any
-
b: any
-
msg?: string optional
public notDeepLooseEqual(a: any, b: any, msg?: string)
Assert that a and b do not have the same structure and nested values using node's deepEqual() algorithm with loose comparisons (==) on leaf nodes and an optional description msg.
Parameters
-
a: any
-
b: any
-
msg?: string optional
public notDeeply(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public notEqual(a: any, b: any, msg?: string)
Assert that a !== b with an optional description msg.
Parameters
-
a: any
-
b: any
-
msg?: string optional
public notEquals(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public notEquivalent(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public notLooseEqual(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public notLooseEquals(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public notOk(value: any, msg?: string)
Assert that value is falsy with an optional description message msg.
Parameters
-
value: any
-
msg?: string optional
public notSame(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public notStrictEqual(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public notStrictEquals(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public notok(value: any, msg?: string)
Parameters
-
value: any
-
msg?: string optional
public ok(value: any, msg?: string)
Assert that value is truthy with an optional description message msg.
Parameters
-
value: any
-
msg?: string optional
public pass(msg?: string)
Generate a passing assertion with a message msg.
Parameters
public plan(n: number)
Declare that n assertions should be run. end() will be called automatically after the nth assertion. If there are any more assertions after the nth, or after end() is called, they will generate errors.
Parameters
public same(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public skip(msg?: string)
Generate an assertion that will be skipped over.
Parameters
public strictEqual(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public strictEquals(a: any, b: any, msg?: string)
Parameters
-
a: any
-
b: any
-
msg?: string optional
public test(name: string, cb: TestCase)
Create a subtest with a new test handle st from cb(st) inside the current test cb(st) will only fire when t finishes. Additional tests queued up after t will not be run until all subtests finish.
Parameters
public throws(fn: () => void, expected: any, msg?: string)
Assert that the function call fn() throws an exception.
Parameters
-
fn: () => void
-
expected: any
-
msg?: string optional
public true(value: any, msg?: string)
Parameters
-
value: any
-
msg?: string optional