
However, during the daily development routine, I had to run these script by hand so often, I searched for a faster and more convenient solution. In this example, I used wildcards to run all my spec.files in a certain directory.

"test-all": "mocha -opts mocha.opts \"./tests/*.spec.ts\""

If no command is provided, it lists all available scripts

NPM defines a lot of predefined scripts and CLI commands which you can run with npm, for example npm install or npm test.įor user-defined scripts, you have to use npm run, such as npm run test-all. Recently, I wondered if there is a possibility not having to remember the NPM script names in my package.json and to start them faster without having to open a terminal and typing npm run every time.
