Andreas Köberle
Andreas Köberle

Reputation: 111092

How can I run "npm test" from webstorm file watcher

Is there a way to run npm test from a watcher in webstorm. I know I can create a run configuration from NPM but then I have to trigger it manually, but I want to run my tests on every file change.

Upvotes: 5

Views: 1357

Answers (1)

lena
lena

Reputation: 93898

Program: path/to/node
Arguments: path/to/npm-cli.js run-script test
Working directory: <folder where your package.json is located, $ProjectFileDir$, for example>

Not sure why you need it though... I'd suggest using existing test runners instead (karma, mocha, node-unit) - WebStorm provides good integration with them, and some of them support 'auto-testing' (rerunning on spec file change)

Upvotes: 6

Related Questions