How to use the power-assert.ifError function in power-assert

To help you get started, we’ve selected a few power-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 Automattic / mongoose / test / harmony / document.test_.js View on Github external
var error;
      var schema = new Schema({
        description: {type: String, required: true}
      });

      var Breakfast = db.model('breakfast', schema, getCollectionName());

      var goodBreakfast = new Breakfast({description: 'eggs & bacon'});

      try {
        yield goodBreakfast.save();
      } catch (e) {
        error = e;
      }

      assert.ifError(error);
      var result;
      try {
        result = yield Breakfast.findOne().exec();
      } catch (e) {
        error = e;
      }
      assert.ifError(error);
      assert.equal(result.description, 'eggs & bacon');

      // Should cause a validation error because `description` is required
      var badBreakfast = new Breakfast({});
      try {
        yield badBreakfast.save();
      } catch (e) {
        error = e;
      }
github yosuke-furukawa / eater / test / core / lib / reporter / TapReporter.js View on Github external
console.log = (message) => {
  assert.ifError('Should not be reached here');
};
github hden / node-serf / test / serf.js View on Github external
const responseStream = clients.one.query(opts, function (err) {
        assert.ifError(err)
      })
      responseStream.on('data', function (data) {