-
-
Notifications
You must be signed in to change notification settings - Fork 392
Expand file tree
/
Copy pathvitest.config.ts
More file actions
55 lines (52 loc) · 1.58 KB
/
vitest.config.ts
File metadata and controls
55 lines (52 loc) · 1.58 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import {defineConfig} from "vitest/config";
import path from "node:path";
const root = import.meta.dirname;
function appPath(subpath: string): string {
return `${path.resolve(root, "app/javascript", subpath)}/`;
}
export default defineConfig({
resolve: {
alias: [
{find: /^channels\//u, replacement: appPath("channels")},
{find: /^controllers\//u, replacement: appPath("controllers")},
{find: /^helpers\//u, replacement: appPath("helpers")},
{find: /^javascript\//u, replacement: appPath("")},
{find: /^spec\//u, replacement: `${path.resolve(root, "spec")}/`},
{find: "bootstrap", replacement: path.resolve(root, "node_modules/bootstrap/dist/js/bootstrap.js")},
{find: "mousetrap", replacement: path.resolve(root, "node_modules/mousetrap/mousetrap.js")},
{
find: /^support\//u,
replacement: `${path.resolve(root, "spec/javascript/support")}/`,
},
],
},
test: {
coverage: {
exclude: ["app/javascript/@types/**"],
include: ["app/javascript/**/*.ts"],
provider: "v8",
reportsDirectory: "coverage/vitest",
thresholds: {
branches: 0,
functions: 0,
lines: 0,
statements: 0,
},
},
environment: "jsdom",
environmentOptions: {
jsdom: {
url: "http://test.host",
},
},
globals: true,
include: ["spec/javascript/**/*_spec.ts"],
outputFile: {
junit: "/tmp/test-results/junit.xml",
},
reporters: ["default", "junit"],
restoreMocks: true,
root: ".",
setupFiles: ["spec/javascript/setup.ts"],
},
});