vercel / turborepo

Build system optimized for JavaScript and TypeScript, written in Rust
https://turbo.build/repo/docs
MIT License
26.39k stars 1.84k forks source link

Pass through arguments not working with yarn v1 #1731

Closed samesfahani-tuplehealth closed 2 years ago

samesfahani-tuplehealth commented 2 years ago

What version of Turborepo are you using?

1.4.3

What package manager are you using / does the bug impact?

Yarn v1

What operating system are you using?

Mac

Describe the Bug

According to docs:

turbo run <task1> <task2> [options] [-- <args passed to task1 and task2>]

turbo can run multiple tasks, and any arguments following -- will be passed through to the tasks to be executed

I have a script in my package.json as so:

"scripts": {
  "test": "turbo run test"
},

and in my package's packages/whatever/package.json I have:

"scripts": {
  "test": "jest"
},

In my previous set up I might run something like yarn test foo and that would get passed through to Jest to target files with foo in their name. However, I am seeing this output

image

Ok no problem, I tried running yarn test -- foo to accommodate. I get the same error with a warning now:

image

It seems like the command that gets run is turbo run test foo which is not valid since it is looking for a task called foo. Of course if I run turbo run test -- foo, things behave as desired but it still remains unknown why I can't pass it through via Yarn.

Expected Behavior

I would expect the final command to be resolved to jest foo.

To Reproduce

Should be fairly trivial to reproduce from any starter (see text/screenshots above).

chris-olszewski commented 2 years ago

Yarn is intercepting the -- before it reaches turbo. Adding -- to the turbo invocation fixed this issue for me:

"scripts": {
  "test": "turbo run test --"
},
gmanavarro commented 1 year ago

Yarn is intercepting the -- before it reaches turbo. Adding -- to the turbo invocation fixed this issue for me:

"scripts": {
  "test": "turbo run test --"
},

I was having the same problem, then I used this solution and now if I try to use any option it is ignored. For example: I try to run yarn build --filter=foo -- bar What's being executed is turbo run build -- bar