diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 68376247e1..8a9fa714b9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -79,10 +79,10 @@ Then: ### 🎋 Initial Creation +1. Make sure the issue is labeled with [`status: accepting prs`](https://github.com/mochajs/mocha/issues?q=is%3Aissue+is%3Aopen+label%3A%22status%3A+accepting+prs%22) 1. Create a new branch in your working copy. - Give your branch a descriptive name, such as `issue/12345`: `git checkout -b issue/12345`. 1. Make your changes and add them via `git add`. - - Your changes will likely be somewhere in `lib/`, `bin/` or `browser-entry.js` (if your changes are browser-specific). + - Your changes will likely be somewhere in `lib/`, `bin/`, or (if your changes are browser-specific) `browser-entry.js`. - Unit and/or integration **tests are required** for any code change. These live in `test/`. - **Do not modify** the root `mocha.js` file directly; it is automatically generated. diff --git a/.github/ISSUE_TEMPLATE/01-bug.yml b/.github/ISSUE_TEMPLATE/01-bug.yml index 2e4e83b673..fc43efff3f 100644 --- a/.github/ISSUE_TEMPLATE/01-bug.yml +++ b/.github/ISSUE_TEMPLATE/01-bug.yml @@ -41,6 +41,7 @@ body: type: textarea description: Report a bug trying to run the code labels: - - "type: bug" + - 'status: in triage' + - 'type: bug' name: 🐛 Bug -title: "🐛 Bug: " +title: '🐛 Bug: ' diff --git a/.github/ISSUE_TEMPLATE/02-documentation.yml b/.github/ISSUE_TEMPLATE/02-documentation.yml index 9f70afc940..09517048ac 100644 --- a/.github/ISSUE_TEMPLATE/02-documentation.yml +++ b/.github/ISSUE_TEMPLATE/02-documentation.yml @@ -21,6 +21,7 @@ body: type: textarea description: Report a typo or missing area of documentation labels: - - "area: documentation" + - 'area: documentation' + - 'status: in triage' name: 📝 Docs -title: "📝 Docs: " +title: '📝 Docs: ' diff --git a/.github/ISSUE_TEMPLATE/03-feature-request.yml b/.github/ISSUE_TEMPLATE/03-feature-request.yml index 1179b25018..00778f454a 100644 --- a/.github/ISSUE_TEMPLATE/03-feature-request.yml +++ b/.github/ISSUE_TEMPLATE/03-feature-request.yml @@ -33,6 +33,7 @@ body: type: textarea description: Request that a new feature be added or an existing feature improved labels: - - "type: feature" + - 'status: in triage' + - 'type: feature' name: 🚀 Feature -title: "🚀 Feature: " +title: '🚀 Feature: ' diff --git a/.github/ISSUE_TEMPLATE/04-repository-tooling.yml b/.github/ISSUE_TEMPLATE/04-repository-tooling.yml index 03e9af72fb..3d3908fa31 100644 --- a/.github/ISSUE_TEMPLATE/04-repository-tooling.yml +++ b/.github/ISSUE_TEMPLATE/04-repository-tooling.yml @@ -25,6 +25,7 @@ body: type: textarea description: Report a bug or request an enhancement in the Mocha repository's internal tooling labels: - - "area: repository tooling" + - 'area: repository tooling' + - 'status: in triage' name: 🛠 Repository Tooling -title: "🛠 Repo: " +title: '🛠 Repo: ' diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c5f9a4894..d6938d051b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,15 @@ -# 10.3.0 / 2024-02-08 +# Changelog + +## 10.3.0 / 2024-02-08 This is a stable release equivalent to [10.30.0-prerelease](#1030-prerelease--2024-01-18). -# 10.3.0-prerelease / 2024-01-18 +## 10.3.0-prerelease / 2024-01-18 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)) @@ -27,36 +29,36 @@ Other than removing or updating dependencies, it contains no intended user-facin - [#4918](https://github.com/mochajs/mocha/pull/4918): docs: fix fragment ID for yargs' "extends" documentation ([**@Spencer-Doak**](https://github.com/Spencer-Doak)) - [#4886](https://github.com/mochajs/mocha/pull/4886): docs: fix jsdoc return type of titlePath method ([**@F3n67u**](https://github.com/F3n67u)) -# 10.2.0 / 2022-12-11 +## 10.2.0 / 2022-12-11 -## :tada: Enhancements +### :tada: Enhancements - [#4945](https://github.com/mochajs/mocha/issues/4945): API: add possibility to decorate ESM name before import ([**@j0tunn**](https://github.com/j0tunn)) -## :bug: Fixes +### :bug: Fixes - [#4946](https://github.com/mochajs/mocha/issues/4946): Browser: color of failed test icon ([**@kleisauke**](https://github.com/kleisauke)) -## :book: Documentation +### :book: Documentation - [#4944](https://github.com/mochajs/mocha/issues/4944): Remove duplicated header ([**@PauloGoncalvesBH**](https://github.com/PauloGoncalvesBH)) -# 10.1.0 / 2022-10-16 +## 10.1.0 / 2022-10-16 -## :tada: Enhancements +### :tada: Enhancements - [#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)) - [#4899](https://github.com/mochajs/mocha/issues/4899): Upgrade official GitHub actions to latest ([**@ddzz**](https://github.com/ddzz)) - [#4770](https://github.com/mochajs/mocha/issues/4770): Fix regex in function `clean`([**@yetingli**](https://github.com/yetingli)) -# 10.0.0 / 2022-05-01 +## 10.0.0 / 2022-05-01 -## :boom: Breaking Changes +### :boom: Breaking Changes - [#4845](https://github.com/mochajs/mocha/issues/4845): **Drop Node.js v12.x support** ([**@juergba**](https://github.com/juergba)) @@ -72,7 +74,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)) @@ -82,84 +84,84 @@ Other than removing or updating dependencies, it contains no intended user-facin Also thanks to [**@ea2305**](https://github.com/ea2305) and [**@SukkaW**](https://github.com/SukkaW) for improvements to our documentation. -# 9.2.2 / 2022-03-11 +## 9.2.2 / 2022-03-11 -## :bug: Fixes +### :bug: Fixes - [#4842](https://github.com/mochajs/mocha/issues/4842): Loading of reporter throws wrong error ([**@juergba**](https://github.com/juergba)) - [#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)) -# 9.2.1 / 2022-02-19 +## 9.2.1 / 2022-02-19 -## :bug: Fixes +### :bug: Fixes - [#4832](https://github.com/mochajs/mocha/issues/4832): Loading of config files throws wrong error ([**@juergba**](https://github.com/juergba)) - [#4799](https://github.com/mochajs/mocha/issues/4799): Reporter: configurable `maxDiffSize` reporter-option ([**@norla**](https://github.com/norla)) -# 9.2.0 / 2022-01-24 +## 9.2.0 / 2022-01-24 -## :tada: Enhancements +### :tada: Enhancements - [#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)) -# 9.1.4 / 2022-01-14 +## 9.1.4 / 2022-01-14 -## :bug: Fixes +### :bug: Fixes - [#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)) -# 9.1.3 / 2021-10-15 +## 9.1.3 / 2021-10-15 -## :bug: Fixes +### :bug: Fixes - [#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)) -# 9.1.2 / 2021-09-25 +## 9.1.2 / 2021-09-25 -## :bug: Fixes +### :bug: Fixes - [#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)) -# 9.1.1 / 2021-08-28 +## 9.1.1 / 2021-08-28 -## :bug: Fixes +### :bug: Fixes - [#4623](https://github.com/mochajs/mocha/issues/4623): `XUNIT` and `JSON` reporter crash in `parallel` mode ([**@curtisman**](https://github.com/curtisman)) -# 9.1.0 / 2021-08-20 +## 9.1.0 / 2021-08-20 -## :tada: Enhancements +### :tada: Enhancements - [#4716](https://github.com/mochajs/mocha/issues/4716): Add new option `--fail-zero` ([**@juergba**](https://github.com/juergba)) - [#4691](https://github.com/mochajs/mocha/issues/4691): Add new option `--node-option` ([**@juergba**](https://github.com/juergba)) - [#4607](https://github.com/mochajs/mocha/issues/4607): Add output option to `JSON` reporter ([**@dorny**](https://github.com/dorny)) -# 9.0.3 / 2021-07-25 +## 9.0.3 / 2021-07-25 -## :bug: Fixes +### :bug: Fixes - [#4702](https://github.com/mochajs/mocha/issues/4702): Error rethrow from cwd-relative path while loading `.mocharc.js` ([**@kirill-golovan**](https://github.com/kirill-golovan)) @@ -167,19 +169,19 @@ Also thanks to [**@ea2305**](https://github.com/ea2305) and [**@SukkaW**](https: - [#4687](https://github.com/mochajs/mocha/issues/4687): ESM: don't swallow `MODULE_NOT_FOUND` errors in case of `type:module` ([**@giltayar**](https://github.com/giltayar)) -# 9.0.2 / 2021-07-03 +## 9.0.2 / 2021-07-03 -## :bug: Fixes +### :bug: Fixes - [#4668](https://github.com/mochajs/mocha/issues/4668): ESM: make `--require ` 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 +## 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)) @@ -187,9 +189,9 @@ We added a separate browser bundle `mocha-es2018.js` in javascript ES2018, as we - [#4653](https://github.com/mochajs/mocha/issues/4653): ESM: proper version check in `hasStableEsmImplementation` ([**@alexander-fenster**](https://github.com/alexander-fenster)) -# 9.0.0 / 2021-06-07 +## 9.0.0 / 2021-06-07 -## :boom: Breaking Changes +### :boom: Breaking Changes - [#4633](https://github.com/mochajs/mocha/issues/4633): **Drop Node.js v10.x support** ([**@juergba**](https://github.com/juergba)) @@ -203,30 +205,30 @@ We added a separate browser bundle `mocha-es2018.js` in javascript ES2018, as we - [#4389](https://github.com/mochajs/mocha/issues/4389): Refactoring: Consuming log-symbols alternate to code for win32 in reporters/base ([**@MoonSupport**](https://github.com/MoonSupport)) -## :tada: Enhancements +### :tada: Enhancements - [#4640](https://github.com/mochajs/mocha/issues/4640): Add new option `--dry-run` ([**@juergba**](https://github.com/juergba)) -## :bug: Fixes +### :bug: Fixes - [#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)) -# 8.4.0 / 2021-05-07 +## 8.4.0 / 2021-05-07 -## :tada: Enhancements +### :tada: Enhancements - [#4502](https://github.com/mochajs/mocha/issues/4502): CLI file parsing errors now have error codes ([**@evaline-ju**](https://github.com/evaline-ju)) -## :bug: Fixes +### :bug: Fixes - [#4614](https://github.com/mochajs/mocha/issues/4614): Watch: fix crash when reloading files ([**@outsideris**](https://github.com/outsideris)) -## :book: Documentation +### :book: Documentation - [#4630](https://github.com/mochajs/mocha/issues/4630): Add `options.require` to Mocha constructor for `root hook` plugins on parallel runs ([**@juergba**](https://github.com/juergba)) - [#4617](https://github.com/mochajs/mocha/issues/4617): Dynamically generating tests with `top-level await` and ESM test files ([**@juergba**](https://github.com/juergba)) @@ -234,62 +236,62 @@ We added a separate browser bundle `mocha-es2018.js` in javascript ES2018, as we Also thanks to [**@outsideris**](https://github.com/outsideris) for various improvements on our GH actions workflows. -# 8.3.2 / 2021-03-12 +## 8.3.2 / 2021-03-12 -## :bug: Fixes +### :bug: Fixes - [#4599](https://github.com/mochajs/mocha/issues/4599): Fix regression in `require` interface ([**@alexander-fenster**](https://github.com/alexander-fenster)) -## :book: Documentation +### :book: Documentation - [#4601](https://github.com/mochajs/mocha/issues/4601): Add build to GH actions run ([**@christian-bromann**](https://github.com/christian-bromann)) - [#4596](https://github.com/mochajs/mocha/issues/4596): Filter active sponsors/backers ([**@juergba**](https://github.com/juergba)) - [#4225](https://github.com/mochajs/mocha/issues/4225): Update config file examples ([**@pkuczynski**](https://github.com/pkuczynski)) -# 8.3.1 / 2021-03-06 +## 8.3.1 / 2021-03-06 -## :bug: Fixes +### :bug: Fixes - [#4577](https://github.com/mochajs/mocha/issues/4577): Browser: fix `EvalError` caused by regenerator-runtime ([**@snoack**](https://github.com/snoack)) - [#4574](https://github.com/mochajs/mocha/issues/4574): ESM: allow `import` from mocha in parallel mode ([**@nicojs**](https://github.com/nicojs)) -# 8.3.0 / 2021-02-11 +## 8.3.0 / 2021-02-11 -## :tada: Enhancements +### :tada: Enhancements - [#4506](https://github.com/mochajs/mocha/issues/4506): Add error code for test timeout errors ([**@boneskull**](https://github.com/boneskull)) - [#4112](https://github.com/mochajs/mocha/issues/4112): Add BigInt support to stringify util function ([**@JosejeSinohui**](https://github.com/JosejeSinohui)) -## :bug: Fixes +### :bug: Fixes - [#4557](https://github.com/mochajs/mocha/issues/4557): Add file location when SyntaxError happens in ESM ([**@giltayar**](https://github.com/giltayar)) - [#4521](https://github.com/mochajs/mocha/issues/4521): Fix `require` error when bundling Mocha with Webpack ([**@devhazem**](https://github.com/devhazem)) -## :book: Documentation +### :book: Documentation - [#4507](https://github.com/mochajs/mocha/issues/4507): Add support for typescript-style docstrings ([**@boneskull**](https://github.com/boneskull)) - [#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)) Also thanks to [**@outsideris**](https://github.com/outsideris) and [**@HyunSangHan**](https://github.com/HyunSangHan) for various fixes to our website and documentation. -# 8.2.1 / 2020-11-02 +## 8.2.1 / 2020-11-02 Fixed stuff. -## :bug: Fixes +### :bug: Fixes - [#4489](https://github.com/mochajs/mocha/issues/4489): Fix problematic handling of otherwise-unhandled `Promise` rejections and erroneous "`done()` called twice" errors ([**@boneskull**](https://github.com/boneskull)) - [#4496](https://github.com/mochajs/mocha/issues/4496): Avoid `MaxListenersExceededWarning` in watch mode ([**@boneskull**](https://github.com/boneskull)) Also thanks to [**@akeating**](https://github.com/akeating) for a documentation fix! -# 8.2.0 / 2020-10-16 +## 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). @@ -322,7 +324,7 @@ Fixtures are loaded with `--require`, e.g., `mocha --require fixtures.js`. For detailed information, please see the [documentation](https://mochajs.org/#global-fixtures) and this handy-dandy [flowchart](https://mochajs.org/#test-fixture-decision-tree-wizard-thing) to help understand the differences between hooks, root hook plugins, and global fixtures (and when you should use each). -## :tada: Enhancements +### :tada: Enhancements - [#4308](https://github.com/mochajs/mocha/issues/4308): Support run-once [global setup & teardown fixtures](https://mochajs.org/#global-fixtures) ([**@boneskull**](https://github.com/boneskull)) - [#4442](https://github.com/mochajs/mocha/issues/4442): Multi-part extensions (e.g., `test.js`) now usable with `--extension` option ([**@jordanstephens**](https://github.com/jordanstephens)) @@ -337,7 +339,7 @@ _For implementors of custom reporters:_ - Allow opt-in of object reference matching for "sufficiently advanced" custom reporters (`Runner.prototype.linkPartialObjects()`); use if strict object equality is needed when consuming `Runner` event data - Enable detection of parallel mode (`Runner.prototype.isParallelMode()`) -## :bug: Fixes +### :bug: Fixes - [#4476](https://github.com/mochajs/mocha/issues/4476): Workaround for profoundly bizarre issue affecting `npm` v6.x causing some of Mocha's deps to be installed when `mocha` is present in a package's `devDependencies` and `npm install --production` is run the package's working copy ([**@boneskull**](https://github.com/boneskull)) - [#4465](https://github.com/mochajs/mocha/issues/4465): Worker processes guaranteed (as opposed to "very likely") to exit before Mocha does; fixes a problem when using `nyc` with Mocha in parallel mode ([**@boneskull**](https://github.com/boneskull)) @@ -345,34 +347,34 @@ _For implementors of custom reporters:_ Thanks to [**@AviVahl**](https://github.com/AviVahl), [**@donghoon-song**](https://github.com/donghoon-song), [**@ValeriaVG**](https://github.com/ValeriaVG), [**@znarf**](https://github.com/znarf), [**@sujin-park**](https://github.com/sujin-park), and [**@majecty**](https://github.com/majecty) for other helpful contributions! -# 8.1.3 / 2020-08-28 +## 8.1.3 / 2020-08-28 -## :bug: Fixes +### :bug: Fixes - [#4425](https://github.com/mochajs/mocha/issues/4425): Restore `Mocha.utils.lookupFiles()` and Webpack compatibility (both broken since v8.1.0); `Mocha.utils.lookupFiles()` is now **deprecated** and will be removed in the next major revision of Mocha; use `require('mocha/lib/cli').lookupFiles` instead ([**@boneskull**](https://github.com/boneskull)) -# 8.1.2 / 2020-08-25 +## 8.1.2 / 2020-08-25 -## :bug: Fixes +### :bug: Fixes - [#4418](https://github.com/mochajs/mocha/issues/4418): Fix command-line flag incompatibility in forthcoming Node.js v14.9.0 ([**@boneskull**](https://github.com/boneskull)) - [#4401](https://github.com/mochajs/mocha/issues/4401): Fix missing global variable in browser ([**@irrationnelle**](https://github.com/irrationnelle)) -## :lock: Security Fixes +### :lock: Security Fixes - [#4396](https://github.com/mochajs/mocha/issues/4396): Update many dependencies ([**@GChuf**](https://github.com/GChuf)) -## :book: Documentation +### :book: Documentation - Various fixes by [**@sujin-park**](https://github.com/sujin-park), [**@wwhurin**](https://github.com/wwhurin) & [**@Donghoon759**](https://github.com/Donghoon759) -# 8.1.1 / 2020-08-04 +## 8.1.1 / 2020-08-04 -## :bug: Fixes +### :bug: Fixes - [#4394](https://github.com/mochajs/mocha/issues/4394): Fix regression wherein certain reporters did not correctly detect terminal width ([**@boneskull**](https://github.com/boneskull)) -# 8.1.0 / 2020-07-30 +## 8.1.0 / 2020-07-30 In this release, Mocha now builds its browser bundle with Rollup and Babel, which will provide the project's codebase more flexibility and consistency. @@ -384,11 +386,11 @@ Other community contributions came from [**@Devjeel**](https://github.com/Devjee > 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). -## :tada: Enhancements +### :tada: Enhancements - [#4287](https://github.com/mochajs/mocha/issues/4287): Use background colors with inline diffs for better visual distinction ([**@michael-brade**](https://github.com/michael-brade)) -## :bug: Fixes +### :bug: Fixes - [#4328](https://github.com/mochajs/mocha/issues/4328): Fix "watch" mode when Mocha run in parallel ([**@boneskull**](https://github.com/boneskull)) - [#4382](https://github.com/mochajs/mocha/issues/4382): Fix root hook execution in "watch" mode ([**@indieisaconcept**](https://github.com/indieisaconcept)) @@ -396,36 +398,36 @@ Other community contributions came from [**@Devjeel**](https://github.com/Devjee - [#4359](https://github.com/mochajs/mocha/issues/4359): Better errors when running `mocha init` ([**@boneskull**](https://github.com/boneskull)) - [#4341](https://github.com/mochajs/mocha/issues/4341): Fix weirdness when using `delay` option in browser ([**@craigtaub**](https://github.com/craigtaub)) -## :lock: Security Fixes +### :lock: Security Fixes - [#4378](https://github.com/mochajs/mocha/issues/4378), [#4333](https://github.com/mochajs/mocha/issues/4333): Update [javascript-serialize](https://npm.im/javascript-serialize) ([**@martinoppitz**](https://github.com/martinoppitz), [**@wnghdcjfe**](https://github.com/wnghdcjfe)) - [#4354](https://github.com/mochajs/mocha/issues/4354): Update [yargs-unparser](https://npm.im/yargs-unparser) ([**@martinoppitz**](https://github.com/martinoppitz)) -## :book: Documentation & Website +### :book: Documentation & Website - [#4173](https://github.com/mochajs/mocha/issues/4173): Document how to use `--enable-source-maps` with Mocha ([**@bcoe**](https://github.com/bcoe)) - [#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)) -# 8.0.1 / 2020-06-10 +## 8.0.1 / 2020-06-10 The obligatory patch after a major. -## :bug: Fixes +### :bug: Fixes - [#4328](https://github.com/mochajs/mocha/issues/4328): Fix `--parallel` when combined with `--watch` ([**@boneskull**](https://github.com/boneskull)) -# 8.0.0 / 2020-06-10 +## 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. Let's welcome [**@giltayar**](https://github.com/giltayar) and [**@nicojs**](https://github.com/nicojs) to the maintenance team! -## :boom: Breaking Changes +### :boom: Breaking Changes - [#4164](https://github.com/mochajs/mocha/issues/4164): **Mocha v8.0.0 now requires Node.js v10.12.0 or newer.** Mocha no longer supports the Node.js v8.x line ("Carbon"), which entered End-of-Life at the end of 2019 ([**@UlisesGascon**](https://github.com/UlisesGascon)) @@ -454,7 +456,7 @@ Let's welcome [**@giltayar**](https://github.com/giltayar) and [**@nicojs**](htt - `Mocha.prototype.useInlineDiffs()` - `Mocha.prototype.hideDiff()` -## :tada: Enhancements +### :tada: Enhancements - [#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)) @@ -464,27 +466,27 @@ Let's welcome [**@giltayar**](https://github.com/giltayar) and [**@nicojs**](htt - [#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 +### :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)) -## :bug: Fixes +### :bug: Fixes (All bug fixes in Mocha v8.0.0 are also breaking changes, and are listed above) -# 7.2.0 / 2020-05-22 +## 7.2.0 / 2020-05-22 -## :tada: Enhancements +### :tada: Enhancements - [#4234](https://github.com/mochajs/mocha/issues/4234): Add ability to run tests in a mocha instance multiple times ([**@nicojs**](https://github.com/nicojs)) - [#4219](https://github.com/mochajs/mocha/issues/4219): Exposing filename in JSON, doc, and json-stream reporters ([**@Daniel0113**](https://github.com/Daniel0113)) - [#4244](https://github.com/mochajs/mocha/issues/4244): Add Root Hook Plugins ([**@boneskull**](https://github.com/boneskull)) -## :bug: Fixes +### :bug: Fixes - [#4258](https://github.com/mochajs/mocha/issues/4258): Fix missing dot in name of configuration file ([**@sonicdoe**](https://github.com/sonicdoe)) - [#4194](https://github.com/mochajs/mocha/issues/4194): Check if module.paths really exists ([**@ematipico**](https://github.com/ematipico)) @@ -493,48 +495,48 @@ Let's welcome [**@giltayar**](https://github.com/giltayar) and [**@nicojs**](htt - [#4275](https://github.com/mochajs/mocha/issues/4275): Improper warnings for invalid reporters ([**@boneskull**](https://github.com/boneskull)) - [#4288](https://github.com/mochajs/mocha/issues/4288): Broken hook.spec.js test for IE11 ([**@boneskull**](https://github.com/boneskull)) -## :book: Documentation +### :book: Documentation - [#4081](https://github.com/mochajs/mocha/issues/4081): Insufficient white space for API docs in view on mobile ([**@HyunSangHan**](https://github.com/HyunSangHan)) - [#4255](https://github.com/mochajs/mocha/issues/4255): Update mocha-docdash for UI fixes on API docs ([**@craigtaub**](https://github.com/craigtaub)) - [#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)) - [#4237](https://github.com/mochajs/mocha/issues/4237): Refactor validatePlugins to throw coded errors ([**@boneskull**](https://github.com/boneskull)) - [#4236](https://github.com/mochajs/mocha/issues/4236): Better debug output ([**@boneskull**](https://github.com/boneskull)) -# 7.1.2 / 2020-04-26 +## 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)) -## :book: Documentation +### :book: Documentation - [#4208](https://github.com/mochajs/mocha/issues/4208): Add Wallaby logo to site ([**@boneskull**](https://github.com/boneskull)) -# 7.1.1 / 2020-03-18 +## 7.1.1 / 2020-03-18 -## :lock: Security Fixes +### :lock: Security Fixes - [#4204](https://github.com/mochajs/mocha/issues/4204): Update dependencies mkdirp, yargs-parser and yargs ([**@juergba**](https://github.com/juergba)) -## :bug: Fixes +### :bug: Fixes - [#3660](https://github.com/mochajs/mocha/issues/3660): Fix `runner` listening to `start` and `end` events ([**@juergba**](https://github.com/juergba)) -## :book: Documentation +### :book: Documentation - [#4190](https://github.com/mochajs/mocha/issues/4190): Show Netlify badge on footer ([**@outsideris**](https://github.com/outsideris)) -# 7.1.0 / 2020-02-26 +## 7.1.0 / 2020-02-26 -## :tada: Enhancements +### :tada: Enhancements [#4038](https://github.com/mochajs/mocha/issues/4038): Add Node.js native ESM support ([**@giltayar**](https://github.com/giltayar)) @@ -547,40 +549,40 @@ Mocha supports writing your test files as ES modules: **Note:** Node.JS native [ECMAScript Modules](https://nodejs.org/api/esm.html) implementation has status: **Stability: 1 - Experimental** -## :bug: Fixes +### :bug: Fixes - [#4181](https://github.com/mochajs/mocha/issues/4181): Programmatic API cannot access retried test objects ([**@juergba**](https://github.com/juergba)) - [#4174](https://github.com/mochajs/mocha/issues/4174): Browser: fix `allowUncaught` option ([**@juergba**](https://github.com/juergba)) -## :book: Documentation +### :book: Documentation - [#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)) -# 7.0.1 / 2020-01-25 +## 7.0.1 / 2020-01-25 -## :bug: Fixes +### :bug: Fixes - [#4165](https://github.com/mochajs/mocha/issues/4165): Fix exception when skipping tests programmatically ([**@juergba**](https://github.com/juergba)) - [#4153](https://github.com/mochajs/mocha/issues/4153): Restore backwards compatibility for `reporterOptions` ([**@holm**](https://github.com/holm)) - [#4150](https://github.com/mochajs/mocha/issues/4150): Fix recovery of an open test upon uncaught exception ([**@juergba**](https://github.com/juergba)) - [#4147](https://github.com/mochajs/mocha/issues/4147): Fix regression of leaking uncaught exception handler ([**@juergba**](https://github.com/juergba)) -## :book: Documentation +### :book: Documentation - [#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)) -# 7.0.0 / 2020-01-05 +## 7.0.0 / 2020-01-05 -## :boom: Breaking Changes +### :boom: Breaking Changes - [#3885](https://github.com/mochajs/mocha/issues/3885): **Drop Node.js v6.x support** ([**@mojosoeun**](https://github.com/mojosoeun)) - [#3890](https://github.com/mochajs/mocha/issues/3890): Remove Node.js debug-related flags `--debug`/`--debug-brk` and deprecate `debug` argument ([**@juergba**](https://github.com/juergba)) @@ -595,31 +597,31 @@ Mocha supports writing your test files as ES modules: - [#4083](https://github.com/mochajs/mocha/issues/4083): Uncaught exception in `pending` test: don't swallow, but retrospectively fail the test for correct exit code ([**@juergba**](https://github.com/juergba)) - [#4004](https://github.com/mochajs/mocha/issues/4004): Align `Mocha` constructor's option names with command-line options ([**@juergba**](https://github.com/juergba)) -## :tada: Enhancements +### :tada: Enhancements - [#3980](https://github.com/mochajs/mocha/issues/3980): Refactor and improve `--watch` mode with chokidar ([**@geigerzaehler**](https://github.com/geigerzaehler)): - adds command-line options `--watch-files` and `--watch-ignore` - removes `--watch-extensions` - [#3979](https://github.com/mochajs/mocha/issues/3979): Type "rs\n" to restart tests ([**@broofa**](https://github.com/broofa)) -## :fax: Deprecations +### :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: - [#3968](https://github.com/mochajs/mocha/issues/3968): Deprecate legacy configuration via `mocha.opts` ([**@juergba**](https://github.com/juergba)) -## :bug: Fixes +### :bug: Fixes - [#4125](https://github.com/mochajs/mocha/issues/4125): Fix timeout handling with `--inspect-brk`/`--inspect` ([**@juergba**](https://github.com/juergba)) - [#4070](https://github.com/mochajs/mocha/issues/4070): `Mocha` constructor: improve browser setup ([**@juergba**](https://github.com/juergba)) - [#4068](https://github.com/mochajs/mocha/issues/4068): XUnit reporter should handle exceptions during diff generation ([**@rgroothuijsen**](https://github.com/rgroothuijsen)) - [#4030](https://github.com/mochajs/mocha/issues/4030): Fix `--allow-uncaught` with `this.skip()` ([**@juergba**](https://github.com/juergba)) -## :mag: Coverage +### :mag: Coverage - [#4109](https://github.com/mochajs/mocha/issues/4109): Add Node.js v13.x to CI test matrix ([**@juergba**](https://github.com/juergba)) -## :book: Documentation +### :book: Documentation - [#4129](https://github.com/mochajs/mocha/issues/4129): Fix broken links ([**@SaeromB**](https://github.com/SaeromB)) - [#4127](https://github.com/mochajs/mocha/issues/4127): Add reporter alias names to docs ([**@khg0712**](https://github.com/khg0712)) @@ -630,37 +632,37 @@ 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)) - [#4089](https://github.com/mochajs/mocha/issues/4089): Add funding information to `package.json` ([**@Munter**](https://github.com/Munter)) - [#4077](https://github.com/mochajs/mocha/issues/4077): Improve integration tests ([**@soobing**](https://github.com/soobing)) -# 6.2.3 / 2020-03-25 +## 6.2.3 / 2020-03-25 -## :lock: Security Fixes +### :lock: Security Fixes - [848d6fb8](https://github.com/mochajs/mocha/commit/848d6fb8feef659564b296db457312d38176910d): Update dependencies mkdirp, yargs-parser and yargs ([**@juergba**](https://github.com/juergba)) -# 6.2.2 / 2019-10-18 +## 6.2.2 / 2019-10-18 -## :bug: Fixes +### :bug: Fixes - [#4025](https://github.com/mochajs/mocha/issues/4025): Fix duplicate `EVENT_RUN_END` events upon uncaught exception ([**@juergba**](https://github.com/juergba)) - [#4051](https://github.com/mochajs/mocha/issues/4051): Fix "unhide" function in `html` reporter (browser) ([**@pec9399**](https://github.com/pec9399)) - [#4063](https://github.com/mochajs/mocha/issues/4063): Fix use of [esm](https://npm.im/esm) in Node.js v8.x ([**@boneskull**](https://github.com/boneskull)) - [#4033](https://github.com/mochajs/mocha/issues/4033): Fix output when multiple async exceptions are thrown ([**@juergba**](https://github.com/juergba)) -## :book: Documentation +### :book: Documentation - [#4046](https://github.com/mochajs/mocha/issues/4046): Site accessibility fixes ([**@Mia-jeong**](https://github.com/Mia-jeong)) - [#4026](https://github.com/mochajs/mocha/issues/4026): Update docs for custom reporters in browser ([**@Lindsay-Needs-Sleep**](https://github.com/Lindsay-Needs-Sleep)) - [#3971](https://github.com/mochajs/mocha/issues/3971): Adopt new OpenJS Foundation Code of Conduct ([**@craigtaub**](https://github.com/craigtaub)) -# 6.2.1 / 2019-09-29 +## 6.2.1 / 2019-09-29 -## :bug: Fixes +### :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)) - [#3970](https://github.com/mochajs/mocha/issues/3970): remove extraGlobals() ([**@juergba**](https://github.com/juergba)) @@ -668,21 +670,21 @@ These are _soft_-deprecated, and will emit a warning upon use. Support will be r - [#3983](https://github.com/mochajs/mocha/issues/3983): Package 'esm': spawn child-process for correct loading ([**@juergba**](https://github.com/juergba)) - [#3986](https://github.com/mochajs/mocha/issues/3986): Update yargs to v13.3.0 and yargs-parser to v13.1.1 ([**@juergba**](https://github.com/juergba)) -## :book: Documentation +### :book: Documentation - [#3886](https://github.com/mochajs/mocha/issues/3886): fix styles on mochajs.org ([**@outsideris**](https://github.com/outsideris)) - [#3966](https://github.com/mochajs/mocha/issues/3966): Remove jsdoc index.html placeholder from eleventy file structure and fix broken link in jsdoc tutorial ([**@Munter**](https://github.com/Munter)) - [#3765](https://github.com/mochajs/mocha/issues/3765): Add Matomo to website ([**@MarioDiaz98**](https://github.com/MarioDiaz98)) - [#3947](https://github.com/mochajs/mocha/issues/3947): Clarify effect of .skip() ([**@oliversalzburg**](https://github.com/oliversalzburg)) -# 6.2.0 / 2019-07-18 +## 6.2.0 / 2019-07-18 -## :tada: Enhancements +### :tada: Enhancements - [#3827](https://github.com/mochajs/mocha/issues/3827): Do not fork child-process if no Node flags are present ([**@boneskull**](https://github.com/boneskull)) - [#3725](https://github.com/mochajs/mocha/issues/3725): Base reporter store ref to console.log, see [mocha/wiki](https://github.com/mochajs/mocha/wiki/HOW-TO:-Correctly-stub-stdout) ([**@craigtaub**](https://github.com/craigtaub)) -## :bug: Fixes +### :bug: Fixes - [#3942](https://github.com/mochajs/mocha/issues/3942): Fix "No test files found" Error when file is passed via `--file` ([**@gabegorelick**](https://github.com/gabegorelick)) - [#3914](https://github.com/mochajs/mocha/issues/3914): Modify Mocha constructor to accept options `global` or `globals` ([**@pascalpp**](https://github.com/pascalpp)) @@ -690,18 +692,18 @@ These are _soft_-deprecated, and will emit a warning upon use. Support will be r - [#3834](https://github.com/mochajs/mocha/issues/3834): Fix CLI parsing with default values ([**@boneskull**](https://github.com/boneskull), [**@juergba**](https://github.com/juergba)) - [#3831](https://github.com/mochajs/mocha/issues/3831): Fix `--timeout`/`--slow` string values and duplicate arguments ([**@boneskull**](https://github.com/boneskull), [**@juergba**](https://github.com/juergba)) -## :book: Documentation +### :book: Documentation - [#3906](https://github.com/mochajs/mocha/issues/3906): Document option to define custom report name for XUnit reporter ([**@pkuczynski**](https://github.com/pkuczynski)) - [#3889](https://github.com/mochajs/mocha/issues/3889): Adds doc links for mocha-examples ([**@craigtaub**](https://github.com/craigtaub)) - [#3887](https://github.com/mochajs/mocha/issues/3887): Fix broken links ([**@toyjhlee**](https://github.com/toyjhlee)) - [#3841](https://github.com/mochajs/mocha/issues/3841): Fix anchors to configuration section ([**@trescube**](https://github.com/trescube)) -## :mag: Coverage +### :mag: Coverage - [#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)) @@ -715,49 +717,49 @@ These are _soft_-deprecated, and will emit a warning upon use. Support will be r - [#3957](https://github.com/mochajs/mocha/issues/3957): Remove duplicate line-height property in `mocha.css` ([**@DanielRuf**](https://github.com/DanielRuf)) - [#3960](https://github.com/mochajs/mocha/issues/3960): Don't re-initialize grep option on watch re-run ([**@geigerzaehler**](https://github.com/geigerzaehler)) -# 6.1.4 / 2019-04-18 +## 6.1.4 / 2019-04-18 -## :lock: Security Fixes +### :lock: Security Fixes - [#3877](https://github.com/mochajs/mocha/issues/3877): Upgrade [js-yaml](https://npm.im/js-yaml), addressing [code injection vulnerability](https://www.npmjs.com/advisories/813) ([**@bjornstar**](https://github.com/bjornstar)) -# 6.1.3 / 2019-04-11 +## 6.1.3 / 2019-04-11 -## :bug: Fixes +### :bug: Fixes - [#3863](https://github.com/mochajs/mocha/issues/3863): Fix `yargs`-related global scope pollution ([**@inukshuk**](https://github.com/inukshuk)) - [#3869](https://github.com/mochajs/mocha/issues/3869): Fix failure when installed w/ `pnpm` ([**@boneskull**](https://github.com/boneskull)) -# 6.1.2 / 2019-04-08 +## 6.1.2 / 2019-04-08 -## :bug: Fixes +### :bug: Fixes - [#3867](https://github.com/mochajs/mocha/issues/3867): Re-publish v6.1.1 from POSIX OS to avoid dropped executable flags ([**@boneskull**](https://github.com/boneskull)) -# 6.1.1 / 2019-04-07 +## 6.1.1 / 2019-04-07 -## :bug: Fixes +### :bug: Fixes - [#3866](https://github.com/mochajs/mocha/issues/3866): Fix Windows End-of-Line publishing issue ([**@juergba**](https://github.com/juergba) & [**@cspotcode**](https://github.com/cspotcode)) -# 6.1.0 / 2019-04-07 +## 6.1.0 / 2019-04-07 -## :lock: Security Fixes +### :lock: Security Fixes - [#3845](https://github.com/mochajs/mocha/issues/3845): Update dependency "js-yaml" to v3.13.0 per npm security advisory ([**@plroebuck**](https://github.com/plroebuck)) -## :tada: Enhancements +### :tada: Enhancements - [#3766](https://github.com/mochajs/mocha/issues/3766): Make reporter constructor support optional `options` parameter ([**@plroebuck**](https://github.com/plroebuck)) - [#3760](https://github.com/mochajs/mocha/issues/3760): Add support for config files with `.jsonc` extension ([**@sstephant**](https://github.com/sstephant)) -## :fax: Deprecations +### :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: - [#3719](https://github.com/mochajs/mocha/issues/3719): Deprecate `this.skip()` for "after all" hooks ([**@juergba**](https://github.com/juergba)) -## :bug: Fixes +### :bug: Fixes - [#3829](https://github.com/mochajs/mocha/issues/3829): Use cwd-relative pathname to load config file ([**@plroebuck**](https://github.com/plroebuck)) - [#3745](https://github.com/mochajs/mocha/issues/3745): Fix async calls of `this.skip()` in "before each" hooks ([**@juergba**](https://github.com/juergba)) @@ -770,7 +772,7 @@ and some regressions: - [#3814](https://github.com/mochajs/mocha/issues/3814): Update "yargs" in order to avoid deprecation message ([**@boneskull**](https://github.com/boneskull)) - [#3788](https://github.com/mochajs/mocha/issues/3788): Fix support for multiple node flags ([**@aginzberg**](https://github.com/aginzberg)) -## :book: Documentation +### :book: Documentation - [mochajs/mocha-examples](https://github.com/mochajs/mocha-examples): New repository of working examples of common configurations using mocha ([**@craigtaub**](https://github.com/craigtaub)) - [#3850](https://github.com/mochajs/mocha/issues/3850): Remove pound icon showing on header hover on docs ([**@jd2rogers2**](https://github.com/jd2rogers2)) @@ -779,25 +781,25 @@ 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)) -# 6.0.2 / 2019-02-25 +## 6.0.2 / 2019-02-25 -## :bug: Fixes +### :bug: Fixes Two more regressions fixed: - [#3768](https://github.com/mochajs/mocha/issues/3768): Test file paths no longer dropped from `mocha.opts` ([**@boneskull**](https://github.com/boneskull)) - [#3767](https://github.com/mochajs/mocha/issues/3767): `--require` does not break on module names that look like certain `node` flags ([**@boneskull**](https://github.com/boneskull)) -# 6.0.1 / 2019-02-21 +## 6.0.1 / 2019-02-21 The obligatory round of post-major-release bugfixes. -## :bug: Fixes +### :bug: Fixes These issues were regressions. @@ -806,18 +808,18 @@ These issues were regressions. - [#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)) -## :book: Documentation +### :book: Documentation - [#3738](https://github.com/mochajs/mocha/issues/3738): Upgrade to `@mocha/docdash@2` ([**@tendonstrength**](https://github.com/tendonstrength)) - [#3751](https://github.com/mochajs/mocha/issues/3751): Use preferred names for example config files ([**@Szauka**](https://github.com/Szauka)) -# 6.0.0 / 2019-02-18 +## 6.0.0 / 2019-02-18 -## :tada: Enhancements +### :tada: Enhancements - [#3726](https://github.com/mochajs/mocha/issues/3726): Add ability to unload files from `require` cache ([**@plroebuck**](https://github.com/plroebuck)) -## :bug: Fixes +### :bug: Fixes - [#3737](https://github.com/mochajs/mocha/issues/3737): Fix falsy values from options globals ([**@plroebuck**](https://github.com/plroebuck)) - [#3707](https://github.com/mochajs/mocha/issues/3707): Fix encapsulation issues for `Suite#_onlyTests` and `Suite#_onlySuites` ([**@vkarpov15**](https://github.com/vkarpov15)) @@ -836,11 +838,11 @@ These issues were regressions. - [#3715](https://github.com/mochajs/mocha/issues/3715): Fix incorrect order of emitted events when used programmatically ([**@boneskull**](https://github.com/boneskull)) - [#3706](https://github.com/mochajs/mocha/issues/3706): Fix regression wherein `--reporter-option`/`--reporter-options` did not support comma-separated key/value pairs ([**@boneskull**](https://github.com/boneskull)) -## :book: Documentation +### :book: Documentation - [#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)) @@ -849,19 +851,19 @@ These issues were regressions. - [#3638](https://github.com/mochajs/mocha/issues/3638): Add meta tag to site ([**@MartijnCuppens**](https://github.com/MartijnCuppens)) - [#3653](https://github.com/mochajs/mocha/issues/3653): Fix parts of test suite failing to run on Windows ([**@boneskull**](https://github.com/boneskull)) -# 6.0.0-1 / 2019-01-02 +## 6.0.0-1 / 2019-01-02 -## :bug: Fixes +### :bug: Fixes - Fix missing `mocharc.json` in published package ([**@boneskull**](https://github.com/boneskull)) -# 6.0.0-0 / 2019-01-01 +## 6.0.0-0 / 2019-01-01 **Documentation for this release can be found at [next.mochajs.org](https://next.mochajs.org)**! Welcome [**@plroebuck**](https://github.com/plroebuck), [**@craigtaub**](https://github.com/craigtaub), & [**@markowsiak**](https://github.com/markowsiak) to the team! -## :boom: Breaking Changes +### :boom: Breaking Changes - [#3149](https://github.com/mochajs/mocha/issues/3149): **Drop Node.js v4.x support** ([**@outsideris**](https://github.com/outsideris)) - [#3556](https://github.com/mochajs/mocha/issues/3556): Changes to command-line options ([**@boneskull**](https://github.com/boneskull)): @@ -877,7 +879,7 @@ Welcome [**@plroebuck**](https://github.com/plroebuck), [**@craigtaub**](https:/ - [#3458](https://github.com/mochajs/mocha/issues/3458): Instantiating a `Base`-extending reporter without a `Runner` parameter will throw an exception ([**@craigtaub**](https://github.com/craigtaub)) - [#3125](https://github.com/mochajs/mocha/issues/3125): For consumers of Mocha's programmatic API, all exceptions thrown from Mocha now have a `code` property (and some will have additional metadata). Some `Error` messages have changed. **Please use the `code` property to check `Error` types instead of the `message` property**; these descriptions will be localized in the future. ([**@craigtaub**](https://github.com/craigtaub)) -## :fax: Deprecations +### :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: @@ -893,7 +895,7 @@ All of the above deprecations were introduced by [#3556](https://github.com/moch `mocha.opts` is now considered "legacy"; please prefer RC file or `package.json` over `mocha.opts`. -## :tada: Enhancements +### :tada: Enhancements Enhancements introduced in [#3556](https://github.com/mochajs/mocha/issues/3556): @@ -937,7 +939,7 @@ Enhancements introduced in [#3556](https://github.com/mochajs/mocha/issues/3556) - [#2962](https://github.com/mochajs/mocha/issues/2962), [#3111](https://github.com/mochajs/mocha/issues/3111): In-browser notification support; warn about missing prereqs when `--growl` supplied ([**@plroebuck**](https://github.com/plroebuck)) -## :bug: Fixes +### :bug: Fixes - [#3356](https://github.com/mochajs/mocha/issues/3356): `--no-timeouts` and `--timeout 0` now does what you'd expect ([**@boneskull**](https://github.com/boneskull)) - [#3475](https://github.com/mochajs/mocha/issues/3475): Restore `--no-exit` option ([**@boneskull**](https://github.com/boneskull)) @@ -953,7 +955,7 @@ Enhancements introduced in [#3556](https://github.com/mochajs/mocha/issues/3556) - [#3580](https://github.com/mochajs/mocha/issues/3580): Fix potential exception when using XUnit reporter programmatically ([**@Lana-Light**](https://github.com/Lana-Light)) - [#1304](https://github.com/mochajs/mocha/issues/1304): Do not output color to `TERM=dumb` ([**@plroebuck**](https://github.com/plroebuck)) -## :book: Documentation +### :book: Documentation - [#3525](https://github.com/mochajs/mocha/issues/3525): Improvements to `.github/CONTRIBUTING.md` ([**@markowsiak**](https://github.com/markowsiak)) - [#3466](https://github.com/mochajs/mocha/issues/3466): Update description of `slow` option ([**@finfin**](https://github.com/finfin)) @@ -963,101 +965,101 @@ 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) - Test refactors by [**@outsideris**](https://github.com/outsideris) -# 5.2.0 / 2018-05-18 +## 5.2.0 / 2018-05-18 -## :tada: Enhancements +### :tada: Enhancements - [#3375](https://github.com/mochajs/mocha/pull/3375): Add support for comments in `mocha.opts` ([@plroebuck](https://github.com/plroebuck)) -## :bug: Fixes +### :bug: Fixes - [#3346](https://github.com/mochajs/mocha/pull/3346): Exit correctly from `before` hooks when using `--bail` ([@outsideris](https://github.com/outsideris)) -## :book: Documentation +### :book: Documentation - [#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)) - [#3356](https://github.com/mochajs/mocha/pull/3356): Refactoring ([@plroebuck](https://github.com/plroebuck)) -# 5.1.1 / 2018-04-18 +## 5.1.1 / 2018-04-18 -## :bug: Fixes +### :bug: Fixes - [#3325](https://github.com/mochajs/mocha/issues/3325): Revert change which broke `--watch` ([@boneskull](https://github.com/boneskull)) -# 5.1.0 / 2018-04-12 +## 5.1.0 / 2018-04-12 -## :tada: Enhancements +### :tada: Enhancements - [#3210](https://github.com/mochajs/mocha/pull/3210): Add `--exclude` option ([@metalex9](https://github.com/metalex9)) -## :bug: Fixes +### :bug: Fixes - [#3318](https://github.com/mochajs/mocha/pull/3318): Fix failures in circular objects in JSON reporter ([@jeversmann](https://github.com/jeversmann), [@boneskull](https://github.com/boneskull)) -## :book: Documentation +### :book: Documentation - [#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)) -# 5.0.5 / 2018-03-22 +## 5.0.5 / 2018-03-22 Welcome [@outsideris](https://github.com/outsideris) to the team! -## :bug: Fixes +### :bug: Fixes - [#3096](https://github.com/mochajs/mocha/issues/3096): Fix `--bail` failing to bail within hooks ([@outsideris](https://github.com/outsideris)) - [#3184](https://github.com/mochajs/mocha/issues/3184): Don't skip too many suites (using `describe.skip()`) ([@outsideris](https://github.com/outsideris)) -## :book: Documentation +### :book: Documentation - [#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)) - [#2952](https://github.com/mochajs/mocha/issues/2952): Fix a debug message ([@boneskull](https://github.com/boneskull)) -# 5.0.4 / 2018-03-07 +## 5.0.4 / 2018-03-07 -## :bug: Fixes +### :bug: Fixes - [#3265](https://github.com/mochajs/mocha/issues/3265): Fixes regression in "watch" functionality introduced in v5.0.2 ([@outsideris](https://github.com/outsideris)) -# 5.0.3 / 2018-03-06 +## 5.0.3 / 2018-03-06 This patch features a fix to address a potential "low severity" [ReDoS vulnerability](https://snyk.io/vuln/npm:diff:20180305) in the [diff](https://npm.im/diff) package (a dependency of Mocha). -## :lock: Security Fixes +### :lock: Security Fixes - [#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 +## 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! -## :bug: Fixes +### :bug: Fixes - [#3226](https://github.com/mochajs/mocha/issues/3226): Do not swallow errors that are thrown asynchronously from passing tests ([@boneskull](https://github.com/boneskull)). Example: @@ -1082,57 +1084,57 @@ This release fixes a class of tests which report as _false positives_. **Certain - [#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)) -# 5.0.1 / 2018-02-07 +## 5.0.1 / 2018-02-07 ...your garden-variety patch release. Special thanks to [Wallaby.js](https://wallabyjs.com) for their continued support! :heart: -## :bug: Fixes +### :bug: Fixes - [#1838](https://github.com/mochajs/mocha/issues/1838): `--delay` now works with `.only()` ([@silviom](https://github.com/silviom)) - [#3119](https://github.com/mochajs/mocha/issues/3119): Plug memory leak present in v8 ([@boneskull](https://github.com/boneskull)) -## :book: Documentation +### :book: Documentation - [#3132](https://github.com/mochajs/mocha/issues/3132), [#3098](https://github.com/mochajs/mocha/issues/3098): Update `--glob` docs ([@outsideris](https://github.com/outsideris)) - [#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 +## 5.0.0 / 2018-01-17 Mocha starts off 2018 right by again dropping support for _unmaintained rubbish_. Welcome [@vkarpov15](https://github.com/vkarpov15) to the team! -## :boom: Breaking Changes +### :boom: Breaking Changes - **[#3148](https://github.com/mochajs/mocha/issues/3148): Drop support for IE9 and IE10** ([@Bamieh](https://github.com/Bamieh)) Practically speaking, only code which consumes (through bundling or otherwise) the userland [buffer](https://npm.im/buffer) module should be affected. However, Mocha will no longer test against these browsers, nor apply fixes for them. -## :tada: Enhancements +### :tada: Enhancements - [#3181](https://github.com/mochajs/mocha/issues/3181): Add useful new `--file` command line argument ([documentation](https://mochajs.org/#--file-file)) ([@hswolff](https://github.com/hswolff)) -## :bug: Fixes +### :bug: Fixes - [#3187](https://github.com/mochajs/mocha/issues/3187): Fix inaccurate test duration reporting ([@FND](https://github.com/FND)) - [#3202](https://github.com/mochajs/mocha/pull/3202): Fix bad markup in HTML reporter ([@DanielRuf](https://github.com/DanielRuf)) -## :sunglasses: Developer Experience +### :sunglasses: Developer Experience - [#2352](https://github.com/mochajs/mocha/issues/2352): Ditch GNU Make for [nps](https://npm.im/nps) to manage scripts ([@TedYav](https://github.com/TedYav)) -## :book: Documentation +### :book: Documentation - [#3137](https://github.com/mochajs/mocha/issues/3137): Add missing `--no-timeouts` docs ([@dfberry](https://github.com/dfberry)) - [#3134](https://github.com/mochajs/mocha/issues/3134): Improve `done()` callback docs ([@maraisr](https://github.com/maraisr)) @@ -1141,7 +1143,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/MAINTAINERS.md b/MAINTAINERS.md index 6accddc8ab..16b4463dd8 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -211,8 +211,8 @@ For all issues, apply the following labels based on which area(s) the issue pert - `area: async`: Issues around Mocha's asynchronous usage - `area: browser`: Issues unique to a browser environment - `area: parallel`: Issues around Mocha's parallel mode -- `area: qa`: Issues around Mocha's own test suite - `area: reporter`: Usually concerning Mocha's output +- `area: repository tooling`: Issues around Mocha's CI, own test suite, or other internal tooling - `area: security`: Involving vulnerabilities, actual or potential - `area: windows`: Windows-specific issues, particularly around path discrepancies @@ -221,13 +221,14 @@ Additionally: - `good first issue`: If the implementation is likely doable by someone who's never contributed to Mocha (or potentially any other open source project) before - `status: duplicate`: If an equivalent issue was already filed, add this label, close as not planned, and comment with something like `duplicate of #` - `status: in discussion`: Add this whenever the issue is blocked on community input and/or deeper discussions +- `status: in triage`: Added on new issues; re-add this whenever the issue is awaiting maintainer attention - `status: waiting for author`: Add this whenever the issue is blocked on something from the author ### 🐛 Bugs Bug reports should include a way to reproduce the issue that someone who is not deeply familiar with Mocha can work with locally. -Depending on that reproduction, add the following label(s) in addition to the auto-added `type: bug`: +Depending on that reproduction, remove `status: in triage` and add the following label(s) in addition to the auto-added `type: bug`: - If the bug is valid and reproduction works: add `status: accepting prs` - If the bug might be valid but the reproduction isn't workable: @@ -244,14 +245,14 @@ Depending on that reproduction, add the following label(s) in addition to the au Documentation reports should clearly indicate a gap or problem that should be addressed in documentation. Triage documentation issues similar to bugs and/or feature requests - documentation is its own form of product area. -Keep the auto-added `area: documentation` label. +Remove `status: in triage` and keep the auto-added `area: documentation` label. ### 🚀 Features Feature requests should include a compelling reason why we should spend the maintenance time on the feature. Given that Mocha is prioritizing stability over growth, this can be a high bar. -Depending on the reasoning, add the following label(s) in addition to the auto-added `type: feature`: +Depending on the reasoning, remove `status: in triage` and add the following label(s) in addition to the auto-added `type: feature`: - If the reasoning is valid and seems worth the maintenance cost: add `status: accepting prs` - If the reasoning is unclear: @@ -268,12 +269,12 @@ Depending on the reasoning, add the following label(s) in addition to the auto-a Issues filed about improvements to Mocha's internal development processes. These can be more informally discussed by maintainers. -Keep the auto-added `area: repository tooling`. +Remove `status: in triage` and keep the auto-added `area: repository tooling`. ### ❓ Questions Our issue tracker is not the right place to ask questions. -If an issue is filed that seems like it's more of a question, add the `type: question` label, politely direct the user to the [❓ Got a Question?](./.github/CONTRIBUTING.md#❓-got-a-question) section, and close the issue as not planned. +If an issue is filed that seems like it's more of a question, remove `status: in triage`, add the `type: question` label, politely direct the user to the [❓ Got a Question?](./.github/CONTRIBUTING.md#❓-got-a-question) section, and close the issue as not planned. If it's _not_ a Mocha problem (people tend not to believe this), you may want to show a counter-example. It's often helpful to direct the issue author to the responsible project, if you can determine what that is. @@ -405,7 +406,6 @@ _It's easier to release often._ 1. Back in your working copy, run `npm publish`. _If you're doing a prerelease, ensure that you use `--tag=next`._ 1. Announce the update on Twitter or just tell your dog or something. - New releases will be automatically tweeted by [@b0neskull](https://twitter.com/b0neskull) via a feed subscription to Mocha's "releases" page on GitHub. _Note: there are too many steps above._ diff --git a/docs/_includes/supporters.md b/docs/_includes/supporters.md index 9ee2b520fe..96d13eb5d9 100644 --- a/docs/_includes/supporters.md +++ b/docs/_includes/supporters.md @@ -6,7 +6,7 @@ Use Mocha at Work? Ask your manager or marketing team if they'd help [support](h {%- for supporter in supporters.sponsors -%}
  • {%- if supporter.website -%} - + {%- endif -%} {%- if supporter.website -%} @@ -24,7 +24,7 @@ Find Mocha helpful? Become a [backer](https://opencollective.com/mochajs#support {%- for supporter in supporters.backers -%}
  • {%- if supporter.website -%} - + {%- endif -%}
    {%- if supporter.website -%} diff --git a/docs/index.md b/docs/index.md index b6a70eba7c..a56b64adde 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2257,10 +2257,11 @@ Some shells support recursive matching by using the globstar (`**`) wildcard. Ba $ mocha "./spec/**/*.js" ``` -[You should _always_ quote your globs in npm scripts][article-globbing]. If you -use double quotes, it's the shell on UNIX that will expand the glob. On the -other hand, if you use single quotes, the [`node-glob`][npm-glob] module will -handle its expansion. +You should _always_ quote your globs in npm scripts. If you +use quotes, the [`node-glob`][npm-glob] module will +handle its expansion. For maximum compatibility, +surround the entire expression with double quotes and refrain +from `$`, `"`, `^`, and `\` within your expression. See this [tutorial][gist-globbing-tutorial] on using globs. @@ -2352,7 +2353,6 @@ For a running example of Mocha, view [example/tests.html](example/tests.html). F or the [source](https://github.com/mochajs/mocha/blob/master/lib/mocha.js). [//]: # 'Cross reference section' -[article-globbing]: https://medium.com/@jakubsynowiec/you-should-always-quote-your-globs-in-npm-scripts-621887a2a784 [bash-globbing]: https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html [better-assert]: https://github.com/visionmedia/better-assert [caniuse-notifications]: https://caniuse.com/#feat=notifications diff --git a/eslint.config.js b/eslint.config.js index 53e788ebed..88fdd14a81 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -12,7 +12,7 @@ module.exports = [ { ...js.configs.recommended, languageOptions: { - ecmaVersion: 2018, + ecmaVersion: 2020, globals: { ...globals.browser, ...globals.node diff --git a/lib/reporters/base.js b/lib/reporters/base.js index 40b5996461..e0ca5f4863 100644 --- a/lib/reporters/base.js +++ b/lib/reporters/base.js @@ -221,6 +221,56 @@ var generateDiff = (exports.generateDiff = function (actual, expected) { } }); +/** + * Traverses err.cause and returns all stack traces + * + * @private + * @param {Error} err + * @param {Set} [seen] + * @return {FullErrorStack} + */ +var getFullErrorStack = function (err, seen) { + if (seen && seen.has(err)) { + return { message: '', msg: '', stack: '' }; + } + + var message; + + if (typeof err.inspect === 'function') { + message = err.inspect() + ''; + } else if (err.message && typeof err.message.toString === 'function') { + message = err.message + ''; + } else { + message = ''; + } + + var msg; + var stack = err.stack || message; + var index = message ? stack.indexOf(message) : -1; + + if (index === -1) { + msg = message; + } else { + index += message.length; + msg = stack.slice(0, index); + // remove msg from stack + stack = stack.slice(index + 1); + + if (err.cause) { + seen = seen || new Set(); + seen.add(err); + const causeStack = getFullErrorStack(err.cause, seen) + stack += '\n Caused by: ' + causeStack.msg + (causeStack.stack ? '\n' + causeStack.stack : ''); + } + } + + return { + message, + msg, + stack + }; +}; + /** * Outputs the given `failures` as a list. * @@ -241,7 +291,6 @@ exports.list = function (failures) { color('error stack', '\n%s\n'); // msg - var msg; var err; if (test.err && test.err.multiple) { if (multipleTest !== test) { @@ -252,25 +301,8 @@ exports.list = function (failures) { } else { err = test.err; } - var message; - if (typeof err.inspect === 'function') { - message = err.inspect() + ''; - } else if (err.message && typeof err.message.toString === 'function') { - message = err.message + ''; - } else { - message = ''; - } - var stack = err.stack || message; - var index = message ? stack.indexOf(message) : -1; - if (index === -1) { - msg = message; - } else { - index += message.length; - msg = stack.slice(0, index); - // remove msg from stack - stack = stack.slice(index + 1); - } + var { message, msg, stack } = getFullErrorStack(err); // uncaught if (err.uncaught) { @@ -548,3 +580,12 @@ function sameType(a, b) { Base.consoleLog = consoleLog; Base.abstract = true; + +/** + * An object with all stack traces recursively mounted from each err.cause + * @memberof module:lib/reporters/base + * @typedef {Object} FullErrorStack + * @property {string} message + * @property {string} msg + * @property {string} stack + */ diff --git a/lib/reporters/xunit.js b/lib/reporters/xunit.js index ec788c5da0..4e6fe2bcf9 100644 --- a/lib/reporters/xunit.js +++ b/lib/reporters/xunit.js @@ -158,6 +158,7 @@ XUnit.prototype.test = function (test) { var attrs = { classname: test.parent.fullTitle(), name: test.title, + file: test.file, time: test.duration / 1000 || 0 }; diff --git a/lib/runner.js b/lib/runner.js index 12807725fb..60a19f0e3f 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -443,11 +443,22 @@ Runner.prototype.fail = function (test, err, force) { err = thrown2Error(err); } - try { - err.stack = - this.fullStackTrace || !err.stack ? err.stack : stackFilter(err.stack); - } catch (ignore) { - // some environments do not take kindly to monkeying with the stack + // Filter the stack traces + if (!this.fullStackTrace) { + const alreadyFiltered = new Set(); + let currentErr = err; + + while (currentErr && currentErr.stack && !alreadyFiltered.has(currentErr)) { + alreadyFiltered.add(currentErr); + + try { + currentErr.stack = stackFilter(currentErr.stack); + } catch (ignore) { + // some environments do not take kindly to monkeying with the stack + } + + currentErr = currentErr.cause; + } } this.emit(constants.EVENT_TEST_FAIL, test, err); diff --git a/package-scripts.js b/package-scripts.js index 6fb0594980..1e4c072973 100644 --- a/package-scripts.js +++ b/package-scripts.js @@ -259,7 +259,7 @@ module.exports = { docs: { default: { script: - 'nps docs.clean && nps docs.api && eleventy && nps docs.linkcheck && node scripts/netlify-headers.js docs/_site >> docs/_site/_headers', + 'nps docs.clean && nps docs.api && eleventy && nps docs.linkcheck', description: 'Build documentation' }, production: { @@ -277,7 +277,7 @@ module.exports = { }, postbuild: { script: - 'buildProduction docs/_site/index.html --outroot docs/_dist --canonicalroot https://mochajs.org/ --optimizeimages --svgo --inlinehtmlimage 9400 --inlinehtmlscript 0 --asyncscripts && cp docs/_headers docs/_dist/_headers && node scripts/netlify-headers.js docs/_dist >> docs/_dist/_headers', + 'node node_modules/assetgraph-builder/bin/buildProduction docs/_site/index.html --outroot docs/_dist --canonicalroot https://mochajs.org/ --optimizeimages --svgo --inlinehtmlimage 9400 --inlinehtmlscript 0 --asyncscripts && cp docs/_headers docs/_dist/_headers', description: 'Post-process docs after build', hiddenFromHelp: true }, diff --git a/scripts/netlify-headers.js b/scripts/netlify-headers.js deleted file mode 100644 index e881423d20..0000000000 --- a/scripts/netlify-headers.js +++ /dev/null @@ -1,126 +0,0 @@ -'use strict'; - -const AssetGraph = require('assetgraph'); - -const dest = process.argv[2]; - -if (!dest) { - console.error('usage: node netlify-headers.js '); - console.error('example: node netlify-headers.js docs/_dist'); - process.exit(1); -} - -const headers = ['Content-Security-Policy']; - -const resourceHintTypeMap = { - HtmlPreloadLink: 'preload', - HtmlPrefetchLink: 'prefetch', - HtmlPreconnectLink: 'preconnect', - HtmlDnsPrefetchLink: 'dns-prefetch' -}; - -function getHeaderForRelation(rel) { - let header = `Link: <${rel.href}>; rel=${resourceHintTypeMap[rel.type]}; as=${ - rel.as - }; type=${rel.to.contentType}`; - - if (rel.as === 'font') { - header = `${header}; crossorigin=anonymous`; - } - - return header; -} - -console.error('Generating optimal netlify headers...'); - -new AssetGraph({root: dest}) - .loadAssets('*.html') - .populate({ - followRelations: {type: 'HtmlAnchor', crossorigin: false} - }) - .queue(function (assetGraph) { - const assets = assetGraph.findAssets({ - type: 'Html', - isInline: false, - isLoaded: true - }); - - const headerMap = {}; - - assets.forEach(function (asset) { - const url = - '/' + - asset.url - .replace(assetGraph.root, '') - .replace(/#.*/, '') - .replace('index.html', ''); - if (!headerMap[url]) { - headerMap[url] = []; - } - - headers.forEach(function (header) { - const node = asset.parseTree.querySelector( - 'meta[http-equiv=' + header + ']' - ); - - if (node) { - headerMap[url].push(`${header}: ${node.getAttribute('content')}`); - - node.parentNode.removeChild(node); - asset.markDirty(); - } - }); - - const firstCssRel = asset.outgoingRelations.filter(r => { - return ( - r.type === 'HtmlStyle' && - r.crossorigin === false && - r.href !== undefined - ); - })[0]; - - if (firstCssRel) { - const header = `Link: <${firstCssRel.href}>; rel=preload; as=style`; - - headerMap[url].push(header); - } - - const resourceHintRelations = asset.outgoingRelations.filter(r => - ['HtmlPreloadLink', 'HtmlPrefetchLink'].includes(r.type) - ); - - resourceHintRelations.forEach(rel => { - headerMap[url].push(getHeaderForRelation(rel)); - - rel.detach(); - }); - - const preconnectRelations = asset.outgoingRelations.filter(r => - ['HtmlPreconnectLink'].includes(r.type) - ); - - preconnectRelations.forEach(rel => { - const header = `Link: <${rel.href}>; rel=preconnect`; - - headerMap[url].push(header); - - rel.detach(); - }); - }); - - console.log('\n## Autogenerated headers:\n'); - - Object.keys(headerMap).forEach(function (url) { - console.log(url); - - const httpHeaders = headerMap[url]; - - httpHeaders.forEach(function (header) { - console.log(` ${header}`); - }); - - console.log(''); - }); - console.error('netlify headers done!'); - }) - .run(); diff --git a/test/reporters/base.spec.js b/test/reporters/base.spec.js index 6b30b2ccc7..84778f3693 100644 --- a/test/reporters/base.spec.js +++ b/test/reporters/base.spec.js @@ -491,6 +491,108 @@ describe('Base reporter', function () { expect(errOut, 'to be', '1) test title:\n Error\n foo\n bar'); }); + describe('error causes', function () { + it('should append any error cause trail to stack traces', function () { + var err = { + message: 'Error', + stack: 'Error\nfoo\nbar', + showDiff: false, + cause: { + message: 'Cause1', + stack: 'Cause1\nbar\nfoo', + showDiff: false, + cause: { + message: 'Cause2', + stack: 'Cause2\nabc\nxyz', + showDiff: false + } + } + }; + var test = makeTest(err); + + list([test]); + + var errOut = stdout.join('\n').trim(); + expect( + errOut, + 'to be', + '1) test title:\n Error\n foo\n bar\n Caused by: Cause1\n bar\n foo\n Caused by: Cause2\n abc\n xyz' + ); + }); + + it('should not get stuck in a hypothetical circular error cause trail', function () { + var err1 = { + message: 'Error', + stack: 'Error\nfoo\nbar', + showDiff: false, + }; + var err2 = { + message: 'Cause1', + stack: 'Cause1\nbar\nfoo', + showDiff: false, + cause: err1 + } + err1.cause = err2; + + var test = makeTest(err1); + + list([test]); + + var errOut = stdout.join('\n').trim(); + expect( + errOut, + 'to be', + '1) test title:\n Error\n foo\n bar\n Caused by: Cause1\n bar\n foo\n Caused by: ' + ); + }); + + it("should set an empty cause if neither 'inspect' nor 'message' is set", function () { + var err = { + message: 'Error', + stack: 'Error\nfoo\nbar', + showDiff: false, + cause: { + showDiff: false, + } + }; + + var test = makeTest(err); + + list([test]); + + var errOut = stdout.join('\n').trim(); + expect( + errOut, + 'to be', + '1) test title:\n Error\n foo\n bar\n Caused by:' + ); + }); + + it('should not add cause trail if error does not contain message', function () { + var err = { + message: 'Error', + stack: 'foo\nbar', + showDiff: false, + cause: { + message: 'Cause1', + stack: 'Cause1\nbar\nfoo', + showDiff: false, + cause: { + message: 'Cause2', + stack: 'Cause2\nabc\nxyz', + showDiff: false + } + } + }; + var test = makeTest(err); + + list([test]); + + var errOut = stdout.join('\n').trim(); + expect(errOut, 'to be', '1) test title:\n Error\n foo\n bar'); + }); + }); + it('should list multiple Errors per test', function () { var err = new Error('First Error'); err.multiple = [new Error('Second Error - same test')]; diff --git a/test/reporters/xunit.spec.js b/test/reporters/xunit.spec.js index a5e0f1bbeb..4e98cf6002 100644 --- a/test/reporters/xunit.spec.js +++ b/test/reporters/xunit.spec.js @@ -30,6 +30,7 @@ describe('XUnit reporter', function () { var expectedLine = 'some-line'; var expectedClassName = 'fullTitle'; var expectedTitle = 'some title'; + var expectedFile = 'testFile.spec.js'; var expectedMessage = 'some message'; var expectedDiff = '\n + expected - actual\n\n -foo\n +bar\n '; @@ -325,6 +326,7 @@ describe('XUnit reporter', function () { var expectedTest = { state: STATE_FAILED, title: expectedTitle, + file: expectedFile, parent: { fullTitle: function () { return expectedClassName; @@ -347,6 +349,8 @@ describe('XUnit reporter', function () { expectedClassName + '" name="' + expectedTitle + + '" file="' + + expectedFile + '" time="1">' + expectedMessage + '\n' + @@ -365,6 +369,7 @@ describe('XUnit reporter', function () { var expectedTest = { state: STATE_FAILED, title: expectedTitle, + file: expectedFile, parent: { fullTitle: function () { return expectedClassName; @@ -402,6 +407,7 @@ describe('XUnit reporter', function () { return true; }, title: expectedTitle, + file: expectedFile, parent: { fullTitle: function () { return expectedClassName; @@ -418,6 +424,8 @@ describe('XUnit reporter', function () { expectedClassName + '" name="' + expectedTitle + + '" file="' + + expectedFile + '" time="1">'; expect(expectedWrite, 'to be', expectedTag); }); @@ -431,6 +439,7 @@ describe('XUnit reporter', function () { return false; }, title: expectedTitle, + file: expectedFile, parent: { fullTitle: function () { return expectedClassName; @@ -447,6 +456,8 @@ describe('XUnit reporter', function () { expectedClassName + '" name="' + expectedTitle + + '" file="' + + expectedFile + '" time="0"/>'; expect(expectedWrite, 'to be', expectedTag); }); diff --git a/test/unit/runner.spec.js b/test/unit/runner.spec.js index dd96558017..66ca6a0532 100644 --- a/test/unit/runner.spec.js +++ b/test/unit/runner.spec.js @@ -629,6 +629,22 @@ describe('Runner', function () { }); runner.fail(hook, err); }); + + it('should prettify stack-traces in error cause trail', function (done) { + var hook = new Hook(); + hook.parent = suite; + var causeErr = new Error(); + // Fake stack-trace + causeErr.stack = stack.join('\n'); + var err = new Error(); + err.cause = causeErr; + + runner.on(EVENT_TEST_FAIL, function (_hook, _err) { + expect(_err.cause.stack, 'to be', stack.slice(0, 3).join('\n')); + done(); + }); + runner.fail(hook, err); + }); }); describe('long', function () { @@ -647,6 +663,24 @@ describe('Runner', function () { }); runner.fail(hook, err); }); + + it('should display full stack-traces in error cause trail', function (done) { + var hook = new Hook(); + hook.parent = suite; + var causeErr = new Error(); + // Fake stack-trace + causeErr.stack = stack.join('\n'); + var err = new Error(); + err.cause = causeErr; + // Add --stack-trace option + runner.fullStackTrace = true; + + runner.on(EVENT_TEST_FAIL, function (_hook, _err) { + expect(_err.cause.stack, 'to be', stack.join('\n')); + done(); + }); + runner.fail(hook, err); + }); }); describe('ginormous', function () {