You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Jest test fails in Yarn monorepo with object version of workspaces key #4043
yarn --version (if you use Yarn): 1.4.1-20180217.1901
npm ls react-scripts (if you haven’t ejected): -- UNMET DEPENDENCY react-scripts@2.0.0-next.47d2d941
Then, specify:
Operating system: Windows 10
Browser and version (if relevant): n/a
Steps to Reproduce
Create monorepo
Create react project as a package
Use the new workspaces format in the root package.json:
"workspaces": {
"packages": [
"packages/app"
]
}
Run yarn test in React app package
Expected Behavior
Executes test successfully.
Actual Behavior
C:\Users\jason\code\public\cra-nohoist\node_modules\react-scripts\config\paths.js:130
.reduce(
^
TypeError: globPatterns.reduce is not a function
at findPkgs (C:\Users\jason\code\public\cra-nohoist\node_modules\react-scripts\config\paths.js:130:6)
at getMonorepoPkgPaths (C:\Users\jason\code\public\cra-nohoist\node_modules\react-scripts\config\paths.js:146:22)
at Object.<anonymous> (C:\Users\jason\code\public\cra-nohoist\node_modules\react-scripts\config\paths.js:158:55)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
error Command failed with exit code 1.
Clone project, install dependencies with Yarn, and attempt to run the test script in the react project.
The paths util script detects the presence of the workspaces key but doesn't handle the alternative structure. The new workspaces layout allows for adding a nohoist section.
Activity
bradfordlemley commentedon Feb 21, 2018
Fixed by #4001.
That PR has been merged, should be in next alpha.