mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:57:10 -06:00
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:
parent
b3bcf2769a
commit
e429af8220
@ -244,6 +244,9 @@ function setupTestsCommon(application, container, config) {
|
||||
let pluginPath = getUrlParameter("qunit_single_plugin")
|
||||
? "/" + getUrlParameter("qunit_single_plugin") + "/"
|
||||
: "/plugins/";
|
||||
if (getUrlParameter("qunit_disable_auto_start") === "1") {
|
||||
QUnit.config.autostart = false;
|
||||
}
|
||||
|
||||
Object.keys(requirejs.entries).forEach(function (entry) {
|
||||
let isTest = /\-test/.test(entry);
|
||||
|
@ -106,8 +106,9 @@ async function runAllTests() {
|
||||
}
|
||||
});
|
||||
|
||||
console.log("navigate to " + args[0]);
|
||||
Page.navigate({ url: args[0] });
|
||||
let url = args[0] + "&qunit_disable_auto_start=1";
|
||||
console.log("navigate to ", url);
|
||||
Page.navigate({ url });
|
||||
|
||||
Page.loadEventFired(async () => {
|
||||
let qff = process.env.QUNIT_FAIL_FAST;
|
||||
@ -281,6 +282,7 @@ function logQUnit() {
|
||||
|
||||
window.qunitDone = context;
|
||||
});
|
||||
QUnit.start();
|
||||
}
|
||||
let qunit_script = logQUnit.toString();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user