Conversation
In #32416, @michaelfaith discovered that https://github.com/facebook/react/blob/029e8bd618af23fbdd9efdac565ad81f7d4640d8/scripts/jest/setupTests.js#L82 would fail on the merged compiler eslint rule. Upon further investigation I discovered that our CompilerError implementation doesn't play nicely with Reflect, so `Reflect.construct` would fail as `.toString` would error: ``` TypeError: Cannot read properties of undefined (reading 'map') at _CompilerError.toString (/Users/.../code/react/node_modules/babel-plugin-react-compiler/src/CompilerError.ts:200:25) at _CompilerError.get message [as message] (/Users/.../code/react/node_modules/babel-plugin-react-compiler/src/CompilerError.ts:194:17) at Object.construct (/Users/.../code/react/scripts/jest/setupTests.js:153:52) ``` I tested this fix using my local copy of the built babel-plugin-react-compiler to verify that this fixes those tests.
huozhi
pushed a commit
to vercel/next.js
that referenced
this pull request
Mar 11, 2025
[diff facebook/react@029e8bd6...0ca3deeb](facebook/react@029e8bd...0ca3dee) <details> <summary>React upstream changes</summary> - facebook/react#32569 - facebook/react#32567 - facebook/react#32549 - facebook/react#32545 - facebook/react#32566 - facebook/react#32551 - facebook/react#32550 - facebook/react#32528 - facebook/react#32359 - facebook/react#32536 - facebook/react#32539 </details>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #32416, @michaelfaith discovered that
react/scripts/jest/setupTests.js
Line 82 in 029e8bd
Upon further investigation I discovered that our CompilerError implementation doesn't play nicely with Reflect, so
Reflect.constructwould fail as.toStringwould error:I tested this fix using my local copy of the built babel-plugin-react-compiler to verify that this fixes those tests.