Dynamic module tape

Index

Functions

Functions

tape(name: string, cb: TestCase)

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.

Parameters

Test: Test

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

  • msg?: string optional

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

  • msg?: string optional

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

  • n: number

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

  • msg?: string optional

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

TestCase: TestCase

(test: Test)

Parameters

createHarness(): tape

Create a new test harness instance, which is a function like test(), but with a new pending stack and test state.

Returns

tape

createStream(opts?: any): ReadableStream

Create a stream of output, bypassing the default output stream that writes messages to console.log().

Parameters

  • opts?: any optional

Returns

ReadableStream

only(name: string, cb: TestCase)

Like test(name, cb) except if you use .only this is the only test case that will run for the entire process, all other test cases using tape will be ignored

Parameters

skip(name: string, cb: TestCase)

Generate a new test that will be skipped over.

Parameters