Skip to main content
assert.AssertionError - assert - Node documentation
class assert.AssertionError
extends Error

Usage in Deno

import assert from "node:assert";

Indicates the failure of an assertion. All errors thrown by the node:assert module will be instances of the AssertionError class.

Constructors

new
AssertionError(options?: { message?: string | undefined; actual?: unknown | undefined; expected?: unknown | undefined; operator?: string | undefined; stackStartFn?: Function | undefined; })

Properties

actual: unknown

Set to the actual argument for methods such as assert.strictEqual().

code: "ERR_ASSERTION"

Value is always ERR_ASSERTION to show that the error is an assertion error.

expected: unknown

Set to the expected argument for methods such as assert.strictEqual().

Indicates if the message was auto-generated (true) or not.

operator: string

Set to the passed in operator value.