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)

0

1 Answer 1

8

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

npm test -- -arg=val
Sign up to request clarification or add additional context in comments.

1 Comment

thanks, thats helpd @Sebastian Kaczmarek

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.