From 12c88a75694f7e923114f6943a0dbd66302945c3 Mon Sep 17 00:00:00 2001
From: Josh Goldberg <git@joshuakgoldberg.com>
Date: Mon, 24 Jun 2024 13:36:58 -0400
Subject: [PATCH 1/5] Docs: add 10.5.0 to CHANGELOG.md

---
 CHANGELOG.md | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 62a37eb7a8..46350a07ed 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,23 @@
 # Changelog
 
+## 10.5.0 / 2024-05-24
+
+### :tada: Enhancements
+
+* [#5015](https://github.com/mochajs/mocha/pull/5015) feat: use \<progress\> and \<svg\> for browser progress indicator instead of \<canvas\> ([**@yourWaifu**](https://github.com/yourWaifu))
+* [#5143](https://github.com/mochajs/mocha/pull/5143) feat: allow using any 3.x chokidar dependencies ([**@simhnna**](https://github.com/simhnna))
+* [#4835](https://github.com/mochajs/mocha/pull/4835) feat: add MOCHA_OPTIONS env variable ([**@icholy**](https://github.com/icholy))
+
+### :bug: Fixes
+
+* [#5107](https://github.com/mochajs/mocha/pull/5107) fix: include stack in browser uncaught error reporting ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
+
+### :nut_and_bolt: Other
+
+* [#5110](https://github.com/mochajs/mocha/pull/5110) chore: switch two-column list styles to be opt-in ([**@marjys**](https://github.com/marjys))
+* [#5135](https://github.com/mochajs/mocha/pull/5135) chore: fix some typos in comments ([**@StevenMia**](https://github.com/StevenMia))
+* [#5130](https://github.com/mochajs/mocha/pull/5130) chore: rename 'master' to 'main' in docs and tooling ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
+
 ## 10.4.0 / 2024-03-26
 
 ### :tada: Enhancements

From b9ce511348e55adf721b55f836fcddfa81537735 Mon Sep 17 00:00:00 2001
From: Josh Goldberg <git@joshuakgoldberg.com>
Date: Mon, 24 Jun 2024 13:37:07 -0400
Subject: [PATCH 2/5] Release v10.5.0

---
 AUTHORS           |   5 ++
 CHANGELOG.md      | 120 +++++++++++++++++++++++-----------------------
 package-lock.json |   4 +-
 package.json      |   2 +-
 4 files changed, 68 insertions(+), 63 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 17d79bd2be..a872e5c109 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -554,5 +554,10 @@ Ville Lahdenvuo <tuhoojabotti@gmail.com>
 Nathan Phillip Brink <ohnobinki@ohnopublishing.net>
 Ståle Tomten <stale.tomten@finn.no>
 dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
+Sleepy Flower <wuhao64@gmail.com>
+StevenMia <166844090+StevenMia@users.noreply.github.com>
+Simon Hanna <33220646+simhnna@users.noreply.github.com>
+Ilia Choly <ilia.choly@gmail.com>
+Marjorie Saito <marjorieysaito@gmail.com>
 
 # Generated by scripts/update-authors.js
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 46350a07ed..bc515e5d3c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,19 +4,19 @@
 
 ### :tada: Enhancements
 
-* [#5015](https://github.com/mochajs/mocha/pull/5015) feat: use \<progress\> and \<svg\> for browser progress indicator instead of \<canvas\> ([**@yourWaifu**](https://github.com/yourWaifu))
-* [#5143](https://github.com/mochajs/mocha/pull/5143) feat: allow using any 3.x chokidar dependencies ([**@simhnna**](https://github.com/simhnna))
-* [#4835](https://github.com/mochajs/mocha/pull/4835) feat: add MOCHA_OPTIONS env variable ([**@icholy**](https://github.com/icholy))
+- [#5015](https://github.com/mochajs/mocha/pull/5015) feat: use \<progress> and \<svg> for browser progress indicator instead of \<canvas> ([**@yourWaifu**](https://github.com/yourWaifu))
+- [#5143](https://github.com/mochajs/mocha/pull/5143) feat: allow using any 3.x chokidar dependencies ([**@simhnna**](https://github.com/simhnna))
+- [#4835](https://github.com/mochajs/mocha/pull/4835) feat: add MOCHA\_OPTIONS env variable ([**@icholy**](https://github.com/icholy))
 
 ### :bug: Fixes
 
-* [#5107](https://github.com/mochajs/mocha/pull/5107) fix: include stack in browser uncaught error reporting ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
+- [#5107](https://github.com/mochajs/mocha/pull/5107) fix: include stack in browser uncaught error reporting ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
-* [#5110](https://github.com/mochajs/mocha/pull/5110) chore: switch two-column list styles to be opt-in ([**@marjys**](https://github.com/marjys))
-* [#5135](https://github.com/mochajs/mocha/pull/5135) chore: fix some typos in comments ([**@StevenMia**](https://github.com/StevenMia))
-* [#5130](https://github.com/mochajs/mocha/pull/5130) chore: rename 'master' to 'main' in docs and tooling ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
+- [#5110](https://github.com/mochajs/mocha/pull/5110) chore: switch two-column list styles to be opt-in ([**@marjys**](https://github.com/marjys))
+- [#5135](https://github.com/mochajs/mocha/pull/5135) chore: fix some typos in comments ([**@StevenMia**](https://github.com/StevenMia))
+- [#5130](https://github.com/mochajs/mocha/pull/5130) chore: rename 'master' to 'main' in docs and tooling ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
 
 ## 10.4.0 / 2024-03-26
 
@@ -29,7 +29,7 @@
 
 - [#5074](https://github.com/mochajs/mocha/pull/5074) fix: harden error handling in `lib/cli/run.js` ([**@stalet**](https://github.com/stalet))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#5077](https://github.com/mochajs/mocha/pull/5077) chore: add mtfoley/pr-compliance-action ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
 - [#5060](https://github.com/mochajs/mocha/pull/5060) chore: migrate ESLint config to flat config ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
@@ -54,7 +54,7 @@ This is a stable release equivalent to [10.30.0-prerelease](#1030-prerelease--20
 This is a prerelease version to test our ability to release.
 Other than removing or updating dependencies, it contains no intended user-facing changes.
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#5069](https://github.com/mochajs/mocha/pull/5069): chore: remove unnecessary canvas dependency ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
 - [#5068](https://github.com/mochajs/mocha/pull/5068): fix: add alt text to Built with Netlify badge ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
@@ -94,7 +94,7 @@ Other than removing or updating dependencies, it contains no intended user-facin
 
 - [#4896](https://github.com/mochajs/mocha/issues/4896): Browser: add support for `prefers-color-scheme: dark` ([**@greggman**](https://github.com/greggman))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4912](https://github.com/mochajs/mocha/issues/4912): Browser: increase contrast for replay buttons ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
 - [#4905](https://github.com/mochajs/mocha/issues/4905): Use standard `Promise.allSettled` instead of polyfill ([**@outsideris**](https://github.com/outsideris))
@@ -119,7 +119,7 @@ Other than removing or updating dependencies, it contains no intended user-facin
 
 - [#4861](https://github.com/mochajs/mocha/issues/4861): Remove deprecated `Runner` signature ([**@juergba**](https://github.com/juergba))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4878](https://github.com/mochajs/mocha/issues/4878): Update production dependencies ([**@juergba**](https://github.com/juergba))
 
@@ -137,7 +137,7 @@ Also thanks to [**@ea2305**](https://github.com/ea2305) and [**@SukkaW**](https:
 
 - [#4839](https://github.com/mochajs/mocha/issues/4839): `dry-run`: prevent potential call-stack crash ([**@juergba**](https://github.com/juergba))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4843](https://github.com/mochajs/mocha/issues/4843): Update production dependencies ([**@juergba**](https://github.com/juergba))
 
@@ -155,7 +155,7 @@ Also thanks to [**@ea2305**](https://github.com/ea2305) and [**@SukkaW**](https:
 
 - [#4813](https://github.com/mochajs/mocha/issues/4813): Parallel: assign each worker a worker-id ([**@forty**](https://github.com/forty))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4818](https://github.com/mochajs/mocha/issues/4818): Update production dependencies ([**@juergba**](https://github.com/juergba))
 
@@ -165,7 +165,7 @@ Also thanks to [**@ea2305**](https://github.com/ea2305) and [**@SukkaW**](https:
 
 - [#4807](https://github.com/mochajs/mocha/issues/4807): `import` throws wrong error if loader is used ([**@giltayar**](https://github.com/giltayar))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4777](https://github.com/mochajs/mocha/issues/4777): Add Node v17 to CI test matrix ([**@outsideris**](https://github.com/outsideris))
 
@@ -175,7 +175,7 @@ Also thanks to [**@ea2305**](https://github.com/ea2305) and [**@SukkaW**](https:
 
 - [#4769](https://github.com/mochajs/mocha/issues/4769): Browser: re-enable `bdd` ES6 style import ([**@juergba**](https://github.com/juergba))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4764](https://github.com/mochajs/mocha/issues/4764): Revert deprecation of `EVENT_SUITE_ADD_*` events ([**@beatfactor**](https://github.com/beatfactor))
 
@@ -185,7 +185,7 @@ Also thanks to [**@ea2305**](https://github.com/ea2305) and [**@SukkaW**](https:
 
 - [#4746](https://github.com/mochajs/mocha/issues/4746): Browser: stop using all global vars in `browser-entry.js` ([**@PaperStrike**](https://github.com/PaperStrike))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4754](https://github.com/mochajs/mocha/issues/4754): Remove dependency wide-align ([**@juergba**](https://github.com/juergba))
 - [#4736](https://github.com/mochajs/mocha/issues/4736): ESM: remove code for Node versions <10 ([**@juergba**](https://github.com/juergba))
@@ -220,13 +220,13 @@ Also thanks to [**@ea2305**](https://github.com/ea2305) and [**@SukkaW**](https:
 
 - [#4668](https://github.com/mochajs/mocha/issues/4668): ESM: make `--require <dir>` work with new `import`-first loading ([**@giltayar**](https://github.com/giltayar))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4674](https://github.com/mochajs/mocha/issues/4674): Update production dependencies ([**@juergba**](https://github.com/juergba))
 
 ## 9.0.1 / 2021-06-18
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4657](https://github.com/mochajs/mocha/issues/4657): Browser: add separate bundle for modern browsers ([**@juergba**](https://github.com/juergba))
 
@@ -258,7 +258,7 @@ We added a separate browser bundle `mocha-es2018.js` in javascript ES2018, as we
 
 - [#4128](https://github.com/mochajs/mocha/issues/4128): Fix: control stringification of error message ([**@syeutyu**](https://github.com/syeutyu))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4646](https://github.com/mochajs/mocha/issues/4646): Deprecate `Runner(suite: Suite, delay: boolean)` signature ([**@juergba**](https://github.com/juergba))
 - [#4643](https://github.com/mochajs/mocha/issues/4643): Update production dependencies ([**@juergba**](https://github.com/juergba))
@@ -318,7 +318,7 @@ Also thanks to [**@outsideris**](https://github.com/outsideris) for various impr
 - [#4503](https://github.com/mochajs/mocha/issues/4503): Add GH Actions workflow status badge ([**@outsideris**](https://github.com/outsideris))
 - [#4494](https://github.com/mochajs/mocha/issues/4494): Add example of generating tests dynamically with a closure ([**@maxwellgerber**](https://github.com/maxwellgerber))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4556](https://github.com/mochajs/mocha/issues/4556): Upgrade all dependencies to latest stable ([**@AviVahl**](https://github.com/AviVahl))
 - [#4543](https://github.com/mochajs/mocha/issues/4543): Update dependencies yargs and yargs-parser ([**@juergba**](https://github.com/juergba))
@@ -338,11 +338,11 @@ Also thanks to [**@akeating**](https://github.com/akeating) for a documentation
 
 ## 8.2.0 / 2020-10-16
 
-The major feature added in v8.2.0 is addition of support for [_global fixtures_](https://mochajs.org/#global-fixtures).
+The major feature added in v8.2.0 is addition of support for [*global fixtures*](https://mochajs.org/#global-fixtures).
 
-While Mocha has always had the ability to run setup and teardown via a hook (e.g., a `before()` at the top level of a test file) when running tests in serial, Mocha v8.0.0 added support for parallel runs. Parallel runs are _incompatible_ with this strategy; e.g., a top-level `before()` would only run for the file in which it was defined.
+While Mocha has always had the ability to run setup and teardown via a hook (e.g., a `before()` at the top level of a test file) when running tests in serial, Mocha v8.0.0 added support for parallel runs. Parallel runs are *incompatible* with this strategy; e.g., a top-level `before()` would only run for the file in which it was defined.
 
-With [global fixtures](https://mochajs.org/#global-fixtures), Mocha can now perform user-defined setup and teardown _regardless_ of mode, and these fixtures are guaranteed to run _once and only once_. This holds for parallel mode, serial mode, and even "watch" mode (the teardown will run once you hit Ctrl-C, just before Mocha finally exits). Tasks such as starting and stopping servers are well-suited to global fixtures, but not sharing resources--global fixtures do _not_ share context with your test files (but they do share context with each other).
+With [global fixtures](https://mochajs.org/#global-fixtures), Mocha can now perform user-defined setup and teardown *regardless* of mode, and these fixtures are guaranteed to run *once and only once*. This holds for parallel mode, serial mode, and even "watch" mode (the teardown will run once you hit Ctrl-C, just before Mocha finally exits). Tasks such as starting and stopping servers are well-suited to global fixtures, but not sharing resources--global fixtures do *not* share context with your test files (but they do share context with each other).
 
 Here's a short example of usage:
 
@@ -377,7 +377,7 @@ For detailed information, please see the [documentation](https://mochajs.org/#gl
 - [#4434](https://github.com/mochajs/mocha/issues/4434): Output of `json` reporter now contains `speed` ("fast"/"medium"/"slow") property ([**@wwhurin**](https://github.com/wwhurin))
 - [#4464](https://github.com/mochajs/mocha/issues/4464): Errors thrown by serializer in parallel mode now have error codes ([**@evaline-ju**](https://github.com/evaline-ju))
 
-_For implementors of custom reporters:_
+*For implementors of custom reporters:*
 
 - [#4409](https://github.com/mochajs/mocha/issues/4409): Parallel mode and custom reporter improvements ([**@boneskull**](https://github.com/boneskull)):
   - Support custom worker-process-only reporters (`Runner.prototype.workerReporter()`); reporters should subclass `ParallelBufferedReporter` in `mocha/lib/nodejs/reporters/parallel-buffered`
@@ -423,11 +423,11 @@ Thanks to [**@AviVahl**](https://github.com/AviVahl), [**@donghoon-song**](https
 
 In this release, Mocha now builds its browser bundle with Rollup and Babel, which will provide the project's codebase more flexibility and consistency.
 
-While we've been diligent about backwards compatibility, it's _possible_ consumers of the browser bundle will encounter differences (other than an increase in the bundle size). If you _do_ encounter an issue with the build, please [report it here](https://github.com/mochajs/mocha/issues/new?labels=unconfirmed-bug&template=bug_report.md&title=).
+While we've been diligent about backwards compatibility, it's *possible* consumers of the browser bundle will encounter differences (other than an increase in the bundle size). If you *do* encounter an issue with the build, please [report it here](https://github.com/mochajs/mocha/issues/new?labels=unconfirmed-bug\&template=bug_report.md\&title=).
 
 This release **does not** drop support for IE11.
 
-Other community contributions came from [**@Devjeel**](https://github.com/Devjeel), [**@Harsha509**](https://github.com/Harsha509) and [**@sharath2106**](https://github.com/sharath2106). _Thank you_ to everyone who contributed to this release!
+Other community contributions came from [**@Devjeel**](https://github.com/Devjeel), [**@Harsha509**](https://github.com/Harsha509) and [**@sharath2106**](https://github.com/sharath2106). *Thank you* to everyone who contributed to this release!
 
 > Do you read Korean? See [this guide to running parallel tests in Mocha](https://blog.outsider.ne.kr/1489), translated by our maintainer, [**@outsideris**](https://github.com/outsideris).
 
@@ -454,7 +454,7 @@ Other community contributions came from [**@Devjeel**](https://github.com/Devjee
 - [#4343](https://github.com/mochajs/mocha/issues/4343): Clean up some API docs ([**@craigtaub**](https://github.com/craigtaub))
 - [#4318](https://github.com/mochajs/mocha/issues/4318): Sponsor images are now self-hosted ([**@Munter**](https://github.com/Munter))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4293](https://github.com/mochajs/mocha/issues/4293): Use Rollup and Babel in build pipeline; add source map to published files ([**@Munter**](https://github.com/Munter))
 
@@ -468,7 +468,7 @@ The obligatory patch after a major.
 
 ## 8.0.0 / 2020-06-10
 
-In this major release, Mocha adds the ability to _run tests in parallel_. Better late than never! Please note the **breaking changes** detailed below.
+In this major release, Mocha adds the ability to *run tests in parallel*. Better late than never! Please note the **breaking changes** detailed below.
 
 Let's welcome [**@giltayar**](https://github.com/giltayar) and [**@nicojs**](https://github.com/nicojs) to the maintenance team!
 
@@ -505,17 +505,17 @@ Let's welcome [**@giltayar**](https://github.com/giltayar) and [**@nicojs**](htt
 
 - [#4245](https://github.com/mochajs/mocha/issues/4245): Add ability to run tests in parallel for Node.js (see [docs](https://mochajs.org/#parallel-tests)) ([**@boneskull**](https://github.com/boneskull))
 
-  :exclamation: See also [#4244](https://github.com/mochajs/mocha/issues/4244); [Root Hook Plugins (docs)](https://mochajs.org/#root-hook-plugins) -- _root hooks must be defined via Root Hook Plugins to work in parallel mode_
+  :exclamation: See also [#4244](https://github.com/mochajs/mocha/issues/4244); [Root Hook Plugins (docs)](https://mochajs.org/#root-hook-plugins) -- *root hooks must be defined via Root Hook Plugins to work in parallel mode*
 
 - [#4304](https://github.com/mochajs/mocha/issues/4304): `--require` now works with ES modules ([**@JacobLey**](https://github.com/JacobLey))
 
-- [#4299](https://github.com/mochajs/mocha/issues/4299): In some circumstances, Mocha can run ES modules under Node.js v10 -- _use at your own risk!_ ([**@giltayar**](https://github.com/giltayar))
+- [#4299](https://github.com/mochajs/mocha/issues/4299): In some circumstances, Mocha can run ES modules under Node.js v10 -- *use at your own risk!* ([**@giltayar**](https://github.com/giltayar))
 
 ### :book: Documentation
 
 - [#4246](https://github.com/mochajs/mocha/issues/4246): Add documentation for parallel mode and Root Hook plugins ([**@boneskull**](https://github.com/boneskull))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4200](https://github.com/mochajs/mocha/issues/4200): Drop mkdirp and replace it with fs.mkdirSync ([**@HyunSangHan**](https://github.com/HyunSangHan))
 
@@ -547,7 +547,7 @@ Let's welcome [**@giltayar**](https://github.com/giltayar) and [**@nicojs**](htt
 - [#4235](https://github.com/mochajs/mocha/issues/4235): Enable emoji on website; enable normal ul elements ([**@boneskull**](https://github.com/boneskull))
 - [#4272](https://github.com/mochajs/mocha/issues/4272): Fetch sponsors at build time, show ALL non-skeevy sponsors ([**@boneskull**](https://github.com/boneskull))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4249](https://github.com/mochajs/mocha/issues/4249): Refactoring improving encapsulation ([**@arvidOtt**](https://github.com/arvidOtt))
 - [#4242](https://github.com/mochajs/mocha/issues/4242): CI add job names, add Node.js v14 to matrix ([**@boneskull**](https://github.com/boneskull))
@@ -556,7 +556,7 @@ Let's welcome [**@giltayar**](https://github.com/giltayar) and [**@nicojs**](htt
 
 ## 7.1.2 / 2020-04-26
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4251](https://github.com/mochajs/mocha/issues/4251): Prevent karma-mocha from stalling ([**@juergba**](https://github.com/juergba))
 - [#4222](https://github.com/mochajs/mocha/issues/4222): Update dependency mkdirp to v0.5.5 ([**@outsideris**](https://github.com/outsideris))
@@ -603,7 +603,7 @@ Mocha supports writing your test files as ES modules:
 
 - [#4058](https://github.com/mochajs/mocha/issues/4058): Manage author list in AUTHORS instead of `package.json` ([**@outsideris**](https://github.com/outsideris))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4138](https://github.com/mochajs/mocha/issues/4138): Upgrade ESLint v6.8 ([**@kaicataldo**](https://github.com/kaicataldo))
 
@@ -621,7 +621,7 @@ Mocha supports writing your test files as ES modules:
 - [#4146](https://github.com/mochajs/mocha/issues/4146): Update copyright & trademark notices per OJSF ([**@boneskull**](https://github.com/boneskull))
 - [#4140](https://github.com/mochajs/mocha/issues/4140): Fix broken links ([**@KyoungWan**](https://github.com/KyoungWan))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4133](https://github.com/mochajs/mocha/issues/4133): Print more descriptive error message ([**@Zirak**](https://github.com/Zirak))
 
@@ -651,7 +651,7 @@ Mocha supports writing your test files as ES modules:
 
 ### :fax: Deprecations
 
-These are _soft_-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha:
+These are *soft*-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha:
 
 - [#3968](https://github.com/mochajs/mocha/issues/3968): Deprecate legacy configuration via `mocha.opts` ([**@juergba**](https://github.com/juergba))
 
@@ -677,7 +677,7 @@ These are _soft_-deprecated, and will emit a warning upon use. Support will be r
 - [#4045](https://github.com/mochajs/mocha/issues/4045): Update README.md concerning GraphicsMagick installation ([**@HyunSangHan**](https://github.com/HyunSangHan))
 - [#3988](https://github.com/mochajs/mocha/issues/3988): Fix sponsors background color for readability ([**@outsideris**](https://github.com/outsideris))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#4118](https://github.com/mochajs/mocha/issues/4118): Update node-environment-flags to 1.0.6 ([**@kylef**](https://github.com/kylef))
 - [#4097](https://github.com/mochajs/mocha/issues/4097): Add GH Funding Metadata ([**@SheetJSDev**](https://github.com/SheetJSDev))
@@ -709,7 +709,7 @@ These are _soft_-deprecated, and will emit a warning upon use. Support will be r
 
 ### :bug: Fixes
 
-- [#3955](https://github.com/mochajs/mocha/issues/3955): tty.getWindowSize is not a function inside a "worker_threads" worker ([**@1999**](https://github.com/1999))
+- [#3955](https://github.com/mochajs/mocha/issues/3955): tty.getWindowSize is not a function inside a "worker\_threads" worker ([**@1999**](https://github.com/1999))
 - [#3970](https://github.com/mochajs/mocha/issues/3970): remove extraGlobals() ([**@juergba**](https://github.com/juergba))
 - [#3984](https://github.com/mochajs/mocha/issues/3984): Update yargs-unparser to v1.6.0 ([**@juergba**](https://github.com/juergba))
 - [#3983](https://github.com/mochajs/mocha/issues/3983): Package 'esm': spawn child-process for correct loading ([**@juergba**](https://github.com/juergba))
@@ -748,7 +748,7 @@ These are _soft_-deprecated, and will emit a warning upon use. Support will be r
 
 - [#3915](https://github.com/mochajs/mocha/issues/3915), [#3929](https://github.com/mochajs/mocha/issues/3929): Increase tests coverage for `--watch` options ([**@geigerzaehler**](https://github.com/geigerzaehler))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#3953](https://github.com/mochajs/mocha/issues/3953): Collect test files later, prepares improvements to the `--watch` mode behavior ([**@geigerzaehler**](https://github.com/geigerzaehler))
 - [#3939](https://github.com/mochajs/mocha/issues/3939): Upgrade for npm audit ([**@boneskull**](https://github.com/boneskull))
@@ -800,7 +800,7 @@ These are _soft_-deprecated, and will emit a warning upon use. Support will be r
 
 ### :fax: Deprecations
 
-These are _soft_-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha:
+These are *soft*-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha:
 
 - [#3719](https://github.com/mochajs/mocha/issues/3719): Deprecate `this.skip()` for "after all" hooks ([**@juergba**](https://github.com/juergba))
 
@@ -826,7 +826,7 @@ and some regressions:
 - [#3807](https://github.com/mochajs/mocha/issues/3807): Mocha website HTML tweaks ([**@plroebuck**](https://github.com/plroebuck))
 - [#3793](https://github.com/mochajs/mocha/issues/3793): Update config file example ".mocharc.yml" ([**@cspotcode**](https://github.com/cspotcode))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#3830](https://github.com/mochajs/mocha/issues/3830): Replace dependency "findup-sync" with "find-up" for faster startup ([**@cspotcode**](https://github.com/cspotcode))
 - [#3799](https://github.com/mochajs/mocha/issues/3799): Update devDependencies to fix many npm vulnerabilities ([**@XhmikosR**](https://github.com/XhmikosR))
@@ -851,7 +851,7 @@ These issues were regressions.
 - [#3754](https://github.com/mochajs/mocha/issues/3754): Mocha again finds `test.js` when run without arguments ([**@plroebuck**](https://github.com/plroebuck))
 - [#3756](https://github.com/mochajs/mocha/issues/3756): Mocha again supports third-party interfaces via `--ui` ([**@boneskull**](https://github.com/boneskull))
 - [#3755](https://github.com/mochajs/mocha/issues/3755): Fix broken `--watch` ([**@boneskull**](https://github.com/boneskull))
-- [#3759](https://github.com/mochajs/mocha/issues/3759): Fix unwelcome deprecation notice when Mocha run against languages (CoffeeScript) with implicit return statements; _returning a non-`undefined` value from a `describe` callback is no longer considered deprecated_ ([**@boneskull**](https://github.com/boneskull))
+- [#3759](https://github.com/mochajs/mocha/issues/3759): Fix unwelcome deprecation notice when Mocha run against languages (CoffeeScript) with implicit return statements; *returning a non-`undefined` value from a `describe` callback is no longer considered deprecated* ([**@boneskull**](https://github.com/boneskull))
 
 ### :book: Documentation
 
@@ -887,7 +887,7 @@ These issues were regressions.
 
 - [#3652](https://github.com/mochajs/mocha/issues/3652): Switch from Jekyll to Eleventy ([**@Munter**](https://github.com/Munter))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#3677](https://github.com/mochajs/mocha/issues/3677): Add error objects for createUnsupportedError and createInvalidExceptionError ([**@boneskull**](https://github.com/boneskull))
 - [#3733](https://github.com/mochajs/mocha/issues/3733): Removed unnecessary processing in post-processing hook ([**@wanseob**](https://github.com/wanseob))
@@ -917,7 +917,7 @@ Welcome [**@plroebuck**](https://github.com/plroebuck), [**@craigtaub**](https:/
   - `-d` is no longer an alias for `--debug`; `-d` is currently ignored
   - [#3275](https://github.com/mochajs/mocha/issues/3275): `--watch-extensions` no longer implies `js`; it must be explicitly added ([**@TheDancingCode**](https://github.com/TheDancingCode))
 - [#2908](https://github.com/mochajs/mocha/issues/2908): `tap` reporter emits error messages ([**@chrmod**](https://github.com/chrmod))
-- [#2819](https://github.com/mochajs/mocha/issues/2819): When conditionally skipping in a `before` hook, subsequent `before` hooks _and_ tests in nested suites are now skipped ([**@bannmoore**](https://github.com/bannmoore))
+- [#2819](https://github.com/mochajs/mocha/issues/2819): When conditionally skipping in a `before` hook, subsequent `before` hooks *and* tests in nested suites are now skipped ([**@bannmoore**](https://github.com/bannmoore))
 - [#627](https://github.com/mochajs/mocha/issues/627): Emit filepath in "timeout exceeded" exceptions where applicable ([**@boneskull**](https://github.com/boneskull))
 - [#3556](https://github.com/mochajs/mocha/issues/3556): `lib/template.html` has moved to `lib/browser/template.html` ([**@boneskull**](https://github.com/boneskull))
 - [#2576](https://github.com/mochajs/mocha/issues/2576): An exception is now thrown if Mocha fails to parse or find a `mocha.opts` at a user-specified path ([**@plroebuck**](https://github.com/plroebuck))
@@ -926,7 +926,7 @@ Welcome [**@plroebuck**](https://github.com/plroebuck), [**@craigtaub**](https:/
 
 ### :fax: Deprecations
 
-These are _soft_-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha:
+These are *soft*-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha:
 
 - `-gc` users should use `--gc-global` instead
 - Consumers of the function exported by `bin/options` should now use the `loadMochaOpts` or `loadOptions` (preferred) functions exported by the `lib/cli/options` module
@@ -963,7 +963,7 @@ Enhancements introduced in [#3556](https://github.com/mochajs/mocha/issues/3556)
   - Support all allowed `node` flags as supported by the running version of `node` (also thanks to [**@demurgos**](https://github.com/demurgos))
   - Support any V8 flag by prepending `--v8-` to the flag name
   - All flags are also supported via config files, `package.json` properties, or `mocha.opts`
-  - Debug-related flags (e.g., `--inspect`) now _imply_ `--no-timeouts`
+  - Debug-related flags (e.g., `--inspect`) now *imply* `--no-timeouts`
   - Use of e.g., `--debug` will automatically invoke `--inspect` if supported by running version of `node`
 
 - Support negation of any Mocha-specific command-line flag by prepending `--no-` to the flag name
@@ -972,7 +972,7 @@ Enhancements introduced in [#3556](https://github.com/mochajs/mocha/issues/3556)
 
 - `Mocha` constructor supports all options
 
-- `--extension` is now an alias for `--watch-extensions` and affects _non-watch-mode_ test runs as well. For example, to run _only_ `test/*.coffee` (not `test/*.js`), you can do `mocha --require coffee-script/register --extensions coffee`.
+- `--extension` is now an alias for `--watch-extensions` and affects *non-watch-mode* test runs as well. For example, to run *only* `test/*.coffee` (not `test/*.js`), you can do `mocha --require coffee-script/register --extensions coffee`.
 
 - [#3552](https://github.com/mochajs/mocha/issues/3552): `tap` reporter is now TAP13-capable ([**@plroebuck**](https://github.com/plroebuck) & [**@mollstam**](https://github.com/mollstam))
 
@@ -1010,7 +1010,7 @@ Enhancements introduced in [#3556](https://github.com/mochajs/mocha/issues/3556)
 - [#2819](https://github.com/mochajs/mocha/issues/2819): Update docs around skips and hooks ([**@bannmoore**](https://github.com/bannmoore))
 - Many improvements by [**@outsideris**](https://github.com/outsideris)
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#3557](https://github.com/mochajs/mocha/issues/3557): Use `ms` userland module instead of hand-rolled solution ([**@gizemkeser**](https://github.com/gizemkeser))
 - Many CI fixes and other refactors by [**@plroebuck**](https://github.com/plroebuck)
@@ -1030,7 +1030,7 @@ Enhancements introduced in [#3556](https://github.com/mochajs/mocha/issues/3556)
 
 - [#3328](https://github.com/mochajs/mocha/pull/3328): Mocha-flavored [API docs](https://mochajs.org/api/)! ([@Munter](https://github.com/munter))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#3330](https://github.com/mochajs/mocha/pull/3330): Use `Buffer.from()` ([@harrysarson](https://github.com/harrysarson))
 - [#3295](https://github.com/mochajs/mocha/pull/3295): Remove redundant folder ([@DavNej](https://github.com/DajNev))
@@ -1057,7 +1057,7 @@ Enhancements introduced in [#3556](https://github.com/mochajs/mocha/issues/3556)
 - [#3323](https://github.com/mochajs/mocha/pull/3323): Publish actual [API documentation](https://mochajs.org/api/)! ([@dfberry](https://github.com/dfberry), [@Munter](https://github.com/munter))
 - [#3299](https://github.com/mochajs/mocha/pull/3299): Improve docs around exclusive tests ([@nicgirault](https://github.com/nicgirault))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#3302](https://github.com/mochajs/mocha/pull/3302), [#3308](https://github.com/mochajs/mocha/pull/3308), [#3310](https://github.com/mochajs/mocha/pull/3310), [#3315](https://github.com/mochajs/mocha/pull/3315), [#3316](https://github.com/mochajs/mocha/pull/3316): Build matrix improvements ([more info](https://boneskull.com/mocha-and-travis-ci-build-stages/)) ([@outsideris](https://github.com/outsideris), [@boneskull](https://github.com/boneskull))
 - [#3272](https://github.com/mochajs/mocha/pull/3272): Refactor reporter tests ([@jMuzsik](https://github.com/jMuzsik))
@@ -1076,7 +1076,7 @@ Welcome [@outsideris](https://github.com/outsideris) to the team!
 - [#3133](https://github.com/mochajs/mocha/issues/3133): Improve docs regarding "pending" behavior ([@ematicipo](https://github.com/ematicipo))
 - [#3276](https://github.com/mochajs/mocha/pull/3276), [#3274](https://github.com/mochajs/mocha/pull/3274): Fix broken stuff in `CHANGELOG.md` ([@tagoro9](https://github.com/tagoro9), [@honzajavorek](https://github.com/honzajavorek))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#3208](https://github.com/mochajs/mocha/issues/3208): Improve test coverage for AMD users ([@outsideris](https://github.com/outsideris))
 - [#3267](https://github.com/mochajs/mocha/pull/3267): Remove vestiges of PhantomJS from CI ([@anishkny](https://github.com/anishkny))
@@ -1096,13 +1096,13 @@ This patch features a fix to address a potential "low severity" [ReDoS vulnerabi
 
 - [#3266](https://github.com/mochajs/mocha/pull/3266): Bump `diff` to v3.5.0 ([@anishkny](https://github.com/anishkny))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#3011](https://github.com/mochajs/mocha/issues/3011): Expose `generateDiff()` in `Base` reporter ([@harrysarson](https://github.com/harrysarson))
 
 ## 5.0.2 / 2018-03-05
 
-This release fixes a class of tests which report as _false positives_. **Certain tests will now break**, though they would have previously been reported as passing. Details below. Sorry for the inconvenience!
+This release fixes a class of tests which report as *false positives*. **Certain tests will now break**, though they would have previously been reported as passing. Details below. Sorry for the inconvenience!
 
 ### :bug: Fixes
 
@@ -1123,13 +1123,13 @@ This release fixes a class of tests which report as _false positives_. **Certain
   });
   \`\`\`
 
-  Previously to this version, Mocha would have _silently swallowed_ the `chaos!` exception, and you wouldn't know. Well, _now you know_. Mocha cannot recover from this gracefully, so it will exit with a nonzero code.
+  Previously to this version, Mocha would have *silently swallowed* the `chaos!` exception, and you wouldn't know. Well, *now you know*. Mocha cannot recover from this gracefully, so it will exit with a nonzero code.
 
-  **Maintainers of external reporters**: _If_ a test of this class is encountered, the `Runner` instance will emit the `end` event _twice_; you _may_ need to change your reporter to use `runner.once('end')` intead of `runner.on('end')`.
+  **Maintainers of external reporters**: *If* a test of this class is encountered, the `Runner` instance will emit the `end` event *twice*; you *may* need to change your reporter to use `runner.once('end')` intead of `runner.on('end')`.
 
 - [#3093](https://github.com/mochajs/mocha/issues/3093): Fix stack trace reformatting problem ([@outsideris](https://github.com/outsideris))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#3248](https://github.com/mochajs/mocha/issues/3248): Update `browser-stdout` to v1.3.1 ([@honzajavorek](https://github.com/honzajavorek))
 
@@ -1150,14 +1150,14 @@ Special thanks to [Wallaby.js](https://wallabyjs.com) for their continued suppor
 - [#3212](https://github.com/mochajs/mocha/pull/3212): Update [Wallaby.js](https://wallabyjs.com)-related docs ([@ArtemGovorov](https://github.com/ArtemGovorov))
 - [#3205](https://github.com/mochajs/mocha/pull/3205): Remove outdated cruft ([@boneskull](https://github.com/boneskull))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#3224](https://github.com/mochajs/mocha/pull/3224): Add proper Wallaby.js config ([@ArtemGovorov](https://github.com/ArtemGovorov))
 - [#3230](https://github.com/mochajs/mocha/pull/3230): Update copyright year ([@josephlin55555](https://github.com/josephlin55555))
 
 ## 5.0.0 / 2018-01-17
 
-Mocha starts off 2018 right by again dropping support for _unmaintained rubbish_.
+Mocha starts off 2018 right by again dropping support for *unmaintained rubbish*.
 
 Welcome [@vkarpov15](https://github.com/vkarpov15) to the team!
 
@@ -1188,7 +1188,7 @@ Welcome [@vkarpov15](https://github.com/vkarpov15) to the team!
 - [#3177](https://github.com/mochajs/mocha/pull/3177): Tweak `README.md` organization ([@xxczaki](https://github.com/xxczaki))
 - Misc updates ([@boneskull](https://github.com/boneskull))
 
-### :nut_and_bolt: Other
+### :nut\_and\_bolt: Other
 
 - [#3118](https://github.com/mochajs/mocha/issues/3118): Move TextMate Integration to [its own repo](https://github.com/mochajs/mocha.tmbundle) ([@Bamieh](https://github.com/Bamieh))
 - [#3185](https://github.com/mochajs/mocha/issues/3185): Add Node.js v9 to build matrix; remove v7 ([@xxczaki](https://github.com/xxczaki))
diff --git a/package-lock.json b/package-lock.json
index 7d5c3379ac..d9e2b95f89 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "mocha",
-  "version": "10.4.0",
+  "version": "10.5.0",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "mocha",
-      "version": "10.4.0",
+      "version": "10.5.0",
       "license": "MIT",
       "dependencies": {
         "ansi-colors": "4.1.1",
diff --git a/package.json b/package.json
index f4fcf530e5..04adfa1d54 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "mocha",
-  "version": "10.4.0",
+  "version": "10.5.0",
   "type": "commonjs",
   "description": "simple, flexible, fun test framework",
   "keywords": [

From dbe229d1b7ce672a02992b12ecb38a1cdd440a1e Mon Sep 17 00:00:00 2001
From: Khoa Huynh <58313491+khoaHyh@users.noreply.github.com>
Date: Tue, 25 Jun 2024 02:17:32 -0400
Subject: [PATCH 3/5] fix: Add error handling for nonexistent file case with
 --file option (#5086)

* feat: handle nonexistent files passed to --file

- added error handling when using the --file flag to do it the way
  --require does
- added a test to assert that we throw the same type of error

* refactor: remove path.resolve()

- require.resolve() by Node.js follows a Node.js module resolution algo
  which includes checking if the resolved path actually exists on the
  file system.

* add comment to new code in collect-files.js

* fix: add back absolute path resolving

* refactor: log warning and remove call stack

* revert changes to bin/mocha.js

* improve test case

* throw error and have handler work with it

* change collectFiles to return object

* clean up

* exit mocha immediately on missing file

* new log message

* add tests

* code quality improvements

* add comments

* docs: update to new link name

* pass mocha instance to helper function

---------

Co-authored-by: Pelle Wessman <pelle@kodfabrik.se>
---
 docs/index.md                                 |  4 +-
 lib/cli/collect-files.js                      | 56 ++++++++++--
 lib/cli/run-helpers.js                        | 53 ++++++++++--
 lib/cli/watch-run.js                          |  4 +-
 .../fixtures/collect-files.fixture.mjs        |  7 ++
 test/integration/options/file.spec.js         | 86 ++++++++++++++++++-
 6 files changed, 190 insertions(+), 20 deletions(-)
 create mode 100644 test/integration/fixtures/collect-files.fixture.mjs

diff --git a/docs/index.md b/docs/index.md
index 2e9313185d..bf9c12fd23 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1063,7 +1063,7 @@ The option can be given multiple times. The option accepts a comma-delimited lis
 
 `--extension` now supports multipart extensions (e.g., `spec.js`), leading dots (`.js`) and combinations thereof (`.spec.js`);
 
-### `--file <file|directory|glob>`
+### `--file <file>`
 
 > _WARNING: `--file` is incompatible with [parallel mode](#parallel-tests)._
 
@@ -1298,7 +1298,7 @@ In parallel mode, Mocha does not guarantee the order in which test files will ru
 
 Because of this, the following options, which depend on order, _cannot be used_ in parallel mode:
 
-- [`--file`](#-file-filedirectoryglob)
+- [`--file`](#-file-file)
 - [`--sort`](#-sort-s)
 - [`--delay`](#delayed-root-suite)
   {:.single-column}
diff --git a/lib/cli/collect-files.js b/lib/cli/collect-files.js
index cc04559443..73f5d2e95a 100644
--- a/lib/cli/collect-files.js
+++ b/lib/cli/collect-files.js
@@ -1,5 +1,6 @@
 'use strict';
 
+const fs = require('fs');
 const path = require('path');
 const ansi = require('ansi-colors');
 const debug = require('debug')('mocha:cli:run:helpers');
@@ -19,7 +20,7 @@ const {castArray} = require('../utils');
 /**
  * Smash together an array of test files in the correct order
  * @param {FileCollectionOptions} [opts] - Options
- * @returns {string[]} List of files to test
+ * @returns {FileCollectionResponse} An object containing a list of files to test and unmatched files.
  * @private
  */
 module.exports = ({
@@ -30,7 +31,7 @@ module.exports = ({
   sort,
   spec
 } = {}) => {
-  const unmatched = [];
+  const unmatchedSpecFiles = [];
   const specFiles = spec.reduce((specFiles, arg) => {
     try {
       const moreSpecFiles = castArray(lookupFiles(arg, extension, recursive))
@@ -44,7 +45,7 @@ module.exports = ({
       return [...specFiles, ...moreSpecFiles];
     } catch (err) {
       if (err.code === NO_FILES_MATCH_PATTERN) {
-        unmatched.push({message: err.message, pattern: err.pattern});
+        unmatchedSpecFiles.push({message: err.message, pattern: err.pattern});
         return specFiles;
       }
 
@@ -52,6 +53,27 @@ module.exports = ({
     }
   }, []);
 
+  // check that each file passed in to --file exists
+
+  const unmatchedFiles = [];
+  fileArgs.forEach(file => {
+    const fileAbsolutePath = path.resolve(file);
+    try {
+      // Used instead of fs.existsSync to ensure that file-ending less files are still resolved correctly
+      require.resolve(fileAbsolutePath);
+    } catch (err) {
+      if (err.code === 'MODULE_NOT_FOUND') {
+        unmatchedFiles.push({
+          pattern: file,
+          absolutePath: fileAbsolutePath
+        });
+        return;
+      }
+
+      throw err;
+    }
+  });
+
   // ensure we don't sort the stuff from fileArgs; order is important!
   if (sort) {
     specFiles.sort();
@@ -67,19 +89,24 @@ module.exports = ({
   if (!files.length) {
     // give full message details when only 1 file is missing
     const noneFoundMsg =
-      unmatched.length === 1
-        ? `Error: No test files found: ${JSON.stringify(unmatched[0].pattern)}` // stringify to print escaped characters raw
+      unmatchedSpecFiles.length === 1
+        ? `Error: No test files found: ${JSON.stringify(
+            unmatchedSpecFiles[0].pattern
+          )}` // stringify to print escaped characters raw
         : 'Error: No test files found';
     console.error(ansi.red(noneFoundMsg));
     process.exit(1);
   } else {
     // print messages as a warning
-    unmatched.forEach(warning => {
+    unmatchedSpecFiles.forEach(warning => {
       console.warn(ansi.yellow(`Warning: ${warning.message}`));
     });
   }
 
-  return files;
+  return {
+    files,
+    unmatchedFiles
+  };
 };
 
 /**
@@ -93,3 +120,18 @@ module.exports = ({
  * @property {boolean} recursive - Find files recursively
  * @property {boolean} sort - Sort test files
  */
+
+/**
+ * Diagnostic object containing unmatched files
+ * @typedef {Object} UnmatchedFile -
+ * @property {string} absolutePath - A list of unmatched files derived from the file arguments passed in.
+ * @property {string} pattern - A list of unmatched files derived from the file arguments passed in.
+ *
+ */
+
+/**
+ * Response object containing a list of files to test and unmatched files.
+ * @typedef {Object} FileCollectionResponse
+ * @property {string[]} files - A list of files to test
+ * @property {UnmatchedFile[]} unmatchedFiles - A list of unmatched files derived from the file arguments passed in.
+ */
diff --git a/lib/cli/run-helpers.js b/lib/cli/run-helpers.js
index 078ca7e434..0d01afbf11 100644
--- a/lib/cli/run-helpers.js
+++ b/lib/cli/run-helpers.js
@@ -9,6 +9,7 @@
 
 const fs = require('fs');
 const path = require('path');
+const ansi = require('ansi-colors');
 const debug = require('debug')('mocha:cli:run:helpers');
 const {watchRun, watchParallelRun} = require('./watch-run');
 const collectFiles = require('./collect-files');
@@ -16,6 +17,7 @@ const {format} = require('util');
 const {createInvalidLegacyPluginError} = require('../errors');
 const {requireOrImport} = require('../nodejs/esm-utils');
 const PluginLoader = require('../plugin-loader');
+const {UnmatchedFile} = require('./collect-files');
 
 /**
  * Exits Mocha when tests + code under test has finished execution (default)
@@ -106,6 +108,32 @@ exports.handleRequires = async (requires = [], {ignoredPlugins = []} = {}) => {
   return plugins;
 };
 
+/**
+ * Logs errors and exits the app if unmatched files exist
+ * @param {Mocha} mocha - Mocha instance
+ * @param {UnmatchedFile} unmatchedFiles - object containing unmatched file paths
+ * @returns {Promise<Runner>}
+ * @private
+ */
+const handleUnmatchedFiles = (mocha, unmatchedFiles) => {
+  if (unmatchedFiles.length === 0) {
+    return;
+  }
+
+  unmatchedFiles.forEach(({pattern, absolutePath}) => {
+    console.error(
+      ansi.yellow(
+        `Warning: Cannot find any files matching pattern "${pattern}" at the absolute path "${absolutePath}"`
+      )
+    );
+  });
+  console.log(
+    'No test file(s) found with the given pattern, exiting with code 1'
+  );
+
+  return mocha.run(exitMocha(1));
+};
+
 /**
  * Collect and load test files, then run mocha instance.
  * @param {Mocha} mocha - Mocha instance
@@ -117,9 +145,14 @@ exports.handleRequires = async (requires = [], {ignoredPlugins = []} = {}) => {
  * @private
  */
 const singleRun = async (mocha, {exit}, fileCollectParams) => {
-  const files = collectFiles(fileCollectParams);
-  debug('single run with %d file(s)', files.length);
-  mocha.files = files;
+  const fileCollectionObj = collectFiles(fileCollectParams);
+
+  if (fileCollectionObj.unmatchedFiles.length > 0) {
+    return handleUnmatchedFiles(mocha, fileCollectionObj.unmatchedFiles);
+  }
+
+  debug('single run with %d file(s)', fileCollectionObj.files.length);
+  mocha.files = fileCollectionObj.files;
 
   // handles ESM modules
   await mocha.loadFilesAsync();
@@ -140,9 +173,17 @@ const singleRun = async (mocha, {exit}, fileCollectParams) => {
  * @private
  */
 const parallelRun = async (mocha, options, fileCollectParams) => {
-  const files = collectFiles(fileCollectParams);
-  debug('executing %d test file(s) in parallel mode', files.length);
-  mocha.files = files;
+  const fileCollectionObj = collectFiles(fileCollectParams);
+
+  if (fileCollectionObj.unmatchedFiles.length > 0) {
+    return handleUnmatchedFiles(mocha, fileCollectionObj.unmatchedFiles);
+  }
+
+  debug(
+    'executing %d test file(s) in parallel mode',
+    fileCollectionObj.files.length
+  );
+  mocha.files = fileCollectionObj.files;
 
   // note that we DO NOT load any files here; this is handled by the worker
   return mocha.run(options.exit ? exitMocha : exitMochaLater);
diff --git a/lib/cli/watch-run.js b/lib/cli/watch-run.js
index a77ed7a91a..6d5c6c26a7 100644
--- a/lib/cli/watch-run.js
+++ b/lib/cli/watch-run.js
@@ -58,7 +58,7 @@ exports.watchParallelRun = (
       newMocha.suite.ctx = new Context();
 
       // reset the list of files
-      newMocha.files = collectFiles(fileCollectParams);
+      newMocha.files = collectFiles(fileCollectParams).files;
 
       // because we've swapped out the root suite (see the `run` inner function
       // in `createRerunner`), we need to call `mocha.ui()` again to set up the context/globals.
@@ -120,7 +120,7 @@ exports.watchRun = (mocha, {watchFiles, watchIgnore}, fileCollectParams) => {
       newMocha.suite.ctx = new Context();
 
       // reset the list of files
-      newMocha.files = collectFiles(fileCollectParams);
+      newMocha.files = collectFiles(fileCollectParams).files;
 
       // because we've swapped out the root suite (see the `run` inner function
       // in `createRerunner`), we need to call `mocha.ui()` again to set up the context/globals.
diff --git a/test/integration/fixtures/collect-files.fixture.mjs b/test/integration/fixtures/collect-files.fixture.mjs
new file mode 100644
index 0000000000..199e9714ac
--- /dev/null
+++ b/test/integration/fixtures/collect-files.fixture.mjs
@@ -0,0 +1,7 @@
+var obj = {foo: 'bar'};
+
+describe('mjs', function () {
+  it('should work', function () {
+    expect(obj, 'to equal', {foo: 'bar'});
+  });
+});
diff --git a/test/integration/options/file.spec.js b/test/integration/options/file.spec.js
index 88815376f0..259ce4782e 100644
--- a/test/integration/options/file.spec.js
+++ b/test/integration/options/file.spec.js
@@ -1,9 +1,11 @@
 'use strict';
 
 var path = require('path').posix;
-var helpers = require('../helpers');
-var runMochaJSON = helpers.runMochaJSON;
-var resolvePath = helpers.resolveFixturePath;
+const {
+  runMochaJSON,
+  resolveFixturePath: resolvePath,
+  runMocha
+} = require('../helpers');
 
 describe('--file', function () {
   var args = [];
@@ -64,4 +66,82 @@ describe('--file', function () {
       done();
     });
   });
+
+  it('should run esm tests passed via file', function (done) {
+    const esmFile = 'collect-files.fixture.mjs';
+    const testArgs = ['--file', resolvePath(esmFile)];
+
+    runMochaJSON(esmFile, testArgs, function (err, res) {
+      if (err) {
+        return done(err);
+      }
+      expect(res, 'to have passed');
+      done();
+    });
+  });
+
+  it('should log a warning if a nonexistent file with an unknown extension is specified', function (done) {
+    const nonexistentTestFileArg = 'nonexistent.test.ts';
+    runMocha(
+      nonexistentTestFileArg,
+      ['--file'],
+      function (err, res) {
+        if (err) {
+          return done(err);
+        }
+
+        expect(
+          res.output,
+          'to contain',
+          `Warning: Cannot find any files matching pattern`
+        ).and('to contain', nonexistentTestFileArg);
+        done();
+      },
+      {stdio: 'pipe'}
+    );
+  });
+
+  it('should provide warning for nonexistent js file extensions', function (done) {
+    const nonexistentCjsArg = 'nonexistent.test.js';
+
+    runMocha(
+      nonexistentCjsArg,
+      ['--file'],
+      function (err, res) {
+        if (err) {
+          return done(err);
+        }
+
+        expect(
+          res.output,
+          'to contain',
+          `Warning: Cannot find any files matching pattern`
+        ).and('to contain', nonexistentCjsArg);
+        done();
+      },
+      {stdio: 'pipe'}
+    );
+  });
+
+  it('should provide warning for nonexistent esm file extensions', function (done) {
+    const nonexistentEsmArg = 'nonexistent.test.mjs';
+
+    runMocha(
+      nonexistentEsmArg,
+      ['--file'],
+      function (err, res) {
+        if (err) {
+          return done(err);
+        }
+
+        expect(
+          res.output,
+          'to contain',
+          `Warning: Cannot find any files matching pattern`
+        ).and('to contain', nonexistentEsmArg);
+        done();
+      },
+      {stdio: 'pipe'}
+    );
+  });
 });

From 545b66d5927472378aed8e19317212a7535c1650 Mon Sep 17 00:00:00 2001
From: Josh Goldberg <git@joshuakgoldberg.com>
Date: Tue, 25 Jun 2024 02:20:25 -0400
Subject: [PATCH 4/5] docs: add 10.5.1 to CHANGELOG.md

---
 CHANGELOG.md | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index bc515e5d3c..34f02204bb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
 # Changelog
 
+## 10.5.1 / 2024-05-24
+
+### :bug: Fixes
+
+- [#5086](https://github.com/mochajs/mocha/pull/5086) fix: Add error handling for nonexistent file case with --file option ([**@khoaHyh**](https://github.com/khoaHyh))
+
 ## 10.5.0 / 2024-05-24
 
 ### :tada: Enhancements

From 103c56b63542e36ba7a289ec25913d77bf2156b6 Mon Sep 17 00:00:00 2001
From: Josh Goldberg <git@joshuakgoldberg.com>
Date: Tue, 25 Jun 2024 02:20:54 -0400
Subject: [PATCH 5/5] Release v10.5.1

---
 AUTHORS           | 1 +
 package-lock.json | 4 ++--
 package.json      | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index a872e5c109..0f46f00d64 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -559,5 +559,6 @@ StevenMia <166844090+StevenMia@users.noreply.github.com>
 Simon Hanna <33220646+simhnna@users.noreply.github.com>
 Ilia Choly <ilia.choly@gmail.com>
 Marjorie Saito <marjorieysaito@gmail.com>
+Khoa Huynh <58313491+khoaHyh@users.noreply.github.com>
 
 # Generated by scripts/update-authors.js
diff --git a/package-lock.json b/package-lock.json
index d9e2b95f89..f55017bbdb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "mocha",
-  "version": "10.5.0",
+  "version": "10.5.1",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "mocha",
-      "version": "10.5.0",
+      "version": "10.5.1",
       "license": "MIT",
       "dependencies": {
         "ansi-colors": "4.1.1",
diff --git a/package.json b/package.json
index 04adfa1d54..13d879c73d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "mocha",
-  "version": "10.5.0",
+  "version": "10.5.1",
   "type": "commonjs",
   "description": "simple, flexible, fun test framework",
   "keywords": [