[compiler]: fix link compiler & 4 broken tests from path containing spaces#33409
Merged
josephsavona merged 19 commits intofacebook:mainfrom Jun 9, 2025
Merged
[compiler]: fix link compiler & 4 broken tests from path containing spaces#33409josephsavona merged 19 commits intofacebook:mainfrom
josephsavona merged 19 commits intofacebook:mainfrom
Conversation
|
Comparing: 428ab82...6c525d1 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
…eu/react into fix-compiler-path-spaces
josephsavona
reviewed
Jun 7, 2025
| 'StateBasedOnContext uses the legacy contextTypes API which will soon be removed. ' + | ||
| 'Use React.createContext() with static contextType instead. (https://react.dev/link/legacy-context)\n' + | ||
| ' in ProvideChildContextTypes.createElement (at **)', | ||
| ' in ProvideChildContextTypes.createElement [as render] (at **)', |
Member
There was a problem hiding this comment.
This seems unrelated, let’s revert?
Contributor
Author
There was a problem hiding this comment.
Yes, thank you for reviewing and for you spotting that. Fixed!
| 'ReadContext uses the legacy contextTypes API which will soon be removed. ' + | ||
| 'Use React.createContext() with static contextType instead. (https://react.dev/link/legacy-context)\n' + | ||
| ' in ProvideContext.createElement (at **)', | ||
| ' in ProvideContext.createElement [as render] (at **)', |
Member
|
thanks again! |
17 tasks
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.
Summary
Problem #1: Running the
link-compiler.shbash script via"prebuild"script fails if a developer has cloned thereactrepo into a folder that contains any spaces. 3 tests fail because of this.For example, my current folder is:
/Users/wes/Development/Open Source Contributions/reactThe link compiler error returns:
./scripts/react-compiler/link-compiler.sh: line 15: cd: /Users/wes/Development/Open: No such file or directoryProblem #2: 1 test in
ReactChildren-test.jsfails due the existing stack trace regex which should be lightly revised.([^(\[\n]+)[^\n]*/gis more robust for stack traces: it captures the function/class name (with dots) and does not break on spaces in file paths.([\S]+)[^\n]*/gis simpler but breaks if there are spaces and doesn't handle dotted names well.Additionally, we trim the whitespace off the name to resolve extra spaces breaking this test as well:
All of the above tests pass if I hyphenate my local folder:
/Users/wes/Development/Open-Source-Contributions/reactI selfishly want to keep spaces in my folder names. 🫣
How did you test this change?
npx yarn prebuild
Before:

After:

npx yarn test
npx yarn test ./packages/react/src/__tests__/ReactChildren-test.js
npx yarn test -r=xplat --env=development --variant=true --ci --shard=3/5
Before:

After:
