assert
History
Added in: v23.7.0, v22.14.0
v23.7.0, v22.14.0
Introduced in: v18.0.0
v18.0.0
An object whose methods are used to configure available assertions on the
TestContext objects in the current process. The methods from node:assert
and snapshot testing functions are available by default.
It is possible to apply the same configuration to all files by placing common
configuration code in a module
preloaded with --require or --import.
assert.register(name, fn): void
Defines a new assertion function with the provided name and function. If an assertion already exists with the same name, it is overwritten.