Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest test fails in Yarn monorepo with object version of workspaces key #4043

Closed
strothj opened this issue Feb 19, 2018 · 1 comment
Closed

Comments

@strothj
Copy link

strothj commented Feb 19, 2018

Is this a bug report?

Yes

Did you try recovering your dependencies?

1.4.1-20180217.1901

Which terms did you search for in User Guide?

nohoist
workspaces

Environment

  1. node -v: v8.9.420180217.1901
  2. npm -v: 5.6.0
  3. yarn --version (if you use Yarn): 1.4.1-20180217.1901
  4. npm ls react-scripts (if you haven’t ejected): -- UNMET DEPENDENCY [email protected]

Then, specify:

  1. Operating system: Windows 10
  2. Browser and version (if relevant): n/a

Steps to Reproduce

  1. Create monorepo
  2. Create react project as a package
  3. Use the new workspaces format in the root package.json:
"workspaces": {
    "packages": [
      "packages/app"
    ]
  }
  1. 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.

Reproducible Demo

https://github.com/strothj/cra-nohoist

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.

@bradfordlemley
Copy link
Contributor

Fixed by #4001.
That PR has been merged, should be in next alpha.

@strothj strothj closed this as completed Feb 22, 2018
@lock lock bot locked and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants