QUnit.testDone()


QUnit.testDone( callback )

Description: Register a callback to fire whenever a test ends.

  • QUnit.testDone( callback )

    • callback
      Type: Function( Object details )
      Callback to execute. Provides a single argument with the following properties:
      • name
        Type: String
        Name of the current test
      • module
        Type: String
        Name of the current module
      • failed
        Type: Number
        The number of failed assertions
      • passed
        Type: Number
        The number of passed assertions
      • total
        Type: Number
        The total number of assertions
      • runtime
        Type: Number
        The total runtime in millseconds of the test, including beforeEach and afterEach

Example:

Register a callback that logs results of a single test

1
2
3
QUnit.testDone(function( details ) {
console.log( "Finished running: ", details.module, details.name, "Failed/total: ", details.failed, details.total, details.duration );
});