Skip to content

Commit 1f49474

Browse files
committed
🤖 ci: speed up integration suite
- Run heavy runtime-only suites only for local runtime to keep remote fixtures lightweight. - Ensure CI uses at least 2 Jest workers so the integration suite stays under the 10-minute job timeout.
1 parent 545ffee commit 1f49474

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

jest.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ module.exports = {
2121
// Transform ESM modules to CommonJS for Jest
2222
transformIgnorePatterns: ["node_modules/(?!(@orpc|shiki|json-schema-typed|rou3)/)"],
2323
// Run tests in parallel (use 50% of available cores, or 4 minimum)
24-
maxWorkers: "50%",
24+
// CI runners often have a low core count; "50%" can result in a single Jest worker,
25+
// which can push the integration job over its 10-minute timeout.
26+
maxWorkers: process.env.CI ? 2 : "50%",
2527
// Force exit after tests complete to avoid hanging on lingering handles
2628
forceExit: true,
2729
// 10 minute timeout for integration tests, 10s for unit tests

tests/runtime/runtime.test.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,18 @@ describeIntegration("Runtime integration tests", () => {
7676

7777
// DockerRuntime is slower than local/ssh, and the integration job has a hard
7878
// time budget. Keep the Docker coverage focused on the core Runtime contract.
79+
const describeLocalOnly = type === "local" ? describe : describe.skip;
80+
7981
const describeNonDocker = type === "docker" ? describe.skip : describe;
8082

8183
// Running these runtime contract tests with test.concurrent can easily overwhelm
8284
// the docker/ssh fixtures in CI and cause the overall integration job to hit its
8385
// 10-minute timeout. Keep runtime tests deterministic by running them sequentially
8486
// for remote runtimes.
8587
const testForRuntime = type === "local" ? test.concurrent : test;
88+
const isRemote = type !== "local";
89+
const testLocalOnly = isRemote ? test.skip : testForRuntime;
90+
const testDockerOnly = type === "docker" ? testForRuntime : test.skip;
8691
const createRuntime = (): Runtime =>
8792
createTestRuntime(
8893
type,
@@ -121,7 +126,7 @@ describeIntegration("Runtime integration tests", () => {
121126
expect(result.exitCode).toBe(42);
122127
});
123128

124-
testForRuntime("handles stdin input", async () => {
129+
testLocalOnly("handles stdin input", async () => {
125130
const runtime = createRuntime();
126131
await using workspace = await TestWorkspace.create(runtime, type);
127132

@@ -174,7 +179,7 @@ describeIntegration("Runtime integration tests", () => {
174179
expect(result.exitCode).toBe(0);
175180
});
176181

177-
testForRuntime("handles commands with quotes and special characters", async () => {
182+
testLocalOnly("handles commands with quotes and special characters", async () => {
178183
const runtime = createRuntime();
179184
await using workspace = await TestWorkspace.create(runtime, type);
180185

@@ -194,7 +199,7 @@ describeIntegration("Runtime integration tests", () => {
194199

195200
expect(result.stdout.trim()).toContain(workspace.path);
196201
});
197-
testForRuntime(
202+
testLocalOnly(
198203
"handles timeout correctly",
199204
async () => {
200205
const runtime = createRuntime();
@@ -272,7 +277,7 @@ describeIntegration("Runtime integration tests", () => {
272277
expect(content).toBe("");
273278
});
274279

275-
testForRuntime("reads binary data correctly", async () => {
280+
testLocalOnly("reads binary data correctly", async () => {
276281
const runtime = createRuntime();
277282
await using workspace = await TestWorkspace.create(runtime, type);
278283

@@ -368,7 +373,7 @@ describeIntegration("Runtime integration tests", () => {
368373
expect(content).toBe("");
369374
});
370375

371-
testForRuntime("writes binary data", async () => {
376+
testLocalOnly("writes binary data", async () => {
372377
const runtime = createRuntime();
373378
await using workspace = await TestWorkspace.create(runtime, type);
374379

@@ -407,7 +412,7 @@ describeIntegration("Runtime integration tests", () => {
407412
expect(content).toBe(specialContent);
408413
});
409414

410-
testForRuntime("preserves symlinks when editing target file", async () => {
415+
testDockerOnly("preserves symlinks when editing target file", async () => {
411416
const runtime = createRuntime();
412417
await using workspace = await TestWorkspace.create(runtime, type);
413418

@@ -450,7 +455,7 @@ describeIntegration("Runtime integration tests", () => {
450455
expect(targetContent).toBe("new content");
451456
});
452457

453-
testForRuntime("preserves file permissions when editing through symlink", async () => {
458+
testDockerOnly("preserves file permissions when editing through symlink", async () => {
454459
const runtime = createRuntime();
455460
await using workspace = await TestWorkspace.create(runtime, type);
456461

@@ -547,7 +552,7 @@ describeIntegration("Runtime integration tests", () => {
547552
});
548553
});
549554

550-
describeNonDocker("Edge cases", () => {
555+
describeLocalOnly("Edge cases", () => {
551556
testForRuntime(
552557
"handles large files efficiently",
553558
async () => {
@@ -566,7 +571,7 @@ describeIntegration("Runtime integration tests", () => {
566571
30000
567572
);
568573

569-
testForRuntime("handles concurrent operations", async () => {
574+
testLocalOnly("handles concurrent operations", async () => {
570575
const runtime = createRuntime();
571576
await using workspace = await TestWorkspace.create(runtime, type);
572577

@@ -784,7 +789,7 @@ describeIntegration("Runtime integration tests", () => {
784789
});
785790
});
786791

787-
describeNonDocker("Error handling", () => {
792+
describeLocalOnly("Error handling", () => {
788793
testForRuntime("handles command not found", async () => {
789794
const runtime = createRuntime();
790795
await using workspace = await TestWorkspace.create(runtime, type);

0 commit comments

Comments
 (0)