diff --git a/package-lock.json b/package-lock.json index fb3dc4a10..19d5b1269 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,6 +49,7 @@ "express-session": "1.18.1", "force-graph": "1.49.0", "fs-extra": "11.3.0", + "happy-dom": "17.1.8", "helmet": "8.0.0", "html": "1.0.0", "html2plaintext": "2.1.4", @@ -10883,6 +10884,28 @@ "integrity": "sha512-3GKBOn+m2LX9iq+JC1064cSFprJY4jL1jCXTcpnfER5HYE2l/4EfWSGzkPa/ZDBmYI0ZOEj5VHV/eKnPGkHuOg==", "license": "MIT" }, + "node_modules/happy-dom": { + "version": "17.1.8", + "resolved": "https://registry.npmjs.org/happy-dom/-/happy-dom-17.1.8.tgz", + "integrity": "sha512-Yxbq/FG79z1rhAf/iB6YM8wO2JB/JDQBy99RiLSs+2siEAi5J05x9eW1nnASHZJbpldjJE2KuFLsLZ+AzX/IxA==", + "license": "MIT", + "dependencies": { + "webidl-conversions": "^7.0.0", + "whatwg-mimetype": "^3.0.0" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/happy-dom/node_modules/whatwg-mimetype": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", + "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", + "license": "MIT", + "engines": { + "node": ">=12" + } + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", diff --git a/package.json b/package.json index 3a592b626..29db7c861 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,9 @@ "docs:build": "npm run docs:build-backend && npm run docs:build-frontend", "build:webpack": "tsx node_modules/webpack/bin/webpack.js -c webpack.config.ts", "build:prepare-dist": "npm run build:webpack && rimraf ./dist && tsc && tsx ./bin/copy-dist.ts", - "test": "cross-env TRILIUM_DATA_DIR=./integration-tests/db TRILIUM_INTEGRATION_TEST=memory vitest", + "test": "npm run test:server && npm run test:client", + "test:server": "cross-env TRILIUM_DATA_DIR=./integration-tests/db TRILIUM_INTEGRATION_TEST=memory vitest", + "test:client": "cross-env TRILIUM_DATA_DIR=./integration-tests/db TRILIUM_INTEGRATION_TEST=memory vitest --root src/public/app", "test:coverage": "cross-env TRILIUM_DATA_DIR=./integration-tests/db vitest --coverage", "test:playwright": "playwright test", "test:integration-edit-db": "cross-env TRILIUM_INTEGRATION_TEST=edit TRILIUM_PORT=8081 TRILIUM_ENV=dev TRILIUM_DATA_DIR=./integration-tests/db nodemon src/main.ts", @@ -99,6 +101,7 @@ "express-session": "1.18.1", "force-graph": "1.49.0", "fs-extra": "11.3.0", + "happy-dom": "17.1.8", "helmet": "8.0.0", "html": "1.0.0", "html2plaintext": "2.1.4", diff --git a/src/public/app/vitest.config.ts b/src/public/app/vitest.config.ts new file mode 100644 index 000000000..3ffc3a485 --- /dev/null +++ b/src/public/app/vitest.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + environment: "happy-dom" + } +}); diff --git a/vitest.config.ts b/vitest.config.ts index eeee86955..8e101f964 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -8,6 +8,7 @@ const customExcludes = [ "tests-examples/**", "node_modules/**", "src/public/app-dist/**", + "src/public/app/**", "libraries/**", "docs/**", "out/**",