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

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,…

Contents