In order to write tests in Node.js applications, you typically want to select a framework. There are dozens of testing frameworks available from npm like Mocha, Jasmine, and more. In this chapter, you are using Jest which was created on Facebook.
- [Instructor] We're in the process … of writing test for our dictionary API. … At present, all we've done is we've taken the code, … and we've broken it down into four separate modules … and test them independently. … There's Mocha, Jasmine, Jest. … run tests and report on the status of those tests. … In fact, they also have similar syntax. … So once you learn to write a test in one framework, … you'll be able to write tests in them all. … So we're going to use Jest, a testing framework … to make it easier for us to test routes. … So what is testing framework. … Let's take a look. … Let's go ahead and open up our terminal … and first install Jest. … So I can npm install jest -D. … in our package JSON under developer dependencies … that our application needs to run. … Developer dependencies are those dependencies … that developers need to work with our application. … For example, let's go ahead and go to our files … that have the .test.js extension and run those. … And what you do with Jest is you describe …
- 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.