4

I have a test script in my package.json that looks like this

"scripts": {
    "test": "mocha --timeout 4000 "
}

I am trying to send additional arguments from the command line(on windows) but it seems not to get them

I tried

npm test --key mykey
npm test --key=mykey
npm run test --key mykey

but none of the above worked. my test scripts need to get this argument. anyone know how it can be done? (putting this argument in the package.json is not an option)

Amit Wagner
  • 3,134
  • 3
  • 19
  • 35

1 Answers1

7

To pass arguments to the script you have to add -- before those arguments, like this:

npm test -- -arg=val
Sebastian Kaczmarek
  • 8,120
  • 4
  • 20
  • 38