Skip to content

Commit 77cca31

Browse files
committedJun 10, 2024
Merge branch 'master' into repo/default-list-style
2 parents 7ed3565 + 2f3fedc commit 77cca31

File tree

11 files changed

+82
-191
lines changed

11 files changed

+82
-191
lines changed
 

‎.github/ISSUE_TEMPLATE/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
blank_issues_enabled: false
1+
blank_issues_enabled: true
22
contact_links:
33
- name: Documentation Website
44
about: Please read our documentation website before filing new issues.

‎docs/changelogs/CHANGELOG_V3_older.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ Thanks to everyone who contributed, and our fabulous [sponsors and backers](http
789789

790790
# 1.10.0 / 2013-05-21
791791

792-
- add add better globbing support for windows via `glob` module
792+
- add better globbing support for windows via `glob` module
793793
- add support to pass through flags such as --debug-brk=1234. Closes [#852](https://github.com/mochajs/mocha/issues/852)
794794
- add test.only, test.skip to qunit interface
795795
- change to always use word-based diffs for now. Closes [#733](https://github.com/mochajs/mocha/issues/733)

‎docs/index.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ Available root hooks and their behavior:
14601460

14611461
> _Tip: If you need to ensure code runs once and only once in any mode, use [global fixtures](#global-fixtures)._
14621462
1463-
As with other hooks, `this` refers to to the current context object:
1463+
As with other hooks, `this` refers to the current context object:
14641464

14651465
```js
14661466
// test/hooks.mjs
@@ -2216,11 +2216,22 @@ If no custom path was given, and if there are multiple configuration files in th
22162216
1. `.mocharc.jsonc`
22172217
1. `.mocharc.json`
22182218

2219+
### Environment Variables
2220+
2221+
The `MOCHA_OPTIONS` environment variable may be used to specify command line arguments. These arguments take priority over those found in configuration files.
2222+
2223+
For example, setting the `bail` and `retries` options:
2224+
2225+
```bash
2226+
$ MOCHA_OPTIONS="--bail --retries 3" mocha
2227+
```
2228+
22192229
### Merging
22202230

22212231
Mocha will also _merge_ any options found in `package.json` into its run-time configuration. In case of conflict, the priority is:
22222232

22232233
1. Arguments specified on command-line
2234+
1. Arguments specified in `MOCHA_OPTIONS` environment variable.
22242235
1. Configuration file (`.mocharc.js`, `.mocharc.yml`, etc.)
22252236
1. `mocha` property of `package.json`
22262237

‎lib/cli/options.js

+13-4
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,10 @@ module.exports.loadPkgRc = loadPkgRc;
208208
* Priority list:
209209
*
210210
* 1. Command-line args
211-
* 2. RC file (`.mocharc.c?js`, `.mocharc.ya?ml`, `mocharc.json`)
212-
* 3. `mocha` prop of `package.json`
213-
* 4. default configuration (`lib/mocharc.json`)
211+
* 2. `MOCHA_OPTIONS` environment variable.
212+
* 3. RC file (`.mocharc.c?js`, `.mocharc.ya?ml`, `mocharc.json`)
213+
* 4. `mocha` prop of `package.json`
214+
* 5. default configuration (`lib/mocharc.json`)
214215
*
215216
* If a {@link module:lib/cli/one-and-dones.ONE_AND_DONE_ARGS "one-and-done" option} is present in the `argv` array, no external config files will be read.
216217
* @summary Parses options read from `.mocharc.*` and `package.json`.
@@ -231,6 +232,7 @@ const loadOptions = (argv = []) => {
231232
return args;
232233
}
233234

235+
const envConfig = parse(process.env.MOCHA_OPTIONS || '');
234236
const rcConfig = loadRc(args);
235237
const pkgConfig = loadPkgRc(args);
236238

@@ -243,7 +245,14 @@ const loadOptions = (argv = []) => {
243245
args._ = args._.concat(pkgConfig._ || []);
244246
}
245247

246-
args = parse(args._, mocharc, args, rcConfig || {}, pkgConfig || {});
248+
args = parse(
249+
args._,
250+
mocharc,
251+
args,
252+
envConfig,
253+
rcConfig || {},
254+
pkgConfig || {}
255+
);
247256

248257
// recombine positional arguments and "spec"
249258
if (args.spec) {

‎lib/nodejs/reporters/parallel-buffered.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const ONCE_EVENT_NAMES = [EVENT_DELAY_BEGIN, EVENT_DELAY_END];
5454

5555
/**
5656
* The `ParallelBuffered` reporter is used by each worker process in "parallel"
57-
* mode, by default. Instead of reporting to to `STDOUT`, etc., it retains a
57+
* mode, by default. Instead of reporting to `STDOUT`, etc., it retains a
5858
* list of events it receives and hands these off to the callback passed into
5959
* {@link Mocha#run}. That callback will then return the data to the main
6060
* process.

‎lib/nodejs/serializer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class SerializableEvent {
117117
/**
118118
* Constructs a `SerializableEvent`, throwing if we receive unexpected data.
119119
*
120-
* Practically, events emitted from `Runner` have a minumum of zero (0)
120+
* Practically, events emitted from `Runner` have a minimum of zero (0)
121121
* arguments-- (for example, {@link Runnable.constants.EVENT_RUN_BEGIN}) and a
122122
* maximum of two (2) (for example,
123123
* {@link Runnable.constants.EVENT_TEST_FAIL}, where the second argument is an

‎package-lock.json

+1-170
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)