Skip to content

[Bug] workspace-tools foreach doesn't run each workspace for node 15 #2074

@DouglasMeyer

Description

@DouglasMeyer
  • I'd be willing to implement a fix

Describe the bug

Running yarn workspaces foreach -A run script_name only runs script_name on one workspace (even with script_name defined in other workspaces).

To Reproduce

await packageJson({
  name: "one",
  scripts: {
    print: 'echo "one"'
  }
}, { cwd: 'one' })
await packageJson({
  name: "two",
  scripts: {
    print: 'echo "two"'
  }
}, { cwd: 'two' })
await packageJsonAndInstall({
  workspaces: ['one', 'two']
});

const output = await yarn(`workspaces`, `foreach`, 'run', 'print');

expect(output).toContain(`one`);
expect(output).toContain(`two`);
expect(await yarn('node', '--version')).toContain(`v15`);

Notice only one gets printed and not also two.

Environment:

  • OS: OSX or Linux (docker node:15.0.1)
  • Node version: v15.0.1
  • Yarn version: 2.3.3

Additional context

Works with:

  • node: v14.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreproducibleThis issue can be successfully reproduced

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions