-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathvitest.config.ts
More file actions
55 lines (51 loc) · 2.09 KB
/
Copy pathvitest.config.ts
File metadata and controls
55 lines (51 loc) · 2.09 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 { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig } from "vitest/config";
const __dirname = dirname(fileURLToPath(import.meta.url));
/**
* Vitest config for repo-root `/src` and `/scripts` tests (FR-2609).
*
* These are small Node-environment suites (pep440, dev-config, gen-theme-schema,
* i18n-merge-driver) that previously ran under `ts-jest`. They do not need a
* browser DOM, React, or Relay — so this config is deliberately minimal and
* does not share the `@vitejs/plugin-react` transform pipeline used by
* `react/vitest.config.ts` and `packages/backend.ai-ui/vitest.config.ts`.
*/
export default defineConfig({
test: {
globals: true,
environment: "node",
include: ["{src,scripts}/**/*.{test,spec}.ts"],
exclude: [
"**/node_modules/**",
"**/build/**",
"**/dist/**",
// react/ and packages/ workspaces have their own vitest configs.
"react/**",
"packages/**",
],
// V8 coverage instrumentation slows down tests significantly on CI's
// smaller boxes. `gen-theme-schema.test.ts > generates a valid JSON
// schema file` exercises the antd type tree several times per test
// and routinely takes 5–10s under coverage. Bump the per-test timeout
// so CI matches a normal local run without coverage.
testTimeout: 30000,
// Coverage settings — see comment in `react/vitest.config.ts`. Same
// reporters and provider so the `davelosert/vitest-coverage-report-action`
// PR comment shape is consistent across the three workspaces.
coverage: {
provider: "v8",
reporter: ["text", "json", "json-summary"],
reportsDirectory: "coverage",
include: ["{src,scripts}/**/*.{ts,js,cjs}"],
exclude: [
"{src,scripts}/**/*.{test,spec}.ts",
"src/wsproxy/**",
// Build tooling — instrumenting these slows tests without giving
// useful coverage signal. They are exercised end-to-end by the
// tests but the coverage % of build scripts is not actionable.
"scripts/**/*.cjs",
],
},
},
});