Permalink
Browse files

Updated AMD tests

  • Loading branch information...
1 parent 3529dfd commit ea9fc405e0fed81a5c76c7b5e65e0c72ece1d80f Kevin Malakoff committed Mar 30, 2013
@@ -23,4 +23,4 @@ try
require ['underscore', 'backbone', 'knockout', 'knockback', 'knockback-page-navigator-panes', 'qunit_test_runner'], (_, Backbone, ko, kb, kbn, runner) ->
window._ = window.Backbone = window.ko = null # force each test to require dependencies synchronously
# window.kb = null # force each test to require dependencies synchronously
- runner.start(); require ['./build/test'], ->
+ require ['./build/test'], -> runner.start()
@@ -23,4 +23,4 @@ try
require ['underscore', 'backbone', 'knockout', 'knockback', 'knockback-page-navigator-simple', 'qunit_test_runner'], (_, Backbone, ko, kb, kbn, runner) ->
window._ = window.Backbone = window.ko = null # force each test to require dependencies synchronously
# window.kb = null # force each test to require dependencies synchronously
- runner.start(); require ['./build/test'], ->
+ require ['./build/test'], -> runner.start()
@@ -23,4 +23,4 @@ try
require ['underscore', 'backbone', 'knockout', 'knockback', 'knockback-pane-navigator', 'qunit_test_runner'], (_, Backbone, ko, kb, kbn, runner) ->
window._ = window.Backbone = window.ko = null # force each test to require dependencies synchronously
# window.kb = null # force each test to require dependencies synchronously
- runner.start(); require ['./build/test'], ->
+ require ['./build/test'], -> runner.start()
@@ -1,24 +1,27 @@
(function() {
+ var started = false,
+ interval = null;
+ QUnit.done(function(details) {
+ if (!started) return;
+ clearInterval(interval);
+ if (!details.total) {
+ $('#qunit-banner').removeClass('qunit-pass').addClass('qunit-fail');
+ throw new Error('Warning: no tests run');
+ }
+ });
var startRunner = function() {
+ started = true;
var start = Date.now();
var timeout = 60000;
- var interval = setInterval((function() {
+ interval = setInterval((function() {
var code, stats;
if (Date.now() > start + timeout) {
// TIMEOUT
$('#qunit-banner').removeClass('qunit-pass').addClass('qunit-fail');
throw 'Warning: tests timed out';
}
}), 500);
-
- QUnit.done(function(details) {
- clearInterval(interval);
- if (!details.total) {
- $('#qunit-banner').removeClass('qunit-pass').addClass('qunit-fail');
- throw new Error('Warning: no tests run');
- }
- });
};
// AMD

0 comments on commit ea9fc40

Please sign in to comment.