mocha 6.1.0 → 6.1.4

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 +1776 -1751
  2. package/LICENSE +22 -22
  3. package/README.md +105 -105
  4. package/bin/_mocha +10 -10
  5. package/bin/mocha +149 -149
  6. package/bin/options.js +10 -10
  7. package/browser-entry.js +191 -191
  8. package/index.js +3 -3
  9. package/lib/browser/growl.js +168 -168
  10. package/lib/browser/progress.js +119 -119
  11. package/lib/browser/template.html +18 -18
  12. package/lib/browser/tty.js +13 -13
  13. package/lib/cli/cli.js +69 -69
  14. package/lib/cli/commands.js +13 -13
  15. package/lib/cli/config.js +101 -101
  16. package/lib/cli/index.js +9 -9
  17. package/lib/cli/init.js +37 -37
  18. package/lib/cli/node-flags.js +86 -86
  19. package/lib/cli/one-and-dones.js +70 -70
  20. package/lib/cli/options.js +347 -347
  21. package/lib/cli/run-helpers.js +337 -337
  22. package/lib/cli/run-option-metadata.js +76 -76
  23. package/lib/cli/run.js +297 -297
  24. package/lib/context.js +101 -101
  25. package/lib/errors.js +141 -141
  26. package/lib/growl.js +136 -136
  27. package/lib/hook.js +46 -46
  28. package/lib/interfaces/bdd.js +118 -118
  29. package/lib/interfaces/common.js +191 -191
  30. package/lib/interfaces/exports.js +60 -60
  31. package/lib/interfaces/index.js +6 -6
  32. package/lib/interfaces/qunit.js +99 -99
  33. package/lib/interfaces/tdd.js +107 -107
  34. package/lib/mocha.js +843 -843
  35. package/lib/mocharc.json +10 -10
  36. package/lib/pending.js +12 -12
  37. package/lib/reporters/base.js +491 -491
  38. package/lib/reporters/doc.js +85 -85
  39. package/lib/reporters/dot.js +81 -81
  40. package/lib/reporters/html.js +390 -390
  41. package/lib/reporters/index.js +19 -19
  42. package/lib/reporters/json-stream.js +90 -90
  43. package/lib/reporters/json.js +135 -135
  44. package/lib/reporters/landing.js +108 -108
  45. package/lib/reporters/list.js +78 -78
  46. package/lib/reporters/markdown.js +112 -112
  47. package/lib/reporters/min.js +52 -52
  48. package/lib/reporters/nyan.js +276 -276
  49. package/lib/reporters/progress.js +104 -104
  50. package/lib/reporters/spec.js +99 -99
  51. package/lib/reporters/tap.js +294 -294
  52. package/lib/reporters/xunit.js +216 -216
  53. package/lib/runnable.js +496 -496
  54. package/lib/runner.js +1049 -1049
  55. package/lib/stats-collector.js +83 -83
  56. package/lib/suite.js +642 -642
  57. package/lib/test.js +51 -51
  58. package/lib/utils.js +897 -897
  59. package/mocha.css +326 -326
  60. package/mocha.js +8170 -8476
  61. package/package.json +630 -628
@@ -1,99 +1,99 @@
1
- 'use strict';
2
-
3
- var Test = require('../test');
4
- var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
5
- .EVENT_FILE_PRE_REQUIRE;
6
-
7
- /**
8
- * QUnit-style interface:
9
- *
10
- * suite('Array');
11
- *
12
- * test('#length', function() {
13
- * var arr = [1,2,3];
14
- * ok(arr.length == 3);
15
- * });
16
- *
17
- * test('#indexOf()', function() {
18
- * var arr = [1,2,3];
19
- * ok(arr.indexOf(1) == 0);
20
- * ok(arr.indexOf(2) == 1);
21
- * ok(arr.indexOf(3) == 2);
22
- * });
23
- *
24
- * suite('String');
25
- *
26
- * test('#length', function() {
27
- * ok('foo'.length == 3);
28
- * });
29
- *
30
- * @param {Suite} suite Root suite.
31
- */
32
- module.exports = function qUnitInterface(suite) {
33
- var suites = [suite];
34
-
35
- suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
36
- var common = require('./common')(suites, context, mocha);
37
-
38
- context.before = common.before;
39
- context.after = common.after;
40
- context.beforeEach = common.beforeEach;
41
- context.afterEach = common.afterEach;
42
- context.run = mocha.options.delay && common.runWithSuite(suite);
43
- /**
44
- * Describe a "suite" with the given `title`.
45
- */
46
-
47
- context.suite = function(title) {
48
- if (suites.length > 1) {
49
- suites.shift();
50
- }
51
- return common.suite.create({
52
- title: title,
53
- file: file,
54
- fn: false
55
- });
56
- };
57
-
58
- /**
59
- * Exclusive Suite.
60
- */
61
-
62
- context.suite.only = function(title) {
63
- if (suites.length > 1) {
64
- suites.shift();
65
- }
66
- return common.suite.only({
67
- title: title,
68
- file: file,
69
- fn: false
70
- });
71
- };
72
-
73
- /**
74
- * Describe a specification or test-case
75
- * with the given `title` and callback `fn`
76
- * acting as a thunk.
77
- */
78
-
79
- context.test = function(title, fn) {
80
- var test = new Test(title, fn);
81
- test.file = file;
82
- suites[0].addTest(test);
83
- return test;
84
- };
85
-
86
- /**
87
- * Exclusive test-case.
88
- */
89
-
90
- context.test.only = function(title, fn) {
91
- return common.test.only(mocha, context.test(title, fn));
92
- };
93
-
94
- context.test.skip = common.test.skip;
95
- context.test.retries = common.test.retries;
96
- });
97
- };
98
-
99
- module.exports.description = 'QUnit style';
1
+ 'use strict';
2
+
3
+ var Test = require('../test');
4
+ var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
5
+ .EVENT_FILE_PRE_REQUIRE;
6
+
7
+ /**
8
+ * QUnit-style interface:
9
+ *
10
+ * suite('Array');
11
+ *
12
+ * test('#length', function() {
13
+ * var arr = [1,2,3];
14
+ * ok(arr.length == 3);
15
+ * });
16
+ *
17
+ * test('#indexOf()', function() {
18
+ * var arr = [1,2,3];
19
+ * ok(arr.indexOf(1) == 0);
20
+ * ok(arr.indexOf(2) == 1);
21
+ * ok(arr.indexOf(3) == 2);
22
+ * });
23
+ *
24
+ * suite('String');
25
+ *
26
+ * test('#length', function() {
27
+ * ok('foo'.length == 3);
28
+ * });
29
+ *
30
+ * @param {Suite} suite Root suite.
31
+ */
32
+ module.exports = function qUnitInterface(suite) {
33
+ var suites = [suite];
34
+
35
+ suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
36
+ var common = require('./common')(suites, context, mocha);
37
+
38
+ context.before = common.before;
39
+ context.after = common.after;
40
+ context.beforeEach = common.beforeEach;
41
+ context.afterEach = common.afterEach;
42
+ context.run = mocha.options.delay && common.runWithSuite(suite);
43
+ /**
44
+ * Describe a "suite" with the given `title`.
45
+ */
46
+
47
+ context.suite = function(title) {
48
+ if (suites.length > 1) {
49
+ suites.shift();
50
+ }
51
+ return common.suite.create({
52
+ title: title,
53
+ file: file,
54
+ fn: false
55
+ });
56
+ };
57
+
58
+ /**
59
+ * Exclusive Suite.
60
+ */
61
+
62
+ context.suite.only = function(title) {
63
+ if (suites.length > 1) {
64
+ suites.shift();
65
+ }
66
+ return common.suite.only({
67
+ title: title,
68
+ file: file,
69
+ fn: false
70
+ });
71
+ };
72
+
73
+ /**
74
+ * Describe a specification or test-case
75
+ * with the given `title` and callback `fn`
76
+ * acting as a thunk.
77
+ */
78
+
79
+ context.test = function(title, fn) {
80
+ var test = new Test(title, fn);
81
+ test.file = file;
82
+ suites[0].addTest(test);
83
+ return test;
84
+ };
85
+
86
+ /**
87
+ * Exclusive test-case.
88
+ */
89
+
90
+ context.test.only = function(title, fn) {
91
+ return common.test.only(mocha, context.test(title, fn));
92
+ };
93
+
94
+ context.test.skip = common.test.skip;
95
+ context.test.retries = common.test.retries;
96
+ });
97
+ };
98
+
99
+ module.exports.description = 'QUnit style';
@@ -1,107 +1,107 @@
1
- 'use strict';
2
-
3
- var Test = require('../test');
4
- var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
5
- .EVENT_FILE_PRE_REQUIRE;
6
-
7
- /**
8
- * TDD-style interface:
9
- *
10
- * suite('Array', function() {
11
- * suite('#indexOf()', function() {
12
- * suiteSetup(function() {
13
- *
14
- * });
15
- *
16
- * test('should return -1 when not present', function() {
17
- *
18
- * });
19
- *
20
- * test('should return the index when present', function() {
21
- *
22
- * });
23
- *
24
- * suiteTeardown(function() {
25
- *
26
- * });
27
- * });
28
- * });
29
- *
30
- * @param {Suite} suite Root suite.
31
- */
32
- module.exports = function(suite) {
33
- var suites = [suite];
34
-
35
- suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
36
- var common = require('./common')(suites, context, mocha);
37
-
38
- context.setup = common.beforeEach;
39
- context.teardown = common.afterEach;
40
- context.suiteSetup = common.before;
41
- context.suiteTeardown = common.after;
42
- context.run = mocha.options.delay && common.runWithSuite(suite);
43
-
44
- /**
45
- * Describe a "suite" with the given `title` and callback `fn` containing
46
- * nested suites and/or tests.
47
- */
48
- context.suite = function(title, fn) {
49
- return common.suite.create({
50
- title: title,
51
- file: file,
52
- fn: fn
53
- });
54
- };
55
-
56
- /**
57
- * Pending suite.
58
- */
59
- context.suite.skip = function(title, fn) {
60
- return common.suite.skip({
61
- title: title,
62
- file: file,
63
- fn: fn
64
- });
65
- };
66
-
67
- /**
68
- * Exclusive test-case.
69
- */
70
- context.suite.only = function(title, fn) {
71
- return common.suite.only({
72
- title: title,
73
- file: file,
74
- fn: fn
75
- });
76
- };
77
-
78
- /**
79
- * Describe a specification or test-case with the given `title` and
80
- * callback `fn` acting as a thunk.
81
- */
82
- context.test = function(title, fn) {
83
- var suite = suites[0];
84
- if (suite.isPending()) {
85
- fn = null;
86
- }
87
- var test = new Test(title, fn);
88
- test.file = file;
89
- suite.addTest(test);
90
- return test;
91
- };
92
-
93
- /**
94
- * Exclusive test-case.
95
- */
96
-
97
- context.test.only = function(title, fn) {
98
- return common.test.only(mocha, context.test(title, fn));
99
- };
100
-
101
- context.test.skip = common.test.skip;
102
- context.test.retries = common.test.retries;
103
- });
104
- };
105
-
106
- module.exports.description =
107
- 'traditional "suite"/"test" instead of BDD\'s "describe"/"it"';
1
+ 'use strict';
2
+
3
+ var Test = require('../test');
4
+ var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
5
+ .EVENT_FILE_PRE_REQUIRE;
6
+
7
+ /**
8
+ * TDD-style interface:
9
+ *
10
+ * suite('Array', function() {
11
+ * suite('#indexOf()', function() {
12
+ * suiteSetup(function() {
13
+ *
14
+ * });
15
+ *
16
+ * test('should return -1 when not present', function() {
17
+ *
18
+ * });
19
+ *
20
+ * test('should return the index when present', function() {
21
+ *
22
+ * });
23
+ *
24
+ * suiteTeardown(function() {
25
+ *
26
+ * });
27
+ * });
28
+ * });
29
+ *
30
+ * @param {Suite} suite Root suite.
31
+ */
32
+ module.exports = function(suite) {
33
+ var suites = [suite];
34
+
35
+ suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
36
+ var common = require('./common')(suites, context, mocha);
37
+
38
+ context.setup = common.beforeEach;
39
+ context.teardown = common.afterEach;
40
+ context.suiteSetup = common.before;
41
+ context.suiteTeardown = common.after;
42
+ context.run = mocha.options.delay && common.runWithSuite(suite);
43
+
44
+ /**
45
+ * Describe a "suite" with the given `title` and callback `fn` containing
46
+ * nested suites and/or tests.
47
+ */
48
+ context.suite = function(title, fn) {
49
+ return common.suite.create({
50
+ title: title,
51
+ file: file,
52
+ fn: fn
53
+ });
54
+ };
55
+
56
+ /**
57
+ * Pending suite.
58
+ */
59
+ context.suite.skip = function(title, fn) {
60
+ return common.suite.skip({
61
+ title: title,
62
+ file: file,
63
+ fn: fn
64
+ });
65
+ };
66
+
67
+ /**
68
+ * Exclusive test-case.
69
+ */
70
+ context.suite.only = function(title, fn) {
71
+ return common.suite.only({
72
+ title: title,
73
+ file: file,
74
+ fn: fn
75
+ });
76
+ };
77
+
78
+ /**
79
+ * Describe a specification or test-case with the given `title` and
80
+ * callback `fn` acting as a thunk.
81
+ */
82
+ context.test = function(title, fn) {
83
+ var suite = suites[0];
84
+ if (suite.isPending()) {
85
+ fn = null;
86
+ }
87
+ var test = new Test(title, fn);
88
+ test.file = file;
89
+ suite.addTest(test);
90
+ return test;
91
+ };
92
+
93
+ /**
94
+ * Exclusive test-case.
95
+ */
96
+
97
+ context.test.only = function(title, fn) {
98
+ return common.test.only(mocha, context.test(title, fn));
99
+ };
100
+
101
+ context.test.skip = common.test.skip;
102
+ context.test.retries = common.test.retries;
103
+ });
104
+ };
105
+
106
+ module.exports.description =
107
+ 'traditional "suite"/"test" instead of BDD\'s "describe"/"it"';