Skip to content

Commit 7488e86

Browse files
betegonclaude
andcommitted
fix(ci): run isolated tests separately to avoid mock.module() leakage
Bun's mock.module() leaks between test files in the same run. Keep test:unit and test:isolated as separate invocations, add coverage flags to test:isolated, and merge lcov reports before upload. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 068663d commit 7488e86

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,17 @@ jobs:
169169
run: bun install --frozen-lockfile
170170
- name: Unit Tests
171171
run: bun run test:unit
172+
- name: Save Unit Coverage
173+
run: cp coverage/lcov.info coverage/unit-lcov.info
174+
- name: Isolated Tests
175+
run: bun run test:isolated
176+
- name: Merge Coverage
177+
run: cat coverage/unit-lcov.info coverage/lcov.info > coverage/merged-lcov.info
172178
- name: Upload Coverage
173179
uses: getsentry/codecov-action@main
174180
with:
175181
token: ${{ secrets.GITHUB_TOKEN }}
182+
files: coverage/merged-lcov.info
176183

177184
build-binary:
178185
name: Build Binary (${{ matrix.target }})

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@
6363
"typecheck": "tsc --noEmit",
6464
"lint": "bunx ultracite check",
6565
"lint:fix": "bunx ultracite fix",
66-
"test": "bun run test:unit",
67-
"test:unit": "bun test test/lib test/commands test/types test/isolated --coverage --coverage-reporter=lcov",
68-
"test:isolated": "bun test test/isolated",
66+
"test": "bun run test:unit && bun run test:isolated",
67+
"test:unit": "bun test test/lib test/commands test/types --coverage --coverage-reporter=lcov",
68+
"test:isolated": "bun test test/isolated --coverage --coverage-reporter=lcov",
6969
"test:e2e": "bun test test/e2e",
7070
"test:init-eval": "bun test test/init-eval --timeout 600000 --concurrency 6",
7171
"generate:skill": "bun run script/generate-skill.ts",

0 commit comments

Comments
 (0)