Exemple #1
0
exports.doesNotThrow = function (block, error, msg) {
  var err;
  try {
    block();
  } catch (e) {
    err = e;
  }

  if (err) throw new Error(msg || fmt('Expected %s not to throw an error.', block.toString()));
  if (error && (err instanceof error)) {
    throw new Error(msg || fmt('Expected %s not to throw an %o.', block.toString(), error));
  }
};
Exemple #2
0
exports.notStrictEqual = function (actual, expected, msg) {
  if (actual !== expected) return;
  throw new Error(msg || fmt('Expected %o not to strictly equal %o.', actual, expected));
};
Exemple #3
0
exports.notDeepEqual = function (actual, expected, msg) {
  if (!equals(actual, expected)) return;
  throw new Error(msg || fmt('Expected %o not to deeply equal %o.', actual, expected));
};
Exemple #4
0
exports.equal = function (actual, expected, msg) {
  if (actual == expected) return;
  throw new Error(msg || fmt('Expected %o to equal %o.', actual, expected));
};