Fix crash when constructing a mock function whose implementation returns a primitive#31375
Closed
robobun wants to merge 2 commits into
Closed
Fix crash when constructing a mock function whose implementation returns a primitive#31375robobun wants to merge 2 commits into
robobun wants to merge 2 commits into
Claude / Claude Code Review
completed
May 25, 2026 in 6m 11s
Code review found 1 potential issue
Found 5 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 1 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | test/js/bun/test/mock-fn.test.js:798-825 |
New test uses mock() outside isBun guard, breaking Jest/Vitest compatibility |
Annotations
Check warning on line 825 in test/js/bun/test/mock-fn.test.js
claude / Claude Code Review
New test uses mock() outside isBun guard, breaking Jest/Vitest compatibility
This test calls `mock()` directly but isn't wrapped in `if (isBun)`, so it will throw `TypeError: mock is not a function` when this file is run under Jest or Vitest (where `test-interop.js` returns `mock: null`). Since the behavior being tested is meant to match Jest semantics anyway, the simplest fix is to use `jest.fn(...)` instead of `mock(...)` here — they're the same function under Bun and the assertions would then exercise the cross-runner contract this file is documented to support.
Loading