Repository navigation
Expand file tree
/
Copy pathvitest.config.mts
More file actions
59 lines (55 loc) · 1.61 KB
/
Copy pathvitest.config.mts
File metadata and controls
59 lines (55 loc) · 1.61 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
56
57
58
59
import { playwright } from "@vitest/browser-playwright";
import process from "node:process";
import { defineConfig, defineProject } from "vitest/config";
// 8 browser providers each add a SIGTERM listener
process.setMaxListeners(20);
// Packages with browser-mode unit tests (`*.test.ts`):
const UNIT_PACKAGES = [
"sigma",
"node-image",
"node-border",
"node-piechart",
"utils",
"layer-leaflet",
"layer-maplibre",
"layout-fa2-gpu",
];
// Packages with type tests (`*.test-d.ts`). Browser (Playwright) tests live in
// `packages/browser-tests` and run separately — not part of this config.
const TYPE_PACKAGES = ["sigma", "node-image", "node-border", "node-piechart"];
export default defineConfig({
test: {
projects: [
...UNIT_PACKAGES.map((pkg) =>
defineProject({
test: {
name: pkg,
root: `packages/${pkg}`,
include: ["src/**/*.test.ts"],
browser: {
enabled: true,
provider: playwright(),
instances: [{ browser: "chromium", headless: true }],
},
},
}),
),
// Typecheck projects: no browser, isolated so `--project '!*:types'` can
// skip them when only unit tests are wanted.
...TYPE_PACKAGES.map((pkg) =>
defineProject({
test: {
name: `${pkg}:types`,
root: `packages/${pkg}`,
include: [],
typecheck: {
enabled: true,
include: ["src/**/*.test-d.ts"],
ignoreSourceErrors: true,
},
},
}),
),
],
},
});