assert.fail(actual, expected, message, operator)
Throws an AssertionError
. If message
is falsy, the error message is set as the values of actual
and expected
separated by the provided operator
. Otherwise, the error message is the value of message
.
const assert = require('assert'); assert.fail(1, 2, undefined, '>'); // AssertionError: 1 > 2 assert.fail(1, 2, 'whoops', '>'); // AssertionError: whoops
Please login to continue.