Skip to content

Commit 85b004c

Browse files
stack72claude
andauthored
feat: enable parallel test execution for faster CI (#1149)
## Summary - Add `--parallel` flag to the `deno test` task so test modules run concurrently across available CPU cores - Each module runs in its own subprocess with full process isolation (separate globalThis, env vars, memory) - No test changes needed — temp dirs already use `Deno.makeTempDir()`, ports use dynamic allocation ## Expected impact CI runs on ubuntu-latest (4 cores), so expect ~3-4x speedup on the test step. Local runs on machines with more cores will see even more improvement. ## Test plan - [ ] CI passes — this PR is the test. Compare test step duration against recent main builds - [ ] If any flaky failures appear, investigate filesystem race conditions in integration tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 07dae00 commit 85b004c

22 files changed

Lines changed: 155 additions & 86 deletions

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"workspace": ["packages/client", "packages/testing"],
77
"tasks": {
88
"dev": "deno run --unstable-bundle --allow-read --allow-write --allow-env --allow-run --allow-sys main.ts",
9-
"test": "deno test --unstable-bundle --allow-read --allow-write --allow-env --allow-run --allow-net --allow-sys",
9+
"test": "deno test --parallel --unstable-bundle --allow-read --allow-write --allow-env --allow-run --allow-net --allow-sys",
1010
"check": "deno check main.ts",
1111
"lint": "deno lint",
1212
"fmt": "deno fmt",

integration/cli_test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@
1919

2020
import { assertStringIncludes } from "@std/assert";
2121
import { VERSION } from "../src/cli/commands/version.ts";
22+
import { CLI_ARGS } from "./test_helpers.ts";
2223

2324
// Integration tests run the CLI as a subprocess to test end-to-end behavior
2425

2526
async function runCliCommand(
2627
args: string[],
2728
): Promise<{ stdout: string; stderr: string; code: number }> {
2829
const command = new Deno.Command(Deno.execPath(), {
29-
args: ["task", "dev", ...args],
30+
args: [...CLI_ARGS, ...args],
3031
stdout: "piped",
3132
stderr: "piped",
3233
cwd: Deno.cwd(),

integration/data_output_flow_test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { stringify as stringifyYaml } from "@std/yaml";
3737
import { Definition } from "../src/domain/definitions/definition.ts";
3838
import { YamlDefinitionRepository } from "../src/infrastructure/persistence/yaml_definition_repository.ts";
3939
import { SHELL_MODEL_TYPE } from "../src/domain/models/command/shell/shell_model.ts";
40+
import { CLI_ARGS } from "./test_helpers.ts";
4041

4142
async function withTempDir(fn: (dir: string) => Promise<void>): Promise<void> {
4243
const dir = await Deno.makeTempDir({ prefix: "swamp-data-output-flow-" });
@@ -78,7 +79,7 @@ async function runCliCommand(
7879
cwd: string,
7980
): Promise<{ stdout: string; stderr: string; code: number }> {
8081
const command = new Deno.Command(Deno.execPath(), {
81-
args: ["task", "dev", ...args],
82+
args: [...CLI_ARGS, ...args],
8283
stdout: "piped",
8384
stderr: "piped",
8485
cwd,

integration/definition_lifecycle_test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { Definition } from "../src/domain/definitions/definition.ts";
3535
import { ModelType } from "../src/domain/models/model_type.ts";
3636
import { YamlDefinitionRepository } from "../src/infrastructure/persistence/yaml_definition_repository.ts";
3737
import { ExpressionEvaluationService } from "../src/domain/expressions/expression_evaluation_service.ts";
38+
import { CLI_ARGS } from "./test_helpers.ts";
3839

3940
async function withTempDir(fn: (dir: string) => Promise<void>): Promise<void> {
4041
const dir = await Deno.makeTempDir({ prefix: "swamp-def-lifecycle-" });
@@ -80,7 +81,7 @@ async function runCliCommand(
8081
env?: Record<string, string>,
8182
): Promise<{ stdout: string; stderr: string; code: number }> {
8283
const command = new Deno.Command(Deno.execPath(), {
83-
args: ["task", "dev", ...args],
84+
args: [...CLI_ARGS, ...args],
8485
stdout: "piped",
8586
stderr: "piped",
8687
cwd,

integration/extension_fmt_test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ import { assertStringIncludes } from "@std/assert/string-includes";
2121
import { assertEquals } from "@std/assert";
2222
import { join } from "@std/path";
2323
import { stringify as stringifyYaml } from "@std/yaml";
24+
import { CLI_ARGS } from "./test_helpers.ts";
2425

2526
const PROJECT_ROOT = Deno.cwd();
2627

2728
async function runCli(
2829
args: string[],
2930
): Promise<{ stdout: string; stderr: string; code: number }> {
3031
const command = new Deno.Command(Deno.execPath(), {
31-
args: ["task", "dev", ...args],
32+
args: [...CLI_ARGS, ...args],
3233
stdout: "piped",
3334
stderr: "piped",
3435
cwd: PROJECT_ROOT,

integration/extension_list_test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import { assertStringIncludes } from "@std/assert/string-includes";
2121
import { assertEquals } from "@std/assert";
2222
import { join } from "@std/path";
23+
import { CLI_ARGS } from "./test_helpers.ts";
2324

2425
const PROJECT_ROOT = Deno.cwd();
2526

@@ -28,7 +29,7 @@ async function runCli(
2829
env?: Record<string, string>,
2930
): Promise<{ stdout: string; stderr: string; code: number }> {
3031
const command = new Deno.Command(Deno.execPath(), {
31-
args: ["task", "dev", ...args],
32+
args: [...CLI_ARGS, ...args],
3233
stdout: "piped",
3334
stderr: "piped",
3435
cwd: PROJECT_ROOT,

integration/extension_pull_test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import { assertStringIncludes } from "@std/assert/string-includes";
2121
import { assertEquals } from "@std/assert";
22+
import { CLI_ARGS } from "./test_helpers.ts";
2223

2324
const PROJECT_ROOT = Deno.cwd();
2425

@@ -27,7 +28,7 @@ async function runCli(
2728
env?: Record<string, string>,
2829
): Promise<{ stdout: string; stderr: string; code: number }> {
2930
const command = new Deno.Command(Deno.execPath(), {
30-
args: ["task", "dev", ...args],
31+
args: [...CLI_ARGS, ...args],
3132
stdout: "piped",
3233
stderr: "piped",
3334
cwd: PROJECT_ROOT,

integration/extension_push_test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { assertStringIncludes } from "@std/assert/string-includes";
2121
import { assertEquals } from "@std/assert";
2222
import { join } from "@std/path";
2323
import { stringify as stringifyYaml } from "@std/yaml";
24+
import { CLI_ARGS } from "./test_helpers.ts";
2425

2526
const PROJECT_ROOT = Deno.cwd();
2627

@@ -29,7 +30,7 @@ async function runCli(
2930
env?: Record<string, string>,
3031
): Promise<{ stdout: string; stderr: string; code: number }> {
3132
const command = new Deno.Command(Deno.execPath(), {
32-
args: ["task", "dev", ...args],
33+
args: [...CLI_ARGS, ...args],
3334
stdout: "piped",
3435
stderr: "piped",
3536
cwd: PROJECT_ROOT,

integration/extension_rm_test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import { assertStringIncludes } from "@std/assert/string-includes";
2121
import { assertEquals } from "@std/assert";
22+
import { CLI_ARGS } from "./test_helpers.ts";
2223

2324
const PROJECT_ROOT = Deno.cwd();
2425

@@ -27,7 +28,7 @@ async function runCli(
2728
env?: Record<string, string>,
2829
): Promise<{ stdout: string; stderr: string; code: number }> {
2930
const command = new Deno.Command(Deno.execPath(), {
30-
args: ["task", "dev", ...args],
31+
args: [...CLI_ARGS, ...args],
3132
stdout: "piped",
3233
stderr: "piped",
3334
cwd: PROJECT_ROOT,

integration/foreach_test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { assertEquals, assertStringIncludes } from "@std/assert";
3131
import { join } from "@std/path";
3232
import { ensureDir } from "@std/fs";
3333
import { stringify as stringifyYaml } from "@std/yaml";
34+
import { CLI_ARGS } from "./test_helpers.ts";
3435

3536
async function withTempDir(fn: (dir: string) => Promise<void>): Promise<void> {
3637
const dir = await Deno.makeTempDir({ prefix: "swamp-foreach-" });
@@ -70,7 +71,7 @@ async function runCliCommand(
7071
cwd: string,
7172
): Promise<{ stdout: string; stderr: string; code: number }> {
7273
const command = new Deno.Command(Deno.execPath(), {
73-
args: ["task", "dev", ...args],
74+
args: [...CLI_ARGS, ...args],
7475
stdout: "piped",
7576
stderr: "piped",
7677
cwd,

0 commit comments

Comments
 (0)