Skip to content

Commit e9860b3

Browse files
authored
Update config file examples (#4225) [ci skip]
1 parent 21652d9 commit e9860b3

File tree

4 files changed

+50
-17
lines changed

4 files changed

+50
-17
lines changed

example/config/.mocharc.js

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,47 @@
11
'use strict';
22

3-
// Here's a JavaScript-based config file.
3+
// This is a JavaScript-based config file containing every Mocha option plus others.
44
// If you need conditional logic, you might want to use this type of config.
55
// Otherwise, JSON or YAML is recommended.
66

77
module.exports = {
8+
'allow-uncaught': false,
9+
'async-only': false,
10+
bail: false,
11+
'check-leaks': false,
12+
color: true,
13+
delay: false,
814
diff: true,
15+
exit: false, // could be expressed as "'no-exit': true"
916
extension: ['js'],
17+
// fgrep: something, // fgrep and grep are mutually exclusive
18+
file: ['/path/to/some/file', '/path/to/some/other/file'],
19+
'forbid-only': false,
20+
'forbid-pending': false,
21+
'full-trace': false,
22+
global: ['jQuery', '$'],
23+
// grep: something, // fgrep and grep are mutually exclusive
24+
growl: false,
25+
ignore: ['/path/to/some/ignored/file'],
26+
'inline-diffs': false,
27+
// invert: false, // needs to be used with grep or fgrep
28+
jobs: 1,
1029
package: './package.json',
30+
parallel: false,
31+
recursive: false,
1132
reporter: 'spec',
12-
slow: 75,
13-
timeout: 2000,
33+
'reporter-option': ['foo=bar', 'baz=quux'],
34+
require: '@babel/register',
35+
retries: 1,
36+
slow: '75',
37+
sort: false,
38+
spec: ['test/**/*.spec.js'], // the positional arguments!
39+
timeout: '2000', // same as "timeout: '2s'"
40+
// timeout: false, // same as "'no-timeout': true" or "timeout: 0"
41+
'trace-warnings': true, // node flags ok
1442
ui: 'bdd',
43+
'v8-stack-trace-limit': 100, // V8 flags are prepended with "v8-"
44+
watch: false,
1545
'watch-files': ['lib/**/*.js', 'test/**/*.js'],
1646
'watch-ignore': ['lib/vendor']
1747
};

example/config/.mocharc.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
// This config file contains Mocha's defaults.
2-
// As you can see, comments are allowed.
32
// This same configuration could be provided in the `mocha` property of your
43
// project's `package.json`.
54
{
65
"diff": true,
7-
"extension": ["js"],
6+
"extension": ["js", "cjs", "mjs"],
87
"package": "./package.json",
98
"reporter": "spec",
10-
"slow": 75,
11-
"timeout": 2000,
9+
"slow": "75",
10+
"timeout": "2000",
1211
"ui": "bdd",
1312
"watch-files": ["lib/**/*.js", "test/**/*.js"],
1413
"watch-ignore": ["lib/vendor"]

example/config/.mocharc.jsonc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
// project's `package.json`.
55
{
66
"diff": true,
7-
"extension": ["js"],
7+
"extension": ["js","cjs","mjs"],
88
"package": /* 📦 */ "./package.json",
99
"reporter": /* 📋 */ "spec",
10-
"slow": 75,
11-
"timeout": 2000,
10+
"slow": "75",
11+
"timeout": "2000",
1212
"ui": "bdd",
13-
// Camel-casing options are also accepted
14-
"watchFiles": ["lib/**/*.js", "test/**/*.js"],
15-
"watchIgnore": ["lib/vendor"]
13+
"watch-files": ["lib/**/*.js", "test/**/*.js"],
14+
"watch-ignore": ["lib/vendor"]
1615
}

example/config/.mocharc.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This is an example Mocha config containing every Mocha option plus others
1+
# This is an example Mocha config containing every Mocha option plus others.
22
allow-uncaught: false
33
async-only: false
44
bail: false
@@ -28,17 +28,22 @@ ignore:
2828
inline-diffs: false
2929
# needs to be used with grep or fgrep
3030
# invert: false
31+
jobs: 1
32+
package: './package.json'
33+
parallel: false
3134
recursive: false
3235
reporter: 'spec'
3336
reporter-option:
3437
- 'foo=bar'
3538
- 'baz=quux'
3639
require: '@babel/register'
3740
retries: 1
38-
slow: 75
41+
slow: '75'
3942
sort: false
40-
spec: 'test/**/*.spec.js' # the positional arguments!
41-
timeout: false # same as "no-timeout: true" or "timeout: 0"
43+
spec:
44+
- 'test/**/*.spec.js' # the positional arguments!
45+
timeout: '2000' # same as "timeout: '2s'"
46+
# timeout: false # same as "no-timeout: true" or "timeout: 0"
4247
trace-warnings: true # node flags ok
4348
ui: 'bdd'
4449
v8-stack-trace-limit: 100 # V8 flags are prepended with "v8-"

0 commit comments

Comments
 (0)