diff --git third_party/blanketjs/src/qunit_adapter.js third_party/blanketjs/src/qunit_adapter.js index 3d5b768..a1fb769 100644 --- third_party/blanketjs/src/qunit_adapter.js +++ third_party/blanketjs/src/qunit_adapter.js @@ -1,17 +1,23 @@ (function(){ if (typeof QUnit !== 'undefined'){ + var QUnitAutostart = (QUnit.config.autostart === undefined) ? true : QUnit.config.autostart; + //check to make sure requirejs is completed before we start the test runner var allLoaded = function() { return window.QUnit.config.queue.length > 0 && blanket.noConflict().requireFilesLoaded(); }; + function shouldAutoStart() { + return !(blanket.options("existingRequireJS") && !blanket.options("autoStart")) && QUnitAutostart; + } + if (!QUnit.config.urlConfig[0].tooltip){ //older versions we run coverage automatically //and we change how events are binded QUnit.begin=function(){ blanket.noConflict().setupCoverage(); }; - + QUnit.done=function(failures, total) { blanket.noConflict().onTestsDone(); }; @@ -34,12 +40,13 @@ if (typeof QUnit !== 'undefined'){ label: "Enable coverage", tooltip: "Enable code coverage." }); - + if ( QUnit.urlParams.coverage || blanket.options("autoStart") ) { + QUnit.config.autostart = false; QUnit.begin(function(){ blanket.noConflict().setupCoverage(); }); - + QUnit.done(function(failures, total) { blanket.noConflict().onTestsDone(); }); @@ -55,22 +62,11 @@ if (typeof QUnit !== 'undefined'){ blanket.noConflict().beforeStartTestRunner({ condition: allLoaded, callback: function(){ - if (!(blanket.options("existingRequireJS") && !blanket.options("autoStart"))){ + if (shouldAutoStart()){ QUnit.start(); } } }); - }else{ - if (blanket.options("existingRequireJS")){ requirejs.load = _blanket.utils.oldloader; } - blanket.noConflict().beforeStartTestRunner({ - condition: allLoaded, - callback: function(){ - if (!(blanket.options("existingRequireJS") && !blanket.options("autoStart"))){ - QUnit.start(); - } - }, - coverage:false - }); } } }