My team and I have been using NightwatchJS for a couple of years. After comparing a few other test solutions, it’s time for an improved solution — Jest. (If you’re not using it, give it a try.)
As developers’ ownership of quality continues to shift to adding more and more tests, my team has wanted a solution that caters to their needs. Jest allows developers to write unit, integration, visual, front-end browser, and performance tests. Jest and Mocha are very similar. Mocha requires a lot more configuration, but is a well-established solution with many more integrations available. Jest, however, usually works out of the box with zero configuration.
Strengths and Robust Feature Set
Jest has a feature-rich API library for testing which is continuously being developed. It’s a well-documented solution with a number of guides to help with on-boarding. The documentation also allows for easy browsing.
- It's fast, compared to the other solutions mentioned above
- If you're into visual testing, it can perform snapshot testing. (My team is working on developing an Applitools library.)
- It automatically handles splitting of tests across processes by taking a round-robin approach to squeeze the most out of your processing power and maximize performance.
- No additional setup required. You're able to generate code coverage information by adding the coverage flag from the command line (includes untested files).
- Easy mocking that allows you to test functionality that depends on the database, network requests, access files, any external system, or that lets you spy on the behavior of a function.
Jest is everything you dream of from a single solution for developers: readable test syntax, tests that run faster, quicker turnaround time during development, and more. That's why I think it's one of the best testing solutions available today. Happy testing!
Greg Sypolt (@gregsypolt) is a senior engineer at Gannett and co-founder of Quality Element. The last 5 years focused on creation and deployment of automated test strategies, frameworks, tools, and platforms.