Introducing Jest
Jest is a test framework developed by Facebook. Thanks to its zippyness and rich feature set, it’s quickly become the de facto standard for testing React apps. It’s catching on outside of the React ecosystem, too.
Unlike its forerunners (notably Jasmine), which expect to run in a browser environment, Jest runs in a Node.js process. That may seem counterintuitive: Shouldn’t code written to be run in the browser be tested in the browser? Short answer: not anymore! It’s become possible to simulate browser APIs in Node.js, thanks to a miraculous library called jsdom.[6] The advantages of using a simulated browser environment in Node are huge: tests can be run much more quickly, code coverage can be calculated easily, and the same ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access