Sha256: a1f74d24a385ce1674213763d6cff64aedee0518b53e77abb668e756b52333cb
Contents?: true
Size: 1.21 KB
Versions: 16
Compression:
Stored size: 1.21 KB
Contents
/*! * Should * Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca> * MIT Licensed */ var util = require('../util') , assert = require('assert') , AssertionError = assert.AssertionError; module.exports = function(should) { var i = should.format; /** * Expose assert to should * * This allows you to do things like below * without require()ing the assert module. * * should.equal(foo.bar, undefined); * */ util.merge(should, assert); /** * Assert _obj_ exists, with optional message. * * @param {*} obj * @param {String} [msg] * @api public */ should.exist = should.exists = function(obj, msg) { if(null == obj) { throw new AssertionError({ message: msg || ('expected ' + i(obj) + ' to exist'), stackStartFunction: should.exist }); } }; /** * Asserts _obj_ does not exist, with optional message. * * @param {*} obj * @param {String} [msg] * @api public */ should.not = {}; should.not.exist = should.not.exists = function(obj, msg) { if(null != obj) { throw new AssertionError({ message: msg || ('expected ' + i(obj) + ' to not exist'), stackStartFunction: should.not.exist }); } }; };
Version data entries
16 entries across 16 versions & 1 rubygems