It depends on whether QUnit is running when the tests are declared. If you stop it, declare all the tests, then start it the moduleDone
callback will be triggered once at the end of the module. If it's running while declaring the tests then the tests will be run as soon as they're declared, causing the module to only contain the tests that have been declared so far and it believes the modules done after each test finishes.
The same problem occurs with the done
callback, if QUnit is running while tests are being declared this is continuously triggered.
So if you're using either of these callbacks you really need to either load all tests synchronously in the head, so they exist when QUnit autostarts in the load event, or set QUnit.config.autostart = false
and not call QUnit.start
until all asynchronously loaded scripts have finished declaring their tests.