From: btea <2356281422@qq.com> Date: Thu, 23 Feb 2023 13:26:34 +0000 (+0800) Subject: fix: use a standalone config file for the vitest (#227) X-Git-Tag: v3.6.0~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89a84035c3bf85bfc66641da596148559c74a9c7;p=thirdparty%2Fvuejs%2Fcreate-vue.git fix: use a standalone config file for the vitest (#227) Co-authored-by: Haoqun Jiang Fixes #221 Fixes #199 --- diff --git a/template/config/vitest/package.json b/template/config/vitest/package.json index 57a87462..7bae9296 100644 --- a/template/config/vitest/package.json +++ b/template/config/vitest/package.json @@ -1,6 +1,6 @@ { "scripts": { - "test:unit": "vitest --environment jsdom --root src/" + "test:unit": "vitest" }, "dependencies": { "vue": "^3.2.47" diff --git a/template/config/vitest/vitest.config.js b/template/config/vitest/vitest.config.js new file mode 100644 index 00000000..a2f57a5d --- /dev/null +++ b/template/config/vitest/vitest.config.js @@ -0,0 +1,15 @@ +import { fileURLToPath } from 'node:url' +import { mergeConfig } from 'vite' +import { configDefaults, defineConfig } from 'vitest/config' +import viteConfig from './vite.config' + +export default mergeConfig( + viteConfig, + defineConfig({ + test: { + environment: 'jsdom', + exclude: [...configDefaults.exclude, 'e2e/*'], + root: fileURLToPath(new URL('./', import.meta.url)) + } + }) +)