Claude / Claude Code Review
completed
Apr 11, 2026 in 13m 12s
Code review found 2 potential issues
Found 5 candidates, confirmed 2. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 1 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | src/bun.js/bindings/JSMockFunction.cpp:982-1001 |
mockReturnThis+contexts incorrect in construct context due to thisValue==newTarget |
Annotations
Check warning on line 1001 in src/bun.js/bindings/JSMockFunction.cpp
claude / Claude Code Review
mockReturnThis+contexts incorrect in construct context due to thisValue==newTarget
When jsMockFunctionConstruct delegates to jsMockFunctionCall, the thisValue captured inside jsMockFunctionCall is callframe->thisValue(), which for JSC InternalFunction native constructors equals newTarget() (the constructor function itself). This causes two observable deviations from Jest semantics: (1) mock().mockReturnThis() used as a constructor via Reflect.construct returns the mock function itself as the result (since result.isObject() is true for functions); (2) mock.mock.contexts records
Loading