Skip to content

Commit a1213f9

Browse files
committed
fix: replace mock.module with spyOn for logger in timeline-formatting tests
mock.module() globally replaces the logger module for ALL test files running in the same Bun process, causing logger.formatTool to be undefined in logger-format-tool.test.ts. Using spyOn instead keeps the real Logger instance and only stubs individual methods. This was the root cause of the recurring CI-only test failure — mock.module poisoned the module cache across parallel test files.
1 parent e0b3352 commit a1213f9

3 files changed

Lines changed: 4 additions & 39 deletions

File tree

.github/workflows/release-dev.yml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -117,28 +117,12 @@ jobs:
117117
- name: Setup Bun
118118
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2
119119
with:
120-
bun-version: "1.3.9"
120+
bun-version: latest
121121

122122
- name: Install dependencies
123123
working-directory: console
124124
run: bun install
125125

126-
- name: Verify logger.ts content
127-
working-directory: console
128-
run: |
129-
echo "=== logger.ts line count ==="
130-
wc -l src/utils/logger.ts
131-
echo "=== formatTool present? ==="
132-
grep -n "formatTool" src/utils/logger.ts || echo "MISSING: formatTool not found!"
133-
echo "=== file type ==="
134-
file src/utils/logger.ts
135-
echo "=== first 5 lines ==="
136-
head -5 src/utils/logger.ts
137-
echo "=== export line ==="
138-
grep "export const logger" src/utils/logger.ts || echo "MISSING: no logger export!"
139-
echo "=== git-crypt status ==="
140-
git-crypt status -- console/src/utils/logger.ts || true
141-
142126
- name: Run console tests
143127
working-directory: console
144128
run: bun test
@@ -170,7 +154,7 @@ jobs:
170154
- name: Setup Bun
171155
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2
172156
with:
173-
bun-version: "1.3.9"
157+
bun-version: latest
174158

175159
- name: Install dependencies
176160
working-directory: console

.github/workflows/release.yml

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -166,31 +166,12 @@ jobs:
166166
- name: Setup Bun
167167
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2
168168
with:
169-
bun-version: "1.3.9"
169+
bun-version: latest
170170

171171
- name: Install dependencies
172172
working-directory: console
173173
run: bun install
174174

175-
- name: Verify logger.ts after git-crypt unlock
176-
working-directory: console
177-
run: |
178-
echo "=== test file first 5 lines ==="
179-
head -5 tests/utils/logger-format-tool.test.ts
180-
echo "=== test file line count ==="
181-
wc -l tests/utils/logger-format-tool.test.ts
182-
echo "=== test file md5 ==="
183-
md5sum tests/utils/logger-format-tool.test.ts || true
184-
echo "=== inline bun test ==="
185-
bun -e "
186-
import { logger } from './src/utils/logger.js';
187-
const has = typeof logger.formatTool === 'function';
188-
console.log('formatTool exists:', has);
189-
if (has) console.log('result:', logger.formatTool('Bash', '{\"command\": \"ls\"}'));
190-
"
191-
echo "=== single test file run ==="
192-
bun test tests/utils/logger-format-tool.test.ts 2>&1 | head -20 || true
193-
194175
- name: Run console tests
195176
working-directory: console
196177
run: bun test
@@ -222,7 +203,7 @@ jobs:
222203
- name: Setup Bun
223204
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2
224205
with:
225-
bun-version: "1.3.9"
206+
bun-version: latest
226207

227208
- name: Install dependencies
228209
working-directory: console
166 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)