Skip to content

Commit 299c6f1

Browse files
committed
feature: add vitest
1 parent 2b292d6 commit 299c6f1

File tree

10 files changed

+9493
-9
lines changed

10 files changed

+9493
-9
lines changed

build/vite/viteTestConfig.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { UserConfig } from 'vitest/config';
2+
3+
export const createVitestTest = (): UserConfig['test'] => {
4+
return {
5+
environment: 'jsdom',
6+
transformMode: {
7+
web: [/.tsx$/],
8+
},
9+
};
10+
};

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
"preview": "npm run build && vite preview",
1616
"preview:dist": "vite preview",
1717
"log": "conventional-changelog -p cmyr-config -i CHANGELOG.md -s -r 0",
18+
"test": "vitest",
19+
"test:ui": "vitest --ui",
20+
"test:run": "vitest run",
1821
"test:gzip": "http-server dist --cors --gzip -c-1",
1922
"test:br": "http-server dist --cors --brotli -c-1",
2023
"lint:eslint": "eslint \"{src,mock}/**/*.{vue,ts,js,tsx,jsx}\" --fix",
@@ -75,6 +78,7 @@
7578
"@vitejs/plugin-vue": "^3.0.3",
7679
"@vitejs/plugin-vue-jsx": "^2.0.0",
7780
"@vue/compiler-sfc": "^3.2.37",
81+
"@vue/test-utils": "^2.0.2",
7882
"autoprefixer": "^10.4.8",
7983
"commitizen": "^4.2.5",
8084
"conventional-changelog-cli": "^2.2.2",
@@ -90,6 +94,7 @@
9094
"eslint-plugin-vue": "^9.3.0",
9195
"http-server": "^14.1.1",
9296
"husky": "^8.0.1",
97+
"jsdom": "^20.0.0",
9398
"kolorist": "^1.5.1",
9499
"lint-staged": "^13.0.3",
95100
"postcss": "^8.4.16",
@@ -116,6 +121,7 @@
116121
"vite-plugin-pwa": "^0.12.3",
117122
"vite-plugin-style-import": "^2.0.0",
118123
"vite-plugin-svg-icons": "^2.0.1",
124+
"vitest": "^0.23.4",
119125
"vue-eslint-parser": "^9.0.3",
120126
"vue-tsc": "^0.40.1"
121127
},

0 commit comments

Comments
 (0)