Back to Qunit

QUnit.testStart()

docs/api/callbacks/QUnit.testStart.md

2.25.01019 B
Original Source

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.

parameterdescription
callback (function)Callback to execute. Provides a single argument with the callback Details object

Details object

Passed to the callback:

propertydescription
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:

js
QUnit.testStart(details => {
  console.log(`Now running: ${details.module} ${details.name}`);
});