Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm + Mocha --watch (not accurately watching files)

I'm using Mocha with npm, and doing an "npm test" to start up mocha. It has the --watch enabled in the mocha.opts, but for some reason it's not accurately watching. When I make a change to my test file, and then save it, whether I put in a faulty test or an ok test, I get the same thing: 0 passing (in green), whereas, when I first run mocha, I get 2 passing.

Is there something I am missing?

Thanks!

like image 631
Mr Mikkél Avatar asked Apr 02 '14 21:04

Mr Mikkél


1 Answers

You need to ensure that npm passes the CLI opts through to mocha using:

npm test -- --watch

This will pass the watch flag when npm runs mocha.

like image 115
Toby Hede Avatar answered Sep 24 '22 01:09

Toby Hede