Assertions
API support and documentation for the node:assert
module.
import assert from "node:assert"
const assert = require("node:assert")
Modules
Status | Module | Docs | Notes |
---|---|---|---|
🟢 Supported. |
| Standard assertions. | |
🔴 Not yet implemented. |
| Strict-mode assertions. |
assert
| Classes
AssertionError
🟢 Supported.
CallTracker
🔴 Not implemented; deprecated at Node.js v20.
assert
| Methods
assert(value[, message])
🟡 Implemented; awaiting bugfix for default module exports. Use
assert.ok()
in the meantime.assert.deepEqual(actual, expected[, message])
🔴 Not yet implemented.
assert.deepStrictEqual(actual, expected[, message])
🔴 Not yet implemented.
assert.doesNotMatch(string, regexp[, message])
🟢 Supported.
assert.doesNotReject(asyncFn[, error][, message])
🟢 Supported.
assert.doesNotThrow(fn[, error][, message])
🟢 Supported.
assert.equal(actual, expected[, message])
🟢 Supported.
assert.fail([message])
🟢 Supported.
assert.fail(actual, expected[, message[, operator[, stackStartFn]]])
🟢 Supported.
assert.ifError(value)
🟢 Supported.
assert.match(string, regexp[, message])
🟢 Supported.
assert.notDeepEqual(actual, expected[, message])
🔴 Not yet implemented.
assert.notDeepEqualStrict(actual, expected[, message])
🔴 Not yet implemented.
assert.notEqual(actual, expected[, message])
🟢 Supported.
assert.notStrictEqual(actual, expected[, message])
🔴 Not yet implemented.
assert.ok(value[, message])
🟢 Supported.
assert.rejects(asyncFn[, error][, message])
🟢 Supported.
assert.strictEqual(actual, expected[, message])
🔴 Not yet implemented.
assert.throws(fn[, error][, message])
🟢 Supported.
Last modified: 14 May 2024