mjquito
mjquito

Reputation: 582

How to have mocha watch source/project files?

I would like to have Mocha watch my source/project files and NOT the test files. how can I accomplish this? Also the test files and source/project files are in different directories. Thank you in advance!

Upvotes: 2

Views: 550

Answers (2)

Cédric Teyton
Cédric Teyton

Reputation: 56

I think this tutorial can help you : https://dev.to/promyze/setup-mocha-in-watch-mode-for-tdd-in-node-js-1mah

You can just update the paths to follow, or add the --watch-ignore options in the package.json file.

Upvotes: 2

zendka
zendka

Reputation: 1327

mocha --watch watches the current working directory.

If you'd like more felxibility you can use:

npm install -g watch
watch 'mocha' dir_to_watch

Upvotes: 0

Related Questions