improve commonjs support on browser build

This commit is contained in:
Jake Luer 2012-07-09 12:47:29 -04:00
parent c7bf837721
commit 2621414573

67
chai.js
View file

@ -1,5 +1,6 @@
!function (name, context, definition) {
if (typeof module !== 'undefined') module.exports = definition(name, context);
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
module.exports = definition(name, context);
else if (typeof define === 'function' && typeof define.amd === 'object') define(definition);
else context[name] = definition(name, context);
}('chai', this, function (name, context) {
@ -257,6 +258,38 @@
}); // module: chai/assertion.js
require.register("chai/browser/error.js", function(module, exports, require){
/*!
* chai
* Copyright(c) 2011-2012 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
module.exports = AssertionError;
function AssertionError (options) {
options = options || {};
this.message = options.message;
this.actual = options.actual;
this.expected = options.expected;
this.operator = options.operator;
if (options.stackStartFunction && Error.captureStackTrace) {
var stackStartFunction = options.stackStartFunction;
Error.captureStackTrace(this, stackStartFunction);
}
}
AssertionError.prototype = Object.create(Error.prototype);
AssertionError.prototype.name = 'AssertionError';
AssertionError.prototype.constructor = AssertionError;
AssertionError.prototype.toString = function() {
return this.message;
};
}); // module: chai/browser/error.js
require.register("chai/core/assertions.js", function(module, exports, require){
/*!
* chai
@ -2359,38 +2392,6 @@
}); // module: chai/interface/should.js
require.register("chai/browser/error.js", function(module, exports, require){
/*!
* chai
* Copyright(c) 2011-2012 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
module.exports = AssertionError;
function AssertionError (options) {
options = options || {};
this.message = options.message;
this.actual = options.actual;
this.expected = options.expected;
this.operator = options.operator;
if (options.stackStartFunction && Error.captureStackTrace) {
var stackStartFunction = options.stackStartFunction;
Error.captureStackTrace(this, stackStartFunction);
}
}
AssertionError.prototype = Object.create(Error.prototype);
AssertionError.prototype.name = 'AssertionError';
AssertionError.prototype.constructor = AssertionError;
AssertionError.prototype.toString = function() {
return this.message;
};
}); // module: chai/browser/error.js
require.register("chai/utils/addChainableMethod.js", function(module, exports, require){
/*!
* Chai - addChainingMethod utility