Switch to happy-dom for testing (#29948)

Use `happy-dom` again in vitest as it has caught up recently to `jsdom`
in terms of features and it is a much more lightweight solution.

I encountered [one
bug](https://github.com/capricorn86/happy-dom/issues/1342), but it's an
easy workaround until fixed.

I regenerated the lockfile to get rid of the transitive dependencies so
that's why the diff also has some upgrades in it.

In total, this change removes 39 npm dependencies.
This commit is contained in:
silverwind 2024-03-21 15:05:24 +01:00 committed by GitHub
parent 62f8174aa2
commit 82979588f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 323 additions and 1066 deletions

1383
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -84,7 +84,7 @@
"eslint-plugin-vue": "9.23.0", "eslint-plugin-vue": "9.23.0",
"eslint-plugin-vue-scoped-css": "2.7.2", "eslint-plugin-vue-scoped-css": "2.7.2",
"eslint-plugin-wc": "2.0.4", "eslint-plugin-wc": "2.0.4",
"jsdom": "24.0.0", "happy-dom": "14.2.0",
"markdownlint-cli": "0.39.0", "markdownlint-cli": "0.39.0",
"postcss-html": "1.6.0", "postcss-html": "1.6.0",
"stylelint": "16.2.1", "stylelint": "16.2.1",

View File

@ -6,7 +6,7 @@ export default defineConfig({
test: { test: {
include: ['web_src/**/*.test.js'], include: ['web_src/**/*.test.js'],
setupFiles: ['web_src/js/vitest.setup.js'], setupFiles: ['web_src/js/vitest.setup.js'],
environment: 'jsdom', environment: 'happy-dom',
testTimeout: 20000, testTimeout: 20000,
open: false, open: false,
allowOnly: true, allowOnly: true,

View File

@ -205,7 +205,7 @@ export const SvgIcon = {
// make the <SvgIcon class="foo" class-name="bar"> classes work together // make the <SvgIcon class="foo" class-name="bar"> classes work together
const classes = []; const classes = [];
for (const cls of svgOuter.classList) { for (const cls of svgOuter.classList.values()) {
classes.push(cls); classes.push(cls);
} }
// TODO: drop the `className/class-name` prop in the future, only use "class" prop // TODO: drop the `className/class-name` prop in the future, only use "class" prop