Node.js: Testing and Code Quality

Node.js: Testing and Code Quality

English | MP4 | AVC 1280×720 | AAC 48KHz 2ch | 4h 21m | 1.04 GB

Most software engineers would agree that clean code is easier to maintain than messy code, but what exactly does that look like, and how do go about cleaning up messy code? In this course, Jon Peck shows how to measure quality, implement testing, and measure code coverage in your Node.js apps, using a complete but buggy restaurant booking application to illustrate the concepts. Jon first reviews JavaScript fundamentals and testing and code quality concepts. He then explains how to use linters to find suspicious code; explores different testing frameworks and their components; and shows how to isolate your code for testing using test doubles, then verify with spies and mocks. Jon wraps up the course by showing how to generate reports on code health across your entire codebase. Along the way, he provides challenge and solution videos so you can test your knowledge of each section before moving on.

Table of Contents

1 Cleaning your codebase
2 What you should know
3 Preparing for Node.js development
4 Exercise files
5 Demo setup and tour

1. Testing and Code Quality Fundamentals
6 What is code quality
7 Coding conventions and standards
8 Creating and enforcing coding standards
9 Unit, integration, and functional testing
10 Testing frameworks
11 TDD and BDD test specifications
12 Assertions for correctness
13 Challenge Organize your tests
14 Solution Organize your tests

2. Finding Errors with Linting
15 Solution Create a shareable ESLint config
16 Standardizing with EditorConfig
17 Adding EditorConfig to a project and IDE
18 Comparing JavaScript linters
19 Installing ESLint
20 Configuring ESLint
21 Extending an ESLint shareable config
22 Linting your codebase
23 Fixing code in VSC with ESLint
24 Challenge Create a shareable ESLint config

3. Validate Correctness with Unit Testing
25 Solution Test asyncawait with Jest
26 Survey of Node.js testing frameworks
27 Install Jest in a Node.js project
28 What and where to unit test
29 Writing your first Jest unit test
30 Running a test suite with Jest
31 Testing asynchronous callbacks with Jest
32 Writing callback test suites with Jest
33 Testing promises with Jest
34 Challenge Test asyncawait with Jest

4. Replacing and Inspecting Using Spies, Stubs, and Mocks
35 Replacing code with test doubles
36 Mocking functions for test code
37 Writing your first Jest mock
38 Mock an entire module with Jest
39 Mocking module dependencies
40 Spying to observe interactions
41 Challenge Mock a successful reservation creation
42 Solution Mock a successful reservation creation

5. Reporting on Your Entire Codebase
43 Why code coverage matters
44 Measuring code coverage with Jest
45 Functional testing with Jest
46 Test doubles and Express apps
47 Form submissions with SuperTest
48 Fallacies of 100% test coverage
49 Coverage with continuous integration
50 Challenge Isolate routes for faster tests
51 Solution Isolate routes for faster tests

52 Testing and code quality goals
53 Where to go from here