0

I have 2 npm scripts: tsc -w and jest --watch that I want to execute concurrently. I know there is a tool called concurrently that could be used for this.

"test:watch": "concurrently -P --kill-others \"npm run watch\"  \"jest --watchAll -- {@} \"",

Problem is I want to pass a param to the Jest command, and not to the concurrently command.

How to pass an argument to the 2nd command when using concurrently with npm?

Ilya Kushlianski
  • 780
  • 9
  • 15

1 Answers1

2

Use the pass-through flag to pass arguments from your command line to the script.

"test:watch": "concurrently -P --kill-others \"npm run watch\"  \"jest --watchAll -- {@} \"",

Use it like this:

npm run test:watch -- -- cookie

You need to use -- twice to reach the inner Jest script!

Ilya Kushlianski
  • 780
  • 9
  • 15