One of my short term goals is to be proficient in Node.js and to achieve this goal I subscribed to the (Udemy course by Andrew Mead). The best way to learn Node is by building Node apps.
Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.
Mocha allows Asynchronous testing. Let's say it provides the environment in which we can use our favorite assertion libraries to test the code.
Mocha comes with tons of great features, the website shows a long list but here are the ones I like the most:
- simple async support, including promises.
- async test timeout support.
- before, after, before each, after each hooks (very useful to clean the environment where each test!).
Supertest is library written to test HTTP calls in node.js. So if you want to write test cases which going to do some HTTP calls ( GET, POST, PUT etc ) then this might be the useful tool for you.