Learn Advanced JavaScript Testing patterns with Jest. Get testing superpowers by leveraging underused Jest features.
You're a JavaScript developer who wants to learn unit testing?
You come from a non-JS background and want to apply your existing unit testing knowledge in JavaScript?
You're proficient at testing in JavaScript and would like to learn Jest best-practices and featureset?
The Jest Handbook is for you.
Jest/Jest CLI expert - Debugging tests
Spying, stubbing - become a stub/mock function assertion pro
Testing synchronous vs asynchronous code
test('a', async () => { await codeUnderTest() })
return expect().rejects
)fail()
, throw 'foo'
Partial matches
expect.anything()
expect.any(Function)
etc.Philosophies to write unit tests for Express.js
Coverage in Jest
Get the Jest Handbook (100 pages) nowInterested in upgrading your Jest and testing game?
Jest is the most widespread solution to test JavaScript applications. Jest is a modern, batteries-included testing framework that comes with all features you need to set up for your JavaScript tests including coverage, interactive watch mode, advanced matchers.
Jest is the leading test framework in terms of downloads as of 2020 as per npmtrends Jest vs Mocha vs AVA vs Jasmine vs QUnit vs Chai. Jest came out of efforts from Facebook. It's is used at a plethora of small and large companies including Facebook, AirBnB, The New York Times and Spotify.
I've looked around the web for resources dedicated to teaching you the ins and outs of Jest. The vast majority of solutions are GitHub issues or StackOverflow posts, and there are a few React/Vue.js (framework specific) testing books out there. None really focus on Jest itself and how it can be leveraged to write better tests, faster.
The Jest Handbook is an example and solutions-driven book that will teach you in the ins and outs of testing JavaScript applications with Jest.
Hugo Di Francesco is a co-author of "Professional JavaScript" with Packt. He runs the Code with Hugo website helping over 100,000 developers every month and holds an MEng in Mathematical Computation from University College London (UCL). He has used JavaScript extensively to create scalable and performant platforms at companies such as Canon and Elsevier.
Hugo has also written some of the top articles on the internet about Jest at codewithhugo.com/tags/jest/ including: