Node.js module
assert
The 'node:assert' module provides a simple set of assertion tests for validating invariants in code. It includes functions like assert.ok, assert.strictEqual, and assert.throws to perform runtime checks and throw descriptive errors when assertions fail.
Assertions are commonly used in tests and internal sanity checks to ensure that expected values and conditions hold true during execution. The module supports deep equality checks, custom error messages, and strict or loose comparisons.
Fully supported in Bun
Fully implemented.
Functions 1
- assert.default()
An alias of assert.ok.