All files / lib/internal assert.js

100% Statements 25/25
100% Branches 6/6
100% Functions 3/3
100% Lines 25/25

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2619x 19x 19x 23x 23x 9x 9x 23x 23x 19x 183525x 183525x 21x 21x 21x 183525x 19x 2x 2x 2x 2x 19x 19x 19x 19x  
'use strict';
 
let error;
function lazyError() {
  if (!error) {
    error = require('internal/errors').codes.ERR_INTERNAL_ASSERTION;
  }
  return error;
}
 
function assert(value, message) {
  if (!value) {
    const ERR_INTERNAL_ASSERTION = lazyError();
    throw new ERR_INTERNAL_ASSERTION(message);
  }
}
 
function fail(message) {
  const ERR_INTERNAL_ASSERTION = lazyError();
  throw new ERR_INTERNAL_ASSERTION(message);
}
 
assert.fail = fail;
 
module.exports = assert;