O'Reilly logo

React 16 Tooling by Adam Boduch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running tests using react-scripts

When you create your React application using create-react-app, you're ready to run tests right away. In fact, as part of the boilerplate code that's created for you, a unit test for the App component is created. This test is added so that Jest will find a test that it can run. It doesn't actually test anything meaningful in your application, so you'll probably delete it once more tests are added.

Additionally, create-react-app adds the appropriate script to your package.json file to run your tests. You can just run the following command in your Terminal:

npm test

This will actually invoke the test script from react-scripts. This will invoke Jest, which runs any tests that it finds. In this case, since you're ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required