chai/lib/chai.js

73 lines
1,001 B
JavaScript
Raw Normal View History

/*!
* chai
2012-02-07 21:09:38 +00:00
* Copyright(c) 2011-2012 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
2011-12-07 05:25:52 +00:00
var used = []
, exports = module.exports = {};
/*!
* Chai version
*/
2011-12-07 05:25:52 +00:00
2012-04-22 20:54:21 +00:00
exports.version = '1.0.0alpha1';
2011-12-07 05:25:52 +00:00
/*!
* Primary `Assertion` prototype
*/
2011-12-07 05:25:52 +00:00
exports.Assertion = require('./assertion');
/*!
* Assertion Error
*/
2011-12-15 10:54:23 +00:00
exports.AssertionError = require('./error');
/*!
* Utils for plugins (not exported)
*/
var util = require('./utils');
/**
* # .use(function)
*
* Provides a way to extend the internals of Chai
*
* @param {Function}
* @returns {this} for chaining
* @api public
*/
2012-01-27 00:13:41 +00:00
exports.use = function (fn) {
2012-02-07 21:09:38 +00:00
if (!~used.indexOf(fn)) {
fn(this, util);
used.push(fn);
}
2012-01-27 00:13:41 +00:00
return this;
};
/*!
* Expect interface
*/
2012-01-27 00:14:08 +00:00
var expect = require('./interface/expect');
exports.use(expect);
/*!
* Should interface
*/
2012-01-27 00:14:08 +00:00
var should = require('./interface/should');
exports.use(should);
/*!
* Assert interface
*/
2012-01-27 00:14:08 +00:00
var assert = require('./interface/assert');
exports.use(assert);