Webinar

“Digging into Gatsby 5’s Slice API” Register now

Testing

To preserve code quality over time, you may want to add testing to your Gatsby site. Several of the more popular testing use-cases with Gatsby are JavaScript unit tests (Jest), React component tests (react-testing-library), and end-to-end tests (Cypress).

 Main Guides 3

Jest

Unit testing protects against unexpected behavior in your code. Walk through a few extra steps you'll need to set up Jest, a popular Javascript testing framework, with Gatsby.

React components

Install and use react-testing-library, the most popular framework for testing the behavior of React components.

E2E tests with Cypress

Automated checks of specific user flows through one or many pages.

 Additional Guides 3

  • GraphQL
  • CSS-in-JS
  • Visual testing with Storybook
© 2022 Gatsby, Inc.