javascript - Callback for when QUnit has finished running all tests. (`QUnit.done()` not working as expected) -


qunit has number of callbacks, such as:

  • qunit.done()
  • qunit.moduledone()
  • qunit.testdone()

the problem qunit.done() not work expected. fires after each test. expected behaviour?

i register tests qunit once page loaded (with jquery) below since (unfortunately) depend on app being loaded first. , split among multiple handlers tests can put in different files.

$(function(){     qunit.module( "module 1" );         qunit.test("test 1", function( assert ){             assert.ok(true);         });     }); });  $(function(){     qunit.module( "module 2" );         qunit.test("test 2", function( assert ){             assert.ok(true);         });     }); }); 

would reason done() being called after each test? there way around this, besides having tests in 1 file?

i found answer in similar question.

the trick set qunit.config.autostart = false , once tests loaded , application loaded, start tests.


Comments