Jest Setup

Get introduced with the Jest setup file and learn why it’s used.

We'll cover the following...

Adding a Jest setup file

Since this chapter’s project will have three components (Carousel, CarouselButton, and CarouselSlide), it’s going to have three test files. Rather than duplicate the Enzyme configuration logic across all three, we should move that logic into a “setup file” that will only run once whenever Jest runs our tests.

Actually, we’re going to need two files. The setup file, and a Jest configuration to point to it. Let’s start with the configuration. By default, Jest looks for a file ...