Skip to content

Commit

Permalink
Merge branch 'master' into repo/default-list-style
Browse files Browse the repository at this point in the history
  • Loading branch information
marjys committed Jun 10, 2024
2 parents 7ed3565 + 2f3fedc commit 77cca31
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 191 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
blank_issues_enabled: false
blank_issues_enabled: true
contact_links:
- name: Documentation Website
about: Please read our documentation website before filing new issues.
Expand Down
2 changes: 1 addition & 1 deletion docs/changelogs/CHANGELOG_V3_older.md
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ Thanks to everyone who contributed, and our fabulous [sponsors and backers](http

# 1.10.0 / 2013-05-21

- add add better globbing support for windows via `glob` module
- add better globbing support for windows via `glob` module
- add support to pass through flags such as --debug-brk=1234. Closes [#852](https:/mochajs/mocha/issues/852)
- add test.only, test.skip to qunit interface
- change to always use word-based diffs for now. Closes [#733](https:/mochajs/mocha/issues/733)
Expand Down
13 changes: 12 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ Available root hooks and their behavior:

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

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

### Environment Variables

The `MOCHA_OPTIONS` environment variable may be used to specify command line arguments. These arguments take priority over those found in configuration files.

For example, setting the `bail` and `retries` options:

```bash
$ MOCHA_OPTIONS="--bail --retries 3" mocha
```

### Merging

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

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

Expand Down
17 changes: 13 additions & 4 deletions lib/cli/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,10 @@ module.exports.loadPkgRc = loadPkgRc;
* Priority list:
*
* 1. Command-line args
* 2. RC file (`.mocharc.c?js`, `.mocharc.ya?ml`, `mocharc.json`)
* 3. `mocha` prop of `package.json`
* 4. default configuration (`lib/mocharc.json`)
* 2. `MOCHA_OPTIONS` environment variable.
* 3. RC file (`.mocharc.c?js`, `.mocharc.ya?ml`, `mocharc.json`)
* 4. `mocha` prop of `package.json`
* 5. default configuration (`lib/mocharc.json`)
*
* 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.
* @summary Parses options read from `.mocharc.*` and `package.json`.
Expand All @@ -231,6 +232,7 @@ const loadOptions = (argv = []) => {
return args;
}

const envConfig = parse(process.env.MOCHA_OPTIONS || '');
const rcConfig = loadRc(args);
const pkgConfig = loadPkgRc(args);

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

args = parse(args._, mocharc, args, rcConfig || {}, pkgConfig || {});
args = parse(
args._,
mocharc,
args,
envConfig,
rcConfig || {},
pkgConfig || {}
);

// recombine positional arguments and "spec"
if (args.spec) {
Expand Down
2 changes: 1 addition & 1 deletion lib/nodejs/reporters/parallel-buffered.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const ONCE_EVENT_NAMES = [EVENT_DELAY_BEGIN, EVENT_DELAY_END];

/**
* The `ParallelBuffered` reporter is used by each worker process in "parallel"
* mode, by default. Instead of reporting to to `STDOUT`, etc., it retains a
* mode, by default. Instead of reporting to `STDOUT`, etc., it retains a
* list of events it receives and hands these off to the callback passed into
* {@link Mocha#run}. That callback will then return the data to the main
* process.
Expand Down
2 changes: 1 addition & 1 deletion lib/nodejs/serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class SerializableEvent {
/**
* Constructs a `SerializableEvent`, throwing if we receive unexpected data.
*
* Practically, events emitted from `Runner` have a minumum of zero (0)
* Practically, events emitted from `Runner` have a minimum of zero (0)
* arguments-- (for example, {@link Runnable.constants.EVENT_RUN_BEGIN}) and a
* maximum of two (2) (for example,
* {@link Runnable.constants.EVENT_TEST_FAIL}, where the second argument is an
Expand Down
171 changes: 1 addition & 170 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 77cca31

Please sign in to comment.