assert.fail()

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
doc_Nodejs
2016-04-30 04:37:20
Comments
Leave a Comment

Please login to continue.