fix(bun:test): return an object when a mock function is constructed with new#31386
Open
robobun wants to merge 10 commits into
Open
fix(bun:test): return an object when a mock function is constructed with new#31386robobun wants to merge 10 commits into
robobun wants to merge 10 commits into
Claude / Claude Code Review
completed
May 31, 2026 in 8m 59s
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:171-184 |
New mock.instances test breaks Jest cross-runner compatibility |
Annotations
Check warning on line 184 in test/js/bun/test/mock-fn.test.js
claude / Claude Code Review
New mock.instances test breaks Jest cross-runner compatibility
This test will fail when run under real Jest: `jest-mock` pushes `this` to `mock.instances` on **every** invocation (no `new.target` check), so after `fn.call(ctx); fn();` Jest gives `[ctx, undefined]`, not `[]`. The file header says it's "meant to be runnable in Jest, Vitest, and Bun" and other Bun-only divergences here are gated behind `if (isBun)`; this one isn't. Worth noting that commit 3b292844 ("record mock.instances on every call (matches jest)") had Jest's actual behavior right before i
Loading