Pass command-line arguments to NPM script
12 June 2022 (Updated 12 July 2022)
Syntax
npm run <cmd> -- <your-args>
Example
Suppose you have a test
script in your package.json
:
{
"scripts": {
"test": "jest",
}
}
And you want to run npm run test
but with additional arguments. Something like:
jest --watch utils.spec.ts
You can do this with:
npm run test -- --watch utils.spec.ts
Tagged:
NPM
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment