Skip to content

A platform for community discussion. Free, open, simple.

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

Robin Warde429af8220aa
diff --git a/app/assets/javascripts/discourse/tests/setup-tests.js b/app/assets/javascripts/discourse/tests/setup-tests.js
index 266b81b3e89..be43cc10826 100644
--- a/app/assets/javascripts/discourse/tests/setup-tests.js
+++ b/app/assets/javascripts/discourse/tests/setup-tests.js
@@ -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);
diff --git a/test/run-qunit.js b/test/run-qunit.js
index 9438b34679f..9737efc35aa 100644
--- a/test/run-qunit.js
+++ b/test/run-qunit.js
@@ -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();