QUnit.reporters.tap

version added: 2.16.0.

Description

The tap reporter formats test results according to the TAP specification, and prints them to the console. It enables pairing QUnit with any tools from the TAP-based ecosystem.

Example

TAP version 13
ok 1 add > two numbers
1..1
# pass 1
# skip 0
# todo 0
# fail 0

Command-line

This is the default in the QUnit CLI. This allows you to pair QUnit with any TAP-based reporters, by piping the output. For example:

qunit test/ | tap-min

See also QUnit CLI ยง reporter.

Enable

Declaratively enable the TAP reporter in a browser environment, or in a custom Node.js runner, e.g. for use with TAP-based tooling such as Airtap, or karma-tap.

// Preconfig:
// Set as environment variable to Node.js,
// or as global variable before loading qunit.js
qunit_config_reporters_tap = true;

Enable via QUnit.config:

// Config: Set from any inline script or JS file after qunit.js
QUnit.config.reporters.tap = true;

Enable manually, since QUnit 2.16:

QUnit.reporters.tap.init(QUnit);

Changelog

UNRELEASED Enable declaratively via QUnit.config.reporters.
QUnit 2.16.0 Exposed as QUnit.reporters.tap for programmatic use in browsers or Node.js.
QUnit 2.3.0 Introduced as part of the QUnit CLI.