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..192e9ffa 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 ``` +`--parallel` runs test files side by side, 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"