DEV: Add "loop until failure" feature to QUnit (#24545)

This commit is contained in:
Jarek Radosz 2023-11-24 13:15:43 +01:00 committed by GitHub
parent 1f2a25331b
commit e98ac4736e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -139,6 +139,12 @@ function setupToolbar() {
?.content.querySelectorAll("script[data-discourse-plugin]")
.forEach((script) => pluginNames.add(script.dataset.discoursePlugin));
QUnit.config.urlConfig.push({
id: "loop",
label: "Loop until failure",
value: "1",
});
QUnit.config.urlConfig.push({
id: "target",
label: "Target",
@ -356,6 +362,14 @@ export default function setupTests(config) {
QUnit.config.autostart = false;
}
if (getUrlParameter("loop")) {
QUnit.done(({ failed }) => {
if (failed === 0) {
window.location.reload();
}
});
}
handleLegacyParameters();
const target = getUrlParameter("target") || "core";