chore: 移除测试相关依赖和脚本
This commit is contained in:
10
package.json
10
package.json
@@ -10,10 +10,6 @@
|
|||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"build-only": "vite build",
|
"build-only": "vite build",
|
||||||
"type-check": "vue-tsc --noEmit",
|
"type-check": "vue-tsc --noEmit",
|
||||||
"test": "vitest",
|
|
||||||
"test:ui": "vitest --ui",
|
|
||||||
"test:run": "vitest run",
|
|
||||||
"test:coverage": "vitest run --coverage",
|
|
||||||
"lint:eslint": "eslint --cache \"src/**/*.{vue,ts,js}\" --fix",
|
"lint:eslint": "eslint --cache \"src/**/*.{vue,ts,js}\" --fix",
|
||||||
"lint:prettier": "prettier --write \"**/*.{js,cjs,ts,json,css,scss,vue,html,md}\"",
|
"lint:prettier": "prettier --write \"**/*.{js,cjs,ts,json,css,scss,vue,html,md}\"",
|
||||||
"lint:stylelint": "stylelint --cache \"**/*.{css,scss,vue}\" --fix",
|
"lint:stylelint": "stylelint --cache \"**/*.{css,scss,vue}\" --fix",
|
||||||
@@ -79,8 +75,6 @@
|
|||||||
"@commitlint/config-conventional": "^20.5.0",
|
"@commitlint/config-conventional": "^20.5.0",
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^10.0.1",
|
||||||
"@iconify/utils": "^3.1.0",
|
"@iconify/utils": "^3.1.0",
|
||||||
"@testing-library/user-event": "^14.6.1",
|
|
||||||
"@testing-library/vue": "^8.1.0",
|
|
||||||
"@types/codemirror": "^5.60.17",
|
"@types/codemirror": "^5.60.17",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/node": "^25.5.0",
|
"@types/node": "^25.5.0",
|
||||||
@@ -91,8 +85,6 @@
|
|||||||
"@typescript-eslint/eslint-plugin": "^8.57.0",
|
"@typescript-eslint/eslint-plugin": "^8.57.0",
|
||||||
"@typescript-eslint/parser": "^8.57.0",
|
"@typescript-eslint/parser": "^8.57.0",
|
||||||
"@vitejs/plugin-vue": "^6.0.5",
|
"@vitejs/plugin-vue": "^6.0.5",
|
||||||
"@vitest/ui": "^4.1.0",
|
|
||||||
"@vue/test-utils": "^2.4.6",
|
|
||||||
"autoprefixer": "^10.4.27",
|
"autoprefixer": "^10.4.27",
|
||||||
"commitizen": "^4.3.1",
|
"commitizen": "^4.3.1",
|
||||||
"cz-git": "^1.12.0",
|
"cz-git": "^1.12.0",
|
||||||
@@ -101,7 +93,6 @@
|
|||||||
"eslint-plugin-prettier": "^5.5.5",
|
"eslint-plugin-prettier": "^5.5.5",
|
||||||
"eslint-plugin-vue": "^10.8.0",
|
"eslint-plugin-vue": "^10.8.0",
|
||||||
"globals": "^17.4.0",
|
"globals": "^17.4.0",
|
||||||
"happy-dom": "^20.8.4",
|
|
||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
"lint-staged": "^16.4.0",
|
"lint-staged": "^16.4.0",
|
||||||
"postcss": "^8.5.8",
|
"postcss": "^8.5.8",
|
||||||
@@ -124,7 +115,6 @@
|
|||||||
"unplugin-vue-components": "^31.0.0",
|
"unplugin-vue-components": "^31.0.0",
|
||||||
"vite": "^8.0.0",
|
"vite": "^8.0.0",
|
||||||
"vite-plugin-mock-dev-server": "^2.1.0",
|
"vite-plugin-mock-dev-server": "^2.1.0",
|
||||||
"vitest": "^4.1.0",
|
|
||||||
"vue-eslint-parser": "^10.4.0",
|
"vue-eslint-parser": "^10.4.0",
|
||||||
"vue-tsc": "^3.2.5"
|
"vue-tsc": "^3.2.5"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
/**
|
|
||||||
* 测试环境全局配置
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { vi } from "vitest";
|
|
||||||
|
|
||||||
// Mock window.matchMedia
|
|
||||||
Object.defineProperty(window, "matchMedia", {
|
|
||||||
writable: true,
|
|
||||||
value: vi.fn().mockImplementation((query) => ({
|
|
||||||
matches: false,
|
|
||||||
media: query,
|
|
||||||
onchange: null,
|
|
||||||
addListener: vi.fn(),
|
|
||||||
removeListener: vi.fn(),
|
|
||||||
addEventListener: vi.fn(),
|
|
||||||
removeEventListener: vi.fn(),
|
|
||||||
dispatchEvent: vi.fn(),
|
|
||||||
})),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Mock IntersectionObserver
|
|
||||||
global.IntersectionObserver = class IntersectionObserver {
|
|
||||||
constructor() {}
|
|
||||||
disconnect() {}
|
|
||||||
observe() {}
|
|
||||||
takeRecords() {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
unobserve() {}
|
|
||||||
} as any;
|
|
||||||
|
|
||||||
// Mock ResizeObserver
|
|
||||||
global.ResizeObserver = class ResizeObserver {
|
|
||||||
constructor() {}
|
|
||||||
disconnect() {}
|
|
||||||
observe() {}
|
|
||||||
unobserve() {}
|
|
||||||
} as any;
|
|
||||||
|
|
||||||
// Mock Element.scrollIntoView
|
|
||||||
Element.prototype.scrollIntoView = vi.fn();
|
|
||||||
|
|
||||||
// Mock __APP_INFO__
|
|
||||||
(globalThis as any).__APP_INFO__ = {
|
|
||||||
pkg: {
|
|
||||||
name: "vue3-element-admin",
|
|
||||||
version: "4.0.0",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// Mock console methods to reduce noise in tests
|
|
||||||
global.console = {
|
|
||||||
...console,
|
|
||||||
log: vi.fn(),
|
|
||||||
debug: vi.fn(),
|
|
||||||
info: vi.fn(),
|
|
||||||
warn: vi.fn(),
|
|
||||||
error: vi.fn(),
|
|
||||||
};
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
import { defineConfig } from "vitest/config";
|
|
||||||
import vue from "@vitejs/plugin-vue";
|
|
||||||
import { resolve } from "path";
|
|
||||||
import AutoImport from "unplugin-auto-import/vite";
|
|
||||||
import Components from "unplugin-vue-components/vite";
|
|
||||||
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
plugins: [
|
|
||||||
vue(),
|
|
||||||
// API 自动导入
|
|
||||||
AutoImport({
|
|
||||||
imports: ["vue", "@vueuse/core", "pinia", "vue-router", "vue-i18n"],
|
|
||||||
resolvers: [ElementPlusResolver()],
|
|
||||||
dts: false,
|
|
||||||
}),
|
|
||||||
// 组件自动导入
|
|
||||||
Components({
|
|
||||||
resolvers: [ElementPlusResolver()],
|
|
||||||
dts: false,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
test: {
|
|
||||||
// 使用 happy-dom 作为测试环境(比 jsdom 快)
|
|
||||||
environment: "happy-dom",
|
|
||||||
|
|
||||||
// 全局测试 API(describe, it, expect 等)
|
|
||||||
globals: true,
|
|
||||||
|
|
||||||
// 测试环境设置文件
|
|
||||||
setupFiles: ["./tests/setup.ts"],
|
|
||||||
|
|
||||||
// 覆盖率配置
|
|
||||||
coverage: {
|
|
||||||
provider: "v8",
|
|
||||||
reporter: ["text", "json", "html"],
|
|
||||||
exclude: [
|
|
||||||
"node_modules/",
|
|
||||||
"tests/",
|
|
||||||
"**/*.d.ts",
|
|
||||||
"**/*.config.*",
|
|
||||||
"**/mockData",
|
|
||||||
"**/.{idea,git,cache,output,temp}",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
// 测试文件匹配规则
|
|
||||||
include: ["tests/**/*.{test,spec}.{js,ts}"],
|
|
||||||
|
|
||||||
// 测试超时时间
|
|
||||||
testTimeout: 10000,
|
|
||||||
},
|
|
||||||
|
|
||||||
resolve: {
|
|
||||||
alias: {
|
|
||||||
"@": resolve(__dirname, "./src"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user