From the course: Node.js: Testing and Code Quality
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Running a test suite with Jest
From the course: Node.js: Testing and Code Quality
Running a test suite with Jest
- We've already configured Jest to run through NPM test. So let's execute our brand new tests. Switch over to VS code, open up a terminal, and then type MPM test and press Enter. The test suites run and we have a failure and a pass. Let's look at the output. I'm going to open up this window and then scroll to the top. Right at the top, we see the name of the test suite by file along with the overall pass or fail. The implicit name of the suite is the file path, lib schemareservations.test.js. Under each file name comes the test suites defined. We only created one with describe combined date time. Under the name of the suite comes the individual test specs. The first test with valid input failed, which is indicated with a red X, more on the failure and a moment. At the end is the duration of test execution in milliseconds. The second test passed with a green check mark. After the broad report of the passes and failures,…
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.
Contents
-
-
-
-
-
Survey of Node.js testing frameworks5m 5s
-
(Locked)
Install Jest in a Node.js project2m 25s
-
(Locked)
What and where to unit test?4m 46s
-
(Locked)
Writing your first Jest unit test4m 36s
-
(Locked)
Running a test suite with Jest6m 5s
-
(Locked)
Testing asynchronous callbacks with Jest5m 42s
-
(Locked)
Writing callback test suites with Jest6m 32s
-
(Locked)
Testing promises with Jest7m 52s
-
(Locked)
Challenge: Test async/await with Jest49s
-
(Locked)
Solution: Test async/await with Jest2m 51s
-
-
-
-