Skip to content

Instantly share code, notes, and snippets.

@andruhon
Created April 23, 2025 21:09
Show Gist options
  • Save andruhon/ca06132e46f9ebcae180fddaaf35de5d to your computer and use it in GitHub Desktop.
Save andruhon/ca06132e46f9ebcae180fddaaf35de5d to your computer and use it in GitHub Desktop.
npm tricks

NPM Tricks

Considering the following setup in package.json

{
    "scripts": {
      "test": "coolcommand"
    }
}  

You would expect npm run test -- specs/myTest.spec.js to pass the parameter into the coolcommand, but unfortunately this is not always the case.

I initially thought that this may be the Windows/PS issue, but it turns out that the command is simply wrapped twice and doing double dash twice might actually help, for example:

npm run test -- -- specs/myTest.spec.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment