From 59f321f95a0d0f37cb262dd716a36027a0b1312e Mon Sep 17 00:00:00 2001 From: SuperSodaSea Date: Sat, 4 Feb 2023 00:18:00 +0800 Subject: [PATCH 1/5] chore: Cleanup incorrect URLs in CHANGELOG.md --- CHANGELOG.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fa90977d331..dd21b0247e60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -294,7 +294,7 @@ ### Fixes -- `[@jest/expect-utils]` Fix deep equality of ImmutableJS OrderedMaps ([#12763](https://github.com/facebook/jest/pull/12899)) +- `[@jest/expect-utils]` Fix deep equality of ImmutableJS OrderedMaps ([#12899](https://github.com/facebook/jest/pull/12899)) - `[jest-docblock]` Handle multiline comments in parseWithComments ([#12845](https://github.com/facebook/jest/pull/12845)) - `[jest-mock]` Improve `spyOn` error messages ([#12901](https://github.com/facebook/jest/pull/12901)) - `[jest-runtime]` Correctly report V8 coverage with `resetModules: true` ([#12912](https://github.com/facebook/jest/pull/12912)) @@ -772,7 +772,7 @@ ### Features -- `[@jest/fake-timers]` Flush callbacks scheduled with `requestAnimationFrame` every 16ms when using legacy timers. ([#11523](https://github.com/facebook/jest/pull/11567)) +- `[@jest/fake-timers]` Flush callbacks scheduled with `requestAnimationFrame` every 16ms when using legacy timers. ([#11567](https://github.com/facebook/jest/pull/11567)) - `[pretty-format]` Use `globalThis` (with polyfill if required) to bring support for esbuild's browser bundling mode ([#11569](https://github.com/facebook/jest/pull/11569)) ### Fixes @@ -859,7 +859,7 @@ - `[jest-runtime]` Detect reexports from CJS as named exports in ESM ([#10988](https://github.com/facebook/jest/pull/10988)) - `[jest-runtime]` Support for async code transformations ([#11191](https://github.com/facebook/jest/pull/11191) & [#11220](https://github.com/facebook/jest/pull/11220)) - `[jest-snapshot]` [**BREAKING**] Make prettier optional for inline snapshots - fall back to string replacement ([#7792](https://github.com/facebook/jest/pull/7792) & [#11192](https://github.com/facebook/jest/pull/11192)) -- `[jest-snapshot]` [**BREAKING**] Run transforms over `snapshotResolver` ([#8751](https://github.com/facebook/jest/pull/8829)) +- `[jest-snapshot]` [**BREAKING**] Run transforms over `snapshotResolver` ([#8829](https://github.com/facebook/jest/pull/8829)) - `[jest-transform]` Pass config options defined in Jest's config to transformer's `process` and `getCacheKey` functions ([#10926](https://github.com/facebook/jest/pull/10926)) - `[jest-transform]` Add support for transformers written in ESM ([#11163](https://github.com/facebook/jest/pull/11163)) - `[jest-transform]` [**BREAKING**] Do not export `ScriptTransformer` class, instead export the async function `createScriptTransformer` ([#11163](https://github.com/facebook/jest/pull/11163)) @@ -1107,7 +1107,7 @@ - `[jest-core]` Don't report ELDHistogram as open handle ([#10417](https://github.com/facebook/jest/pull/10417)) - `[jest-matcher-utils]` Fix diffing object contain readonly symbol key object ([#10414](https://github.com/facebook/jest/pull/10414)) -- `[jest-reporters]` Fixes notify reporter on Linux (using notify-send) ([#10393](https://github.com/facebook/jest/pull/10400)) +- `[jest-reporters]` Fixes notify reporter on Linux (using notify-send) ([#10400](https://github.com/facebook/jest/pull/10400)) - `[jest-snapshot]` Correctly handles arrays and property matchers in snapshots ([#10404](https://github.com/facebook/jest/pull/10404)) ## 26.4.0 @@ -1156,7 +1156,7 @@ - `[jest-haste-map]` Watchman crawler now includes dotfiles ([#10075](https://github.com/facebook/jest/pull/10075)) - `[jest-worker]` Added support for workers to send custom messages to parent in jest-worker ([#10293](https://github.com/facebook/jest/pull/10293)) - `[jest-worker]` Support passing `resourceLimits` ([#10335](https://github.com/facebook/jest/pull/10335)) -- `[pretty-format]` Added support for serializing custom elements (web components) ([#10217](https://github.com/facebook/jest/pull/10237)) +- `[pretty-format]` Added support for serializing custom elements (web components) ([#10237](https://github.com/facebook/jest/pull/10237)) ### Fixes @@ -1573,7 +1573,7 @@ - `[expect]` Display equal values for ReturnedWith similar to CalledWith ([#8791](https://github.com/facebook/jest/pull/8791)) - `[expect, jest-snapshot]` Change color from green for some args in matcher hints ([#8812](https://github.com/facebook/jest/pull/8812)) - `[jest-snapshot]` Highlight substring differences when matcher fails, part 3 ([#8569](https://github.com/facebook/jest/pull/8569)) -- `[jest-core]` Improve report when snapshots are obsolete ([#8448](https://github.com/facebook/jest/pull/8665)) +- `[jest-core]` Improve report when snapshots are obsolete ([#8665](https://github.com/facebook/jest/pull/8665)) - `[jest-cli]` Improve chai support (with detailed output, to match jest exceptions) ([#8454](https://github.com/facebook/jest/pull/8454)) - `[*]` Manage the global timeout with `--testTimeout` command line argument. ([#8456](https://github.com/facebook/jest/pull/8456)) - `[pretty-format]` Render custom displayName of memoized components ([#8546](https://github.com/facebook/jest/pull/8546)) @@ -1862,7 +1862,7 @@ We skipped 24.2.0 because a draft was accidentally published. Please use `24.3.0 - `[jest-docblock]`: Migrate to TypeScript ([#7836](https://github.com/facebook/jest/pull/7836)) - `[jest-each]`: Migrate to Typescript ([#8007](https://github.com/facebook/jest/pull/8007)) - `[jest-each]`: Refactor into multiple files with better types ([#8018](https://github.com/facebook/jest/pull/8018)) -- `[jest-environment-jsdom]`: Migrate to TypeScript ([#7985](https://github.com/facebook/jest/pull/8003)) +- `[jest-environment-jsdom]`: Migrate to TypeScript ([#8003](https://github.com/facebook/jest/pull/8003)) - `[jest-environment-node]`: Migrate to TypeScript ([#7985](https://github.com/facebook/jest/pull/7985)) - `[jest-get-type]`: Migrate to TypeScript ([#7818](https://github.com/facebook/jest/pull/7818)) - `[jest-haste-map]`: Migrate to TypeScript ([#7854](https://github.com/facebook/jest/pull/7854), [#7951](https://github.com/facebook/jest/pull/7951)) @@ -1885,7 +1885,7 @@ We skipped 24.2.0 because a draft was accidentally published. Please use `24.3.0 - `[jest-watcher]`: Migrate to TypeScript ([#7843](https://github.com/facebook/jest/pull/7843)) - `[jest-worker]`: Migrate to TypeScript ([#7853](https://github.com/facebook/jest/pull/7853)) - `[jest]`: Migrate to TypeScript ([#8024](https://github.com/facebook/jest/pull/8024)) -- `[pretty-format]`: Migrate to TypeScript ([#7809](https://github.com/facebook/jest/pull/7809), [#7809](https://github.com/facebook/jest/pull/7972)) +- `[pretty-format]`: Migrate to TypeScript ([#7809](https://github.com/facebook/jest/pull/7809), [#7972](https://github.com/facebook/jest/pull/7972)) ### Performance @@ -2179,7 +2179,7 @@ We skipped 24.2.0 because a draft was accidentally published. Please use `24.3.0 - `[jest-jasmine2]` Use prettier through `require` instead of `localRequire`. Fixes `matchInlineSnapshot` where prettier dependencies like `path` and `fs` are mocked with `jest.mock`. ([#6776](https://github.com/facebook/jest/pull/6776)) - `[docs]` Fix contributors link ([#6711](https://github.com/facebook/jest/pull/6711)) - `[website]` Fix website versions page to link to correct language ([#6734](https://github.com/facebook/jest/pull/6734)) -- `[expect]` Update `toContain` suggestion to contain equal message ([#6792](https://github.com/facebook/jest/pull/6810)) +- `[expect]` Update `toContain` suggestion to contain equal message ([#6810](https://github.com/facebook/jest/pull/6810)) ## 23.4.1 @@ -2320,7 +2320,7 @@ We skipped 24.2.0 because a draft was accidentally published. Please use `24.3.0 - `[jest-runtime]` Prevent modules from marking themselves as their own parent ([#5235](https://github.com/facebook/jest/issues/5235)) - `[jest-mock]` Add support for auto-mocking generator functions ([#5983](https://github.com/facebook/jest/pull/5983)) - `[expect]` Add support for async matchers ([#5919](https://github.com/facebook/jest/pull/5919)) -- `[expect]` Suggest toContainEqual ([#5948](https://github.com/facebook/jest/pull/5953)) +- `[expect]` Suggest toContainEqual ([#5953](https://github.com/facebook/jest/pull/5953)) - `[jest-config]` Export Jest's default options ([#5948](https://github.com/facebook/jest/pull/5948)) - `[jest-editor-support]` Move `coverage` to `ProjectWorkspace.collectCoverage` ([#5929](https://github.com/facebook/jest/pull/5929)) - `[jest-editor-support]` Add `coverage` option to runner ([#5836](https://github.com/facebook/jest/pull/5836)) @@ -2398,7 +2398,7 @@ We skipped 24.2.0 because a draft was accidentally published. Please use `24.3.0 - `[docs]` Add explanation on how to mock methods not implemented in JSDOM - `[jest-jasmine2]` Simplify `Env.execute` and TreeProcessor to setup and clean resources for the top suite the same way as for all of the children suites ([#5885](https://github.com/facebook/jest/pull/5885)) - `[babel-jest]` [**BREAKING**] Always return object from transformer ([#5991](https://github.com/facebook/jest/pull/5991)) -- `[*]` Run Prettier on compiled output ([#5858](https://github.com/facebook/jest/pull/3497)) +- `[*]` Run Prettier on compiled output ([#5858](https://github.com/facebook/jest/pull/5858)) - `[jest-cli]` Add fileChange hook for plugins ([#5708](https://github.com/facebook/jest/pull/5708)) - `[docs]` Add docs on using `jest.mock(...)` ([#5648](https://github.com/facebook/jest/pull/5648)) - `[docs]` Mention Jest Puppeteer Preset ([#5722](https://github.com/facebook/jest/pull/5722)) @@ -2484,7 +2484,7 @@ We skipped 24.2.0 because a draft was accidentally published. Please use `24.3.0 ### Fixes - `[babel-jest]` Revert "Remove retainLines from babel-jest" ([#5496](https://github.com/facebook/jest/pull/5496)) -- `[jest-docblock]` Support multiple of the same `@pragma`. ([#5154](https://github.com/facebook/jest/pull/5502)) +- `[jest-docblock]` Support multiple of the same `@pragma`. ([#5502](https://github.com/facebook/jest/pull/5502)) ### Features @@ -2668,7 +2668,7 @@ We skipped 24.2.0 because a draft was accidentally published. Please use `24.3.0 - `[pretty-format]` Fix errors when identity-obj-proxy mocks CSS Modules ([#4935](https://github.com/facebook/jest/pull/4935)) - `[babel-jest]` Fix support for namespaced babel version 7 ([#4918](https://github.com/facebook/jest/pull/4918)) - `[expect]` fix .toThrow for promises ([#4884](https://github.com/facebook/jest/pull/4884)) -- `[jest-docblock]` pragmas should preserve urls ([#4837](https://github.com/facebook/jest/pull/4629)) +- `[jest-docblock]` pragmas should preserve urls ([#4837](https://github.com/facebook/jest/pull/4837)) - `[jest-cli]` Check if `npm_lifecycle_script` calls Jest directly ([#4629](https://github.com/facebook/jest/pull/4629)) - `[jest-cli]` Fix --showConfig to show all configs ([#4494](https://github.com/facebook/jest/pull/4494)) - `[jest-cli]` Throw if `maxWorkers` doesn't have a value ([#4591](https://github.com/facebook/jest/pull/4591)) From 61a29356ea6cebfd4ebdc2f4253c3e0bfd1452c7 Mon Sep 17 00:00:00 2001 From: SuperSodaSea Date: Sat, 4 Feb 2023 00:33:47 +0800 Subject: [PATCH 2/5] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd21b0247e60..ad83eacde6e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ### Chore & Maintenance - `[*]` make sure to exclude `.eslintcache` from published module ([#13832](https://github.com/facebook/jest/pull/13832)) +- `[docs]` Cleanup incorrect URLs in CHANGELOG.md ([#13857](https://github.com/facebook/jest/pull/13857)) ### Performance From d5dfee05f60782a1e90b2d1dba21ba3c19df9b52 Mon Sep 17 00:00:00 2001 From: SuperSodaSea Date: Sat, 4 Feb 2023 01:56:08 +0800 Subject: [PATCH 3/5] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad83eacde6e1..ff0bd2ebfba1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ ### Chore & Maintenance - `[*]` make sure to exclude `.eslintcache` from published module ([#13832](https://github.com/facebook/jest/pull/13832)) -- `[docs]` Cleanup incorrect URLs in CHANGELOG.md ([#13857](https://github.com/facebook/jest/pull/13857)) +- `[docs]` Cleanup incorrect links in CHANGELOG.md ([#13857](https://github.com/facebook/jest/pull/13857)) ### Performance From 778f8652b82eb42f09be13e0e906f84b68344cc7 Mon Sep 17 00:00:00 2001 From: SuperSodaSea Date: Sun, 5 Feb 2023 20:49:51 +0800 Subject: [PATCH 4/5] Add check-changelog --- .github/workflows/nodejs.yml | 2 ++ package.json | 1 + scripts/checkChangelog.mjs | 31 +++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 scripts/checkChangelog.mjs diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index b9111207f03a..39abe409fe23 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -82,6 +82,8 @@ jobs: run: yarn lint - name: run prettier run: yarn lint:prettier:ci + - name: check changelog + run: yarn check-changelog - name: check copyright headers run: yarn check-copyright-headers diff --git a/package.json b/package.json index 8caee36a19c3..bf5568503c6e 100644 --- a/package.json +++ b/package.json @@ -89,6 +89,7 @@ "build:js": "node ./scripts/build.mjs", "build:ts": "node ./scripts/buildTs.mjs", "bundle:ts": "node ./scripts/bundleTs.mjs", + "check-changelog": "node ./scripts/checkChangelog.mjs", "check-copyright-headers": "node ./scripts/checkCopyrightHeaders.mjs", "clean-all": "yarn clean-e2e && yarn build-clean && rimraf './packages/*/node_modules' && rimraf './node_modules'", "clean-e2e": "node ./scripts/cleanE2e.mjs", diff --git a/scripts/checkChangelog.mjs b/scripts/checkChangelog.mjs new file mode 100644 index 000000000000..670f61b3c77a --- /dev/null +++ b/scripts/checkChangelog.mjs @@ -0,0 +1,31 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import fs from 'graceful-fs'; + +const linkRegex = + /\[#(\d+)\]\(https:\/\/github.com\/facebook\/jest\/(issues|pull)\/(\d+)\)/g; + +const changelogPath = 'CHANGELOG.md'; +const data = fs.readFileSync(changelogPath, 'utf-8'); + +let error = false; +let lineNumber = 1; +for (const line of data.split('\n')) { + for (const match of line.matchAll(linkRegex)) + if (match[1] !== match[3]) { + const column = match.index + 1; + console.error( + `${changelogPath}:${lineNumber}:${column}: error: ` + + `Link is incorrect: ${match[0]}`, + ); + error = true; + } + ++lineNumber; +} + +process.exit(+error); From c6e8dcc603ac8dcfef54b61bc9691539f7a21786 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Sun, 5 Feb 2023 14:00:16 +0100 Subject: [PATCH 5/5] Update scripts/checkChangelog.mjs --- scripts/checkChangelog.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkChangelog.mjs b/scripts/checkChangelog.mjs index 670f61b3c77a..85cc6d0119b7 100644 --- a/scripts/checkChangelog.mjs +++ b/scripts/checkChangelog.mjs @@ -28,4 +28,4 @@ for (const line of data.split('\n')) { ++lineNumber; } -process.exit(+error); +process.exit(error ? 1 : 0);