I have two question on JS unit testing:
1) Is there some tool that allows to automaticaly run javascript unit tests when certain files are changed (like for example nodemon restarts node.js on js changes).
2) Is this strategy appropriate (efficient) way to run unit tests?
Thanks, Alex
When you are using node you have to restart on your own to see the changes you made But nodemon watches the particular path for any changes. If you make any changes in your file, nodemon will restart it for you. Save this answer.
JavaScript Unit Testing is a method where JavaScript test code is written for a web page or web application module. It is then combined with HTML as an inline event handler and executed in the browser to test if all functionalities are working as desired. These unit tests are then organized in the test suite.
For those who are committed to using nodemon, nodemon -x "npm test"
has worked for me.
nodemon --help
says:
-x, --exec app ........... execute script with "app", ie. -x "python -v".
In our case npm test
is set to run tests by configuring our package.json
For example:
"scripts": {
"test": "mocha"
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With