Throws an AssertionError with the provided error message or a default error message. If the message parameter is an instance of an Error then it will be thrown instead of the AssertionError.
AssertionError
message
Error
import assert from 'assert/strict';assert.fail();// AssertionError [ERR_ASSERTION]: Failedassert.fail('boom');// AssertionError [ERR_ASSERTION]: boomassert.fail(new TypeError('need array'));// TypeError: need array
Using assert.fail() with more than two arguments is possible but deprecated. See below for further details.
assert.fail()
Optional
since v10.0.0 - use fail([message]) or other assert functions instead.
Generated using TypeDoc
Throws an
AssertionError
with the provided error message or a default error message. If themessage
parameter is an instance of anError
then it will be thrown instead of theAssertionError
.Using
assert.fail()
with more than two arguments is possible but deprecated. See below for further details.