Permalink
Browse files

Update mocha (1.8.1) and chai (1.4.2)

  • Loading branch information...
1 parent b0c93f0 commit 5def088e1ecdd3e3c1b585235f760d6e8080cbff @jfirebaugh committed Jan 9, 2013
Showing with 440 additions and 67 deletions.
  1. +1 −1 chai
  2. +1 −1 mocha
  3. +84 −42 vendor/assets/javascripts/chai.js
  4. +346 −19 vendor/assets/javascripts/mocha.js
  5. +8 −4 vendor/assets/stylesheets/mocha.css
Submodule mocha updated from 652df5 to 8f66a5
@@ -74,7 +74,7 @@
* Chai version
*/
- exports.version = '1.4.0';
+ exports.version = '1.4.2';
/*!
* Primary `Assertion` prototype
@@ -86,7 +86,7 @@
* Assertion Error
*/
- exports.AssertionError = require('./chai/browser/error');
+ exports.AssertionError = require('./chai/error');
/*!
* Utils for plugins (not exported)
@@ -155,7 +155,7 @@
* Module dependencies.
*/
- var AssertionError = require('./browser/error')
+ var AssertionError = require('./error')
, util = require('./utils')
, flag = util.flag;
@@ -228,8 +228,9 @@
* @api private
*/
- Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual) {
+ Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) {
var ok = util.test(this, arguments);
+ if (true !== showDiff) showDiff = false;
if (!ok) {
var msg = util.getMessage(this, arguments)
@@ -239,6 +240,7 @@
, actual: actual
, expected: expected
, stackStartFunction: (Assertion.includeStack) ? this.assert : flag(this, 'ssfi')
+ , showDiff: showDiff
});
}
};
@@ -262,38 +264,6 @@
}); // 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
@@ -674,6 +644,8 @@
, 'expected #{this} to equal #{exp}'
, 'expected #{this} to not equal #{exp}'
, val
+ , this._obj
+ , true
);
}
}
@@ -703,6 +675,8 @@
, 'expected #{this} to deeply equal #{exp}'
, 'expected #{this} to not deeply equal #{exp}'
, obj
+ , this._obj
+ , true
);
});
@@ -1489,6 +1463,70 @@
}); // module: chai/core/assertions.js
+ require.register("chai/error.js", function(module, exports, require){
+ /*!
+ * chai
+ * Copyright(c) 2011-2012 Jake Luer <jake@alogicalparadox.com>
+ * MIT Licensed
+ */
+
+ /*!
+ * Main export
+ */
+
+ module.exports = AssertionError;
+
+ /**
+ * # AssertionError (constructor)
+ *
+ * Create a new assertion error based on the Javascript
+ * `Error` prototype.
+ *
+ * **Options**
+ * - message
+ * - actual
+ * - expected
+ * - operator
+ * - startStackFunction
+ *
+ * @param {Object} options
+ * @api public
+ */
+
+ function AssertionError (options) {
+ options = options || {};
+ this.message = options.message;
+ this.actual = options.actual;
+ this.expected = options.expected;
+ this.operator = options.operator;
+ this.showDiff = options.showDiff;
+
+ if (options.stackStartFunction && Error.captureStackTrace) {
+ var stackStartFunction = options.stackStartFunction;
+ Error.captureStackTrace(this, stackStartFunction);
+ }
+ }
+
+ /*!
+ * Inherit from Error
+ */
+
+ AssertionError.prototype = Object.create(Error.prototype);
+ AssertionError.prototype.name = 'AssertionError';
+ AssertionError.prototype.constructor = AssertionError;
+
+ /**
+ * # toString()
+ *
+ * Override default to string method
+ */
+
+ AssertionError.prototype.toString = function() {
+ return this.message;
+ };
+
+ }); // module: chai/error.js
+
require.register("chai/interface/assert.js", function(module, exports, require){
/*!
* chai
@@ -2352,13 +2390,17 @@
};
/**
- * ### .throws(function, [constructor/regexp], [message])
+ * ### .throws(function, [constructor/string/regexp], [string/regexp], [message])
*
* Asserts that `function` will throw an error that is an instance of
* `constructor`, or alternately that it will throw an error with message
* matching `regexp`.
*
+ * assert.throw(fn, 'function throws a reference error');
+ * assert.throw(fn, /function throws a reference error/);
+ * assert.throw(fn, ReferenceError);
* assert.throw(fn, ReferenceError, 'function throws a reference error');
+ * assert.throw(fn, ReferenceError, /function throws a reference error/);
*
* @name throws
* @alias throw
@@ -2371,13 +2413,13 @@
* @api public
*/
- assert.Throw = function (fn, type, msg) {
- if ('string' === typeof type) {
- msg = type;
- type = null;
+ assert.Throw = function (fn, errt, errs, msg) {
+ if ('string' === typeof errt || errt instanceof RegExp) {
+ errs = errt;
+ errt = null;
}
- new Assertion(fn, msg).to.Throw(type);
+ new Assertion(fn, msg).to.Throw(errt, errs);
};
/**
Oops, something went wrong. Retry.

0 comments on commit 5def088

Please sign in to comment.