mocha 1.17.0 → 1.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/_mocha CHANGED
File without changes
@@ -188,7 +188,7 @@ exports.list = function(failures){
188
188
  if ('string' == typeof actual && 'string' == typeof expected) {
189
189
  fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n');
190
190
  var match = message.match(/^([^:]+): expected/);
191
- msg = match ? '\n ' + color('error message', match[1]) : '';
191
+ msg = '\n ' + color('error message', match ? match[1] : msg);
192
192
 
193
193
  if (exports.inlineDiffs) {
194
194
  msg += inlineDiff(err, escape);
package/lib/runner.js CHANGED
@@ -58,7 +58,7 @@ function Runner(suite) {
58
58
  this.on('test end', function(test){ self.checkGlobals(test); });
59
59
  this.on('hook end', function(hook){ self.checkGlobals(hook); });
60
60
  this.grep(/.*/);
61
- this.globals(this.globalProps().concat(['errno']));
61
+ this.globals(this.globalProps().concat(extraGlobals()));
62
62
  }
63
63
 
64
64
  /**
@@ -168,10 +168,6 @@ Runner.prototype.checkGlobals = function(test){
168
168
  ok = ok.concat(test._allowedGlobals || []);
169
169
  }
170
170
 
171
- // check length - 2 ('errno' and 'location' globals)
172
- if (isNode && 1 == ok.length - globals.length) return;
173
- else if (2 == ok.length - globals.length) return;
174
-
175
171
  if(this.prevGlobalsLength == globals.length) return;
176
172
  this.prevGlobalsLength = globals.length;
177
173
 
@@ -638,3 +634,28 @@ function filterLeaks(ok, globals) {
638
634
  return matched.length == 0 && (!global.navigator || 'onerror' !== key);
639
635
  });
640
636
  }
637
+
638
+ /**
639
+ * Array of globals dependent on the environment.
640
+ *
641
+ * @return {Array}
642
+ * @api private
643
+ */
644
+
645
+ function extraGlobals() {
646
+ if (typeof(process) === 'object' &&
647
+ typeof(process.version) === 'string') {
648
+
649
+ var nodeVersion = process.version.split('.').reduce(function(a, v) {
650
+ return a << 8 | v;
651
+ });
652
+
653
+ // 'errno' was renamed to process._errno in v0.9.11.
654
+
655
+ if (nodeVersion < 0x00090B) {
656
+ return ['errno'];
657
+ }
658
+ }
659
+
660
+ return [];
661
+ }
package/mocha.js CHANGED
@@ -2038,7 +2038,7 @@ exports.list = function(failures){
2038
2038
  if ('string' == typeof actual && 'string' == typeof expected) {
2039
2039
  fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n');
2040
2040
  var match = message.match(/^([^:]+): expected/);
2041
- msg = match ? '\n ' + color('error message', match[1]) : '';
2041
+ msg = '\n ' + color('error message', match ? match[1] : msg);
2042
2042
 
2043
2043
  if (exports.inlineDiffs) {
2044
2044
  msg += inlineDiff(err, escape);
@@ -4404,7 +4404,7 @@ function Runner(suite) {
4404
4404
  this.on('test end', function(test){ self.checkGlobals(test); });
4405
4405
  this.on('hook end', function(hook){ self.checkGlobals(hook); });
4406
4406
  this.grep(/.*/);
4407
- this.globals(this.globalProps().concat(['errno']));
4407
+ this.globals(this.globalProps().concat(extraGlobals()));
4408
4408
  }
4409
4409
 
4410
4410
  /**
@@ -4518,10 +4518,6 @@ Runner.prototype.checkGlobals = function(test){
4518
4518
  ok = ok.concat(test._allowedGlobals || []);
4519
4519
  }
4520
4520
 
4521
- // check length - 2 ('errno' and 'location' globals)
4522
- if (isNode && 1 == ok.length - globals.length) return;
4523
- else if (2 == ok.length - globals.length) return;
4524
-
4525
4521
  if(this.prevGlobalsLength == globals.length) return;
4526
4522
  this.prevGlobalsLength = globals.length;
4527
4523
 
@@ -4989,6 +4985,31 @@ function filterLeaks(ok, globals) {
4989
4985
  });
4990
4986
  }
4991
4987
 
4988
+ /**
4989
+ * Array of globals dependent on the environment.
4990
+ *
4991
+ * @return {Array}
4992
+ * @api private
4993
+ */
4994
+
4995
+ function extraGlobals() {
4996
+ if (typeof(process) === 'object' &&
4997
+ typeof(process.version) === 'string') {
4998
+
4999
+ var nodeVersion = process.version.split('.').reduce(function(a, v) {
5000
+ return a << 8 | v;
5001
+ });
5002
+
5003
+ // 'errno' was renamed to process._errno in v0.9.11.
5004
+
5005
+ if (nodeVersion < 0x00090B) {
5006
+ return ['errno'];
5007
+ }
5008
+ }
5009
+
5010
+ return [];
5011
+ }
5012
+
4992
5013
  }); // module: runner.js
4993
5014
 
4994
5015
  require.register("suite.js", function(module, exports, require){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mocha",
3
- "version": "1.17.0",
3
+ "version": "1.17.1",
4
4
  "description": "simple, flexible, fun test framework",
5
5
  "keywords": [
6
6
  "mocha",