Test coverage reports show how many files and functions have been tested in an application. In this video, look at how to set up a test coverage report and what it means to have comprehensive test coverage in a Node.js application using Jest. Having 80-90% code coverage is a good rule of thumb in an app.
been executed during our test. … Now right now we're focused on the dictionary routes file, … is open coverage/lcov-report/index.html. … Let's go ahead and look at the dictionary-routes.js. … So this is telling us that we have not tested … So we can improve the code coverage in this file … simply by testing these routes. … and we're going to open up the dictionary routes test … and the next route I'm going to test for is the delete route. … pass that by invoking dictionary/bbb success. … So now, what I want to do is go ahead and grab my body, … or the response, and we're going to await, … this has to be an async function, we're going to await … for a request, or our super test function, … at the route, so when we delete a term, we get this body … because we had that data on the clipboard. … What I want to do is, when we run the delete route, … I don't want to save the ski terms. … So again I don't want to use the real save function, … So I will add this mock now, jest.mock, … and we are going to go ahead and mock the lib. …
- Making HTTP requests
- Building web and file servers
- Installing packages with npm
- Managing and linking global packages
- Working with Express, the web server framework
- Handling POST and DELETE requests
- Creating WebSockets
- Testing and debugging Node.js code
Skill Level Advanced
Node.js: Real-Time Web with Socket.IOwith Emmanuel Henri1h 24m Intermediate
Work with VSCode1m 59s
1. The HTTP Module
3. Web Servers
5. Node.js Testing
6. Automation and Deployment
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.