Each QUnit test should either return a Promise to QUnit.test (which QUnit will automatically wait for and also report a test failure if the Promise is rejected), or manually use assert.async() where needed.
Examples:
QUnit.test( 'example should pass', function ( assert ) { return something().then( function ( val ) { assert.equals( val, 'expected' ); } ); } ); QUnit.test( 'example should fail', function ( assert ) { var done = assert.async(); something().fail( function ( val ) { assert.equals( val, 'error message' ); } ).always( done ); } );
See also MediaWiki core's QUnit tests of mediawiki.api for more examples.
This is in preparation for jQuery 3.0, where $.Deferred callbacks are processed asynchronously. https://jquery.com/upgrade-guide/3.0/
Failures can be seen at the pending core patch: https://gerrit.wikimedia.org/r/322812/.
03:54:38 Chrome 55.0.2883 (Linux 0.0.0) ext.translate.special.pagemigration -- Source units FAILED 03:54:38 Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.