test: introduce and set up unit tests in the UI (#486)

This commit is contained in:
Fine0830
2025-08-05 11:48:07 +08:00
committed by GitHub
parent ad4b0639cd
commit b73ae65efc
20 changed files with 3061 additions and 63 deletions

View File

@@ -6,8 +6,6 @@
"dev": "vite",
"build": "run-p type-check build-only",
"preview": "vite preview",
"test:unit": "vitest --environment jsdom --root src/",
"test:e2e:dev": "start-server-and-test 'vite dev --port 4173' :4173 'cypress open --e2e'",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
@@ -15,7 +13,17 @@
"lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
"lint:lint-staged": "lint-staged",
"prepare": "husky install",
"check-components-types": "if (! git diff --quiet -U0 ./src/types); then echo 'type files are not updated correctly'; git diff -U0 ./src/types; exit 1; fi"
"check-components-types": "if (! git diff --quiet -U0 ./src/types); then echo 'type files are not updated correctly'; git diff -U0 ./src/types; exit 1; fi",
"test:unit": "vitest --environment jsdom --root src/",
"test:unit:watch": "vitest --environment jsdom --root src/ --watch",
"test:unit:coverage": "vitest --environment jsdom --root src/ --coverage",
"test:utils": "vitest --environment jsdom src/utils/**/*.spec.ts",
"test:components": "vitest --environment jsdom src/components/**/*.spec.ts",
"test:hooks": "vitest --environment jsdom src/hooks/**/*.spec.ts",
"test:stores": "vitest --environment jsdom src/store/**/*.spec.ts",
"test:views": "vitest --environment jsdom src/views/**/*.spec.ts",
"test:all": "vitest --environment jsdom --root src/ --coverage --reporter=verbose",
"test:e2e:dev": "start-server-and-test 'vite dev --port 4173' :4173 'cypress open --e2e'"
},
"dependencies": {
"d3": "^7.3.0",
@@ -44,6 +52,7 @@
"@types/three": "^0.131.0",
"@vitejs/plugin-vue": "^5.2.1",
"@vitejs/plugin-vue-jsx": "^4.1.1",
"@vitest/coverage-v8": "^3.0.6",
"@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^11.0.0",
"@vue/test-utils": "^2.2.6",