Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Fix start on Node when autostart is not set to true #1105

Merged
merged 1 commit into from
Mar 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down