Running the tests from the command line
So far, we’ve been running the tests from IntelliJ, which provides a convenient way to run a single test or a complete test suite. However, you might not be using IntelliJ, or even if you do, it’s always important to know how to execute the tests using the command line. This is also the way you’d configure the test execution in a CI pipeline.
Our application was bootstrapped using Create React App, and one of its main features is the provision of scripts for your application that you don’t need to maintain. This is the case for the test scripts too, which are linked in the package.json
file as we can see in the following screenshot:
Figure 10.6 – A screenshot of the beginning of the scripts section in package.json
In the Testing helpers section, we added some testing helper files to a directory named __tests__
. Unfortunately, Jest treats these files as tests too by default. We’...