In the ebook, I explain software testing techniques and share tips and tricks I learned while working with Jest on testing multiple Node.js backends and React.js applications.
I focus on unit test separation, unique Jest mocking features, creating a maintainable test suite, patterns, and best practices.
It's going to take you about 3 to 4 hours in total to finish all the chapters, but you can also pick only topics that are most interesting for you. Source code for examples is included.
You take no risk with a 30-day money-back guarantee policy! Start learning new skills right now! 🚀
Is this for me?
The ebook is best suited for developers who have some basic experience with unit testing but want to become better, quickly learn a few good practices, and be more fluent with Jest.
What do readers say?
I’ve learned a few non-obvious tricks that would be hard to find otherwise. The ebook is concise, nicely put together, and definitely worth reading!
The information in this ebook is beneficial for anyone who wants to level up his testing skills. All topics have straightforward description, often taken from the author’s experience. Enjoyed it!
A brief and practical overview of not only basic, but also very advanced features of the Jest testing framework. Full of smart solutions to problems, which are often solved in a crappy and over-complicated way!
What can I learn?
Unit testing - Knowing the testing framework is not enough to write a good unit test. It requires practice so let me share insights, patterns, and best practices.
Jest matchers - Make your tests more descriptive and easier to read with custom matchers. Write your own or use matchers provided by the community.
Mocking - Mocking is a controversial but powerful tool. Learn how to use it to your advantage, automate mocking or mock only part of the module (yes, you can do that!).
React - Components tests are often a big part of the test suite in my projects. Let me share some tips for when working with React Testing Library.
Table of contents
The ebook consists of easily digestible chapters. Chapters have an introduction and a few short sections, each teaches you about a different topic:
- Run only selected tests
- Skip excluded tests
- Enter interactive watch mode
- Check test coverage
- Debug tests with Node inspector
- Decide when to use snapshots
- Inline snapshots
- Matching nondeterministic objects
- Create your own matcher
- More matchers and chaining
- Import mocked modules
- Mock part of the module
- Mock implementation with polyfill
- Automatic and manual mocking
- Name mocks
- Clear mocks
- Usage with React
- Why react testing library
- Waiting for changes
- Avoiding duplication
- Working with network requests
- Element matchers
- Patterns and best practices
- Page object pattern
- Control table pattern
- Property-based testing
- The shape of testing pyramid
About the author
Hey! 👋 I'm Michal. I work remotely at Hotjar as a Senior Software Engineer and software consultant. My main focus is unit testing and software architecture. I now mostly write code in TypeScript (React/Node.js) and Golang. I maintain a personal blog: michalzalecki.com. Follow me on Twitter, where I share some interesting, bite-size content.
Start learning new skills right now! 🚀
Book + source code