-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathvitest.config.ts
More file actions
50 lines (47 loc) · 2.2 KB
/
Copy pathvitest.config.ts
File metadata and controls
50 lines (47 loc) · 2.2 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
import {defineConfig, mergeConfig} from "vitest/config";
import {playwright} from "@vitest/browser-playwright";
import {storybookTest} from "@storybook/addon-vitest/vitest-plugin";
import viteConfig from "./vite.config";
// More info at: https://storybook.js.org/docs/writing-tests/vitest-plugin
export default mergeConfig(
viteConfig,
defineConfig({
test: {
projects: [
{
extends: true,
plugins: [
// See options at: https://storybook.js.org/docs/writing-tests/vitest-plugin#storybooktest
storybookTest({
configDir: ".storybook",
storybookUrl:
process.env.SB_URL || "http://localhost:6061",
}),
],
test: {
name: "storybook",
// Run story files serially in a single Chromium
// process to keep peak memory under the CI runner's
// limit. Browser mode spawns one Chromium process per
// worker; the ~170-file suite had grown large enough to
// OOM-kill the runner (exit 137) at the default worker
// count, and `maxWorkers: 2` was still borderline
// (passed once, then died ~150 files in). One worker
// minimizes concurrent browser memory, leaving headroom
// for the node coordinator; per-file isolation (the
// vitest default) keeps that single browser near
// steady-state. Trades wall-clock time for reliability.
maxWorkers: 1,
browser: {
enabled: true,
instances: [{browser: "chromium"}],
headless: true,
provider: playwright({}),
},
setupFiles: ["./.storybook/vitest.setup.ts"],
},
},
],
},
}),
);