Skip to content

Commit

Permalink
assert: add internal assert.fail()
Browse files Browse the repository at this point in the history
PR-URL: #26047
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and targos committed Feb 14, 2019
1 parent 21e6d35 commit ccf60bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/internal/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ function assert(value, message) {
}
}

function fail(message) {
require('assert').fail(message);
}

assert.fail = fail;

module.exports = assert;
2 changes: 2 additions & 0 deletions test/parallel/test-internal-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ internalAssert(true, 'fhqwhgads');
assert.throws(() => { internalAssert(false); }, assert.AssertionError);
assert.throws(() => { internalAssert(false, 'fhqwhgads'); },
{ code: 'ERR_ASSERTION', message: 'fhqwhgads' });
assert.throws(() => { internalAssert.fail('fhqwhgads'); },
{ code: 'ERR_ASSERTION', message: 'fhqwhgads' });

0 comments on commit ccf60bb

Please sign in to comment.