mocha 3.0.2 → 3.2.0

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/LICENSE +1 -1
  3. package/README.md +2 -2
  4. package/bin/_mocha +170 -104
  5. package/bin/mocha +22 -13
  6. package/bin/options.js +7 -5
  7. package/browser-entry.js +43 -22
  8. package/lib/browser/.eslintrc.yaml +4 -0
  9. package/lib/browser/debug.js +6 -3
  10. package/lib/browser/events.js +11 -9
  11. package/lib/browser/progress.js +9 -7
  12. package/lib/browser/tty.js +4 -2
  13. package/lib/context.js +11 -9
  14. package/lib/hook.js +4 -2
  15. package/lib/interfaces/bdd.js +11 -9
  16. package/lib/interfaces/common.js +16 -14
  17. package/lib/interfaces/exports.js +4 -2
  18. package/lib/interfaces/index.js +2 -0
  19. package/lib/interfaces/qunit.js +12 -8
  20. package/lib/interfaces/tdd.js +9 -7
  21. package/lib/mocha.js +36 -34
  22. package/lib/ms.js +12 -10
  23. package/lib/pending.js +2 -1
  24. package/lib/reporters/base.js +52 -50
  25. package/lib/reporters/doc.js +8 -6
  26. package/lib/reporters/dot.js +9 -7
  27. package/lib/reporters/html.js +32 -30
  28. package/lib/reporters/index.js +2 -0
  29. package/lib/reporters/json-stream.js +8 -6
  30. package/lib/reporters/json.js +11 -9
  31. package/lib/reporters/landing.js +8 -6
  32. package/lib/reporters/list.js +13 -11
  33. package/lib/reporters/markdown.js +12 -10
  34. package/lib/reporters/min.js +4 -2
  35. package/lib/reporters/nyan.js +22 -20
  36. package/lib/reporters/progress.js +7 -5
  37. package/lib/reporters/spec.js +17 -15
  38. package/lib/reporters/tap.js +10 -8
  39. package/lib/reporters/xunit.js +14 -12
  40. package/lib/runnable.js +43 -32
  41. package/lib/runner.js +78 -63
  42. package/lib/suite.js +24 -22
  43. package/lib/test.js +4 -2
  44. package/lib/utils.js +115 -90
  45. package/mocha.js +1185 -800
  46. package/package.json +9 -2
  47. package/lib/interfaces/bdd.js.orig +0 -118
  48. package/lib/mocha.js.orig +0 -532
  49. package/lib/runnable.js.orig +0 -378
  50. package/lib/runner.js.orig +0 -934
  51. package/lib/suite.js.orig +0 -418
  52. package/lib/test.js.orig +0 -52
  53. package/lib/utils.js.orig +0 -758
@@ -1,3 +1,5 @@
1
+ 'use strict';
2
+
1
3
  /**
2
4
  * Module dependencies.
3
5
  */
@@ -101,7 +103,7 @@ if (process.platform === 'win32') {
101
103
  * @return {string}
102
104
  * @api private
103
105
  */
104
- var color = exports.color = function(type, str) {
106
+ var color = exports.color = function (type, str) {
105
107
  if (!exports.useColors) {
106
108
  return String(str);
107
109
  }
@@ -127,23 +129,23 @@ if (isatty) {
127
129
  */
128
130
 
129
131
  exports.cursor = {
130
- hide: function() {
132
+ hide: function () {
131
133
  isatty && process.stdout.write('\u001b[?25l');
132
134
  },
133
135
 
134
- show: function() {
136
+ show: function () {
135
137
  isatty && process.stdout.write('\u001b[?25h');
136
138
  },
137
139
 
138
- deleteLine: function() {
140
+ deleteLine: function () {
139
141
  isatty && process.stdout.write('\u001b[2K');
140
142
  },
141
143
 
142
- beginningOfLine: function() {
144
+ beginningOfLine: function () {
143
145
  isatty && process.stdout.write('\u001b[0G');
144
146
  },
145
147
 
146
- CR: function() {
148
+ CR: function () {
147
149
  if (isatty) {
148
150
  exports.cursor.deleteLine();
149
151
  exports.cursor.beginningOfLine();
@@ -160,13 +162,13 @@ exports.cursor = {
160
162
  * @api public
161
163
  */
162
164
 
163
- exports.list = function(failures) {
165
+ exports.list = function (failures) {
164
166
  console.log();
165
- failures.forEach(function(test, i) {
167
+ failures.forEach(function (test, i) {
166
168
  // format
167
- var fmt = color('error title', ' %s) %s:\n')
168
- + color('error message', ' %s')
169
- + color('error stack', '\n%s\n');
169
+ var fmt = color('error title', ' %s) %s:\n') +
170
+ color('error message', ' %s') +
171
+ color('error stack', '\n%s\n');
170
172
 
171
173
  // msg
172
174
  var msg;
@@ -236,7 +238,7 @@ exports.list = function(failures) {
236
238
  * @api public
237
239
  */
238
240
 
239
- function Base(runner) {
241
+ function Base (runner) {
240
242
  var stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 };
241
243
  var failures = this.failures = [];
242
244
 
@@ -247,21 +249,21 @@ function Base(runner) {
247
249
 
248
250
  runner.stats = stats;
249
251
 
250
- runner.on('start', function() {
252
+ runner.on('start', function () {
251
253
  stats.start = new Date();
252
254
  });
253
255
 
254
- runner.on('suite', function(suite) {
256
+ runner.on('suite', function (suite) {
255
257
  stats.suites = stats.suites || 0;
256
258
  suite.root || stats.suites++;
257
259
  });
258
260
 
259
- runner.on('test end', function() {
261
+ runner.on('test end', function () {
260
262
  stats.tests = stats.tests || 0;
261
263
  stats.tests++;
262
264
  });
263
265
 
264
- runner.on('pass', function(test) {
266
+ runner.on('pass', function (test) {
265
267
  stats.passes = stats.passes || 0;
266
268
 
267
269
  if (test.duration > test.slow()) {
@@ -275,19 +277,19 @@ function Base(runner) {
275
277
  stats.passes++;
276
278
  });
277
279
 
278
- runner.on('fail', function(test, err) {
280
+ runner.on('fail', function (test, err) {
279
281
  stats.failures = stats.failures || 0;
280
282
  stats.failures++;
281
283
  test.err = err;
282
284
  failures.push(test);
283
285
  });
284
286
 
285
- runner.on('end', function() {
287
+ runner.on('end', function () {
286
288
  stats.end = new Date();
287
289
  stats.duration = new Date() - stats.start;
288
290
  });
289
291
 
290
- runner.on('pending', function() {
292
+ runner.on('pending', function () {
291
293
  stats.pending++;
292
294
  });
293
295
  }
@@ -298,16 +300,16 @@ function Base(runner) {
298
300
  *
299
301
  * @api public
300
302
  */
301
- Base.prototype.epilogue = function() {
303
+ Base.prototype.epilogue = function () {
302
304
  var stats = this.stats;
303
305
  var fmt;
304
306
 
305
307
  console.log();
306
308
 
307
309
  // passes
308
- fmt = color('bright pass', ' ')
309
- + color('green', ' %d passing')
310
- + color('light', ' (%s)');
310
+ fmt = color('bright pass', ' ') +
311
+ color('green', ' %d passing') +
312
+ color('light', ' (%s)');
311
313
 
312
314
  console.log(fmt,
313
315
  stats.passes || 0,
@@ -315,8 +317,8 @@ Base.prototype.epilogue = function() {
315
317
 
316
318
  // pending
317
319
  if (stats.pending) {
318
- fmt = color('pending', ' ')
319
- + color('pending', ' %d pending');
320
+ fmt = color('pending', ' ') +
321
+ color('pending', ' %d pending');
320
322
 
321
323
  console.log(fmt, stats.pending);
322
324
  }
@@ -342,7 +344,7 @@ Base.prototype.epilogue = function() {
342
344
  * @param {string} len
343
345
  * @return {string}
344
346
  */
345
- function pad(str, len) {
347
+ function pad (str, len) {
346
348
  str = String(str);
347
349
  return Array(len - str.length + 1).join(' ') + str;
348
350
  }
@@ -355,26 +357,26 @@ function pad(str, len) {
355
357
  * @param {boolean} escape
356
358
  * @return {string} Diff
357
359
  */
358
- function inlineDiff(err, escape) {
360
+ function inlineDiff (err, escape) {
359
361
  var msg = errorDiff(err, 'WordsWithSpace', escape);
360
362
 
361
363
  // linenos
362
364
  var lines = msg.split('\n');
363
365
  if (lines.length > 4) {
364
366
  var width = String(lines.length).length;
365
- msg = lines.map(function(str, i) {
367
+ msg = lines.map(function (str, i) {
366
368
  return pad(++i, width) + ' |' + ' ' + str;
367
369
  }).join('\n');
368
370
  }
369
371
 
370
372
  // legend
371
- msg = '\n'
372
- + color('diff removed', 'actual')
373
- + ' '
374
- + color('diff added', 'expected')
375
- + '\n\n'
376
- + msg
377
- + '\n';
373
+ msg = '\n' +
374
+ color('diff removed', 'actual') +
375
+ ' ' +
376
+ color('diff added', 'expected') +
377
+ '\n\n' +
378
+ msg +
379
+ '\n';
378
380
 
379
381
  // indent
380
382
  msg = msg.replace(/^/gm, ' ');
@@ -389,9 +391,9 @@ function inlineDiff(err, escape) {
389
391
  * @param {boolean} escape
390
392
  * @return {string} The diff.
391
393
  */
392
- function unifiedDiff(err, escape) {
394
+ function unifiedDiff (err, escape) {
393
395
  var indent = ' ';
394
- function cleanUp(line) {
396
+ function cleanUp (line) {
395
397
  if (escape) {
396
398
  line = escapeInvisibles(line);
397
399
  }
@@ -401,7 +403,7 @@ function unifiedDiff(err, escape) {
401
403
  if (line[0] === '-') {
402
404
  return indent + colorLines('diff removed', line);
403
405
  }
404
- if (line.match(/\@\@/)) {
406
+ if (line.match(/@@/)) {
405
407
  return null;
406
408
  }
407
409
  if (line.match(/\\ No newline/)) {
@@ -409,16 +411,16 @@ function unifiedDiff(err, escape) {
409
411
  }
410
412
  return indent + line;
411
413
  }
412
- function notBlank(line) {
414
+ function notBlank (line) {
413
415
  return typeof line !== 'undefined' && line !== null;
414
416
  }
415
417
  var msg = diff.createPatch('string', err.actual, err.expected);
416
418
  var lines = msg.split('\n').splice(4);
417
- return '\n '
418
- + colorLines('diff added', '+ expected') + ' '
419
- + colorLines('diff removed', '- actual')
420
- + '\n\n'
421
- + lines.map(cleanUp).filter(notBlank).join('\n');
419
+ return '\n ' +
420
+ colorLines('diff added', '+ expected') + ' ' +
421
+ colorLines('diff removed', '- actual') +
422
+ '\n\n' +
423
+ lines.map(cleanUp).filter(notBlank).join('\n');
422
424
  }
423
425
 
424
426
  /**
@@ -430,10 +432,10 @@ function unifiedDiff(err, escape) {
430
432
  * @param {boolean} escape
431
433
  * @return {string}
432
434
  */
433
- function errorDiff(err, type, escape) {
435
+ function errorDiff (err, type, escape) {
434
436
  var actual = escape ? escapeInvisibles(err.actual) : err.actual;
435
437
  var expected = escape ? escapeInvisibles(err.expected) : err.expected;
436
- return diff['diff' + type](actual, expected).map(function(str) {
438
+ return diff['diff' + type](actual, expected).map(function (str) {
437
439
  if (str.added) {
438
440
  return colorLines('diff added', str.value);
439
441
  }
@@ -451,7 +453,7 @@ function errorDiff(err, type, escape) {
451
453
  * @param {string} line
452
454
  * @return {string}
453
455
  */
454
- function escapeInvisibles(line) {
456
+ function escapeInvisibles (line) {
455
457
  return line.replace(/\t/g, '<tab>')
456
458
  .replace(/\r/g, '<CR>')
457
459
  .replace(/\n/g, '<LF>\n');
@@ -465,8 +467,8 @@ function escapeInvisibles(line) {
465
467
  * @param {string} str
466
468
  * @return {string}
467
469
  */
468
- function colorLines(name, str) {
469
- return str.split('\n').map(function(str) {
470
+ function colorLines (name, str) {
471
+ return str.split('\n').map(function (str) {
470
472
  return color(name, str);
471
473
  }).join('\n');
472
474
  }
@@ -484,6 +486,6 @@ var objToString = Object.prototype.toString;
484
486
  * @param {Object} b
485
487
  * @return {boolean}
486
488
  */
487
- function sameType(a, b) {
489
+ function sameType (a, b) {
488
490
  return objToString.call(a) === objToString.call(b);
489
491
  }
@@ -1,3 +1,5 @@
1
+ 'use strict';
2
+
1
3
  /**
2
4
  * Module dependencies.
3
5
  */
@@ -17,16 +19,16 @@ exports = module.exports = Doc;
17
19
  * @param {Runner} runner
18
20
  * @api public
19
21
  */
20
- function Doc(runner) {
22
+ function Doc (runner) {
21
23
  Base.call(this, runner);
22
24
 
23
25
  var indents = 2;
24
26
 
25
- function indent() {
27
+ function indent () {
26
28
  return Array(indents).join(' ');
27
29
  }
28
30
 
29
- runner.on('suite', function(suite) {
31
+ runner.on('suite', function (suite) {
30
32
  if (suite.root) {
31
33
  return;
32
34
  }
@@ -37,7 +39,7 @@ function Doc(runner) {
37
39
  console.log('%s<dl>', indent());
38
40
  });
39
41
 
40
- runner.on('suite end', function(suite) {
42
+ runner.on('suite end', function (suite) {
41
43
  if (suite.root) {
42
44
  return;
43
45
  }
@@ -47,13 +49,13 @@ function Doc(runner) {
47
49
  --indents;
48
50
  });
49
51
 
50
- runner.on('pass', function(test) {
52
+ runner.on('pass', function (test) {
51
53
  console.log('%s <dt>%s</dt>', indent(), utils.escape(test.title));
52
54
  var code = utils.escape(utils.clean(test.body));
53
55
  console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
54
56
  });
55
57
 
56
- runner.on('fail', function(test, err) {
58
+ runner.on('fail', function (test, err) {
57
59
  console.log('%s <dt class="error">%s</dt>', indent(), utils.escape(test.title));
58
60
  var code = utils.escape(utils.clean(test.body));
59
61
  console.log('%s <dd class="error"><pre><code>%s</code></pre></dd>', indent(), code);
@@ -1,3 +1,5 @@
1
+ 'use strict';
2
+
1
3
  /**
2
4
  * Module dependencies.
3
5
  */
@@ -18,25 +20,25 @@ exports = module.exports = Dot;
18
20
  * @api public
19
21
  * @param {Runner} runner
20
22
  */
21
- function Dot(runner) {
23
+ function Dot (runner) {
22
24
  Base.call(this, runner);
23
25
 
24
26
  var self = this;
25
- var width = Base.window.width * .75 | 0;
27
+ var width = Base.window.width * 0.75 | 0;
26
28
  var n = -1;
27
29
 
28
- runner.on('start', function() {
30
+ runner.on('start', function () {
29
31
  process.stdout.write('\n');
30
32
  });
31
33
 
32
- runner.on('pending', function() {
34
+ runner.on('pending', function () {
33
35
  if (++n % width === 0) {
34
36
  process.stdout.write('\n ');
35
37
  }
36
38
  process.stdout.write(color('pending', Base.symbols.comma));
37
39
  });
38
40
 
39
- runner.on('pass', function(test) {
41
+ runner.on('pass', function (test) {
40
42
  if (++n % width === 0) {
41
43
  process.stdout.write('\n ');
42
44
  }
@@ -47,14 +49,14 @@ function Dot(runner) {
47
49
  }
48
50
  });
49
51
 
50
- runner.on('fail', function() {
52
+ runner.on('fail', function () {
51
53
  if (++n % width === 0) {
52
54
  process.stdout.write('\n ');
53
55
  }
54
56
  process.stdout.write(color('fail', Base.symbols.bang));
55
57
  });
56
58
 
57
- runner.on('end', function() {
59
+ runner.on('end', function () {
58
60
  console.log();
59
61
  self.epilogue();
60
62
  });
@@ -1,3 +1,5 @@
1
+ 'use strict';
2
+
1
3
  /* eslint-env browser */
2
4
 
3
5
  /**
@@ -32,12 +34,12 @@ exports = module.exports = HTML;
32
34
  * Stats template.
33
35
  */
34
36
 
35
- var statsTemplate = '<ul id="mocha-stats">'
36
- + '<li class="progress"><canvas width="40" height="40"></canvas></li>'
37
- + '<li class="passes"><a href="javascript:void(0);">passes:</a> <em>0</em></li>'
38
- + '<li class="failures"><a href="javascript:void(0);">failures:</a> <em>0</em></li>'
39
- + '<li class="duration">duration: <em>0</em>s</li>'
40
- + '</ul>';
37
+ var statsTemplate = '<ul id="mocha-stats">' +
38
+ '<li class="progress"><canvas width="40" height="40"></canvas></li>' +
39
+ '<li class="passes"><a href="javascript:void(0);">passes:</a> <em>0</em></li>' +
40
+ '<li class="failures"><a href="javascript:void(0);">failures:</a> <em>0</em></li>' +
41
+ '<li class="duration">duration: <em>0</em>s</li>' +
42
+ '</ul>';
41
43
 
42
44
  /**
43
45
  * Initialize a new `HTML` reporter.
@@ -45,7 +47,7 @@ var statsTemplate = '<ul id="mocha-stats">'
45
47
  * @api public
46
48
  * @param {Runner} runner
47
49
  */
48
- function HTML(runner) {
50
+ function HTML (runner) {
49
51
  Base.call(this, runner);
50
52
 
51
53
  var self = this;
@@ -80,7 +82,7 @@ function HTML(runner) {
80
82
  }
81
83
 
82
84
  // pass toggle
83
- on(passesLink, 'click', function(evt) {
85
+ on(passesLink, 'click', function (evt) {
84
86
  evt.preventDefault();
85
87
  unhide();
86
88
  var name = (/pass/).test(report.className) ? '' : ' pass';
@@ -91,7 +93,7 @@ function HTML(runner) {
91
93
  });
92
94
 
93
95
  // failure toggle
94
- on(failuresLink, 'click', function(evt) {
96
+ on(failuresLink, 'click', function (evt) {
95
97
  evt.preventDefault();
96
98
  unhide();
97
99
  var name = (/fail/).test(report.className) ? '' : ' fail';
@@ -108,7 +110,7 @@ function HTML(runner) {
108
110
  progress.size(40);
109
111
  }
110
112
 
111
- runner.on('suite', function(suite) {
113
+ runner.on('suite', function (suite) {
112
114
  if (suite.root) {
113
115
  return;
114
116
  }
@@ -123,7 +125,7 @@ function HTML(runner) {
123
125
  el.appendChild(stack[0]);
124
126
  });
125
127
 
126
- runner.on('suite end', function(suite) {
128
+ runner.on('suite end', function (suite) {
127
129
  if (suite.root) {
128
130
  updateStats();
129
131
  return;
@@ -131,17 +133,17 @@ function HTML(runner) {
131
133
  stack.shift();
132
134
  });
133
135
 
134
- runner.on('pass', function(test) {
136
+ runner.on('pass', function (test) {
135
137
  var url = self.testURL(test);
136
- var markup = '<li class="test pass %e"><h2>%e<span class="duration">%ems</span> '
137
- + '<a href="%s" class="replay">‣</a></h2></li>';
138
+ var markup = '<li class="test pass %e"><h2>%e<span class="duration">%ems</span> ' +
139
+ '<a href="%s" class="replay">‣</a></h2></li>';
138
140
  var el = fragment(markup, test.speed, test.title, test.duration, url);
139
141
  self.addCodeToggle(el, test.body);
140
142
  appendToStack(el);
141
143
  updateStats();
142
144
  });
143
145
 
144
- runner.on('fail', function(test) {
146
+ runner.on('fail', function (test) {
145
147
  var el = fragment('<li class="test fail"><h2>%e <a href="%e" class="replay">‣</a></h2></li>',
146
148
  test.title, self.testURL(test));
147
149
  var stackString; // Note: Includes leading newline
@@ -181,20 +183,20 @@ function HTML(runner) {
181
183
  updateStats();
182
184
  });
183
185
 
184
- runner.on('pending', function(test) {
186
+ runner.on('pending', function (test) {
185
187
  var el = fragment('<li class="test pass pending"><h2>%e</h2></li>', test.title);
186
188
  appendToStack(el);
187
189
  updateStats();
188
190
  });
189
191
 
190
- function appendToStack(el) {
192
+ function appendToStack (el) {
191
193
  // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack.
192
194
  if (stack[0]) {
193
195
  stack[0].appendChild(el);
194
196
  }
195
197
  }
196
198
 
197
- function updateStats() {
199
+ function updateStats () {
198
200
  // TODO: add to stats
199
201
  var percent = stats.tests / runner.total * 100 | 0;
200
202
  if (progress) {
@@ -215,7 +217,7 @@ function HTML(runner) {
215
217
  * @param {string} s
216
218
  * @return {string} A new URL.
217
219
  */
218
- function makeUrl(s) {
220
+ function makeUrl (s) {
219
221
  var search = window.location.search;
220
222
 
221
223
  // Remove previous grep query parameter if present
@@ -231,7 +233,7 @@ function makeUrl(s) {
231
233
  *
232
234
  * @param {Object} [suite]
233
235
  */
234
- HTML.prototype.suiteURL = function(suite) {
236
+ HTML.prototype.suiteURL = function (suite) {
235
237
  return makeUrl(suite.fullTitle());
236
238
  };
237
239
 
@@ -240,7 +242,7 @@ HTML.prototype.suiteURL = function(suite) {
240
242
  *
241
243
  * @param {Object} [test]
242
244
  */
243
- HTML.prototype.testURL = function(test) {
245
+ HTML.prototype.testURL = function (test) {
244
246
  return makeUrl(test.fullTitle());
245
247
  };
246
248
 
@@ -250,10 +252,10 @@ HTML.prototype.testURL = function(test) {
250
252
  * @param {HTMLLIElement} el
251
253
  * @param {string} contents
252
254
  */
253
- HTML.prototype.addCodeToggle = function(el, contents) {
255
+ HTML.prototype.addCodeToggle = function (el, contents) {
254
256
  var h2 = el.getElementsByTagName('h2')[0];
255
257
 
256
- on(h2, 'click', function() {
258
+ on(h2, 'click', function () {
257
259
  pre.style.display = pre.style.display === 'none' ? 'block' : 'none';
258
260
  });
259
261
 
@@ -267,7 +269,7 @@ HTML.prototype.addCodeToggle = function(el, contents) {
267
269
  *
268
270
  * @param {string} msg
269
271
  */
270
- function error(msg) {
272
+ function error (msg) {
271
273
  document.body.appendChild(fragment('<div id="mocha-error">%s</div>', msg));
272
274
  }
273
275
 
@@ -276,12 +278,12 @@ function error(msg) {
276
278
  *
277
279
  * @param {string} html
278
280
  */
279
- function fragment(html) {
281
+ function fragment (html) {
280
282
  var args = arguments;
281
283
  var div = document.createElement('div');
282
284
  var i = 1;
283
285
 
284
- div.innerHTML = html.replace(/%([se])/g, function(_, type) {
286
+ div.innerHTML = html.replace(/%([se])/g, function (_, type) {
285
287
  switch (type) {
286
288
  case 's': return String(args[i++]);
287
289
  case 'e': return escape(args[i++]);
@@ -298,7 +300,7 @@ function fragment(html) {
298
300
  *
299
301
  * @param {text} classname
300
302
  */
301
- function hideSuitesWithout(classname) {
303
+ function hideSuitesWithout (classname) {
302
304
  var suites = document.getElementsByClassName('suite');
303
305
  for (var i = 0; i < suites.length; i++) {
304
306
  var els = suites[i].getElementsByClassName(classname);
@@ -311,7 +313,7 @@ function hideSuitesWithout(classname) {
311
313
  /**
312
314
  * Unhide .hidden suites.
313
315
  */
314
- function unhide() {
316
+ function unhide () {
315
317
  var els = document.getElementsByClassName('suite hidden');
316
318
  for (var i = 0; i < els.length; ++i) {
317
319
  els[i].className = els[i].className.replace('suite hidden', 'suite');
@@ -324,7 +326,7 @@ function unhide() {
324
326
  * @param {HTMLElement} el
325
327
  * @param {string} contents
326
328
  */
327
- function text(el, contents) {
329
+ function text (el, contents) {
328
330
  if (el.textContent) {
329
331
  el.textContent = contents;
330
332
  } else {
@@ -335,7 +337,7 @@ function text(el, contents) {
335
337
  /**
336
338
  * Listen on `event` with callback `fn`.
337
339
  */
338
- function on(el, event, fn) {
340
+ function on (el, event, fn) {
339
341
  if (el.addEventListener) {
340
342
  el.addEventListener(event, fn, false);
341
343
  } else {
@@ -1,3 +1,5 @@
1
+ 'use strict';
2
+
1
3
  // Alias exports to a their normalized format Mocha#reporter to prevent a need
2
4
  // for dynamic (try/catch) requires, which Browserify doesn't handle.
3
5
  exports.Base = exports.base = require('./base');
@@ -1,3 +1,5 @@
1
+ 'use strict';
2
+
1
3
  /**
2
4
  * Module dependencies.
3
5
  */
@@ -17,28 +19,28 @@ exports = module.exports = List;
17
19
  * @api public
18
20
  * @param {Runner} runner
19
21
  */
20
- function List(runner) {
22
+ function List (runner) {
21
23
  Base.call(this, runner);
22
24
 
23
25
  var self = this;
24
26
  var total = runner.total;
25
27
 
26
- runner.on('start', function() {
28
+ runner.on('start', function () {
27
29
  console.log(JSON.stringify(['start', { total: total }]));
28
30
  });
29
31
 
30
- runner.on('pass', function(test) {
32
+ runner.on('pass', function (test) {
31
33
  console.log(JSON.stringify(['pass', clean(test)]));
32
34
  });
33
35
 
34
- runner.on('fail', function(test, err) {
36
+ runner.on('fail', function (test, err) {
35
37
  test = clean(test);
36
38
  test.err = err.message;
37
39
  test.stack = err.stack || null;
38
40
  console.log(JSON.stringify(['fail', test]));
39
41
  });
40
42
 
41
- runner.on('end', function() {
43
+ runner.on('end', function () {
42
44
  process.stdout.write(JSON.stringify(['end', self.stats]));
43
45
  });
44
46
  }
@@ -51,7 +53,7 @@ function List(runner) {
51
53
  * @param {Object} test
52
54
  * @return {Object}
53
55
  */
54
- function clean(test) {
56
+ function clean (test) {
55
57
  return {
56
58
  title: test.title,
57
59
  fullTitle: test.fullTitle(),