chai/test/bootstrap/karma.js
2014-09-11 22:54:56 -07:00

22 lines
390 B
JavaScript

/*!
* Attach chai to global
*/
window.chai = require('chai');
/*!
* Provide check for fail function.
*/
window.err = function (fn, msg) {
try {
fn();
throw new chai.AssertionError('Expected an error');
} catch (err) {
if ('string' === typeof msg) {
chai.expect(err.message).to.equal(msg);
} else {
chai.expect(err.message).to.match(msg);
}
}
};