From e8af8a363ba34db31e9410b168e29078cac65ddd Mon Sep 17 00:00:00 2001 From: Will Gosnold Date: Tue, 27 Oct 2026 22:05:24 +0100 Subject: [PATCH 1/2] test: run test files in parallel Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/ci.yml | 6 +++--- .github/workflows/release.yml | 2 +- CONTRIBUTING.md | 4 +++- package.json | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34200e52..3851ac1b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,13 +55,13 @@ jobs: [ "$([ "$(id -u)" = 0 ] && echo root || echo runner)" = "$1" ] if [ "$2" = rest ]; then files=($(ls test/e2e/*.test.ts | grep -Ev "/(fork|vendor)[^/]*$")) - bun test --isolate test/*.test.ts - bun test test/e2e/*.test.ts --test-name-pattern "so only from source" + bun test --parallel test/*.test.ts + bun test --parallel test/e2e/*.test.ts --test-name-pattern "so only from source" else files=(test/e2e/"$2"*.test.ts) fi [ -e "${files[0]}" ] - PATCHBOOK_CMD="$PWD/dist/patchbook" bun test "${files[@]}" + PATCHBOOK_CMD="$PWD/dist/patchbook" bun test --parallel "${files[@]}" ' bash "$USER_KIND" "$SHARD" env: USER_KIND: ${{ matrix.user }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7635eda0..15f29feb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,7 @@ jobs: bun-version: ${{ env.BUN_VERSION }} - run: bun install --frozen-lockfile - run: bun run typecheck - - run: bun test --isolate + - run: bun test --parallel - name: Cross-compile every target run: bun scripts/build-release.ts --version "$VERSION" env: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index af27f81c..c1b7b1c7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,9 +43,11 @@ CI also builds the binary and runs the end-to-end tests against it. Run the same ```sh bun run build -PATCHBOOK_CMD="$PWD/dist/patchbook" bun test test/e2e/*.test.ts +PATCHBOOK_CMD="$PWD/dist/patchbook" bun test --parallel test/e2e/*.test.ts ``` +`bun test` runs test files in parallel, one worker process per CPU core. Tests inside one file still run in order. + ## Tests Every fix and feature needs a test. CLI behaviour goes in a file under `test/e2e/` named for its area, which builds throwaway repos and runs the real command against them. Shared setup lives in `test/e2e-fixtures.ts`. CI runs the files whose names start with `fork` and `vendor` as their own jobs and every other file together, so a new file needs no CI change. Pure functions go in `test/units.test.ts`. diff --git a/package.json b/package.json index 1aa0b33e..af83d201 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "patchbook": "src/cli.ts" }, "scripts": { - "test": "bun test --isolate", + "test": "bun test --parallel", "typecheck": "tsc --noEmit", "qa": "qa/run", "build": "bun build --compile --no-compile-autoload-dotenv --no-compile-autoload-bunfig src/cli.ts --outfile dist/patchbook" From 012df6c91158b8f9a7dc84f370238f3cff9d6e1b Mon Sep 17 00:00:00 2001 From: Will Gosnold Date: Tue, 27 Oct 2026 22:05:37 +0100 Subject: [PATCH 2/2] docs: say what --parallel does Co-Authored-By: Claude Sonnet 5.5 --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c1b7b1c7..192e9ffa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,7 +46,7 @@ bun run build PATCHBOOK_CMD="$PWD/dist/patchbook" bun test --parallel test/e2e/*.test.ts ``` -`bun test` runs test files in parallel, one worker process per CPU core. Tests inside one file still run in order. +`--parallel` runs test files side by side, one worker process per CPU core. Tests inside one file still run in order. ## Tests