[test] Fix Error Proxy stack assignment in Node.js 21+ (#36967)
Same as #35227, but for `set`. V8's `stack` setter silently noops when `this` is a Proxy (nodejs/node#60862), so prodstack-stripping assignments like `error.stack = 'Error: ' + message` in `resolveErrorProd` were dropped and reads returned the real stack. This caused `yarn test --prod` failures on Node 21+. ## Test Plan `yarn test --prod` passes on both old and new Nodes. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
dan committed
Jul 8, 2026 at 13:33 UTC
e3e813d4d6cd61746676f207f0847c744fb3ad64
1 file changed
+4
scripts/jest/setupTests.js
+4
@@ -140,6 +140,10 @@ if (process.env.REACT_CLASS_EQUIVALENCE_TEST) {
140
if (key === 'message') {
141
return ReflectSet(target, key, decodeErrorMessage(value), receiver);
142
}
143
+ if (key === 'stack') {
144
+ // https://github.com/nodejs/node/issues/60862
145
+ return ReflectSet(target, key, value);
146
+ }
147
return ReflectSet(target, key, value, receiver);
148
},
149
get(target, key, receiver) {