FIX: QUnit tests could time out based on load order (#12342)

By default our QUnit test runner starts automatically. This is normally
fine but for our `run-qunit.js` script we add a bunch of QUnit events
using `eval` and sometimes those events were added after the tests
already started/finished resulting in a hang.

This adds a new parameter that will cause QUnit not to run
automatically, which the runner uses, then triggers a `start()` when it
knows it's ready.
This commit is contained in:
Robin Ward 2021-03-10 13:32:20 -05:00 committed by GitHub
parent b3bcf2769a
commit e429af8220
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -244,6 +244,9 @@ function setupTestsCommon(application, container, config) {
let pluginPath = getUrlParameter("qunit_single_plugin") let pluginPath = getUrlParameter("qunit_single_plugin")
? "/" + getUrlParameter("qunit_single_plugin") + "/" ? "/" + getUrlParameter("qunit_single_plugin") + "/"
: "/plugins/"; : "/plugins/";
if (getUrlParameter("qunit_disable_auto_start") === "1") {
QUnit.config.autostart = false;
}
Object.keys(requirejs.entries).forEach(function (entry) { Object.keys(requirejs.entries).forEach(function (entry) {
let isTest = /\-test/.test(entry); let isTest = /\-test/.test(entry);

View File

@ -106,8 +106,9 @@ async function runAllTests() {
} }
}); });
console.log("navigate to " + args[0]); let url = args[0] + "&qunit_disable_auto_start=1";
Page.navigate({ url: args[0] }); console.log("navigate to ", url);
Page.navigate({ url });
Page.loadEventFired(async () => { Page.loadEventFired(async () => {
let qff = process.env.QUNIT_FAIL_FAST; let qff = process.env.QUNIT_FAIL_FAST;
@ -281,6 +282,7 @@ function logQUnit() {
window.qunitDone = context; window.qunitDone = context;
}); });
QUnit.start();
} }
let qunit_script = logQUnit.toString(); let qunit_script = logQUnit.toString();