Skip to content

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

DEV: Update ember-qunit to 9.0.1 (#30358)

Jarek Radosz32ab4449a58b
diff --git a/app/assets/javascripts/discourse/package.json b/app/assets/javascripts/discourse/package.json
index 7b68b167056..93873d16f3d 100644
--- a/app/assets/javascripts/discourse/package.json
+++ b/app/assets/javascripts/discourse/package.json
@@ -97,7 +97,7 @@
"ember-load-initializers": "^3.0.1",
"ember-modifier": "^4.2.0",
"ember-on-resize-modifier": "^2.0.2",
- "ember-qunit": "^8.1.1",
+ "ember-qunit": "^9.0.1",
"ember-source": "~5.12.0",
"ember-template-imports": "^4.2.0",
"ember-test-selectors": "^7.0.0",
diff --git a/app/assets/javascripts/discourse/tests/setup-tests.js b/app/assets/javascripts/discourse/tests/setup-tests.js
index 61395152a5c..450eb5f84f0 100644
--- a/app/assets/javascripts/discourse/tests/setup-tests.js
+++ b/app/assets/javascripts/discourse/tests/setup-tests.js
@@ -10,7 +10,6 @@ import {
setApplication,
setResolver,
} from "@ember/test-helpers";
-import { addModuleExcludeMatcher } from "ember-cli-test-loader/test-support/index";
import $ from "jquery";
import MessageBus from "message-bus-client";
import QUnit from "qunit";
@@ -357,32 +356,6 @@ export default function setupTests(config) {
const hasPluginJs = !!document.querySelector("script[data-discourse-plugin]");
const hasThemeJs = !!document.querySelector("script[data-theme-id]");
- const shouldLoadModule = (name) => {
- if (!/\-test/.test(name)) {
- return false;
- }
-
- const isPlugin = name.match(/\/plugins\//);
- const isTheme = name.match(/\/theme-\d+\//);
- const isCore = !isPlugin && !isTheme;
- const pluginName = name.match(/\/plugins\/([\w-]+)\//)?.[1];
-
- const loadCore = target === "core" || target === "all";
- const loadAllPlugins = target === "plugins" || target === "all";
-
- if (hasThemeJs) {
- return isTheme;
- } else if (isCore && !loadCore) {
- return false;
- } else if (isPlugin && !(loadAllPlugins || pluginName === target)) {
- return false;
- }
-
- return true;
- };
-
- addModuleExcludeMatcher((name) => !shouldLoadModule(name));
-
// forces 0 as duration for all jquery animations
$.fx.off = true;
diff --git a/app/assets/javascripts/discourse/tests/test-boot-ember-cli.js b/app/assets/javascripts/discourse/tests/test-boot-ember-cli.js
index 435e51ba93c..8ae397edca8 100644
--- a/app/assets/javascripts/discourse/tests/test-boot-ember-cli.js
+++ b/app/assets/javascripts/discourse/tests/test-boot-ember-cli.js
@@ -1,5 +1,5 @@
import loadEmberExam from "ember-exam/test-support/load";
-import { start } from "ember-qunit";
+import { setupEmberOnerrorValidation, start } from "ember-qunit";
import * as QUnit from "qunit";
import { setup } from "qunit-dom";
import setupTests from "discourse/tests/setup-tests";
@@ -20,10 +20,10 @@ document.addEventListener("discourse-init", () => {
}
const params = new URLSearchParams(window.location.search);
- const target = params.get("target");
+ const target = params.get("target") || "core";
const testingTheme = !!document.querySelector("script[data-theme-id]");
- const testingCore = !testingTheme && (!target || target === "core");
const disableAutoStart = params.get("qunit_disable_auto_start") === "1";
+ const hasThemeJs = !!document.querySelector("script[data-theme-id]");
document.body.insertAdjacentHTML(
"afterbegin",
@@ -36,6 +36,11 @@ document.addEventListener("discourse-init", () => {
`
);
+ const testingCore = !testingTheme && target === "core";
+ if (testingCore) {
+ setupEmberOnerrorValidation();
+ }
+
setup(QUnit.assert);
setupTests(config.APP);
let loader = loadEmberExam();
@@ -49,11 +54,33 @@ document.addEventListener("discourse-init", () => {
QUnit.config.reorder = false;
}
+ loader.shouldLoadModule = function (name) {
+ if (!/[-_]test$/.test(name)) {
+ return false;
+ }
+
+ const isPlugin = name.match(/\/plugins\//);
+ const isTheme = name.match(/\/theme-\d+\//);
+ const isCore = !isPlugin && !isTheme;
+ const pluginName = name.match(/\/plugins\/([\w-]+)\//)?.[1];
+
+ const loadCore = target === "core" || target === "all";
+ const loadAllPlugins = target === "plugins" || target === "all";
+
+ if (hasThemeJs) {
+ return isTheme;
+ } else if (isCore && !loadCore) {
+ return false;
+ } else if (isPlugin && !(loadAllPlugins || pluginName === target)) {
+ return false;
+ }
+
+ return true;
+ };
loader.loadModules();
start({
setupTestContainer: false,
- loadTests: false,
startTests: !disableAutoStart,
setupEmberOnerrorValidation: testingCore,
setupTestIsolationValidation: true,
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index a25d60aec08..20c1d791ad0 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -497,7 +497,7 @@ importers:
version: 6.1.1
ember-exam:
specifier: ^9.0.0
ember-load-initializers:
specifier: ^3.0.1
version: 3.0.1([email protected](patch_hash=xx7mvsb7nmshqkkqhmf45r3hse)(@glimmer/[email protected](@babel/[email protected]))(@glint/[email protected])([email protected])([email protected](@swc/[email protected])([email protected])))
@@ -508,8 +508,8 @@ importers:
specifier: ^2.0.2
ember-qunit:
- specifier: ^8.1.1
+ specifier: ^9.0.1
ember-source:
specifier: ~5.12.0
version: 5.12.0(patch_hash=xx7mvsb7nmshqkkqhmf45r3hse)(@glimmer/[email protected](@babel/[email protected]))(@glint/[email protected])([email protected])([email protected](@swc/[email protected])([email protected]))
@@ -4302,10 +4302,6 @@ packages:
resolution: {integrity: sha512-Ej77K+YhCZImotoi/CU2cfsoZaswoPlGaM5TB3LvjvPDlVPRhxUHO2RsaUVC5lsGeRLRiHCOxVtoJ6GyqexzFA==}
engines: {node: 10.* || 12.* || >= 14}
- resolution: {integrity: sha512-0aocZV9SIoOHiU3hrH3IuLR6busWhTX6UVXgd490hmJkIymmOXNH2+jJoC7Ebkeo3PiOfAdjqhb765QDlHSJOw==}
- engines: {node: 10.* || >= 12}
-
resolution: {integrity: sha512-g0weUTOnHmPGqVZzkQTl3Nbk9fzEdFkEXydCs5mT1qBjXh8eQ6VlmjjGD5/998UXKuA0pLSCVVMbSp/linLzGA==}
@@ -4394,8 +4390,8 @@ packages:
resolution: {integrity: sha512-7mcD7CNbiCaZEIASWlRz/Wmn47afCMSFTdQJSSUe0WCgnXxn9DVoqZ39B7ZuddTHa0V6otTFrV/lIRYpggQ+eg==}
engines: {node: 12.* || 14.* || >= 16}
- resolution: {integrity: sha512-nT+6s74j3BKNn+QQY/hINC3Xw3kn0NF0cU9zlgVQmCBWoyis1J24xWrY2LFOMThPmF6lHqcrUb5JwvBD4BXEXg==}
+ resolution: {integrity: sha512-9DgjczFG7ZjINmwWFYDtUF8McbYqQir82hyFp/ZbMOLkpFvHCKPw1mtKcpcdLnLAAYJpwR2/MCyPNiEMkR11aA==}
peerDependencies:
'@ember/test-helpers': '>=3.0.3'
ember-source: '>=4.0.0'
@@ -12376,12 +12372,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
- dependencies:
- ember-cli-babel: 7.26.11
- transitivePeerDependencies:
- - supports-color
-
dependencies:
chalk: 4.1.2
@@ -12637,7 +12627,7 @@ snapshots:
transitivePeerDependencies:
- eslint
dependencies:
'@babel/core': 7.26.0([email protected])
chalk: 5.3.0
@@ -12645,7 +12635,7 @@ snapshots:
debug: 4.3.6
ember-cli-babel: 8.2.0(@babel/[email protected])
ember-source: 5.12.0(patch_hash=xx7mvsb7nmshqkkqhmf45r3hse)(@glimmer/[email protected](@babel/[email protected]))(@glint/[email protected])([email protected])([email protected](@swc/[email protected])([email protected]))
execa: 8.0.1
fs-extra: 11.2.0
@@ -12699,12 +12689,11 @@ snapshots:
- supports-color
- webpack
dependencies:
'@ember/test-helpers': 4.0.4(@babel/[email protected])(@glint/[email protected])([email protected](patch_hash=xx7mvsb7nmshqkkqhmf45r3hse)(@glimmer/[email protected](@babel/[email protected]))(@glint/[email protected])([email protected])([email protected](@swc/[email protected])([email protected])))
'@embroider/addon-shim': 1.9.0
'@embroider/macros': 1.16.10(@glint/[email protected])
- ember-cli-test-loader: 3.1.0
ember-source: 5.12.0(patch_hash=xx7mvsb7nmshqkkqhmf45r3hse)(@glimmer/[email protected](@babel/[email protected]))(@glint/[email protected])([email protected])([email protected](@swc/[email protected])([email protected]))
qunit: 2.23.1
qunit-theme-ember: 1.0.0