mocha 5.1.1 → 6.0.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 (61) hide show
  1. package/CHANGELOG.md +686 -984
  2. package/README.md +2 -1
  3. package/{images → assets/growl}/error.png +0 -0
  4. package/{images → assets/growl}/ok.png +0 -0
  5. package/bin/_mocha +4 -595
  6. package/bin/mocha +121 -61
  7. package/bin/options.js +6 -39
  8. package/browser-entry.js +21 -17
  9. package/lib/browser/growl.js +165 -2
  10. package/lib/browser/progress.js +11 -11
  11. package/lib/{template.html → browser/template.html} +0 -0
  12. package/lib/browser/tty.js +2 -2
  13. package/lib/cli/cli.js +68 -0
  14. package/lib/cli/commands.js +13 -0
  15. package/lib/cli/config.js +79 -0
  16. package/lib/cli/index.js +9 -0
  17. package/lib/cli/init.js +37 -0
  18. package/lib/cli/node-flags.js +69 -0
  19. package/lib/cli/one-and-dones.js +70 -0
  20. package/lib/cli/options.js +330 -0
  21. package/lib/cli/run-helpers.js +337 -0
  22. package/lib/cli/run-option-metadata.js +76 -0
  23. package/lib/cli/run.js +297 -0
  24. package/lib/context.js +14 -14
  25. package/lib/errors.js +141 -0
  26. package/lib/growl.js +136 -0
  27. package/lib/hook.js +5 -16
  28. package/lib/interfaces/bdd.js +16 -13
  29. package/lib/interfaces/common.js +62 -18
  30. package/lib/interfaces/exports.js +5 -8
  31. package/lib/interfaces/qunit.js +10 -10
  32. package/lib/interfaces/tdd.js +12 -11
  33. package/lib/mocha.js +477 -256
  34. package/lib/mocharc.json +10 -0
  35. package/lib/pending.js +1 -5
  36. package/lib/reporters/base.js +95 -117
  37. package/lib/reporters/doc.js +23 -9
  38. package/lib/reporters/dot.js +19 -13
  39. package/lib/reporters/html.js +82 -47
  40. package/lib/reporters/json-stream.js +43 -23
  41. package/lib/reporters/json.js +32 -23
  42. package/lib/reporters/landing.js +16 -9
  43. package/lib/reporters/list.js +19 -11
  44. package/lib/reporters/markdown.js +18 -12
  45. package/lib/reporters/min.js +8 -4
  46. package/lib/reporters/nyan.js +42 -35
  47. package/lib/reporters/progress.js +12 -7
  48. package/lib/reporters/spec.js +23 -12
  49. package/lib/reporters/tap.js +250 -32
  50. package/lib/reporters/xunit.js +61 -35
  51. package/lib/runnable.js +152 -95
  52. package/lib/runner.js +296 -248
  53. package/lib/stats-collector.js +83 -0
  54. package/lib/suite.js +294 -75
  55. package/lib/test.js +16 -15
  56. package/lib/utils.js +419 -146
  57. package/mocha.js +4589 -2228
  58. package/package.json +137 -38
  59. package/lib/ms.js +0 -94
  60. package/lib/reporters/base.js.orig +0 -498
  61. package/lib/reporters/json.js.orig +0 -128
package/lib/test.js CHANGED
@@ -1,29 +1,30 @@
1
1
  'use strict';
2
-
3
- /**
4
- * Module dependencies.
5
- */
6
-
7
2
  var Runnable = require('./runnable');
8
3
  var utils = require('./utils');
4
+ var errors = require('./errors');
5
+ var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
9
6
  var isString = utils.isString;
10
7
 
11
- /**
12
- * Expose `Test`.
13
- */
14
-
15
8
  module.exports = Test;
16
9
 
17
10
  /**
18
11
  * Initialize a new `Test` with the given `title` and callback `fn`.
19
12
  *
20
- * @api private
21
- * @param {String} title
22
- * @param {Function} fn
13
+ * @public
14
+ * @class
15
+ * @extends Runnable
16
+ * @param {String} title - Test title (required)
17
+ * @param {Function} [fn] - Test callback. If omitted, the Test is considered "pending"
23
18
  */
24
- function Test (title, fn) {
19
+ function Test(title, fn) {
25
20
  if (!isString(title)) {
26
- throw new Error('Test `title` should be a "string" but "' + typeof title + '" was given instead.');
21
+ throw createInvalidArgumentTypeError(
22
+ 'Test argument "title" should be a string. Received type "' +
23
+ typeof title +
24
+ '"',
25
+ 'title',
26
+ 'string'
27
+ );
27
28
  }
28
29
  Runnable.call(this, title, fn);
29
30
  this.pending = !fn;
@@ -35,7 +36,7 @@ function Test (title, fn) {
35
36
  */
36
37
  utils.inherits(Test, Runnable);
37
38
 
38
- Test.prototype.clone = function () {
39
+ Test.prototype.clone = function() {
39
40
  var test = new Test(this.title, this.fn);
40
41
  test.timeout(this.timeout());
41
42
  test.slow(this.slow());