chai/lib/chai.js

93 lines
1.2 KiB
JavaScript
Raw Normal View History

/*!
* chai
2013-12-30 15:57:41 +00:00
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
2011-12-07 05:25:52 +00:00
var used = [];
/*!
* Chai version
*/
2011-12-07 05:25:52 +00:00
2018-09-26 09:39:58 +00:00
exports.version = '4.2.0';
2011-12-07 05:25:52 +00:00
/*!
* Assertion Error
*/
exports.AssertionError = require('assertion-error');
2011-12-15 10:54:23 +00:00
/*!
* Utils for plugins (not exported)
*/
2012-06-24 10:25:36 +00:00
var util = require('./chai/utils');
/**
* # .use(function)
*
2016-10-08 13:41:36 +00:00
* 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)) {
2016-06-09 21:49:18 +00:00
fn(exports, util);
used.push(fn);
}
2016-06-09 21:49:18 +00:00
return exports;
2012-01-27 00:13:41 +00:00
};
/*!
* Utility Functions
*/
exports.util = util;
/*!
* Configuration
*/
var config = require('./chai/config');
exports.config = config;
/*!
* Primary `Assertion` prototype
*/
var assertion = require('./chai/assertion');
exports.use(assertion);
/*!
* Core Assertions
*/
var core = require('./chai/core/assertions');
exports.use(core);
/*!
* Expect interface
*/
2012-06-24 10:25:36 +00:00
var expect = require('./chai/interface/expect');
2012-01-27 00:14:08 +00:00
exports.use(expect);
/*!
* Should interface
*/
2012-06-24 10:25:36 +00:00
var should = require('./chai/interface/should');
2012-01-27 00:14:08 +00:00
exports.use(should);
/*!
* Assert interface
*/
2012-06-24 10:25:36 +00:00
var assert = require('./chai/interface/assert');
2012-01-27 00:14:08 +00:00
exports.use(assert);