How to use the assert.ifError function in assert

To help you get started, we’ve selected a few assert examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googleapis / cloud-debug-nodejs / test / test-try-catch.ts View on Github external
api.set(brk, err1 => {
      assert.ifError(err1);
      api.wait(brk, err2 => {
        assert.ifError(err2);
        const frame = brk.stackFrames[0];
        const args = frame.arguments;
        const locals = frame.locals;
        assert.strictEqual(locals.length, 1, 'There should be one local');
        assert.strictEqual(args.length, 0, 'There should be zero arguments');
        const e = locals[0];
        assert(e.name === 'e');
        // Number.isInteger will return false if varTableIndex is `undefined`
        assert(Number.isInteger(e.varTableIndex!));
        assert.strictEqual(args.length, 0, 'There should be zero arguments');
        api.clear(brk, err3 => {
          assert.ifError(err3);
          done();
        });
github kamicane / wrapup / test / up.js View on Github external
wrup1.require(__dirname + '/fixtures/up').up(function(err){
    assert.ifError(err)
    test('up')
})
github Prinzhorn / mongoose-encrypt / test / index.js View on Github external
user.save(function(err, user) {
					assert.ifError(err);

					//TODO: this one is failing, because when encrypting the data in `pre save` hook,
					//they are also encrypted when using this instance after saving.
					assert.strictEqual(user.secret1, 'secret', 'The secret1 is readable.');

					User.findOne({_id: 'user2'}).lean().exec(function(err, user) {
						assert.ifError(err);

						assert.notEqual(user.secret1, 'secret', 'The secret1 is not in plain text.');
						assert.notEqual(user.secret1, oldEncryptedValue, 'The two encrypted values differ.');

						done();
					});
				});
			});
github graalvm / graaljs / test / parallel / test-tls-client-getephemeralkeyinfo.js View on Github external
server.on('close', common.mustCall((err) => {
    assert.ifError(err);
  }));
github googleapis / nodejs-tasks / test / gapic-v2beta3.js View on Github external
client.getTask(request, (err, response) => {
        assert.ifError(err);
        assert.deepStrictEqual(response, expectedResponse);
        done();
      });
    });
github bpaquet / log4node / test / helper.js View on Github external
fs.readFile(target_file, 'utf-8', function(err, content) {
    assert.ifError(err);
    check_content_async(content, file, callback);
  });
}
github TimelordUK / node-sqlserver-v8 / unit.tests / warnings.js View on Github external
q.on('error', err => {
          assert.ifError(err)
        })
        q.on('info', err => {
github digitalbazaar / jsonld.js / tests / callbacks.js View on Github external
jsonld.toRDF(doc, (err, result) => {
      assert.ifError(err);
      assert.deepStrictEqual(result, []);
      done();
    });
  });
github arlolra / otr / test / spec / unit / sm.js View on Github external
    userA.on('ui', function (msg) { assert.ifError(msg, msg) })
    userA.on('error', function (err) { assert.ifError(err, err) })
github db-migrate / node-db-migrate / lib / commands / helper / assert.js View on Github external
module.exports = function (err, callback) {
  if (err) {
    if (typeof (callback) === 'function') {
      callback(err);
      return false;
    } else {
      assert.ifError(err);
      return false;
    }
  }

  return true;
};