Skip to content

Commit c26ac4d

Browse files
test: configure Vitest projects for optimized test timeouts
1 parent b776805 commit c26ac4d

File tree

1 file changed

+46
-13
lines changed

1 file changed

+46
-13
lines changed

vitest.config.mjs

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,21 @@ import {defineConfig} from "vitest/config";
88
*
99
* Parallel execution would require dynamic ports and isolated fixtures,
1010
* so we intentionally cap Vitest at a single worker for now.
11+
*
12+
* Projects separate unit, e2e (Playwright), and electron tests with
13+
* appropriate timeouts for each test type.
1114
*/
1215

1316
export default defineConfig({
1417
test: {
15-
// Global settings
18+
// Shared settings for all test types
1619
globals: true,
1720
environment: "node",
18-
// Setup files for require aliasing
1921
setupFiles: ["./tests/utils/vitest-setup.js"],
20-
// Increased from 20s to 60s for E2E tests, 120s for Electron tests
21-
testTimeout: 120000,
22-
// Increase hook timeout for Electron cleanup
23-
hookTimeout: 30000,
2422
// Stop test execution on first failure
25-
bail: 1,
23+
bail: 3,
2624

27-
// File patterns
28-
include: [
29-
"tests/**/*_spec.js",
30-
// Legacy regression test without the _spec suffix
31-
"tests/unit/modules/default/calendar/calendar_fetcher_utils_bad_rrule.js"
32-
],
25+
// Shared exclude patterns
3326
exclude: [
3427
"**/node_modules/**",
3528
"**/dist/**",
@@ -42,6 +35,46 @@ export default defineConfig({
4235
"tests/utils/**"
4336
],
4437

38+
// Projects with specific configurations per test type
39+
projects: [
40+
{
41+
test: {
42+
name: "unit",
43+
globals: true,
44+
environment: "node",
45+
setupFiles: ["./tests/utils/vitest-setup.js"],
46+
include: [
47+
"tests/unit/**/*_spec.js",
48+
"tests/unit/modules/default/calendar/calendar_fetcher_utils_bad_rrule.js"
49+
],
50+
testTimeout: 20000,
51+
hookTimeout: 10000
52+
}
53+
},
54+
{
55+
test: {
56+
name: "e2e",
57+
globals: true,
58+
environment: "node",
59+
setupFiles: ["./tests/utils/vitest-setup.js"],
60+
include: ["tests/e2e/**/*_spec.js"],
61+
testTimeout: 60000,
62+
hookTimeout: 30000
63+
}
64+
},
65+
{
66+
test: {
67+
name: "electron",
68+
globals: true,
69+
environment: "node",
70+
setupFiles: ["./tests/utils/vitest-setup.js"],
71+
include: ["tests/electron/**/*_spec.js"],
72+
testTimeout: 120000,
73+
hookTimeout: 30000
74+
}
75+
}
76+
],
77+
4578
// Coverage configuration
4679
coverage: {
4780
provider: "v8",

0 commit comments

Comments
 (0)