QUnit.config.reporters
not yet released.
Description
Control which reporters to enable or disable.
type | Object<string,bool> |
---|---|
default | {} |
Built-in reporters
tap
The tap reporter is a TAP compliant reporter. This is the default in the QUnit CLI. This allows you to pair QUnit with many TAP-based reporters, by piping the output. For example:
qunit test/ | tap-min
console
The console reporter logs a JSON object for each reporter event from QUnit.on
. Use this to explore or debug the Reporter API.
runStart {…}
testStart {…}
testEnd {…}
testStart {…}
testEnd {…}
runEnd {…}
perf
The perf reporter emits measures for the duration of each QUnit test and each module via the Web Performance API. This allows you to visualize where time is spent during your test run. This uses the performance.measure() method internally. QUnit enables the perf reporter by default in Browser environments. The measures are included in Firefox Profiler and Chrome DevTools (Safari is pending WebKit #213870).
QUnit Test Run
└── QUnit Test Suite: Example
├── QUnit Test: apple
├── QUnit Test: banana
└── QUnit Test: citron
![QUnit profiling in Chrome DevTools Performance tab](/resources/perf-chrome.png)
![QUnit performance in Firefox Profiler](/resources/perf-firefox.png)
The Web Performance API is also available in Node.js and the QUnit perf reporter can be enabled in Node.js. You can enable it in the QUnit CLI via --reporter perf
. Note that the Node.js inspector does not yet send these to Chrome DevTools (upstream nodejs/node#47813).
html
The html reporter renders a toolbar and visualizes test results. This is the default in Browser environments, and is documented at HTML Reporter.
Examples
By default, the HTML Reporter is automatically enabled in browser environments if a <div id="qunit">
element exists, and it remains disabled (“headless”) if such element doesn’t exist. You can override this to disable the HTML Reporter even if the element does exist.
For example, this lets you share the same HTML file for manual testing, debugging, and CI runs; and yet disable the HTML Reporter in CI for improved performance.
// Declare as preconfig, before loading qunit.js
qunit_config_reporters_html = false;
// Set at runtime, after loading qunit.js (but before QUnit.begin)
QUnit.config.reporters.html = false;
Declaratively enable the TAP reporter in a browser environment:
// Declare preconfig, before loading qunit.js
qunit_config_reporters_tap = true;