8. Conclusion

Throughout the Jest Handbook, you should have had a chance to learn about advanced JavaScript testing use-cases enabled by Jest.

With a deep understanding of the Jest CLI you’re now able to write and debug tests more effectively.

By leveraging advanced spying and stubbing functions, you are able to create mock JavaScript object instances, stub ES6 classes and mock out global objects.

You know how to intercept module imports and internals in both CommonJS and ESM. You’re also aware of the gotchas and limitations of such approaches.

You can test Express/Connect Node.js applications using 2 approaches with Jest and you’re able to illustrate synchronous and asynchronous testing patterns including how to check for test that throws (or does not throw).

You are familiar with advanced Jest partial matching techniques that enable you to write tests with high specificity and reduce toil when updating application code.

You are also familiar with Jest’s built-in coverage tool, how to enable it and configure it to set minimum coverage thresholds, find parts of the code that aren’t tested and how to disable it in specific cases.

In short, you are now familiar with Jest and all it can provide for testing your JavaScript applications and projects.

Jump to table of contents