Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Release 1.12.0

TJ Holowaychuk8e7f3d5566af
diff --git a/History.md b/History.md
index a744af74..b401446e 100644
--- a/History.md
+++ b/History.md
@@ -1,4 +1,15 @@
+1.12.0 / 2013-07-01
+==================
+
+ * add: prevent diffs for differing types. Closes #900
+ * add `Mocha.process` hack for phantomjs
+ * fix: use compilers with requires
+ * fix regexps in diffs. Closes #890
+ * fix xunit NaN on failure. Closes #894
+ * fix: strip tab indentation in `clean` utility method
+ * fix: textmate bundle installation
+
1.11.0 / 2013-06-12
==================
diff --git a/component.json b/component.json
index 8f4b4a07..0eeea823 100644
--- a/component.json
+++ b/component.json
@@ -1,6 +1,6 @@
{
"name": "mocha",
- "version": "1.11.0",
+ "version": "1.12.0",
"repo": "visionmedia/mocha",
"description": "simple, flexible, fun test framework",
"keywords": [
diff --git a/mocha.js b/mocha.js
index 00d88747..a55115a3 100644
--- a/mocha.js
+++ b/mocha.js
@@ -1861,7 +1861,7 @@ exports.list = function(failures){
}
// explicitly show diff
- if (err.showDiff) {
+ if (err.showDiff && sameType(actual, expected)) {
escape = false;
err.actual = actual = stringify(actual);
err.expected = expected = stringify(expected);
@@ -2079,6 +2079,21 @@ function stringify(obj) {
return JSON.stringify(obj, null, 2);
}
+/**
+ * Check that a / b have the same type.
+ *
+ * @param {Object} a
+ * @param {Object} b
+ * @return {Boolean}
+ * @api private
+ */
+
+function sameType(a, b) {
+ a = Object.prototype.toString.call(a);
+ b = Object.prototype.toString.call(b);
+ return a == b;
+}
+
}); // module: reporters/base.js
require.register("reporters/doc.js", function(module, exports, require){
@@ -4340,6 +4355,8 @@ Runner.prototype.hook = function(name, fn){
if (self.failures && suite.bail()) return fn();
self.currentRunnable = hook;
+ hook.ctx.currentTest = self.test;
+
self.emit('hook', hook);
hook.on('error', function(err){
@@ -4352,6 +4369,7 @@ Runner.prototype.hook = function(name, fn){
if (testError) self.fail(self.test, testError);
if (err) return self.failHook(hook, err);
self.emit('hook end', hook);
+ delete hook.ctx.currentTest;
next(++i);
});
}
@@ -5401,4 +5419,10 @@ mocha.run = function(fn){
if (fn) fn();
});
};
+
+/**
+ * Expose the process shim.
+ */
+
+Mocha.process = process;
})();
\ No newline at end of file
diff --git a/package.json b/package.json
index a1465b28..11225cd2 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "mocha",
- "version": "1.11.0",
+ "version": "1.12.0",
"description": "simple, flexible, fun test framework",
"keywords": [
"mocha",