layout | title | excerpt | groups | redirect_from | version_added | |||
---|---|---|---|---|---|---|---|---|
page-api |
QUnit.done() |
Register a callback to fire when the test run has ended. |
|
|
1.0.0 |
QUnit.done( callback )
Register a callback to fire when the test run has ended. 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, called with a details object: |
property | description |
---|---|
failed (number) |
Number of failed assertions |
passed (number) |
Number of passed assertions |
total (number) |
Total number of assertions |
runtime (number) |
Duration of the test run in milliseconds |
Use of details
is deprecated and it's recommended to use QUnit.on('runEnd')
instead.
Caveats:
-
This callback reports the internal assertion count.
-
The default browser and CLI interfaces for QUnit and other popular test frameworks, and most CI integrations, report the number of tests. Reporting the number assertions may be confusing to developers.
-
Failed assertions of a
test.todo()
test are reported exactly as such. While rare, this means that a test run and all tests within it may be reported as passing, while internally there were some failed assertions. Unfortunately, this internal detail is exposed for compatibility reasons.
| QUnit 2.2 | Deprecate details
parameter in favour of QUnit.on('runEnd')
.
Register a callback that logs internal assertion counts.
QUnit.done(function (details) {
console.log(
'Total: ' + details.total + ' Failed: ' + details.failed +
' Passed: ' + details.passed + ' Runtime: ' + details.runtime
);
});