Skip to content

Instantly share code, notes, and snippets.

@paulkoegel
Created January 18, 2013 18:30
Show Gist options
  • Save paulkoegel/4566993 to your computer and use it in GitHub Desktop.
Save paulkoegel/4566993 to your computer and use it in GitHub Desktop.
Synchronously load RequireJS-modularized QUnit tests and start QUnit afterwards This fixes an annoying issue with rerunning single QUnit tests. When loading tests asynchronously, single tests are identified by numerical IDs and since their order can change between reloads, you can't be sure you'll rerun the same test twice.
// author: Mathias Schäfer (@molily)
QUnit.config.autostart = false;
var modules = ['module_a', 'module_b'];
function loadNext () {
var module = modules.shift();
if (module) {
require([module], loadNext);
} else {
QUnit.start();
}
}
loadNext();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment