-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathvitest.config.js
More file actions
41 lines (39 loc) · 1.23 KB
/
vitest.config.js
File metadata and controls
41 lines (39 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { defineConfig } from "vitest/config";
import vue from "@vitejs/plugin-vue2";
import path from "node:path";
const isCI = !!process.env.CI;
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
// Critical: Vue Test Utils uses CJS, Vitest uses ESM
vue: "vue/dist/vue.runtime.common.js",
"@": path.resolve(__dirname, "app/javascript"),
"@test": path.resolve(__dirname, "spec/javascript"),
},
extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
},
css: {
// Skip PostCSS processing in tests (postcss-import etc. are not installed as devDeps)
postcss: {},
},
test: {
globals: true,
environment: "jsdom",
dir: "spec/javascript",
include: ["**/*.spec.js"],
setupFiles: ["./spec/javascript/setup.js"],
// Worker threads are ~15-20% faster than forks for pure jsdom tests
pool: "threads",
// Minimal output in CI, standard locally
reporters: isCI ? ["dot"] : "default",
// Coverage configuration for SonarCloud integration
coverage: {
provider: "v8",
reporter: ["lcov"],
reportsDirectory: "coverage/js",
include: ["app/javascript/**/*.{js,vue}"],
exclude: ["app/javascript/packs/**"],
},
},
});