Skip to content

Glossary: Node.js Basics

assert (node:assert/strict)

Also written: assert.equal, assert.deepEqual, assert.throws, assert.rejects, assert.ok, AssertionError

Node's built-in checking functions for tests. Each one throws an `AssertionError` when its check is false, which fails the test: `equal` compares with `===`, `deepEqual` compares contents, and `throws` and `rejects` check for errors.

Where the book teaches it

Related terms

node:testMock