Node.js: getting started

Lesson 10 · 10 min

Tests: node:test and assert

A test runner is already built into Node. No packages needed.

10 minLesson 10 of 10Practice includedAsk AI on any point

The node:test module provides the test function, and node:assert/strict provides checks: equal, deepEqual, throws, rejects. The node --test command finds files like *.test.js and runs them. A test is ordinary code: call a function and compare the result with what you expect.

Sign in to continue

The rest of this lesson opens after sign up

The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.