Chapter 13. Testing—and then what?
This chapter covers
- Creating automated tests using Mocha
- Running your tests at the command line in Node.js
- Running your tests in the browsers you intend to support
There comes a point during project development when you need to test things to be sure they’re working as expected. Doing manual tests at the beginning of the project might seem like it would suffice, but, as the code gets more and more involved, the testing steps need to become more detailed to ensure that there are no bugs. The problem with this is that testing becomes tedious—as focused as you try to be, it’s easy to miss something, and a bug can slip through.
With manual testing, you’re also dependent on your tester because tests can only be performed based on their availability. At times, testers can test only one thing at a time, and they can go only so fast before they start making mistakes.
When working with a product that needs to support multiple platforms, testing becomes even more involved because every time you make a change to your code, you need to repeat the exact same tests on every platform that you support.
Automated testing takes a bit of work up front to create the tests; but once you have them written, they have the following advantages: