Skip to content

Commit 1dbfcf7

Browse files
Merge branch 'master' into boneskull/issue/3817
2 parents 749da5b + 2f3fedc commit 1dbfcf7

File tree

27 files changed

+449
-410
lines changed

27 files changed

+449
-410
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
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.

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: 'github-actions'
4+
directory: '/'
5+
schedule:
6+
interval: 'weekly'
7+
groups:
8+
github-actions:
9+
patterns:
10+
- '*'

.github/workflows/browser-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
ref: ${{ github.event.pull_request.head.sha }}
2121
persist-credentials: false
2222
- name: 'Cache node_modules'
23-
uses: actions/cache@v3
23+
uses: actions/cache@v4
2424
with:
2525
path: '~/.npm'
2626
key: "ubuntu-latest-node-full-lts-${{ hashFiles('**/package-lock.json') }}"
@@ -32,7 +32,7 @@ jobs:
3232
SAUCE_USERNAME: '${{secrets.SAUCE_USERNAME}}'
3333
SAUCE_ACCESS_KEY: '${{secrets.SAUCE_ACCESS_KEY}}'
3434
- name: remove 'run-browser-test' label
35-
uses: buildsville/[email protected].0
35+
uses: buildsville/[email protected].1
3636
if: ${{ always() }}
3737
with:
3838
token: ${{secrets.GITHUB_TOKEN}}

.github/workflows/mocha.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
with:
7171
persist-credentials: false
7272
- name: 'Cache node_modules'
73-
uses: actions/cache@v3
73+
uses: actions/cache@v4
7474
with:
7575
path: '~/.npm'
7676
key: "ubuntu-latest-node-lts-${{ hashFiles('**/package-lock.json') }}"
@@ -113,7 +113,7 @@ jobs:
113113
run: |
114114
echo "dir=$(npm config get cache)" >> $env:GITHUB_OUTPUT
115115
- name: 'Cache node_modules'
116-
uses: actions/cache@v3
116+
uses: actions/cache@v4
117117
with:
118118
path: ${{ matrix.os == 'ubuntu-latest' && '~/.npm' || steps.npm-cache.outputs.dir }}
119119
key: "${{ matrix.os }}-node-v${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}"
@@ -152,7 +152,7 @@ jobs:
152152
with:
153153
persist-credentials: false
154154
- name: 'Cache node_modules'
155-
uses: actions/cache@v3
155+
uses: actions/cache@v4
156156
with:
157157
path: '~/.npm'
158158
# this key is different than above, since we are running scripts
@@ -189,7 +189,7 @@ jobs:
189189
with:
190190
persist-credentials: false
191191
- name: 'Cache node_modules'
192-
uses: actions/cache@v3
192+
uses: actions/cache@v4
193193
with:
194194
path: '~/.npm'
195195
# this key is different than above, since we are running scripts

AUTHORS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,5 +547,12 @@ Aras Abbasi <[email protected]>
547547
548548
549549
Pelle Wessman <[email protected]>
550+
Orgad Shaneh <[email protected]>
551+
Lucas Lopes <[email protected]>
552+
Bryan Mishkin <[email protected]>
553+
Ville Lahdenvuo <[email protected]>
554+
Nathan Phillip Brink <[email protected]>
555+
Ståle Tomten <[email protected]>
556+
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
550557

551558
# Generated by scripts/update-authors.js

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
# Changelog
22

3+
## 10.4.0 / 2024-03-26
4+
5+
### :tada: Enhancements
6+
7+
- [#4829](https://github.com/mochajs/mocha/pull/4829) feat: include `.cause` stacks in the error stack traces ([**@voxpelli**](https://github.com/voxpelli))
8+
- [#4985](https://github.com/mochajs/mocha/pull/4985) feat: add file path to xunit reporter ([**@bmish**](https://github.com/bmish))
9+
10+
### :bug: Fixes
11+
12+
- [#5074](https://github.com/mochajs/mocha/pull/5074) fix: harden error handling in `lib/cli/run.js` ([**@stalet**](https://github.com/stalet))
13+
14+
### :nut_and_bolt: Other
15+
16+
- [#5077](https://github.com/mochajs/mocha/pull/5077) chore: add mtfoley/pr-compliance-action ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
17+
- [#5060](https://github.com/mochajs/mocha/pull/5060) chore: migrate ESLint config to flat config ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
18+
- [#5095](https://github.com/mochajs/mocha/pull/5095) chore: revert [#5069](https://github.com/mochajs/mocha/pull/5069) to restore Netlify builds ([**@voxpelli**](https://github.com/voxpelli))
19+
- [#5097](https://github.com/mochajs/mocha/pull/5097) docs: add sponsored to sponsorship link rels ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
20+
- [#5093](https://github.com/mochajs/mocha/pull/5093) chore: add 'status: in triage' label to issue templates and docs ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
21+
- [#5083](https://github.com/mochajs/mocha/pull/5083) docs: fix CHANGELOG.md headings to start with a root-level h1 ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
22+
- [#5100](https://github.com/mochajs/mocha/pull/5100) chore: fix header generation and production build crashes ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
23+
- [#5104](https://github.com/mochajs/mocha/pull/5104) chore: bump ESLint ecmaVersion to 2020 ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
24+
- [#5116](https://github.com/mochajs/mocha/pull/5116) fix: eleventy template builds crash with 'unexpected token at ": string, msg..."' ([**@LcsK**](https://github.com/LcsK))
25+
- [#4869](https://github.com/mochajs/mocha/pull/4869) docs: fix documentation concerning glob expansion on UNIX ([**@binki**](https://github.com/binki))
26+
- [#5122](https://github.com/mochajs/mocha/pull/5122) test: fix xunit integration test ([**@voxpelli**](https://github.com/voxpelli))
27+
- [#5123](https://github.com/mochajs/mocha/pull/5123) chore: activate dependabot for workflows ([**@voxpelli**](https://github.com/voxpelli))
28+
- [#5125](https://github.com/mochajs/mocha/pull/5125) build(deps): bump the github-actions group with 2 updates ([**@dependabot**](https://github.com/dependabot))
29+
330
## 10.3.0 / 2024-02-08
431

532
This is a stable release equivalent to [10.30.0-prerelease](#1030-prerelease--2024-01-18).

docs/changelogs/CHANGELOG_V3_older.md

Lines changed: 1 addition & 1 deletion
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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,7 @@ Available root hooks and their behavior:
14581458

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

14631463
```js
14641464
// test/hooks.mjs
@@ -2214,11 +2214,22 @@ If no custom path was given, and if there are multiple configuration files in th
22142214
1. `.mocharc.jsonc`
22152215
1. `.mocharc.json`
22162216

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

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

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

@@ -2257,10 +2268,11 @@ Some shells support recursive matching by using the globstar (`**`) wildcard. Ba
22572268
$ mocha "./spec/**/*.js"
22582269
```
22592270

2260-
[You should _always_ quote your globs in npm scripts][article-globbing]. If you
2261-
use double quotes, it's the shell on UNIX that will expand the glob. On the
2262-
other hand, if you use single quotes, the [`node-glob`][npm-glob] module will
2263-
handle its expansion.
2271+
You should _always_ quote your globs in npm scripts. If you
2272+
use quotes, the [`node-glob`][npm-glob] module will
2273+
handle its expansion. For maximum compatibility,
2274+
surround the entire expression with double quotes and refrain
2275+
from `$`, `"`, `^`, and `\` within your expression.
22642276

22652277
See this [tutorial][gist-globbing-tutorial] on using globs.
22662278

@@ -2352,7 +2364,6 @@ For a running example of Mocha, view [example/tests.html](example/tests.html). F
23522364
or the [source](https://github.com/mochajs/mocha/blob/master/lib/mocha.js).
23532365

23542366
[//]: # 'Cross reference section'
2355-
[article-globbing]: https://medium.com/@jakubsynowiec/you-should-always-quote-your-globs-in-npm-scripts-621887a2a784
23562367
[bash-globbing]: https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
23572368
[better-assert]: https://github.com/visionmedia/better-assert
23582369
[caniuse-notifications]: https://caniuse.com/#feat=notifications

lib/browser/progress.js

Lines changed: 0 additions & 138 deletions
This file was deleted.

lib/cli/options.js

Lines changed: 13 additions & 4 deletions
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/cli/run.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ exports.handler = async function (argv) {
369369
try {
370370
await runMocha(mocha, argv);
371371
} catch (err) {
372-
console.error('\n' + (err.stack || `Error: ${err.message || err}`));
372+
console.error('\n Exception during run:', err);
373373
process.exit(1);
374374
}
375375
};

lib/nodejs/reporters/parallel-buffered.js

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

0 commit comments

Comments
 (0)