Manually starting test run (AMD)

When you use AMD (Asynchronous Module Loading) systems, or otherwise need to manually specify when your system is ready to run tests, you can easily disable auto running of tests and manually start the test run. Normally, Buster.JS starts running tests when the browser has finished loading the page. Since AMD is a manual module loader that Buster.JS can't automatically be aware of, you are required to manually tell Buster.JS when your good to go.

Manually start the test run

Add autoRun: false to your config file.

var config = module.exports;
config["My tests"] = {
    autoRun: false,
    sources: ["../lib/**/*.js"],
    tests: ["**/*-test.js", "run.js"]
}

We added the file run.js to the tests group. In this file, call buster.run() to start the test run.

// App specific notification of when your app is ready to be tested
myApp.onReady = function () {
    buster.run();
};

You're of course free to call buster.run() anywhere you want, the only important thing is that it gets called when you load your tests, and when it gets called your application is ready to ge ttested.