Skip to content

Commit 89a8403

Browse files
authored
fix: use a standalone config file for the vitest (#227)
Co-authored-by: Haoqun Jiang <[email protected]> Fixes #221 Fixes #199
1 parent 9fde3d1 commit 89a8403

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Diff for: template/config/vitest/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"scripts": {
3-
"test:unit": "vitest --environment jsdom --root src/"
3+
"test:unit": "vitest"
44
},
55
"dependencies": {
66
"vue": "^3.2.47"

Diff for: template/config/vitest/vitest.config.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { fileURLToPath } from 'node:url'
2+
import { mergeConfig } from 'vite'
3+
import { configDefaults, defineConfig } from 'vitest/config'
4+
import viteConfig from './vite.config'
5+
6+
export default mergeConfig(
7+
viteConfig,
8+
defineConfig({
9+
test: {
10+
environment: 'jsdom',
11+
exclude: [...configDefaults.exclude, 'e2e/*'],
12+
root: fileURLToPath(new URL('./', import.meta.url))
13+
}
14+
})
15+
)

0 commit comments

Comments
 (0)