mocha 5.1.0 → 6.0.0-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.
Files changed (63) hide show
  1. package/CHANGELOG.md +653 -981
  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 +84 -58
  7. package/bin/options.js +6 -39
  8. package/browser-entry.js +21 -17
  9. package/lib/browser/growl.js +164 -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 +48 -0
  19. package/lib/cli/one-and-dones.js +70 -0
  20. package/lib/cli/options.js +299 -0
  21. package/lib/cli/run-helpers.js +328 -0
  22. package/lib/cli/run-option-metadata.js +72 -0
  23. package/lib/cli/run.js +293 -0
  24. package/lib/context.js +14 -14
  25. package/lib/errors.js +139 -0
  26. package/lib/growl.js +135 -0
  27. package/lib/hook.js +5 -16
  28. package/lib/interfaces/bdd.js +14 -13
  29. package/lib/interfaces/common.js +59 -16
  30. package/lib/interfaces/exports.js +4 -7
  31. package/lib/interfaces/qunit.js +8 -10
  32. package/lib/interfaces/tdd.js +10 -11
  33. package/lib/mocha.js +442 -255
  34. package/lib/mocharc.json +10 -0
  35. package/lib/pending.js +1 -5
  36. package/lib/reporters/base.js +92 -117
  37. package/lib/reporters/doc.js +18 -9
  38. package/lib/reporters/dot.js +13 -13
  39. package/lib/reporters/html.js +76 -47
  40. package/lib/reporters/json-stream.js +38 -23
  41. package/lib/reporters/json.js +26 -23
  42. package/lib/reporters/landing.js +9 -8
  43. package/lib/reporters/list.js +11 -10
  44. package/lib/reporters/markdown.js +13 -12
  45. package/lib/reporters/min.js +4 -3
  46. package/lib/reporters/nyan.js +36 -35
  47. package/lib/reporters/progress.js +8 -7
  48. package/lib/reporters/spec.js +14 -11
  49. package/lib/reporters/tap.js +243 -32
  50. package/lib/reporters/xunit.js +52 -33
  51. package/lib/runnable.js +103 -90
  52. package/lib/runner.js +156 -107
  53. package/lib/stats-collector.js +81 -0
  54. package/lib/suite.js +57 -51
  55. package/lib/test.js +13 -13
  56. package/lib/utils.js +192 -103
  57. package/mocha.js +3836 -2046
  58. package/package.json +122 -38
  59. package/bin/.eslintrc.yml +0 -3
  60. package/lib/browser/.eslintrc.yml +0 -4
  61. package/lib/ms.js +0 -94
  62. package/lib/reporters/base.js.orig +0 -498
  63. package/lib/reporters/json.js.orig +0 -128
@@ -1,9 +1,4 @@
1
1
  'use strict';
2
-
3
- /**
4
- * Module dependencies.
5
- */
6
-
7
2
  var Suite = require('../suite');
8
3
  var Test = require('../test');
9
4
 
@@ -24,12 +19,12 @@ var Test = require('../test');
24
19
  *
25
20
  * @param {Suite} suite Root suite.
26
21
  */
27
- module.exports = function (suite) {
22
+ module.exports = function(suite) {
28
23
  var suites = [suite];
29
24
 
30
25
  suite.on('require', visit);
31
26
 
32
- function visit (obj, file) {
27
+ function visit(obj, file) {
33
28
  var suite;
34
29
  for (var key in obj) {
35
30
  if (typeof obj[key] === 'function') {
@@ -61,3 +56,5 @@ module.exports = function (suite) {
61
56
  }
62
57
  }
63
58
  };
59
+
60
+ module.exports.description = 'Node.js module ("exports") style';
@@ -1,9 +1,5 @@
1
1
  'use strict';
2
2
 
3
- /**
4
- * Module dependencies.
5
- */
6
-
7
3
  var Test = require('../test');
8
4
 
9
5
  /**
@@ -31,10 +27,10 @@ var Test = require('../test');
31
27
  *
32
28
  * @param {Suite} suite Root suite.
33
29
  */
34
- module.exports = function (suite) {
30
+ module.exports = function qUnitInterface(suite) {
35
31
  var suites = [suite];
36
32
 
37
- suite.on('pre-require', function (context, file, mocha) {
33
+ suite.on('pre-require', function(context, file, mocha) {
38
34
  var common = require('./common')(suites, context, mocha);
39
35
 
40
36
  context.before = common.before;
@@ -46,7 +42,7 @@ module.exports = function (suite) {
46
42
  * Describe a "suite" with the given `title`.
47
43
  */
48
44
 
49
- context.suite = function (title) {
45
+ context.suite = function(title) {
50
46
  if (suites.length > 1) {
51
47
  suites.shift();
52
48
  }
@@ -61,7 +57,7 @@ module.exports = function (suite) {
61
57
  * Exclusive Suite.
62
58
  */
63
59
 
64
- context.suite.only = function (title) {
60
+ context.suite.only = function(title) {
65
61
  if (suites.length > 1) {
66
62
  suites.shift();
67
63
  }
@@ -78,7 +74,7 @@ module.exports = function (suite) {
78
74
  * acting as a thunk.
79
75
  */
80
76
 
81
- context.test = function (title, fn) {
77
+ context.test = function(title, fn) {
82
78
  var test = new Test(title, fn);
83
79
  test.file = file;
84
80
  suites[0].addTest(test);
@@ -89,7 +85,7 @@ module.exports = function (suite) {
89
85
  * Exclusive test-case.
90
86
  */
91
87
 
92
- context.test.only = function (title, fn) {
88
+ context.test.only = function(title, fn) {
93
89
  return common.test.only(mocha, context.test(title, fn));
94
90
  };
95
91
 
@@ -97,3 +93,5 @@ module.exports = function (suite) {
97
93
  context.test.retries = common.test.retries;
98
94
  });
99
95
  };
96
+
97
+ module.exports.description = 'QUnit style';
@@ -1,9 +1,5 @@
1
1
  'use strict';
2
2
 
3
- /**
4
- * Module dependencies.
5
- */
6
-
7
3
  var Test = require('../test');
8
4
 
9
5
  /**
@@ -31,10 +27,10 @@ var Test = require('../test');
31
27
  *
32
28
  * @param {Suite} suite Root suite.
33
29
  */
34
- module.exports = function (suite) {
30
+ module.exports = function(suite) {
35
31
  var suites = [suite];
36
32
 
37
- suite.on('pre-require', function (context, file, mocha) {
33
+ suite.on('pre-require', function(context, file, mocha) {
38
34
  var common = require('./common')(suites, context, mocha);
39
35
 
40
36
  context.setup = common.beforeEach;
@@ -47,7 +43,7 @@ module.exports = function (suite) {
47
43
  * Describe a "suite" with the given `title` and callback `fn` containing
48
44
  * nested suites and/or tests.
49
45
  */
50
- context.suite = function (title, fn) {
46
+ context.suite = function(title, fn) {
51
47
  return common.suite.create({
52
48
  title: title,
53
49
  file: file,
@@ -58,7 +54,7 @@ module.exports = function (suite) {
58
54
  /**
59
55
  * Pending suite.
60
56
  */
61
- context.suite.skip = function (title, fn) {
57
+ context.suite.skip = function(title, fn) {
62
58
  return common.suite.skip({
63
59
  title: title,
64
60
  file: file,
@@ -69,7 +65,7 @@ module.exports = function (suite) {
69
65
  /**
70
66
  * Exclusive test-case.
71
67
  */
72
- context.suite.only = function (title, fn) {
68
+ context.suite.only = function(title, fn) {
73
69
  return common.suite.only({
74
70
  title: title,
75
71
  file: file,
@@ -81,7 +77,7 @@ module.exports = function (suite) {
81
77
  * Describe a specification or test-case with the given `title` and
82
78
  * callback `fn` acting as a thunk.
83
79
  */
84
- context.test = function (title, fn) {
80
+ context.test = function(title, fn) {
85
81
  var suite = suites[0];
86
82
  if (suite.isPending()) {
87
83
  fn = null;
@@ -96,7 +92,7 @@ module.exports = function (suite) {
96
92
  * Exclusive test-case.
97
93
  */
98
94
 
99
- context.test.only = function (title, fn) {
95
+ context.test.only = function(title, fn) {
100
96
  return common.test.only(mocha, context.test(title, fn));
101
97
  };
102
98
 
@@ -104,3 +100,6 @@ module.exports = function (suite) {
104
100
  context.test.retries = common.test.retries;
105
101
  });
106
102
  };
103
+
104
+ module.exports.description =
105
+ 'traditional "suite"/"test" instead of BDD\'s "describe"/"it"';