From cb9e2f3abeb5dd1761cc04e65236b1fa17c7607b Mon Sep 17 00:00:00 2001 From: Trent Willis Date: Fri, 10 Mar 2017 17:47:25 -0800 Subject: [PATCH] Core: Fix start on Node when autostart is not set to true --- src/core.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/core.js b/src/core.js index 04ac68f90..0aae4aa24 100644 --- a/src/core.js +++ b/src/core.js @@ -129,16 +129,18 @@ extend( QUnit, { } else if ( config.autostart ) { throw new Error( "Called start() outside of a test context when " + "QUnit.config.autostart was true" ); - } else if ( !defined.document && !config.pageLoaded ) { - - // Starts from Node even if .load was not previously called. We return - // early otherwise we'll wind up "beginning" twice. - QUnit.load(); - return; } else if ( !config.pageLoaded ) { - // The page isn't completely loaded yet, so bail out and let `QUnit.load` handle it + // The page isn't completely loaded yet, so we set autostart and then + // load if we're in Node or wait for the browser's load event. config.autostart = true; + + // Starts from Node even if .load was not previously called. We still return + // early otherwise we'll wind up "beginning" twice. + if ( !defined.document ) { + QUnit.load(); + } + return; } } else {