Wrap все тесты внутри функции.
Вызовите функцию, когда вы будете готовы к тестированию.
Если вы хотите повторно запустить тест после завершения QUnit, тогда сделайте и вызовите функцию типа «rerunQUnitTest».
var runAllTest = function(){
test("test 1", function(){
var a = true;
equal(a, true, "function a should return false");
});
};
// call rerunQUnitTest to reset and run your tests again.
var rerunQUnitTest = function(){
QUnit.reset(); // should clear the DOM
QUnit.init(); // resets the qunit test environment
QUnit.start(); // allows for the new test to be captured.
runAllTest(); // runs your functions that has all the test wrapped inside.
};
runAllTest(); // auto runs your tests.