Install Mocha and Chai into the development dependencies of a Node.js project, and then configure the ESLint environment to prevent false positives.
- [Instructor] We've been discussing the tools in theory…around writing tests.…Let's apply that knowledge to our project.…Three steps are necessary for installation.…The first thing we need to do…is use npm to install mocha and chai…to the project's devDependencies.…Then we'll edit package.json…to add the definition for the test script,…which will be mocha.…Finally we're going to have to add…an ESLint environment configuration for mocha globals.…This isn't required,…but it will prevent a number of false positives.…
We'll do that by adding an ESLint configuration…to the test directory.…Let's switch over to Adam.…- [Adam] Open up a terminal,…and make sure you're in the project directory.…We're going to use npm to install mocha and chai…to the devDependencies.…So, dash capital D, and press return.…After a moment,…mocha, chai, and other dependencies will be installed.…Next, do the tree view,…select package.json.…
In the script section,…add a comma after start,…then a definition for test.…Which will be just in double quotes,…
- What is code quality?
- Testing and code quality fundamentals
- Coding conventions and standards
- Creating and enforcing coding standards
- Unit, integration, and functional testing
- Test-driven development test specificatons
- Behavior-driven development test specifications
- Finding errors with linting
- Extending an ESLint shareable config
- Validating correctness with unit testing
- Replacing and inspecting with stubs, spies, and mocks
- Code coverage and why it matters
- Coverage with continuous integration
Skill Level Intermediate
Node.js: Build Your First Microservicewith Daniel Khan2h 9m Intermediate
Building APIs Using Hapi in Node.jswith Kirsten Hunter2h 23m Intermediate
Node.js: Extend and Maintain Applicationswith Daniel Khan3h 35m Intermediate
1. Testing and Code Quality Fundamentals
2. Finding Errors with Linting
3. Validating Correctness with Unit Testing
4. Replacing and Inspecting with Stubs, Spies, and Mocks
5. Reporting on Your Entire Codebase
Where to go from here?3m 46s
- 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.