chai/lib/chai.js
2012-02-07 16:59:45 -05:00

43 lines
888 B
JavaScript

/*!
* chai
* Copyright(c) 2011-2012 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
var used = [];
var exports = module.exports = {};
exports.version = '0.3.0';
exports.Assertion = require('./assertion');
exports.AssertionError = require('./error');
exports.inspect = require('./utils/inspect');
exports.use = function (fn) {
if (!~used.indexOf(fn)) {
fn(this);
used.push(fn);
}
return this;
};
exports.fail = function (actual, expected, message, operator, stackStartFunction) {
throw new exports.AssertionError({
message: message,
actual: actual,
expected: expected,
operator: operator,
stackStartFunction: stackStartFunction
});
};
var expect = require('./interface/expect');
exports.use(expect);
var should = require('./interface/should');
exports.use(should);
var assert = require('./interface/assert');
exports.use(assert);