From the course: React: Testing and Debugging
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Jest introduction - React.js Tutorial
From the course: React: Testing and Debugging
Jest introduction
- [Instructor] The beauty of starting a React project with Create React App is that you get some very useful tools like Jest. So, in other words, there's no installation needed as Jest comes pre-installed and ready to go. It even has an example task, so let's take a look at it in action. So if you go inside of the project that we just set up, and go into the components folder, you're going to find a file that says app.test.js. And this is one test that's already inside of your application when you create a new application with React. So this test is basically telling you that it renders without crashing, so that means the application's running without crashing. So if you want to test this, you can stop the application by doing control C or command C on a Mac. Here, let me just let me put more screen estate here, and then all you have to do is npm run test, and this is going to run the test command from your package.json…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.