mocha 11.7.4 → 11.7.6
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/bin/_mocha +2 -2
- package/bin/mocha.js +46 -44
- package/browser-entry.js +20 -20
- package/index.js +2 -2
- package/lib/browser/highlight-tags.js +6 -6
- package/lib/browser/parse-query.js +5 -5
- package/lib/browser/template.html +2 -2
- package/lib/cli/cli.js +32 -27
- package/lib/cli/collect-files.js +25 -25
- package/lib/cli/commands.js +4 -4
- package/lib/cli/config.js +26 -25
- package/lib/cli/index.js +2 -2
- package/lib/cli/init.js +19 -19
- package/lib/cli/lookup-files.js +20 -20
- package/lib/cli/node-flags.js +12 -12
- package/lib/cli/one-and-dones.js +12 -11
- package/lib/cli/options.js +49 -49
- package/lib/cli/run-helpers.js +52 -54
- package/lib/cli/run-option-metadata.js +75 -75
- package/lib/cli/run.js +164 -159
- package/lib/cli/watch-run.js +75 -75
- package/lib/context.js +1 -1
- package/lib/error-constants.js +17 -17
- package/lib/errors.js +26 -26
- package/lib/hook.js +9 -9
- package/lib/interfaces/bdd.js +8 -8
- package/lib/interfaces/common.js +12 -12
- package/lib/interfaces/exports.js +8 -8
- package/lib/interfaces/index.js +5 -5
- package/lib/interfaces/qunit.js +7 -7
- package/lib/interfaces/tdd.js +7 -7
- package/lib/mocha.js +97 -97
- package/lib/nodejs/buffered-worker-pool.js +30 -30
- package/lib/nodejs/esm-utils.js +24 -21
- package/lib/nodejs/file-unloader.js +2 -2
- package/lib/nodejs/parallel-buffered-runner.js +67 -67
- package/lib/nodejs/reporters/parallel-buffered.js +13 -10
- package/lib/nodejs/serializer.js +47 -47
- package/lib/nodejs/worker.js +38 -38
- package/lib/pending.js +1 -1
- package/lib/plugin-loader.js +48 -48
- package/lib/reporters/base.js +97 -94
- package/lib/reporters/doc.js +17 -17
- package/lib/reporters/dot.js +14 -14
- package/lib/reporters/html.js +73 -67
- package/lib/reporters/index.js +16 -16
- package/lib/reporters/json-stream.js +10 -10
- package/lib/reporters/json.js +16 -16
- package/lib/reporters/landing.js +20 -20
- package/lib/reporters/list.js +10 -10
- package/lib/reporters/markdown.js +21 -21
- package/lib/reporters/min.js +7 -7
- package/lib/reporters/nyan.js +35 -35
- package/lib/reporters/progress.js +14 -14
- package/lib/reporters/spec.js +15 -15
- package/lib/reporters/tap.js +26 -26
- package/lib/reporters/xunit.js +38 -34
- package/lib/runnable.js +41 -41
- package/lib/runner.js +105 -105
- package/lib/stats-collector.js +4 -4
- package/lib/suite.js +56 -46
- package/lib/test.js +10 -10
- package/lib/utils.js +122 -122
- package/mocha.css +68 -50
- package/mocha.js +826 -803
- package/mocha.js.map +1 -1
- package/package.json +8 -13
package/lib/cli/run.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Definition for Mocha's default ("run tests") command
|
|
@@ -7,285 +7,290 @@
|
|
|
7
7
|
* @private
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
const symbols = require(
|
|
11
|
-
const pc = require(
|
|
12
|
-
const Mocha = require(
|
|
10
|
+
const symbols = require("log-symbols");
|
|
11
|
+
const pc = require("picocolors");
|
|
12
|
+
const Mocha = require("../mocha");
|
|
13
13
|
const {
|
|
14
14
|
createUnsupportedError,
|
|
15
15
|
createInvalidArgumentValueError,
|
|
16
|
-
createMissingArgumentError
|
|
17
|
-
} = require(
|
|
16
|
+
createMissingArgumentError,
|
|
17
|
+
} = require("../errors");
|
|
18
18
|
|
|
19
19
|
const {
|
|
20
20
|
list,
|
|
21
21
|
handleRequires,
|
|
22
22
|
validateLegacyPlugin,
|
|
23
|
-
runMocha
|
|
24
|
-
} = require(
|
|
25
|
-
const {ONE_AND_DONES, ONE_AND_DONE_ARGS} = require(
|
|
26
|
-
const debug = require(
|
|
27
|
-
const defaults = require(
|
|
28
|
-
const {types, aliases} = require(
|
|
23
|
+
runMocha,
|
|
24
|
+
} = require("./run-helpers");
|
|
25
|
+
const { ONE_AND_DONES, ONE_AND_DONE_ARGS } = require("./one-and-dones");
|
|
26
|
+
const debug = require("debug")("mocha:cli:run");
|
|
27
|
+
const defaults = require("../mocharc.json");
|
|
28
|
+
const { types, aliases } = require("./run-option-metadata");
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Logical option groups
|
|
32
32
|
* @constant
|
|
33
33
|
*/
|
|
34
34
|
const GROUPS = {
|
|
35
|
-
FILES:
|
|
36
|
-
FILTERS:
|
|
37
|
-
NODEJS:
|
|
38
|
-
OUTPUT:
|
|
39
|
-
RULES:
|
|
40
|
-
CONFIG:
|
|
35
|
+
FILES: "File Handling",
|
|
36
|
+
FILTERS: "Test Filters",
|
|
37
|
+
NODEJS: "Node.js & V8",
|
|
38
|
+
OUTPUT: "Reporting & Output",
|
|
39
|
+
RULES: "Rules & Behavior",
|
|
40
|
+
CONFIG: "Configuration",
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
exports.command = [
|
|
43
|
+
exports.command = ["$0 [spec..]", "inspect"];
|
|
44
44
|
|
|
45
|
-
exports.describe =
|
|
45
|
+
exports.describe = "Run tests with Mocha";
|
|
46
46
|
|
|
47
|
-
exports.builder = yargs =>
|
|
47
|
+
exports.builder = (yargs) =>
|
|
48
48
|
yargs
|
|
49
49
|
.options({
|
|
50
|
-
|
|
51
|
-
description:
|
|
52
|
-
group: GROUPS.RULES
|
|
50
|
+
"allow-uncaught": {
|
|
51
|
+
description: "Allow uncaught errors to propagate",
|
|
52
|
+
group: GROUPS.RULES,
|
|
53
53
|
},
|
|
54
|
-
|
|
54
|
+
"async-only": {
|
|
55
55
|
description:
|
|
56
|
-
|
|
57
|
-
group: GROUPS.RULES
|
|
56
|
+
"Require all tests to use a callback (async) or return a Promise",
|
|
57
|
+
group: GROUPS.RULES,
|
|
58
58
|
},
|
|
59
59
|
bail: {
|
|
60
60
|
description: 'Abort ("bail") after first test failure',
|
|
61
|
-
group: GROUPS.RULES
|
|
61
|
+
group: GROUPS.RULES,
|
|
62
62
|
},
|
|
63
|
-
|
|
64
|
-
description:
|
|
65
|
-
group: GROUPS.RULES
|
|
63
|
+
"check-leaks": {
|
|
64
|
+
description: "Check for global variable leaks",
|
|
65
|
+
group: GROUPS.RULES,
|
|
66
66
|
},
|
|
67
67
|
color: {
|
|
68
|
-
description:
|
|
69
|
-
group: GROUPS.OUTPUT
|
|
68
|
+
description: "Force-enable color output",
|
|
69
|
+
group: GROUPS.OUTPUT,
|
|
70
70
|
},
|
|
71
71
|
config: {
|
|
72
72
|
config: true,
|
|
73
|
-
defaultDescription:
|
|
74
|
-
description:
|
|
75
|
-
group: GROUPS.CONFIG
|
|
73
|
+
defaultDescription: "(nearest rc file)",
|
|
74
|
+
description: "Path to config file",
|
|
75
|
+
group: GROUPS.CONFIG,
|
|
76
76
|
},
|
|
77
77
|
delay: {
|
|
78
|
-
description:
|
|
79
|
-
group: GROUPS.RULES
|
|
78
|
+
description: "Delay initial execution of root suite",
|
|
79
|
+
group: GROUPS.RULES,
|
|
80
80
|
},
|
|
81
81
|
diff: {
|
|
82
82
|
default: true,
|
|
83
|
-
description:
|
|
84
|
-
group: GROUPS.OUTPUT
|
|
83
|
+
description: "Show diff on failure",
|
|
84
|
+
group: GROUPS.OUTPUT,
|
|
85
85
|
},
|
|
86
|
-
|
|
87
|
-
description:
|
|
88
|
-
group: GROUPS.RULES
|
|
86
|
+
"dry-run": {
|
|
87
|
+
description: "Report tests without executing them",
|
|
88
|
+
group: GROUPS.RULES,
|
|
89
89
|
},
|
|
90
90
|
exit: {
|
|
91
|
-
description:
|
|
92
|
-
group: GROUPS.RULES
|
|
91
|
+
description: "Force Mocha to quit after tests complete",
|
|
92
|
+
group: GROUPS.RULES,
|
|
93
93
|
},
|
|
94
94
|
extension: {
|
|
95
95
|
default: defaults.extension,
|
|
96
|
-
description:
|
|
96
|
+
description: "File extension(s) to load",
|
|
97
97
|
group: GROUPS.FILES,
|
|
98
98
|
requiresArg: true,
|
|
99
|
-
coerce: list
|
|
99
|
+
coerce: list,
|
|
100
100
|
},
|
|
101
|
-
|
|
101
|
+
"pass-on-failing-test-suite": {
|
|
102
102
|
default: false,
|
|
103
|
-
description:
|
|
104
|
-
group: GROUPS.RULES
|
|
103
|
+
description: "Not fail test run if tests were failed",
|
|
104
|
+
group: GROUPS.RULES,
|
|
105
105
|
},
|
|
106
|
-
|
|
107
|
-
description:
|
|
108
|
-
group: GROUPS.RULES
|
|
106
|
+
"fail-zero": {
|
|
107
|
+
description: "Fail test run if no test(s) encountered",
|
|
108
|
+
group: GROUPS.RULES,
|
|
109
109
|
},
|
|
110
110
|
fgrep: {
|
|
111
|
-
conflicts:
|
|
112
|
-
description:
|
|
111
|
+
conflicts: "grep",
|
|
112
|
+
description: "Only run tests containing this string",
|
|
113
113
|
group: GROUPS.FILTERS,
|
|
114
|
-
requiresArg: true
|
|
114
|
+
requiresArg: true,
|
|
115
115
|
},
|
|
116
116
|
file: {
|
|
117
|
-
defaultDescription:
|
|
117
|
+
defaultDescription: "(none)",
|
|
118
118
|
description:
|
|
119
|
-
|
|
119
|
+
"Specify file(s) to be loaded prior to root suite execution",
|
|
120
120
|
group: GROUPS.FILES,
|
|
121
121
|
normalize: true,
|
|
122
|
-
requiresArg: true
|
|
122
|
+
requiresArg: true,
|
|
123
123
|
},
|
|
124
|
-
|
|
125
|
-
description:
|
|
126
|
-
group: GROUPS.RULES
|
|
124
|
+
"forbid-only": {
|
|
125
|
+
description: "Fail if exclusive test(s) encountered",
|
|
126
|
+
group: GROUPS.RULES,
|
|
127
127
|
},
|
|
128
|
-
|
|
129
|
-
description:
|
|
130
|
-
group: GROUPS.RULES
|
|
128
|
+
"forbid-pending": {
|
|
129
|
+
description: "Fail if pending test(s) encountered",
|
|
130
|
+
group: GROUPS.RULES,
|
|
131
131
|
},
|
|
132
|
-
|
|
133
|
-
description:
|
|
134
|
-
group: GROUPS.OUTPUT
|
|
132
|
+
"full-trace": {
|
|
133
|
+
description: "Display full stack traces",
|
|
134
|
+
group: GROUPS.OUTPUT,
|
|
135
135
|
},
|
|
136
136
|
global: {
|
|
137
137
|
coerce: list,
|
|
138
|
-
description:
|
|
138
|
+
description: "List of allowed global variables",
|
|
139
139
|
group: GROUPS.RULES,
|
|
140
|
-
requiresArg: true
|
|
140
|
+
requiresArg: true,
|
|
141
141
|
},
|
|
142
142
|
grep: {
|
|
143
|
-
coerce: value => (!value ? null : value),
|
|
144
|
-
conflicts:
|
|
145
|
-
description:
|
|
143
|
+
coerce: (value) => (!value ? null : value),
|
|
144
|
+
conflicts: "fgrep",
|
|
145
|
+
description: "Only run tests matching this string or regexp",
|
|
146
146
|
group: GROUPS.FILTERS,
|
|
147
|
-
requiresArg: true
|
|
147
|
+
requiresArg: true,
|
|
148
148
|
},
|
|
149
149
|
ignore: {
|
|
150
|
-
defaultDescription:
|
|
151
|
-
description:
|
|
150
|
+
defaultDescription: "(none)",
|
|
151
|
+
description: "Ignore file(s) or glob pattern(s)",
|
|
152
152
|
group: GROUPS.FILES,
|
|
153
|
-
requiresArg: true
|
|
153
|
+
requiresArg: true,
|
|
154
154
|
},
|
|
155
|
-
|
|
155
|
+
"inline-diffs": {
|
|
156
156
|
description:
|
|
157
|
-
|
|
158
|
-
group: GROUPS.OUTPUT
|
|
157
|
+
"Display actual/expected differences inline within each string",
|
|
158
|
+
group: GROUPS.OUTPUT,
|
|
159
159
|
},
|
|
160
160
|
invert: {
|
|
161
|
-
description:
|
|
162
|
-
group: GROUPS.FILTERS
|
|
161
|
+
description: "Inverts --grep and --fgrep matches",
|
|
162
|
+
group: GROUPS.FILTERS,
|
|
163
163
|
},
|
|
164
164
|
jobs: {
|
|
165
165
|
description:
|
|
166
|
-
|
|
167
|
-
defaultDescription:
|
|
166
|
+
"Number of concurrent jobs for --parallel; use 1 to run in serial",
|
|
167
|
+
defaultDescription: "(number of CPU cores - 1)",
|
|
168
168
|
requiresArg: true,
|
|
169
|
-
group: GROUPS.RULES
|
|
169
|
+
group: GROUPS.RULES,
|
|
170
170
|
},
|
|
171
|
-
|
|
172
|
-
conflicts: Array.from(ONE_AND_DONE_ARGS).filter(
|
|
173
|
-
|
|
171
|
+
"list-interfaces": {
|
|
172
|
+
conflicts: Array.from(ONE_AND_DONE_ARGS).filter(
|
|
173
|
+
(arg) => arg !== "list-interfaces",
|
|
174
|
+
),
|
|
175
|
+
description: "List built-in user interfaces & exit",
|
|
174
176
|
},
|
|
175
|
-
|
|
176
|
-
conflicts: Array.from(ONE_AND_DONE_ARGS).filter(
|
|
177
|
-
|
|
177
|
+
"list-reporters": {
|
|
178
|
+
conflicts: Array.from(ONE_AND_DONE_ARGS).filter(
|
|
179
|
+
(arg) => arg !== "list-reporters",
|
|
180
|
+
),
|
|
181
|
+
description: "List built-in reporters & exit",
|
|
178
182
|
},
|
|
179
|
-
|
|
180
|
-
description:
|
|
183
|
+
"no-colors": {
|
|
184
|
+
description: "Force-disable color output",
|
|
181
185
|
group: GROUPS.OUTPUT,
|
|
182
|
-
hidden: true
|
|
186
|
+
hidden: true,
|
|
183
187
|
},
|
|
184
|
-
|
|
188
|
+
"node-option": {
|
|
185
189
|
description: 'Node or V8 option (no leading "--")',
|
|
186
|
-
group: GROUPS.CONFIG
|
|
190
|
+
group: GROUPS.CONFIG,
|
|
187
191
|
},
|
|
188
192
|
package: {
|
|
189
|
-
description:
|
|
193
|
+
description: "Path to package.json for config",
|
|
190
194
|
group: GROUPS.CONFIG,
|
|
191
195
|
normalize: true,
|
|
192
|
-
requiresArg: true
|
|
196
|
+
requiresArg: true,
|
|
193
197
|
},
|
|
194
198
|
parallel: {
|
|
195
|
-
description:
|
|
196
|
-
group: GROUPS.RULES
|
|
199
|
+
description: "Run tests in parallel",
|
|
200
|
+
group: GROUPS.RULES,
|
|
197
201
|
},
|
|
198
|
-
|
|
199
|
-
description:
|
|
200
|
-
|
|
202
|
+
"posix-exit-codes": {
|
|
203
|
+
description:
|
|
204
|
+
"Use POSIX and UNIX shell exit codes as Mocha's return value",
|
|
205
|
+
group: GROUPS.RULES,
|
|
201
206
|
},
|
|
202
207
|
recursive: {
|
|
203
|
-
description:
|
|
204
|
-
group: GROUPS.FILES
|
|
208
|
+
description: "Look for tests in subdirectories",
|
|
209
|
+
group: GROUPS.FILES,
|
|
205
210
|
},
|
|
206
211
|
reporter: {
|
|
207
212
|
default: defaults.reporter,
|
|
208
|
-
description:
|
|
213
|
+
description: "Specify reporter to use",
|
|
209
214
|
group: GROUPS.OUTPUT,
|
|
210
|
-
requiresArg: true
|
|
215
|
+
requiresArg: true,
|
|
211
216
|
},
|
|
212
|
-
|
|
213
|
-
coerce: opts =>
|
|
217
|
+
"reporter-option": {
|
|
218
|
+
coerce: (opts) =>
|
|
214
219
|
list(opts).reduce((acc, opt) => {
|
|
215
|
-
const pair = opt.split(
|
|
220
|
+
const pair = opt.split("=");
|
|
216
221
|
|
|
217
222
|
if (pair.length > 2 || !pair.length) {
|
|
218
223
|
throw createInvalidArgumentValueError(
|
|
219
224
|
`invalid reporter option '${opt}'`,
|
|
220
|
-
|
|
225
|
+
"--reporter-option",
|
|
221
226
|
opt,
|
|
222
|
-
'expected "key=value" format'
|
|
227
|
+
'expected "key=value" format',
|
|
223
228
|
);
|
|
224
229
|
}
|
|
225
230
|
|
|
226
231
|
acc[pair[0]] = pair.length === 2 ? pair[1] : true;
|
|
227
232
|
return acc;
|
|
228
233
|
}, {}),
|
|
229
|
-
description:
|
|
234
|
+
description: "Reporter-specific options (<k=v,[k1=v1,..]>)",
|
|
230
235
|
group: GROUPS.OUTPUT,
|
|
231
|
-
requiresArg: true
|
|
236
|
+
requiresArg: true,
|
|
232
237
|
},
|
|
233
238
|
require: {
|
|
234
|
-
defaultDescription:
|
|
235
|
-
description:
|
|
239
|
+
defaultDescription: "(none)",
|
|
240
|
+
description: "Require module",
|
|
236
241
|
group: GROUPS.FILES,
|
|
237
|
-
requiresArg: true
|
|
242
|
+
requiresArg: true,
|
|
238
243
|
},
|
|
239
244
|
retries: {
|
|
240
|
-
description:
|
|
241
|
-
group: GROUPS.RULES
|
|
245
|
+
description: "Retry failed tests this many times",
|
|
246
|
+
group: GROUPS.RULES,
|
|
242
247
|
},
|
|
243
248
|
slow: {
|
|
244
249
|
default: defaults.slow,
|
|
245
250
|
description: 'Specify "slow" test threshold (in milliseconds)',
|
|
246
|
-
group: GROUPS.RULES
|
|
251
|
+
group: GROUPS.RULES,
|
|
247
252
|
},
|
|
248
253
|
sort: {
|
|
249
|
-
description:
|
|
250
|
-
group: GROUPS.FILES
|
|
254
|
+
description: "Sort test files",
|
|
255
|
+
group: GROUPS.FILES,
|
|
251
256
|
},
|
|
252
257
|
timeout: {
|
|
253
258
|
default: defaults.timeout,
|
|
254
|
-
description:
|
|
255
|
-
group: GROUPS.RULES
|
|
259
|
+
description: "Specify test timeout threshold (in milliseconds)",
|
|
260
|
+
group: GROUPS.RULES,
|
|
256
261
|
},
|
|
257
262
|
ui: {
|
|
258
263
|
default: defaults.ui,
|
|
259
|
-
description:
|
|
264
|
+
description: "Specify user interface",
|
|
260
265
|
group: GROUPS.RULES,
|
|
261
|
-
requiresArg: true
|
|
266
|
+
requiresArg: true,
|
|
262
267
|
},
|
|
263
268
|
watch: {
|
|
264
|
-
description:
|
|
265
|
-
group: GROUPS.FILES
|
|
269
|
+
description: "Watch files in the current working directory for changes",
|
|
270
|
+
group: GROUPS.FILES,
|
|
266
271
|
},
|
|
267
|
-
|
|
268
|
-
description:
|
|
272
|
+
"watch-files": {
|
|
273
|
+
description: "List of paths or globs to watch",
|
|
269
274
|
group: GROUPS.FILES,
|
|
270
275
|
requiresArg: true,
|
|
271
|
-
coerce: list
|
|
276
|
+
coerce: list,
|
|
272
277
|
},
|
|
273
|
-
|
|
274
|
-
description:
|
|
278
|
+
"watch-ignore": {
|
|
279
|
+
description: "List of paths or globs to exclude from watching",
|
|
275
280
|
group: GROUPS.FILES,
|
|
276
281
|
requiresArg: true,
|
|
277
282
|
coerce: list,
|
|
278
|
-
default: defaults[
|
|
279
|
-
}
|
|
283
|
+
default: defaults["watch-ignore"],
|
|
284
|
+
},
|
|
280
285
|
})
|
|
281
|
-
.positional(
|
|
282
|
-
default: [
|
|
283
|
-
description:
|
|
284
|
-
type:
|
|
286
|
+
.positional("spec", {
|
|
287
|
+
default: ["test"],
|
|
288
|
+
description: "One or more files, directories, or globs to test",
|
|
289
|
+
type: "array",
|
|
285
290
|
})
|
|
286
|
-
.check(argv => {
|
|
291
|
+
.check((argv) => {
|
|
287
292
|
// "one-and-dones"; let yargs handle help and version
|
|
288
|
-
Object.keys(ONE_AND_DONES).forEach(opt => {
|
|
293
|
+
Object.keys(ONE_AND_DONES).forEach((opt) => {
|
|
289
294
|
if (argv[opt]) {
|
|
290
295
|
ONE_AND_DONES[opt].call(null, yargs);
|
|
291
296
|
process.exit();
|
|
@@ -293,11 +298,11 @@ exports.builder = yargs =>
|
|
|
293
298
|
});
|
|
294
299
|
|
|
295
300
|
// yargs.implies() isn't flexible enough to handle this
|
|
296
|
-
if (argv.invert && !(
|
|
301
|
+
if (argv.invert && !("fgrep" in argv || "grep" in argv)) {
|
|
297
302
|
throw createMissingArgumentError(
|
|
298
303
|
'"--invert" requires one of "--fgrep <str>" or "--grep <regexp>"',
|
|
299
|
-
|
|
300
|
-
|
|
304
|
+
"--fgrep|--grep",
|
|
305
|
+
"string|regexp",
|
|
301
306
|
);
|
|
302
307
|
}
|
|
303
308
|
|
|
@@ -305,32 +310,32 @@ exports.builder = yargs =>
|
|
|
305
310
|
// yargs.conflicts() can't deal with `--file foo.js --no-parallel`, either
|
|
306
311
|
if (argv.file) {
|
|
307
312
|
throw createUnsupportedError(
|
|
308
|
-
|
|
313
|
+
"--parallel runs test files in a non-deterministic order, and is mutually exclusive with --file",
|
|
309
314
|
);
|
|
310
315
|
}
|
|
311
316
|
|
|
312
317
|
// or this
|
|
313
318
|
if (argv.sort) {
|
|
314
319
|
throw createUnsupportedError(
|
|
315
|
-
|
|
320
|
+
"--parallel runs test files in a non-deterministic order, and is mutually exclusive with --sort",
|
|
316
321
|
);
|
|
317
322
|
}
|
|
318
323
|
|
|
319
|
-
if (argv.reporter ===
|
|
324
|
+
if (argv.reporter === "progress") {
|
|
320
325
|
throw createUnsupportedError(
|
|
321
|
-
|
|
326
|
+
"--reporter=progress is mutually exclusive with --parallel",
|
|
322
327
|
);
|
|
323
328
|
}
|
|
324
329
|
|
|
325
|
-
if (argv.reporter ===
|
|
330
|
+
if (argv.reporter === "markdown") {
|
|
326
331
|
throw createUnsupportedError(
|
|
327
|
-
|
|
332
|
+
"--reporter=markdown is mutually exclusive with --parallel",
|
|
328
333
|
);
|
|
329
334
|
}
|
|
330
335
|
|
|
331
|
-
if (argv.reporter ===
|
|
336
|
+
if (argv.reporter === "json-stream") {
|
|
332
337
|
throw createUnsupportedError(
|
|
333
|
-
|
|
338
|
+
"--reporter=json-stream is mutually exclusive with --parallel",
|
|
334
339
|
);
|
|
335
340
|
}
|
|
336
341
|
}
|
|
@@ -338,14 +343,14 @@ exports.builder = yargs =>
|
|
|
338
343
|
if (argv.compilers) {
|
|
339
344
|
throw createUnsupportedError(
|
|
340
345
|
`--compilers is DEPRECATED and no longer supported.
|
|
341
|
-
See https://github.com/mochajs/mocha/wiki/compilers-deprecation for migration information
|
|
346
|
+
See https://github.com/mochajs/mocha/wiki/compilers-deprecation for migration information.`,
|
|
342
347
|
);
|
|
343
348
|
}
|
|
344
349
|
|
|
345
350
|
if (argv.opts) {
|
|
346
351
|
throw createUnsupportedError(
|
|
347
352
|
`--opts: configuring Mocha via 'mocha.opts' is DEPRECATED and no longer supported.
|
|
348
|
-
Please use a configuration file instead
|
|
353
|
+
Please use a configuration file instead.`,
|
|
349
354
|
);
|
|
350
355
|
}
|
|
351
356
|
|
|
@@ -356,12 +361,12 @@ exports.builder = yargs =>
|
|
|
356
361
|
try {
|
|
357
362
|
// load requires first, because it can impact "plugin" validation
|
|
358
363
|
const plugins = await handleRequires(argv.require);
|
|
359
|
-
validateLegacyPlugin(argv,
|
|
360
|
-
validateLegacyPlugin(argv,
|
|
364
|
+
validateLegacyPlugin(argv, "reporter", Mocha.reporters);
|
|
365
|
+
validateLegacyPlugin(argv, "ui", Mocha.interfaces);
|
|
361
366
|
Object.assign(argv, plugins);
|
|
362
367
|
} catch (err) {
|
|
363
368
|
// this could be a bad --require, bad reporter, ui, etc.
|
|
364
|
-
console.error(`\n${symbols.error} ${pc.red(
|
|
369
|
+
console.error(`\n${symbols.error} ${pc.red("ERROR:")}`, err);
|
|
365
370
|
yargs.exit(1);
|
|
366
371
|
}
|
|
367
372
|
})
|
|
@@ -372,13 +377,13 @@ exports.builder = yargs =>
|
|
|
372
377
|
.alias(aliases);
|
|
373
378
|
|
|
374
379
|
exports.handler = async function (argv) {
|
|
375
|
-
debug(
|
|
380
|
+
debug("post-yargs config", argv);
|
|
376
381
|
const mocha = new Mocha(argv);
|
|
377
382
|
|
|
378
383
|
try {
|
|
379
384
|
await runMocha(mocha, argv);
|
|
380
385
|
} catch (err) {
|
|
381
|
-
console.error(
|
|
386
|
+
console.error("\n Exception during run:", err);
|
|
382
387
|
process.exit(1);
|
|
383
388
|
}
|
|
384
389
|
};
|