Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading