Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

LinkedIn Learning

Node.js: Testing and Code Quality

via LinkedIn Learning

Overview

Learn how to measure quality, implement testing, and ensure code coverage in your node.js apps.

Syllabus

Introduction
  • Cleaning your codebase
  • What you should know
  • Preparing for Node.js development
  • Exercise files
  • Demo setup and tour
1. Testing and Code Quality Fundamentals
  • What is code quality?
  • Coding conventions and standards
  • Creating and enforcing coding standards
  • Unit, integration, and functional testing
  • Testing frameworks
  • TDD and BDD test specifications
  • Assertions for correctness
  • Challenge: Organize your tests
  • Solution: Organize your tests
2. Finding Errors with Linting
  • Standardizing with EditorConfig
  • Adding EditorConfig to a project and IDE
  • Comparing JavaScript linters
  • Installing ESLint
  • Configuring ESLint
  • Extending an ESLint shareable config
  • Linting your codebase
  • Fixing code in VSC with ESLint
  • Challenge: Create a shareable ESLint config
  • Solution: Create a shareable ESLint config
3. Validate Correctness with Unit Testing
  • Survey of Node.js testing frameworks
  • Install Jest in a Node.js project
  • What and where to unit test?
  • Writing your first Jest unit test
  • Running a test suite with Jest
  • Testing asynchronous callbacks with Jest
  • Writing callback test suites with Jest
  • Testing promises with Jest
  • Challenge: Test async/await with Jest
  • Solution: Test async/await with Jest
4. Replacing and Inspecting Using Spies, Stubs, and Mocks
  • Replacing code with test doubles
  • Mocking functions for test code
  • Writing your first Jest mock
  • Mock an entire module with Jest
  • Mocking module dependencies
  • Spying to observe interactions
  • Challenge: Mock a successful reservation creation
  • Solution: Mock a successful reservation creation
5. Reporting on Your Entire Codebase
  • Why code coverage matters
  • Measuring code coverage with Jest
  • Functional testing with Jest
  • Test doubles and Express apps
  • Form submissions with SuperTest
  • Fallacies of 100% test coverage
  • Coverage with continuous integration
  • Challenge: Isolate routes for faster tests
  • Solution: Isolate routes for faster tests
Conclusion
  • Testing and code quality goals
  • Where to go from here?

Taught by

Jon Peck

Reviews

4.7 rating at LinkedIn Learning based on 83 ratings

Start your review of Node.js: Testing and Code Quality

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.