diff --git a/.github/release-please/manifest.json b/.github/release-please/manifest.json index f93a931188..0ba0782ac5 100644 --- a/.github/release-please/manifest.json +++ b/.github/release-please/manifest.json @@ -1 +1 @@ -{".":"10.7.3"} +{".":"10.8.1"} diff --git a/.github/workflows/nightly-site-deploy.yml b/.github/workflows/nightly-site-deploy.yml index f81d2fc814..80f1118d01 100644 --- a/.github/workflows/nightly-site-deploy.yml +++ b/.github/workflows/nightly-site-deploy.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Webhook Action - uses: joelwmale/webhook-action@448a17bf857ead98546cfbdbe3b9d4cf979dda95 + uses: joelwmale/webhook-action@cc1a66f987e1591785273fd6f9d2f7a9d8d7c9cd env: data: '' WEBHOOK_URL: ${{ secrets.NETLIFY_NIGHTLY_DEPLOY_URL }} diff --git a/CHANGELOG.md b/CHANGELOG.md index ee8b6be8dd..f45fe6d6f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,39 @@ # Changelog +## [10.8.1](https://github.com/mochajs/mocha/compare/v10.8.0...v10.8.1) (2024-10-29) + + +### ๐Ÿฉน Fixes + +* handle case of invalid package.json with no explicit config ([#5198](https://github.com/mochajs/mocha/issues/5198)) ([f72bc17](https://github.com/mochajs/mocha/commit/f72bc17cb44164bcfff7abc83d0d37d99a061104)) +* Typos on mochajs.org ([#5237](https://github.com/mochajs/mocha/issues/5237)) ([d8ca270](https://github.com/mochajs/mocha/commit/d8ca270a960554c9d5c5fbf264e89d668d01ff0d)) +* use accurate test links in HTML reporter ([#5228](https://github.com/mochajs/mocha/issues/5228)) ([68803b6](https://github.com/mochajs/mocha/commit/68803b685d55dcccc51fa6ccfd27701cda4e26ed)) + +## [10.8.0](https://github.com/mochajs/mocha/compare/v10.7.3...v10.8.0) (2024-10-29) + + +### ๐ŸŒŸ Features + +* highlight browser failures ([#5222](https://github.com/mochajs/mocha/issues/5222)) ([8ff4845](https://github.com/mochajs/mocha/commit/8ff48453a8b12d9cacf56b0c0c544c8256af64c7)) + + +### ๐Ÿฉน Fixes + +* remove `:is()` from `mocha.css` to support older browsers ([#5225](https://github.com/mochajs/mocha/issues/5225)) ([#5227](https://github.com/mochajs/mocha/issues/5227)) ([0a24b58](https://github.com/mochajs/mocha/commit/0a24b58477ea8ad146afc798930800b02c08790a)) + + +### ๐Ÿ“š Documentation + +* add `SECURITY.md` pointing to Tidelift ([#5210](https://github.com/mochajs/mocha/issues/5210)) ([bd7e63a](https://github.com/mochajs/mocha/commit/bd7e63a1f6d98535ce1ed1ecdb57b3e4db8a33c5)) +* adopt Collective Funds Guidelines 0.1 ([#5199](https://github.com/mochajs/mocha/issues/5199)) ([2b03d86](https://github.com/mochajs/mocha/commit/2b03d865eec63d627ff229e07d777f25061260d4)) +* update README, LICENSE and fix outdated ([#5197](https://github.com/mochajs/mocha/issues/5197)) ([1203e0e](https://github.com/mochajs/mocha/commit/1203e0ed739bbbf12166078738357fdb29a8c000)) + + +### ๐Ÿงน Chores + +* fix npm scripts on windows ([#5219](https://github.com/mochajs/mocha/issues/5219)) ([1173da0](https://github.com/mochajs/mocha/commit/1173da0bf614e8d2a826687802ee8cbe8671ccf1)) +* remove trailing whitespace in SECURITY.md ([7563e59](https://github.com/mochajs/mocha/commit/7563e59ae3c78ada305d26eadb86998ab54342da)) + ## [10.7.3](https://github.com/mochajs/mocha/compare/v10.7.2...v10.7.3) (2024-08-09) diff --git a/docs/index.md b/docs/index.md index cf6010364f..fee4adab0f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1181,7 +1181,7 @@ Cause Mocha to only run tests matching the given `regexp`, which is internally c Suppose, for example, you have "api" related tests, as well as "app" related tests, as shown in the following snippet; One could use `--grep api` or `--grep app` to run one or the other. The same goes for any other part of a suite or test-case title, `--grep users` would be valid as well, or even `--grep GET`. And another option with double quotes: `--grep "groupA|groupB"`.
-And for more complex criterias: `--grep "/get/i"`. Some shells as e.g. Git-Bash-for-Windows may require: `--grep "'/get/i'"`. Using flags other than the `ignoreCase /i` (especially `/g` and `/y`) may lead to unpredictable results. +And for more complex criteria: `--grep "/get/i"`. Some shells as e.g. Git-Bash-for-Windows may require: `--grep "'/get/i'"`. Using flags other than the `ignoreCase /i` (especially `/g` and `/y`) may lead to unpredictable results. ```js describe('api', function () { @@ -2259,7 +2259,7 @@ Mocha will also _merge_ any options found in `package.json` into its run-time co 1. Configuration file (`.mocharc.js`, `.mocharc.yml`, etc.) 1. `mocha` property of `package.json` -Options which can safely be repeated (e.g., `--require`) will be _concatenated_, with higher-priorty configuration sources appearing earlier in the list. For example, a `.mocharc.json` containing `"require": "bar"`, coupled with execution of `mocha --require foo`, would cause Mocha to require `foo`, then `bar`, in that order. +Options which can safely be repeated (e.g., `--require`) will be _concatenated_, with higher-priority configuration sources appearing earlier in the list. For example, a `.mocharc.json` containing `"require": "bar"`, coupled with execution of `mocha --require foo`, would cause Mocha to require `foo`, then `bar`, in that order. ### Extending Configuration @@ -2445,7 +2445,7 @@ or the [source](https://github.com/mochajs/mocha/blob/main/lib/mocha.js). [qunit]: https://qunitjs.com/ [selenium-webdriver-testing]: https://github.com/SeleniumHQ/selenium/blob/c10e8a955883f004452cdde18096d70738397788/javascript/node/selenium-webdriver/testing/index.js [should.js]: https://github.com/shouldjs/should.js -[superagent-docs-test]: https://visionmedia.github.io/superagent/docs/test.html +[superagent-docs-test]: https://ladjs.github.io/superagent/docs/test.html [superagent-makefile]: https://github.com/visionmedia/superagent/blob/master/Makefile [test-anything-protocol]: https://en.wikipedia.org/wiki/Test_Anything_Protocol [textmate-mocha]: https://github.com/mochajs/mocha.tmbundle diff --git a/lib/cli/options.js b/lib/cli/options.js index d238737d37..fc0c951a8c 100644 --- a/lib/cli/options.js +++ b/lib/cli/options.js @@ -181,8 +181,24 @@ const loadPkgRc = (args = {}) => { result = {}; const filepath = args.package || findUp.sync(mocharc.package); if (filepath) { + let configData; try { - const pkg = JSON.parse(fs.readFileSync(filepath, 'utf8')); + configData = fs.readFileSync(filepath, 'utf8'); + } catch (err) { + // If `args.package` was explicitly specified, throw an error + if (filepath == args.package) { + throw createUnparsableFileError( + `Unable to read ${filepath}: ${err}`, + filepath + ); + } else { + debug('failed to read default package.json at %s; ignoring', + filepath); + return result; + } + } + try { + const pkg = JSON.parse(configData); if (pkg.mocha) { debug('`mocha` prop of package.json parsed: %O', pkg.mocha); result = pkg.mocha; @@ -190,13 +206,11 @@ const loadPkgRc = (args = {}) => { debug('no config found in %s', filepath); } } catch (err) { - if (args.package) { - throw createUnparsableFileError( - `Unable to read/parse ${filepath}: ${err}`, - filepath - ); - } - debug('failed to read default package.json at %s; ignoring', filepath); + // If JSON failed to parse, throw an error. + throw createUnparsableFileError( + `Unable to parse ${filepath}: ${err}`, + filepath + ); } } return result; diff --git a/lib/nodejs/serializer.js b/lib/nodejs/serializer.js index 63e1a24e51..a8ed8dfb83 100644 --- a/lib/nodejs/serializer.js +++ b/lib/nodejs/serializer.js @@ -262,9 +262,15 @@ class SerializableEvent { breakCircularDeps(result.error); const pairs = Object.keys(result).map(key => [result, key]); - + const seenPairs = new Set(); let pair; + while ((pair = pairs.shift())) { + if (seenPairs.has(pair[1])) { + continue; + } + + seenPairs.add(pair[1]); SerializableEvent._serialize(pairs, ...pair); } diff --git a/lib/reporters/html.js b/lib/reporters/html.js index ae4a4546f8..5f57279ec2 100644 --- a/lib/reporters/html.js +++ b/lib/reporters/html.js @@ -32,11 +32,12 @@ var Date = global.Date; exports = module.exports = HTML; /** - * Stats template. + * Stats template: Result, progress, passes, failures, and duration. */ var statsTemplate = '