mocha 2.4.5 → 2.5.3

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/lib/utils.js CHANGED
@@ -12,6 +12,7 @@ var join = require('path').join;
12
12
  var readdirSync = require('fs').readdirSync;
13
13
  var statSync = require('fs').statSync;
14
14
  var watchFile = require('fs').watchFile;
15
+ var toISOString = require('to-iso-string');
15
16
 
16
17
  /**
17
18
  * Ignored directories.
@@ -454,7 +455,7 @@ function jsonStringify(object, spaces, depth) {
454
455
  var space = spaces * depth;
455
456
  var str = isArray(object) ? '[' : '{';
456
457
  var end = isArray(object) ? ']' : '}';
457
- var length = object.length || exports.keys(object).length;
458
+ var length = typeof object.length === 'number' ? object.length : exports.keys(object).length;
458
459
  // `.repeat()` polyfill
459
460
  function repeat(s, n) {
460
461
  return new Array(n).join(s);
@@ -472,15 +473,19 @@ function jsonStringify(object, spaces, depth) {
472
473
  break;
473
474
  case 'boolean':
474
475
  case 'regexp':
476
+ case 'symbol':
475
477
  case 'number':
476
478
  val = val === 0 && (1 / val) === -Infinity // `-0`
477
479
  ? '-0'
478
480
  : val.toString();
479
481
  break;
480
482
  case 'date':
481
- var sDate = isNaN(val.getTime()) // Invalid date
482
- ? val.toString()
483
- : val.toISOString();
483
+ var sDate;
484
+ if (isNaN(val.getTime())) { // Invalid date
485
+ sDate = val.toString();
486
+ } else {
487
+ sDate = val.toISOString ? val.toISOString() : toISOString(val);
488
+ }
484
489
  val = '[Date: ' + sDate + ']';
485
490
  break;
486
491
  case 'buffer':
@@ -498,7 +503,7 @@ function jsonStringify(object, spaces, depth) {
498
503
  }
499
504
 
500
505
  for (var i in object) {
501
- if (!object.hasOwnProperty(i)) {
506
+ if (!Object.prototype.hasOwnProperty.call(object, i)) {
502
507
  continue; // not my business
503
508
  }
504
509
  --length;
@@ -597,6 +602,7 @@ exports.canonicalize = function(value, stack) {
597
602
  case 'number':
598
603
  case 'regexp':
599
604
  case 'boolean':
605
+ case 'symbol':
600
606
  canonicalizedObj = value;
601
607
  break;
602
608
  default:
@@ -731,7 +737,11 @@ exports.stackTraceFilter = function() {
731
737
  }
732
738
 
733
739
  // Clean up cwd(absolute)
734
- list.push(line.replace(cwd, ''));
740
+ if (/\(?.+:\d+:\d+\)?$/.test(line)) {
741
+ line = line.replace(cwd, '');
742
+ }
743
+
744
+ list.push(line);
735
745
  return list;
736
746
  }, []);
737
747
 
package/mocha.css CHANGED
@@ -261,6 +261,15 @@ body {
261
261
  #mocha-stats .progress {
262
262
  float: right;
263
263
  padding-top: 0;
264
+
265
+ /**
266
+ * Set safe initial values, so mochas .progress does not inherit these
267
+ * properties from Bootstrap .progress (which causes .progress height to
268
+ * equal line height set in Bootstrap).
269
+ */
270
+ height: auto;
271
+ box-shadow: none;
272
+ background-color: initial;
264
273
  }
265
274
 
266
275
  #mocha-stats em {