QUnit.testStart()
version added: 1.0.0.
Description
QUnit.testStart( callback )
Register a callback to fire whenever a test begins. The callback may be an async function, or a function that return a promise which will be waited for before the next callback is handled.
parameter | description |
---|---|
callback (function) | Callback to execute. Provides a single argument with the callback Details object |
Details object
Passed to the callback:
property | description |
---|---|
name (string) |
Name of the next test to run |
module (string) |
Name of the current module |
testId (string) |
Internal ID of the next test |
previousFailure (boolean) |
Whether the next test failed on a previous run |
Changelog
QUnit 1.16 | Added details.testId property. |
Examples
Register a callback that logs the module and test name:
QUnit.testStart(details => {
console.log(`Now running: ${details.module} ${details.name}`);
});