mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 10:04:50 +00:00
* chore(deps): bump the npm-minor-and-patch group across 2 directories with 38 updates Bumps the npm-minor-and-patch group with 37 updates in the / directory: | Package | From | To | | --- | --- | --- | | [@babel/parser](https://github.com/babel/babel/tree/HEAD/packages/babel-parser) | `8.0.4` | `8.1.2` | | [@babel/types](https://github.com/babel/babel/tree/HEAD/packages/babel-types) | `8.0.4` | `8.1.2` | | [@bufbuild/protobuf](https://github.com/bufbuild/protobuf-es/tree/HEAD/packages/protobuf) | `2.16.0` | `2.17.0` | | [@clack/prompts](https://github.com/bombshell-dev/clack/tree/HEAD/packages/prompts) | `1.7.0` | `1.9.0` | | [@zip.js/zip.js](https://github.com/gildas-lormeau/zip.js) | `2.15.0` | `2.25.0` | | [evmole](https://github.com/cdump/evmole/tree/HEAD/javascript) | `0.9.3` | `0.9.4` | | [ignore](https://github.com/kaelzhang/node-ignore) | `7.0.6` | `7.0.14` | | [isomorphic-git](https://github.com/isomorphic-git/isomorphic-git) | `1.38.7` | `1.44.15` | | [lossless-json](https://github.com/josdejong/lossless-json) | `4.3.1` | `4.3.3` | | [parse5](https://github.com/inikulin/parse5) | `8.0.1` | `8.1.1` | | [playwright-core](https://github.com/microsoft/playwright) | `1.64.1` | `1.65.1` | | [plist](https://github.com/TooTallNate/plist.js) | `5.0.0` | `5.1.1` | | [semver](https://github.com/npm/node-semver) | `7.8.5` | `7.8.6` | | [@types/semver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/semver) | `7.7.1` | `7.8.0` | | [smol-toml](https://github.com/squirrelchat/smol-toml) | `1.9.0` | `1.9.1` | | [stream-chain](https://github.com/uhop/stream-chain) | `4.2.6` | `4.4.2` | | [stream-json](https://github.com/uhop/stream-json) | `3.7.0` | `3.9.0` | | [ws](https://github.com/websockets/ws) | `8.21.0` | `8.23.0` | | [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) | `8.18.1` | `8.18.2` | | [yaml](https://github.com/eemeli/yaml) | `2.9.0` | `2.9.1` | | [zod](https://github.com/colinhacks/zod) | `4.6.6` | `4.6.7` | | [@electron/asar](https://github.com/electron/asar) | `4.2.0` | `4.3.2` | | [@stryker-mutator/core](https://github.com/stryker-mutator/stryker-js/tree/HEAD/packages/core) | `10.0.0` | `10.1.1` | | [@stryker-mutator/typescript-checker](https://github.com/stryker-mutator/stryker-js/tree/HEAD/packages/typescript-checker) | `10.0.0` | `10.1.1` | | [@stryker-mutator/vitest-runner](https://github.com/stryker-mutator/stryker-js/tree/HEAD/packages/vitest-runner) | `10.0.0` | `10.1.1` | | [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `26.6.4` | `26.6.6` | | [@types/semver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/semver) | `7.7.1` | `7.8.0` | | [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) | `8.18.1` | `8.18.2` | | [@vitest/coverage-v8](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8) | `5.0.3` | `5.1.0` | | [jscpd](https://github.com/kucherenko/jscpd/tree/HEAD/rust/jscpd) | `5.0.12` | `5.4.3` | | [knip](https://github.com/webpro-nl/knip/tree/HEAD/packages/knip) | `6.39.0` | `6.45.1` | | [oxfmt](https://github.com/oxc-project/oxc/tree/HEAD/npm/oxfmt) | `0.72.0` | `0.79.0` | | [oxlint](https://github.com/oxc-project/oxc/tree/HEAD/npm/oxlint) | `1.87.0` | `1.94.0` | | [oxlint-tsgolint](https://github.com/oxc-project/tsgolint) | `7.0.2005` | `7.0.2007` | | [release-please](https://github.com/googleapis/release-please) | `17.3.0` | `17.11.2` | | [rolldown](https://github.com/rolldown/rolldown/tree/HEAD/packages/rolldown) | `1.2.12` | `1.3.2` | | [turbo](https://github.com/vercel/turborepo) | `2.11.7` | `2.11.11` | | [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) | `5.0.3` | `5.1.0` | | [frida](https://github.com/frida/frida-node) | `17.23.2` | `17.26.4` | Bumps the npm-minor-and-patch group with 1 update in the /scripts/verify-tools/skills directory: [skills](https://github.com/vercel-labs/skills). Updates `@babel/parser` from 8.0.4 to 8.1.2 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v8.1.2/packages/babel-parser) Updates `@babel/types` from 8.0.4 to 8.1.2 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v8.1.2/packages/babel-types) Updates `@bufbuild/protobuf` from 2.16.0 to 2.17.0 - [Release notes](https://github.com/bufbuild/protobuf-es/releases) - [Commits](https://github.com/bufbuild/protobuf-es/commits/v2.17.0/packages/protobuf) Updates `@clack/prompts` from 1.7.0 to 1.9.0 - [Release notes](https://github.com/bombshell-dev/clack/releases) - [Changelog](https://github.com/bombshell-dev/clack/blob/main/packages/prompts/CHANGELOG.md) - [Commits](https://github.com/bombshell-dev/clack/commits/@clack/prompts@1.9.0/packages/prompts) Updates `@zip.js/zip.js` from 2.15.0 to 2.25.0 - [Release notes](https://github.com/gildas-lormeau/zip.js/releases) - [Commits](https://github.com/gildas-lormeau/zip.js/compare/v2.15.0...v2.25.0) Updates `evmole` from 0.9.3 to 0.9.4 - [Release notes](https://github.com/cdump/evmole/releases) - [Commits](https://github.com/cdump/evmole/commits/0.9.4/javascript) Updates `ignore` from 7.0.6 to 7.0.14 - [Release notes](https://github.com/kaelzhang/node-ignore/releases) - [Commits](https://github.com/kaelzhang/node-ignore/compare/7.0.6...7.0.14) Updates `isomorphic-git` from 1.38.7 to 1.44.15 - [Release notes](https://github.com/isomorphic-git/isomorphic-git/releases) - [Commits](https://github.com/isomorphic-git/isomorphic-git/compare/v1.38.7...v1.44.15) Updates `lossless-json` from 4.3.1 to 4.3.3 - [Changelog](https://github.com/josdejong/lossless-json/blob/main/CHANGELOG.md) - [Commits](https://github.com/josdejong/lossless-json/compare/v4.3.1...v4.3.3) Updates `parse5` from 8.0.1 to 8.1.1 - [Release notes](https://github.com/inikulin/parse5/releases) - [Commits](https://github.com/inikulin/parse5/compare/v8.0.1...v8.1.1) Updates `playwright-core` from 1.64.1 to 1.65.1 - [Release notes](https://github.com/microsoft/playwright/releases) - [Commits](https://github.com/microsoft/playwright/compare/v1.64.1...v1.65.1) Updates `plist` from 5.0.0 to 5.1.1 - [Release notes](https://github.com/TooTallNate/plist.js/releases) - [Changelog](https://github.com/TooTallNate/plist.js/blob/master/CHANGELOG.md) - [Commits](https://github.com/TooTallNate/plist.js/compare/plist@5.0.0...plist@5.1.1) Updates `semver` from 7.8.5 to 7.8.6 - [Release notes](https://github.com/npm/node-semver/releases) - [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md) - [Commits](https://github.com/npm/node-semver/compare/v7.8.5...v7.8.6) Updates `@types/semver` from 7.7.1 to 7.8.0 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/semver) Updates `smol-toml` from 1.9.0 to 1.9.1 - [Release notes](https://github.com/squirrelchat/smol-toml/releases) - [Commits](https://github.com/squirrelchat/smol-toml/compare/v1.9.0...v1.9.1) Updates `stream-chain` from 4.2.6 to 4.4.2 - [Commits](https://github.com/uhop/stream-chain/compare/4.2.6...4.4.2) Updates `stream-json` from 3.7.0 to 3.9.0 - [Commits](https://github.com/uhop/stream-json/compare/3.7.0...3.9.0) Updates `ws` from 8.21.0 to 8.23.0 - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/compare/8.21.0...8.23.0) Updates `@types/ws` from 8.18.1 to 8.18.2 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws) Updates `yaml` from 2.9.0 to 2.9.1 - [Release notes](https://github.com/eemeli/yaml/releases) - [Commits](https://github.com/eemeli/yaml/compare/v2.9.0...v2.9.1) Updates `zod` from 4.6.6 to 4.6.7 - [Release notes](https://github.com/colinhacks/zod/releases) - [Commits](https://github.com/colinhacks/zod/compare/v4.6.6...v4.6.7) Updates `@electron/asar` from 4.2.0 to 4.3.2 - [Release notes](https://github.com/electron/asar/releases) - [Changelog](https://github.com/electron/asar/blob/main/CHANGELOG.md) - [Commits](https://github.com/electron/asar/compare/v4.2.0...v4.3.2) Updates `@stryker-mutator/core` from 10.0.0 to 10.1.1 - [Release notes](https://github.com/stryker-mutator/stryker-js/releases) - [Changelog](https://github.com/stryker-mutator/stryker-js/blob/master/packages/core/CHANGELOG.md) - [Commits](https://github.com/stryker-mutator/stryker-js/commits/v10.1.1/packages/core) Updates `@stryker-mutator/typescript-checker` from 10.0.0 to 10.1.1 - [Release notes](https://github.com/stryker-mutator/stryker-js/releases) - [Changelog](https://github.com/stryker-mutator/stryker-js/blob/master/packages/typescript-checker/CHANGELOG.md) - [Commits](https://github.com/stryker-mutator/stryker-js/commits/v10.1.1/packages/typescript-checker) Updates `@stryker-mutator/vitest-runner` from 10.0.0 to 10.1.1 - [Release notes](https://github.com/stryker-mutator/stryker-js/releases) - [Changelog](https://github.com/stryker-mutator/stryker-js/blob/master/packages/vitest-runner/CHANGELOG.md) - [Commits](https://github.com/stryker-mutator/stryker-js/commits/v10.1.1/packages/vitest-runner) Updates `@types/node` from 26.6.4 to 26.6.6 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Updates `@types/semver` from 7.7.1 to 7.8.0 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/semver) Updates `@types/ws` from 8.18.1 to 8.18.2 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws) Updates `@vitest/coverage-v8` from 5.0.3 to 5.1.0 - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md) - [Commits](https://github.com/vitest-dev/vitest/commits/v5.1.0/packages/coverage-v8) Updates `jscpd` from 5.0.12 to 5.4.3 - [Release notes](https://github.com/kucherenko/jscpd/releases) - [Commits](https://github.com/kucherenko/jscpd/commits/v5.4.3/rust/jscpd) Updates `knip` from 6.39.0 to 6.45.1 - [Release notes](https://github.com/webpro-nl/knip/releases) - [Commits](https://github.com/webpro-nl/knip/commits/knip@6.45.1/packages/knip) Updates `oxfmt` from 0.72.0 to 0.79.0 - [Release notes](https://github.com/oxc-project/oxc/releases) - [Changelog](https://github.com/oxc-project/oxc/blob/main/npm/oxfmt/CHANGELOG.md) - [Commits](https://github.com/oxc-project/oxc/commits/oxfmt_v0.79.0/npm/oxfmt) Updates `oxlint` from 1.87.0 to 1.94.0 - [Release notes](https://github.com/oxc-project/oxc/releases) - [Changelog](https://github.com/oxc-project/oxc/blob/main/npm/oxlint/CHANGELOG.md) - [Commits](https://github.com/oxc-project/oxc/commits/oxlint_v1.94.0/npm/oxlint) Updates `oxlint-tsgolint` from 7.0.2005 to 7.0.2007 - [Release notes](https://github.com/oxc-project/tsgolint/releases) - [Commits](https://github.com/oxc-project/tsgolint/compare/v7.0.2005...v7.0.2007) Updates `release-please` from 17.3.0 to 17.11.2 - [Release notes](https://github.com/googleapis/release-please/releases) - [Changelog](https://github.com/googleapis/release-please/blob/main/CHANGELOG.md) - [Commits](https://github.com/googleapis/release-please/compare/v17.3.0...v17.11.2) Updates `rolldown` from 1.2.12 to 1.3.2 - [Release notes](https://github.com/rolldown/rolldown/releases) - [Changelog](https://github.com/rolldown/rolldown/blob/main/CHANGELOG.md) - [Commits](https://github.com/rolldown/rolldown/commits/v1.3.2/packages/rolldown) Updates `turbo` from 2.11.7 to 2.11.11 - [Release notes](https://github.com/vercel/turborepo/releases) - [Changelog](https://github.com/vercel/turborepo/blob/main/RELEASE.md) - [Commits](https://github.com/vercel/turborepo/compare/v2.11.7...v2.11.11) Updates `vitest` from 5.0.3 to 5.1.0 - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md) - [Commits](https://github.com/vitest-dev/vitest/commits/v5.1.0/packages/vitest) Updates `frida` from 17.23.2 to 17.26.4 - [Commits](https://github.com/frida/frida-node/compare/17.23.2...17.26.4) Updates `skills` from 1.7.2 to 1.9.0 - [Release notes](https://github.com/vercel-labs/skills/releases) - [Commits](https://github.com/vercel-labs/skills/compare/v1.7.2...v1.9.0) --- updated-dependencies: - dependency-name: "@babel/parser" dependency-version: 8.1.2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@babel/types" dependency-version: 8.1.2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@bufbuild/protobuf" dependency-version: 2.17.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@clack/prompts" dependency-version: 1.9.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@electron/asar" dependency-version: 4.3.2 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@stryker-mutator/core" dependency-version: 10.1.1 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@stryker-mutator/typescript-checker" dependency-version: 10.1.1 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@stryker-mutator/vitest-runner" dependency-version: 10.1.1 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@types/node" dependency-version: 26.6.6 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: "@types/semver" dependency-version: 7.8.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@types/semver" dependency-version: 7.8.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@types/ws" dependency-version: 8.18.2 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: "@types/ws" dependency-version: 8.18.2 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: "@vitest/coverage-v8" dependency-version: 5.1.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@zip.js/zip.js" dependency-version: 2.25.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: evmole dependency-version: 0.9.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: frida dependency-version: 17.26.4 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: ignore dependency-version: 7.0.14 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: isomorphic-git dependency-version: 1.44.15 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: jscpd dependency-version: 5.4.3 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: knip dependency-version: 6.45.1 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: lossless-json dependency-version: 4.3.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: oxfmt dependency-version: 0.79.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: oxlint dependency-version: 1.94.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: oxlint-tsgolint dependency-version: 7.0.2007 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: parse5 dependency-version: 8.1.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: playwright-core dependency-version: 1.65.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: plist dependency-version: 5.1.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: release-please dependency-version: 17.11.2 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: rolldown dependency-version: 1.3.2 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: semver dependency-version: 7.8.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: skills dependency-version: 1.9.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: smol-toml dependency-version: 1.9.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: stream-chain dependency-version: 4.4.2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: stream-json dependency-version: 3.9.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: turbo dependency-version: 2.11.11 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: vitest dependency-version: 5.1.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: ws dependency-version: 8.23.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: yaml dependency-version: 2.9.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: zod dependency-version: 4.6.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-minor-and-patch ... Signed-off-by: dependabot[bot] <support@github.com> * fix(deps): adapt release tooling and capture metadata to the new npm pins * fix(deps): preserve numeric, plist and archive evidence semantics * test(zip): verify malformed compression with CRC checks enabled * fix(capture): preserve exact decimal projections and redaction * test(apple): verify keyed archive controls before altering the trailer * test(lint): cover safe and suggested regex escape fixes * fix(reference): preserve directory exclusion provenance with ignore 7 * docs(examples): refresh HAR evidence identities for the current decoder * fix(reference): preserve metadata failures with strict Git ref reads * chore(config): remove the unused MCP profile type alias --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
1374 lines
43 KiB
TypeScript
1374 lines
43 KiB
TypeScript
import { execFile } from "node:child_process";
|
|
import {
|
|
copyFile,
|
|
mkdir,
|
|
readFile,
|
|
symlink,
|
|
writeFile,
|
|
} from "node:fs/promises";
|
|
import { createRequire } from "node:module";
|
|
import { dirname, join } from "node:path";
|
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
import { promisify } from "node:util";
|
|
import { afterEach, beforeAll, expect, it, vi } from "vitest";
|
|
import { z } from "zod";
|
|
|
|
import {
|
|
applyReleasePleasePatch,
|
|
createReleaseProposal,
|
|
describeReleaseProposalError,
|
|
releaseProposalSearchDepth,
|
|
} from "../../../scripts/lib/release-proposal.mjs";
|
|
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
|
import { copyScriptsWithImports } from "../../support/scriptImportClosure.js";
|
|
|
|
const execute = promisify(execFile);
|
|
const require = createRequire(import.meta.url);
|
|
let upstream: typeof import("release-please");
|
|
let githubApi: typeof import("release-please/build/src/github-api.js");
|
|
let githubRuntime: typeof import("release-please/build/src/github.js");
|
|
const baseline = "a".repeat(40);
|
|
const latest = "b".repeat(40);
|
|
const silent = {
|
|
info() {},
|
|
warn() {},
|
|
error() {},
|
|
debug() {},
|
|
trace() {},
|
|
};
|
|
|
|
it("reports an HTTP status when a release proposal error has no message", () => {
|
|
const failure = Object.assign(new Error(""), {
|
|
name: "HttpError",
|
|
status: 504,
|
|
request: { headers: { authorization: "secret" } },
|
|
});
|
|
expect(describeReleaseProposalError(failure)).toBe("HttpError (HTTP 504)");
|
|
expect(describeReleaseProposalError(new Error("broken"))).toBe("broken");
|
|
});
|
|
|
|
it("reports a gateway error without logging the HTML response page", () => {
|
|
const failure = Object.assign(
|
|
new Error("<!DOCTYPE html>\n<html><title>Unicorn!</title></html>"),
|
|
{
|
|
status: 504,
|
|
},
|
|
);
|
|
expect(describeReleaseProposalError(failure)).toBe(
|
|
"GitHub returned an HTML error response (HTTP 504)",
|
|
);
|
|
});
|
|
|
|
beforeAll(async () => {
|
|
upstream = await import("release-please");
|
|
githubApi = require("release-please/build/src/github-api.js");
|
|
githubRuntime = require("release-please/build/src/github.js");
|
|
});
|
|
|
|
afterEach(() => vi.restoreAllMocks());
|
|
|
|
it("preserves the existing overflow notes if their replacement fails", async () => {
|
|
const write = vi
|
|
.fn()
|
|
.mockRejectedValueOnce(new Error("upload failed"))
|
|
.mockResolvedValueOnce({
|
|
data: { content: { html_url: "https://example.test/notes" } },
|
|
});
|
|
const getContent = vi.fn().mockResolvedValue({
|
|
data: { type: "file", sha: "existing-blob" },
|
|
});
|
|
const createNewBranch = vi.fn();
|
|
const forkBranch = vi.fn();
|
|
const github = {
|
|
repository: { owner: "fixture", repo: "rea" },
|
|
getBranchSha: vi.fn().mockResolvedValue("existing-branch"),
|
|
createNewBranch,
|
|
forkBranch,
|
|
octokit: { repos: { getContent, createOrUpdateFileContents: write } },
|
|
} as unknown as InstanceType<typeof githubApi.GitHubApi>;
|
|
const update = () =>
|
|
githubApi.GitHubApi.prototype.createFileOnNewBranch.call(
|
|
github,
|
|
"release-notes.md",
|
|
"Notes: café",
|
|
"notes",
|
|
"main",
|
|
);
|
|
await expect(update()).rejects.toThrow("upload failed");
|
|
expect(forkBranch).not.toHaveBeenCalled();
|
|
expect(createNewBranch).not.toHaveBeenCalled();
|
|
await expect(update()).resolves.toBe("https://example.test/notes");
|
|
expect(write).toHaveBeenLastCalledWith(
|
|
expect.objectContaining({
|
|
branch: "notes",
|
|
sha: "existing-blob",
|
|
content: Buffer.from("Notes: café", "utf8").toString("base64"),
|
|
}),
|
|
);
|
|
});
|
|
|
|
it("creates overflow notes on a new branch without requiring an existing file", async () => {
|
|
const write = vi.fn().mockResolvedValue({
|
|
data: { content: { html_url: "https://example.test/notes" } },
|
|
});
|
|
const createNewBranch = vi.fn();
|
|
const github = {
|
|
repository: { owner: "fixture", repo: "rea" },
|
|
getBranchSha: vi
|
|
.fn()
|
|
.mockResolvedValueOnce(undefined)
|
|
.mockResolvedValueOnce("base-sha"),
|
|
createNewBranch,
|
|
octokit: {
|
|
repos: {
|
|
getContent: vi
|
|
.fn()
|
|
.mockRejectedValue(
|
|
Object.assign(new Error("missing"), { status: 404 }),
|
|
),
|
|
createOrUpdateFileContents: write,
|
|
},
|
|
},
|
|
} as unknown as InstanceType<typeof githubApi.GitHubApi>;
|
|
await expect(
|
|
githubApi.GitHubApi.prototype.createFileOnNewBranch.call(
|
|
github,
|
|
"release-notes.md",
|
|
"Notes",
|
|
"notes",
|
|
"main",
|
|
),
|
|
).resolves.toBe("https://example.test/notes");
|
|
expect(createNewBranch).toHaveBeenCalledWith("notes", "base-sha");
|
|
expect(write).toHaveBeenCalledWith(
|
|
expect.not.objectContaining({ sha: expect.anything() }),
|
|
);
|
|
});
|
|
|
|
function respond(value: unknown, status = 200) {
|
|
return new Response(JSON.stringify(value), {
|
|
status,
|
|
headers: { "content-type": "application/json" },
|
|
});
|
|
}
|
|
|
|
it.each([true, false])(
|
|
"handles an HTTP 200 Git blob without content (recovers: %s)",
|
|
async (recovers) => {
|
|
const sleep = vi
|
|
.spyOn(githubRuntime, "sleepInMs")
|
|
.mockResolvedValue(undefined);
|
|
const path = "CHANGELOG.md";
|
|
const contents = "# Changelog\n";
|
|
let reads = 0;
|
|
const github = await upstream.GitHub.create({
|
|
owner: "fixture",
|
|
repo: "rea",
|
|
defaultBranch: "main",
|
|
logger: silent,
|
|
fetch: async (input: string, options: { method?: string }) => {
|
|
const { pathname } = new URL(input);
|
|
expect(options.method).toBe("GET");
|
|
if (pathname === "/repos/fixture/rea/git/trees/main")
|
|
return respond({ tree: [{ path, sha: baseline, type: "blob" }] });
|
|
expect(pathname).toBe(`/repos/fixture/rea/git/blobs/${baseline}`);
|
|
reads += 1;
|
|
return respond({
|
|
sha: baseline,
|
|
encoding: "base64",
|
|
...(recovers && reads > 1
|
|
? { content: Buffer.from(contents).toString("base64") }
|
|
: {}),
|
|
});
|
|
},
|
|
});
|
|
const result = github.getFileContentsOnBranch(path, "main");
|
|
if (recovers)
|
|
await expect(result).resolves.toMatchObject({ parsedContent: contents });
|
|
else
|
|
await expect(result).rejects.toThrow(
|
|
"GitHub returned an incomplete Git blob for CHANGELOG.md on main",
|
|
);
|
|
expect(reads).toBe(recovers ? 2 : 3);
|
|
expect(sleep.mock.calls).toEqual(recovers ? [[1000]] : [[1000], [2000]]);
|
|
},
|
|
);
|
|
|
|
it.each([0, 12])(
|
|
"checks an empty Git blob response declaring size %s",
|
|
async (size) => {
|
|
const sleep = vi
|
|
.spyOn(githubRuntime, "sleepInMs")
|
|
.mockResolvedValue(undefined);
|
|
let reads = 0;
|
|
const github = await upstream.GitHub.create({
|
|
owner: "fixture",
|
|
repo: "rea",
|
|
defaultBranch: "main",
|
|
logger: silent,
|
|
fetch: async (input: string) => {
|
|
const { pathname } = new URL(input);
|
|
if (pathname === "/repos/fixture/rea/git/trees/main")
|
|
return respond({
|
|
tree: [{ path: "CHANGELOG.md", sha: baseline, type: "blob" }],
|
|
});
|
|
expect(pathname).toBe(`/repos/fixture/rea/git/blobs/${baseline}`);
|
|
reads += 1;
|
|
return respond({
|
|
sha: baseline,
|
|
encoding: "base64",
|
|
content: "",
|
|
size,
|
|
});
|
|
},
|
|
});
|
|
const result = github.getFileContentsOnBranch("CHANGELOG.md", "main");
|
|
if (size === 0) {
|
|
await expect(result).resolves.toMatchObject({ parsedContent: "" });
|
|
expect(reads).toBe(1);
|
|
expect(sleep).not.toHaveBeenCalled();
|
|
} else {
|
|
await expect(result).rejects.toThrow(
|
|
"GitHub returned an incomplete Git blob",
|
|
);
|
|
expect(reads).toBe(3);
|
|
expect(sleep.mock.calls).toEqual([[1000], [2000]]);
|
|
}
|
|
},
|
|
);
|
|
|
|
it.each([
|
|
{ statuses: [504, 200], expectedReads: 2, status: null },
|
|
{ statuses: [504, 504, 504], expectedReads: 3, status: 504 },
|
|
{ statuses: [403], expectedReads: 1, status: 403 },
|
|
])(
|
|
"retries release note reads with HTTP responses $statuses",
|
|
async ({ statuses, expectedReads, status }) => {
|
|
const sleep = vi
|
|
.spyOn(githubRuntime, "sleepInMs")
|
|
.mockResolvedValue(undefined);
|
|
const branch = "proposal--release-notes";
|
|
const path = "release-notes.md";
|
|
const notes = "Existing release notes";
|
|
const reads: string[] = [];
|
|
const github = await upstream.GitHub.create({
|
|
owner: "fixture",
|
|
repo: "rea",
|
|
defaultBranch: "main",
|
|
logger: silent,
|
|
fetch: async (input: string, options: { method?: string }) => {
|
|
const { pathname } = new URL(input);
|
|
expect(options.method).toBe("GET");
|
|
if (pathname === `/repos/fixture/rea/git/trees/${branch}`) {
|
|
reads.push(pathname);
|
|
const responseStatus = statuses[reads.length - 1];
|
|
if (responseStatus !== 200) return respond({}, responseStatus);
|
|
return respond({ tree: [{ path, sha: baseline, type: "blob" }] });
|
|
}
|
|
expect(pathname).toBe(`/repos/fixture/rea/git/blobs/${baseline}`);
|
|
return respond({
|
|
sha: baseline,
|
|
content: Buffer.from(notes).toString("base64"),
|
|
encoding: "base64",
|
|
});
|
|
},
|
|
});
|
|
const result = github.getFileContentsOnBranch(path, branch);
|
|
if (status === null) {
|
|
await expect(result).resolves.toMatchObject({ parsedContent: notes });
|
|
} else {
|
|
await expect(result).rejects.toMatchObject({ status });
|
|
}
|
|
expect(reads).toHaveLength(expectedReads);
|
|
expect(sleep.mock.calls).toEqual(
|
|
[[1000], [2000]].slice(0, expectedReads - 1),
|
|
);
|
|
},
|
|
);
|
|
|
|
function associatedPullRequest(number = 42, mergeCommit = latest) {
|
|
return {
|
|
number,
|
|
title: "Original title",
|
|
baseRefName: "main",
|
|
headRefName: "feature",
|
|
body: `BEGIN_COMMIT_OVERRIDE\nfix: attributed override (#${number})\nEND_COMMIT_OVERRIDE`,
|
|
mergeCommit: { oid: mergeCommit },
|
|
labels: { nodes: [{ name: "reviewed" }] },
|
|
files: {
|
|
nodes: [{ path: "src/feature.ts" }],
|
|
pageInfo: { hasNextPage: false },
|
|
},
|
|
};
|
|
}
|
|
|
|
type CommitRecord = {
|
|
sha: string;
|
|
message: string;
|
|
files: string[];
|
|
pullRequests?: ReturnType<typeof associatedPullRequest>[];
|
|
};
|
|
type HistoryVariables = {
|
|
num: number;
|
|
cursor?: string | undefined;
|
|
includeFiles?: boolean | undefined;
|
|
};
|
|
type HistoryFailure = {
|
|
cursor?: string;
|
|
errors: { message: string; type?: string }[];
|
|
status?: number;
|
|
html?: string;
|
|
disconnect?: boolean;
|
|
};
|
|
const internalError = {
|
|
message:
|
|
"Something went wrong while executing your query on 2026-10-24T08:20:11Z. Please include `fixture:request` when reporting this issue.",
|
|
};
|
|
|
|
function historyPage(
|
|
commits: CommitRecord[],
|
|
page: HistoryVariables,
|
|
pullRequest: boolean,
|
|
) {
|
|
const offset = Number(page.cursor ?? "0");
|
|
const selected = commits.slice(offset, offset + page.num);
|
|
return {
|
|
data: {
|
|
repository: {
|
|
ref: {
|
|
target: {
|
|
history: {
|
|
nodes: selected.map((commit) => ({
|
|
sha: commit.sha,
|
|
message: commit.message,
|
|
associatedPullRequests: {
|
|
nodes: (
|
|
commit.pullRequests ??
|
|
(pullRequest && commit.sha === latest
|
|
? [associatedPullRequest()]
|
|
: [])
|
|
).map(({ files, ...metadata }) => ({
|
|
...metadata,
|
|
...(page.includeFiles === false ? {} : { files }),
|
|
})),
|
|
},
|
|
})),
|
|
pageInfo: {
|
|
hasNextPage: offset + selected.length < commits.length,
|
|
endCursor: String(offset + selected.length),
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
}
|
|
|
|
function releaseRecord(version: string, sha = baseline) {
|
|
const tagName = `rea-agents-${version}`;
|
|
return {
|
|
name: version,
|
|
tag: { name: tagName },
|
|
tagCommit: { oid: sha },
|
|
description: "",
|
|
isDraft: false,
|
|
url: `https://github.com/fixture/rea/releases/tag/${tagName}`,
|
|
};
|
|
}
|
|
|
|
function releasePage(releases: ReturnType<typeof releaseRecord>[]) {
|
|
return {
|
|
data: {
|
|
repository: {
|
|
releases: {
|
|
nodes: releases,
|
|
pageInfo: { hasNextPage: false },
|
|
},
|
|
},
|
|
},
|
|
};
|
|
}
|
|
|
|
const defaultConfiguration = {
|
|
"release-type": "node",
|
|
versioning: "always-bump-minor",
|
|
"include-v-in-tag": false,
|
|
packages: {
|
|
".": {
|
|
"package-name": "rea-agents",
|
|
"extra-files": [{ type: "generic", path: "version.txt" }],
|
|
},
|
|
},
|
|
};
|
|
|
|
function releaseFileEntries(
|
|
configuration: Record<string, unknown>,
|
|
releasedVersions: Record<string, string>,
|
|
) {
|
|
const files: Record<string, unknown> = {
|
|
"release-please-config.json": configuration,
|
|
".release-please-manifest.json": releasedVersions,
|
|
"package.json": {
|
|
name: "rea-agents",
|
|
version: releasedVersions["."] ?? "0.0.0",
|
|
},
|
|
"pkg/package.json": {
|
|
name: "rea-agents",
|
|
version: releasedVersions.pkg ?? "0.0.0",
|
|
},
|
|
};
|
|
return Object.entries(files).map(([path, value], index) => ({
|
|
path,
|
|
sha: (index + 1).toString(16).padStart(40, "0"),
|
|
text: JSON.stringify(value),
|
|
}));
|
|
}
|
|
|
|
async function releaseFixture({
|
|
config = {},
|
|
commits = [
|
|
{ sha: latest, message: "fix: direct change", files: ["docs/changed.md"] },
|
|
{ sha: baseline, message: "chore: release 6.7.0", files: ["package.json"] },
|
|
],
|
|
depth = 500,
|
|
pullRequest = false,
|
|
historyFailures = [],
|
|
releaseFailures = [],
|
|
releasedVersions = { ".": "6.7.0", pkg: "6.7.0" },
|
|
releases = [releaseRecord("6.7.0")],
|
|
tags = [],
|
|
}: {
|
|
config?: Record<string, unknown>;
|
|
commits?: CommitRecord[];
|
|
depth?: number;
|
|
pullRequest?: boolean;
|
|
historyFailures?: HistoryFailure[];
|
|
releaseFailures?: HistoryFailure["errors"][];
|
|
releasedVersions?: Record<string, string>;
|
|
releases?: ReturnType<typeof releaseRecord>[];
|
|
tags?: { name: string; commit: { sha: string } }[];
|
|
} = {}) {
|
|
const requests: { method: string; pathname: string }[] = [];
|
|
const pages: HistoryVariables[] = [];
|
|
const historyQueries: string[] = [];
|
|
const failures = [...historyFailures];
|
|
const releaseErrors = [...releaseFailures];
|
|
const configuration = { ...defaultConfiguration, ...config };
|
|
const entries = releaseFileEntries(configuration, releasedVersions);
|
|
const github = await upstream.GitHub.create({
|
|
owner: "fixture",
|
|
repo: "rea",
|
|
defaultBranch: "main",
|
|
logger: silent,
|
|
fetch: async (
|
|
input: string,
|
|
options: { method?: string; body?: string },
|
|
) => {
|
|
const url = new URL(input);
|
|
requests.push({
|
|
method: options.method ?? "GET",
|
|
pathname: url.pathname,
|
|
});
|
|
if (url.pathname === "/repos/fixture/rea/tags") return respond(tags);
|
|
if (url.pathname === "/repos/fixture/rea/releases/generate-notes") {
|
|
return respond({ body: "Generated release notes" });
|
|
}
|
|
if (url.pathname === "/graphql") {
|
|
const query = z
|
|
.object({
|
|
query: z.string(),
|
|
variables: z.object({
|
|
num: z.number(),
|
|
cursor: z.string().optional(),
|
|
includeFiles: z.boolean().optional(),
|
|
}),
|
|
})
|
|
.parse(JSON.parse(options.body ?? ""));
|
|
if (query.query.includes("query releases(")) {
|
|
const errors = releaseErrors.shift();
|
|
if (errors) return respond({ errors });
|
|
return respond(releasePage(releases));
|
|
}
|
|
if (!query.query.includes("query pullRequestsSince(")) {
|
|
throw new Error(`Unexpected GraphQL operation: ${query.query}`);
|
|
}
|
|
pages.push(query.variables);
|
|
historyQueries.push(query.query);
|
|
const failure = failures[0];
|
|
if (failure && failure.cursor === query.variables.cursor) {
|
|
failures.shift();
|
|
if (failure.disconnect)
|
|
throw new TypeError("fetch failed", {
|
|
cause: new Error("other side closed"),
|
|
});
|
|
if (failure.html !== undefined)
|
|
return new Response(failure.html, {
|
|
status: failure.status ?? 504,
|
|
headers: { "content-type": "text/html; charset=utf-8" },
|
|
});
|
|
return respond(
|
|
{
|
|
...historyPage(commits, query.variables, pullRequest),
|
|
errors: failure.errors,
|
|
},
|
|
failure.status,
|
|
);
|
|
}
|
|
return respond(historyPage(commits, query.variables, pullRequest));
|
|
}
|
|
if (url.pathname === "/repos/fixture/rea/git/trees/main") {
|
|
return respond({
|
|
truncated: false,
|
|
sha: baseline,
|
|
tree: entries.map(({ path, sha, text }) => ({
|
|
path,
|
|
sha,
|
|
type: "blob",
|
|
mode: "100644",
|
|
size: text.length,
|
|
})),
|
|
});
|
|
}
|
|
const blobPrefix = "/repos/fixture/rea/git/blobs/";
|
|
if (url.pathname.startsWith(blobPrefix)) {
|
|
const entry = entries.find(
|
|
(item) => item.sha === url.pathname.slice(blobPrefix.length),
|
|
);
|
|
if (!entry) throw new Error("Unexpected blob read");
|
|
return respond({
|
|
content: Buffer.from(entry.text).toString("base64"),
|
|
encoding: "base64",
|
|
sha: entry.sha,
|
|
size: entry.text.length,
|
|
});
|
|
}
|
|
const commitPath = "/repos/fixture/rea/commits/";
|
|
if (url.pathname.startsWith(commitPath)) {
|
|
const commit = commits.find(
|
|
(item) => item.sha === url.pathname.slice(commitPath.length),
|
|
);
|
|
if (!commit) throw new Error("Unexpected commit lookup");
|
|
return respond({
|
|
files: commit.files.map((filename) => ({ filename })),
|
|
});
|
|
}
|
|
throw new Error(
|
|
`Unexpected HTTP request: ${options.method} ${url.pathname}`,
|
|
);
|
|
},
|
|
});
|
|
const manifest = await upstream.Manifest.fromManifest(
|
|
github,
|
|
"main",
|
|
undefined,
|
|
undefined,
|
|
{
|
|
commitSearchDepth: depth,
|
|
logger: silent,
|
|
},
|
|
);
|
|
return { manifest, github, requests, pages, historyQueries };
|
|
}
|
|
|
|
const mergedRelease = {
|
|
number: 7104,
|
|
body: "Release notes",
|
|
merged_at: "2026-11-12T08:58:31Z",
|
|
merge_commit_sha: latest,
|
|
base: { ref: "main" },
|
|
head: {
|
|
ref: "release-please--branches--main--components--rea-agents",
|
|
repo: { full_name: "fixture/rea" },
|
|
},
|
|
labels: [],
|
|
};
|
|
const proposalContext = {
|
|
repository: "fixture/rea",
|
|
sourceSha: latest,
|
|
targetBranch: "main",
|
|
eventName: "push",
|
|
};
|
|
const proposalReads =
|
|
(pages: unknown) => async (command: string, args: string[]) => {
|
|
if (command === "gh") return JSON.stringify(pages);
|
|
if (command === "git" && args[0] === "rev-parse") return "false\n";
|
|
if (command === "git" && args[0] === "rev-list") return "2\n";
|
|
throw new Error(`Unexpected proposal read: ${command} ${args.join(" ")}`);
|
|
};
|
|
|
|
it("defers the release merge's push while its tag has not been created", async () => {
|
|
const fixture = await releaseFixture({ releases: [] });
|
|
// This is the original failure while the publication workflow creates the tag.
|
|
await expect(fixture.manifest.createPullRequests()).rejects.toThrow(
|
|
"no matching release or tag found",
|
|
);
|
|
const loadManifest = vi.fn(async () => fixture.manifest);
|
|
await expect(
|
|
createReleaseProposal(
|
|
proposalReads([[], [mergedRelease]]),
|
|
proposalContext,
|
|
loadManifest,
|
|
),
|
|
).resolves.toEqual({ kind: "release-merge", pullRequest: 7104 });
|
|
expect(loadManifest).not.toHaveBeenCalled();
|
|
});
|
|
|
|
it.each([
|
|
{ name: "ordinary push", prs: [] },
|
|
{ name: "unmerged PR", prs: [{ ...mergedRelease, merged_at: null }] },
|
|
{
|
|
name: "ordinary PR with no description",
|
|
prs: [
|
|
{
|
|
...mergedRelease,
|
|
body: null,
|
|
head: { ...mergedRelease.head, ref: "feature" },
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: "deleted head repository",
|
|
prs: [{ ...mergedRelease, head: { ...mergedRelease.head, repo: null } }],
|
|
},
|
|
{
|
|
name: "different merge commit",
|
|
prs: [{ ...mergedRelease, merge_commit_sha: baseline }],
|
|
},
|
|
{
|
|
name: "fork release branch",
|
|
prs: [
|
|
{
|
|
...mergedRelease,
|
|
head: { ...mergedRelease.head, repo: { full_name: "fork/rea" } },
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: "ordinary feature PR",
|
|
prs: [
|
|
{ ...mergedRelease, head: { ...mergedRelease.head, ref: "feature" } },
|
|
],
|
|
},
|
|
{
|
|
name: "another base branch",
|
|
prs: [{ ...mergedRelease, base: { ref: "release/6.7.0" } }],
|
|
},
|
|
])("keeps a genuinely missing release fatal for $name", async ({ prs }) => {
|
|
const fixture = await releaseFixture({ releases: [] });
|
|
await expect(
|
|
createReleaseProposal(
|
|
proposalReads([prs]),
|
|
proposalContext,
|
|
async () => fixture.manifest,
|
|
),
|
|
).rejects.toThrow("no matching release or tag found");
|
|
});
|
|
|
|
it.each(["workflow_dispatch", undefined])(
|
|
"does not defer manual proposal preparation for event %s",
|
|
async (eventName) => {
|
|
const fixture = await releaseFixture({ releases: [] });
|
|
const run = vi.fn(proposalReads([[mergedRelease]]));
|
|
await expect(
|
|
createReleaseProposal(
|
|
run,
|
|
{ ...proposalContext, eventName },
|
|
async () => fixture.manifest,
|
|
),
|
|
).rejects.toThrow("no matching release or tag found");
|
|
expect(run.mock.calls.every(([command]) => command === "git")).toBe(true);
|
|
},
|
|
);
|
|
|
|
it.each([
|
|
{ name: "malformed API response", pages: { message: "unavailable" } },
|
|
{
|
|
name: "ambiguous release identity",
|
|
pages: [[mergedRelease, { ...mergedRelease, number: 7105 }]],
|
|
},
|
|
])("fails closed on $name before preparing a proposal", async ({ pages }) => {
|
|
const loadManifest = vi.fn();
|
|
await expect(
|
|
createReleaseProposal(proposalReads(pages), proposalContext, loadManifest),
|
|
).rejects.toThrow();
|
|
expect(loadManifest).not.toHaveBeenCalled();
|
|
});
|
|
|
|
it("preserves an API failure instead of treating the push as ordinary", async () => {
|
|
const failure = new Error("GitHub lookup unavailable");
|
|
const loadManifest = vi.fn();
|
|
await expect(
|
|
createReleaseProposal(
|
|
async () => {
|
|
throw failure;
|
|
},
|
|
proposalContext,
|
|
loadManifest,
|
|
),
|
|
).rejects.toBe(failure);
|
|
expect(loadManifest).not.toHaveBeenCalled();
|
|
});
|
|
|
|
it("builds the root Node proposal without commit-file lookups and retains extra-file updates", async () => {
|
|
const fixture = await releaseFixture();
|
|
const candidates = await fixture.manifest.buildPullRequests();
|
|
expect(candidates).toHaveLength(1);
|
|
expect(candidates[0]?.body.toString()).toContain("direct change");
|
|
const version = candidates[0]?.updates.find(
|
|
(update) => update.path === "version.txt",
|
|
);
|
|
expect(
|
|
version?.updater.updateContent("6.7.0 // x-release-please-version"),
|
|
).toContain("6.8.0");
|
|
expect(
|
|
fixture.requests.filter((request) =>
|
|
request.pathname.includes("/commits/"),
|
|
),
|
|
).toEqual([]);
|
|
expect(fixture.pages.map((page) => page.num)).toEqual([10]);
|
|
expect(fixture.pages[0]?.includeFiles).toBe(false);
|
|
expect(fixture.historyQueries[0]).toContain("$includeFiles: Boolean!");
|
|
expect(fixture.historyQueries[0]).toContain(
|
|
"files(first: $maxFilesChanged) @include(if: $includeFiles)",
|
|
);
|
|
const commits = [];
|
|
for await (const commit of fixture.github.mergeCommitIterator("main", {
|
|
backfillFiles: false,
|
|
}))
|
|
commits.push(commit);
|
|
expect(commits[0]?.files).toBeUndefined();
|
|
});
|
|
|
|
it("keeps real associated PR metadata, body overrides and attribution", async () => {
|
|
const fixture = await releaseFixture({ pullRequest: true });
|
|
const candidates = await fixture.manifest.buildPullRequests();
|
|
const body = candidates[0]?.body.toString();
|
|
expect(body).toContain("attributed override");
|
|
expect(body).toContain("https://github.com/fixture/rea/issues/42");
|
|
expect(body).not.toContain("direct change");
|
|
const commits = [];
|
|
for await (const commit of fixture.github.mergeCommitIterator("main", {
|
|
backfillFiles: false,
|
|
}))
|
|
commits.push(commit);
|
|
expect(commits[0]?.pullRequest).toMatchObject({
|
|
number: 42,
|
|
labels: ["reviewed"],
|
|
mergeCommitOid: latest,
|
|
body: expect.stringContaining("BEGIN_COMMIT_OVERRIDE"),
|
|
files: ["src/feature.ts"],
|
|
});
|
|
expect(commits[0]?.files).toEqual(["src/feature.ts"]);
|
|
expect(fixture.pages.at(-1)?.includeFiles).toBe(true);
|
|
});
|
|
|
|
it.each([false, true])(
|
|
"preserves associated PR selection with omitted files for rebased=%s",
|
|
async (rebased) => {
|
|
const second = "c".repeat(40);
|
|
const fixture = await releaseFixture({
|
|
commits: [
|
|
{
|
|
sha: latest,
|
|
message: "fix: first change",
|
|
files: ["src/first.ts"],
|
|
pullRequests: [
|
|
associatedPullRequest(7, baseline),
|
|
associatedPullRequest(),
|
|
],
|
|
},
|
|
{
|
|
sha: second,
|
|
message: "fix: second change",
|
|
files: ["src/second.ts"],
|
|
pullRequests: rebased ? [associatedPullRequest()] : [],
|
|
},
|
|
{ sha: baseline, message: "chore: release 6.7.0", files: [] },
|
|
],
|
|
});
|
|
const full = [];
|
|
for await (const commit of fixture.github.mergeCommitIterator("main"))
|
|
full.push(commit);
|
|
expect(fixture.pages.length).toBeGreaterThan(0);
|
|
expect(fixture.pages.every((page) => page.includeFiles === true)).toBe(
|
|
true,
|
|
);
|
|
const fullPageCount = fixture.pages.length;
|
|
// The runtime patch adds this option after source checks read upstream types.
|
|
const options = {
|
|
includeFiles: false,
|
|
backfillFiles: true,
|
|
} satisfies NonNullable<
|
|
Parameters<typeof fixture.github.mergeCommitIterator>[1]
|
|
> & { includeFiles: boolean };
|
|
const omitted = [];
|
|
for await (const commit of fixture.github.mergeCommitIterator(
|
|
"main",
|
|
options,
|
|
))
|
|
omitted.push(commit);
|
|
expect(fixture.pages.length).toBeGreaterThan(fullPageCount);
|
|
expect(
|
|
fixture.pages
|
|
.slice(fullPageCount)
|
|
.every((page) => page.includeFiles === false),
|
|
).toBe(true);
|
|
expect(full[0]?.pullRequest?.number).toBe(rebased ? 7 : 42);
|
|
expect(omitted).toEqual(
|
|
full.map(({ files: _files, pullRequest, ...commit }) => ({
|
|
...commit,
|
|
...(pullRequest
|
|
? {
|
|
pullRequest: Object.fromEntries(
|
|
Object.entries(pullRequest).filter(([key]) => key !== "files"),
|
|
),
|
|
}
|
|
: {}),
|
|
})),
|
|
);
|
|
expect(omitted.every((commit) => commit.files === undefined)).toBe(true);
|
|
expect(
|
|
fixture.requests.filter((request) =>
|
|
request.pathname.includes("/commits/"),
|
|
),
|
|
).toEqual([]);
|
|
},
|
|
);
|
|
|
|
it.each([
|
|
{
|
|
name: "inherited exclusion",
|
|
config: { "exclude-paths": ["docs"] },
|
|
excluded: true,
|
|
},
|
|
{
|
|
name: "package exclusion",
|
|
config: {
|
|
packages: {
|
|
".": { "package-name": "rea-agents", "exclude-paths": ["docs"] },
|
|
},
|
|
},
|
|
excluded: true,
|
|
},
|
|
{
|
|
name: "explicit plugin",
|
|
config: { plugins: ["sentence-case"] },
|
|
excluded: false,
|
|
},
|
|
{
|
|
name: "nondefault changelog",
|
|
config: { "changelog-type": "github" },
|
|
excluded: false,
|
|
},
|
|
{
|
|
name: "other versioning strategy",
|
|
config: { versioning: "always-bump-patch" },
|
|
excluded: false,
|
|
},
|
|
{
|
|
name: "subpackage",
|
|
config: { packages: { pkg: { "package-name": "rea-agents" } } },
|
|
excluded: true,
|
|
},
|
|
])("retains file-backed semantics for $name", async ({ config, excluded }) => {
|
|
const fixture = await releaseFixture({ config });
|
|
const candidates = await fixture.manifest.buildPullRequests();
|
|
expect(
|
|
fixture.requests.filter((request) =>
|
|
request.pathname.includes("/commits/"),
|
|
),
|
|
).toHaveLength(2);
|
|
expect(fixture.pages.every((page) => page.includeFiles === true)).toBe(true);
|
|
expect(candidates).toHaveLength(excluded ? 0 : 1);
|
|
});
|
|
|
|
it("collects beyond 500 commits and rejects an unobserved known release boundary", async () => {
|
|
const commits = Array.from({ length: 501 }, (_, index) => ({
|
|
sha: index.toString(16).padStart(40, "0"),
|
|
message: `fix: unreleased change ${index}`,
|
|
files: ["src/change.ts"],
|
|
}));
|
|
commits.push({
|
|
sha: baseline,
|
|
message: "chore: release 6.7.0",
|
|
files: ["package.json"],
|
|
});
|
|
const complete = await releaseFixture({ commits, depth: commits.length });
|
|
const candidates = await complete.manifest.buildPullRequests();
|
|
expect(candidates[0]?.body.toString()).toContain("unreleased change 500");
|
|
expect(complete.pages).toHaveLength(51);
|
|
expect(
|
|
complete.requests.filter((request) =>
|
|
request.pathname.includes("/commits/"),
|
|
),
|
|
).toEqual([]);
|
|
const truncated = await releaseFixture({ commits });
|
|
await expect(truncated.manifest.createPullRequests()).rejects.toThrow(
|
|
"Incomplete release history",
|
|
);
|
|
expect(
|
|
truncated.requests.every(
|
|
(request) => request.method === "GET" || request.pathname === "/graphql",
|
|
),
|
|
).toBe(true);
|
|
});
|
|
|
|
it("rejects a missing manifest release before replaying a historical version override", async () => {
|
|
const fixture = await releaseFixture({
|
|
releasedVersions: { ".": "6.8.0" },
|
|
releases: [releaseRecord("6.7.0", "d".repeat(40))],
|
|
commits: [
|
|
{ sha: latest, message: "fix: current change", files: ["src/change.ts"] },
|
|
{
|
|
sha: baseline,
|
|
message: "chore: release 6.8.0",
|
|
files: ["package.json"],
|
|
},
|
|
{
|
|
sha: "c".repeat(40),
|
|
message: "fix: historical version override\n\nRelease-As: 0.4.0",
|
|
files: ["src/historical.ts"],
|
|
},
|
|
],
|
|
});
|
|
await expect(fixture.manifest.createPullRequests()).rejects.toThrow(
|
|
"Missing expected release",
|
|
);
|
|
expect(fixture.pages).toEqual([]);
|
|
expect(
|
|
fixture.requests.every(
|
|
(request) => request.method === "GET" || request.pathname === "/graphql",
|
|
),
|
|
).toBe(true);
|
|
});
|
|
|
|
it("uses a tag-only manifest release and excludes older version overrides", async () => {
|
|
const fixture = await releaseFixture({
|
|
releasedVersions: { ".": "6.8.0" },
|
|
releases: [],
|
|
tags: [{ name: "rea-agents-6.8.0", commit: { sha: baseline } }],
|
|
commits: [
|
|
{ sha: latest, message: "fix: current change", files: ["src/change.ts"] },
|
|
{
|
|
sha: baseline,
|
|
message: "chore: release 6.8.0",
|
|
files: ["package.json"],
|
|
},
|
|
{
|
|
sha: "c".repeat(40),
|
|
message: "fix: historical version override\n\nRelease-As: 0.4.0",
|
|
files: ["src/historical.ts"],
|
|
},
|
|
],
|
|
});
|
|
const candidates = await fixture.manifest.buildPullRequests();
|
|
expect(candidates).toHaveLength(1);
|
|
expect(candidates[0]?.body.toString()).toContain("current change");
|
|
expect(candidates[0]?.body.toString()).not.toContain(
|
|
"historical version override",
|
|
);
|
|
const version = candidates[0]?.updates.find(
|
|
(update) => update.path === "version.txt",
|
|
);
|
|
expect(
|
|
version?.updater.updateContent("6.8.0 // x-release-please-version"),
|
|
).toContain("6.9.0");
|
|
expect(
|
|
fixture.requests.some(
|
|
(request) => request.pathname === "/repos/fixture/rea/tags",
|
|
),
|
|
).toBe(true);
|
|
});
|
|
|
|
it("recuts the abandoned patch from the last published manifest version", async () => {
|
|
const fixture = await releaseFixture({
|
|
releasedVersions: { ".": "6.10.0" },
|
|
releases: [releaseRecord("6.10.0")],
|
|
commits: [
|
|
{
|
|
sha: latest,
|
|
message:
|
|
"fix(release): restore the previous manifest\n\nRelease-As: 6.10.1",
|
|
files: [".release-please-manifest.json"],
|
|
},
|
|
{
|
|
sha: "b".repeat(40),
|
|
message: "fix: correct candidate regression",
|
|
files: ["src/change.ts"],
|
|
},
|
|
{
|
|
sha: "c".repeat(40),
|
|
message: "chore(main): release rea-agents 6.10.1",
|
|
files: [".release-please-manifest.json"],
|
|
},
|
|
{
|
|
sha: baseline,
|
|
message: "chore(main): release rea-agents 6.10.0",
|
|
files: [".release-please-manifest.json"],
|
|
},
|
|
],
|
|
});
|
|
const [candidate] = await fixture.manifest.buildPullRequests();
|
|
expect(candidate?.body.toString()).toContain("correct candidate regression");
|
|
const version = candidate?.updates.find(
|
|
(update) => update.path === "version.txt",
|
|
);
|
|
expect(
|
|
version?.updater.updateContent("6.10.0 // x-release-please-version"),
|
|
).toContain("6.10.1");
|
|
});
|
|
|
|
it.each(["omitted", "0.0.0"])(
|
|
"preserves initial bootstrap with an %s manifest version",
|
|
async (version) => {
|
|
const releasedVersions: Record<string, string> =
|
|
version === "omitted" ? {} : { ".": version };
|
|
const fixture = await releaseFixture({
|
|
releasedVersions,
|
|
releases: [],
|
|
commits: [
|
|
{
|
|
sha: latest,
|
|
message: "feat: initial change",
|
|
files: ["src/change.ts"],
|
|
},
|
|
],
|
|
});
|
|
const candidates = await fixture.manifest.buildPullRequests();
|
|
expect(candidates).toHaveLength(1);
|
|
const versionUpdate = candidates[0]?.updates.find(
|
|
(update) => update.path === "version.txt",
|
|
);
|
|
expect(
|
|
versionUpdate?.updater.updateContent("0.0.0 // x-release-please-version"),
|
|
).toContain("1.0.0");
|
|
},
|
|
);
|
|
|
|
it.each([
|
|
{
|
|
name: "timestamped GraphQL internal error",
|
|
error: internalError,
|
|
status: 200,
|
|
},
|
|
{
|
|
name: "GraphQL internal error without timestamp",
|
|
error: {
|
|
message:
|
|
"Something went wrong while executing your query. Please include `fixture:request` when reporting this issue.",
|
|
},
|
|
status: 200,
|
|
},
|
|
{ name: "HTTP 502 error", error: internalError, status: 502 },
|
|
{ name: "transport disconnect", error: internalError, disconnect: true },
|
|
{
|
|
name: "HTTP 504 HTML error",
|
|
error: internalError,
|
|
status: 504,
|
|
html: "<!DOCTYPE html><html><title>Unicorn!</title></html>",
|
|
},
|
|
])(
|
|
"retries the same history cursor after $name and discards partial data",
|
|
async ({ error, status, html, disconnect }) => {
|
|
const sleep = vi
|
|
.spyOn(githubRuntime, "sleepInMs")
|
|
.mockResolvedValue(undefined);
|
|
const commits = Array.from({ length: 11 }, (_, index) => ({
|
|
sha: index.toString(16).padStart(40, "0"),
|
|
message: `fix: unreleased change ${index}`,
|
|
files: ["src/change.ts"],
|
|
}));
|
|
commits.push({ sha: baseline, message: "chore: release 6.7.0", files: [] });
|
|
const fixture = await releaseFixture({
|
|
commits,
|
|
historyFailures: [
|
|
{
|
|
cursor: "10",
|
|
errors: [error],
|
|
...(status === undefined ? {} : { status }),
|
|
...(disconnect === undefined ? {} : { disconnect }),
|
|
...(html === undefined ? {} : { html }),
|
|
},
|
|
],
|
|
});
|
|
const candidates = await fixture.manifest.buildPullRequests();
|
|
const body = candidates[0]?.body.toString();
|
|
expect(body?.match(/unreleased change 10/gu)).toHaveLength(1);
|
|
expect(fixture.pages.map((page) => page.cursor)).toEqual([
|
|
undefined,
|
|
"10",
|
|
"10",
|
|
]);
|
|
expect(fixture.pages[2]).toEqual({ ...fixture.pages[1], num: 5 });
|
|
expect(fixture.historyQueries[1]).toBe(fixture.historyQueries[2]);
|
|
expect(sleep.mock.calls).toEqual([[1000]]);
|
|
},
|
|
);
|
|
|
|
it("does not retry canonical internal errors outside commit-history reads", async () => {
|
|
const sleep = vi
|
|
.spyOn(githubRuntime, "sleepInMs")
|
|
.mockResolvedValue(undefined);
|
|
const fixture = await releaseFixture({ releaseFailures: [[internalError]] });
|
|
await expect(fixture.manifest.createPullRequests()).rejects.toMatchObject({
|
|
name: "GraphqlResponseError",
|
|
errors: [internalError],
|
|
});
|
|
expect(fixture.pages).toEqual([]);
|
|
expect(
|
|
fixture.requests.filter((request) => request.pathname === "/graphql"),
|
|
).toHaveLength(1);
|
|
expect(sleep).not.toHaveBeenCalled();
|
|
});
|
|
|
|
it.each([
|
|
{
|
|
name: "permission",
|
|
errors: [{ message: "Resource not accessible", type: "FORBIDDEN" }],
|
|
},
|
|
{
|
|
name: "validation",
|
|
errors: [
|
|
{ message: "Field does not exist", type: "GRAPHQL_VALIDATION_FAILED" },
|
|
],
|
|
},
|
|
{
|
|
name: "mixed",
|
|
errors: [
|
|
internalError,
|
|
{ message: "Resource not accessible", type: "FORBIDDEN" },
|
|
],
|
|
},
|
|
{
|
|
name: "unrecognized internal",
|
|
errors: [{ message: "Another server failure", type: "INTERNAL" }],
|
|
},
|
|
{ name: "empty errors", errors: [] },
|
|
])("does not retry $name GraphQL failures", async ({ errors }) => {
|
|
const sleep = vi
|
|
.spyOn(githubRuntime, "sleepInMs")
|
|
.mockResolvedValue(undefined);
|
|
const fixture = await releaseFixture({ historyFailures: [{ errors }] });
|
|
await expect(fixture.manifest.createPullRequests()).rejects.toMatchObject({
|
|
name: "GraphqlResponseError",
|
|
errors,
|
|
});
|
|
expect(fixture.pages).toHaveLength(1);
|
|
expect(sleep).not.toHaveBeenCalled();
|
|
expect(
|
|
fixture.requests.every(
|
|
(request) => request.method === "GET" || request.pathname === "/graphql",
|
|
),
|
|
).toBe(true);
|
|
});
|
|
|
|
it("does not mistake an HTTP 500 response for a history transport disconnect", async () => {
|
|
const sleep = vi
|
|
.spyOn(githubRuntime, "sleepInMs")
|
|
.mockResolvedValue(undefined);
|
|
const fixture = await releaseFixture({
|
|
historyFailures: [{ errors: [], html: "other side closed", status: 500 }],
|
|
});
|
|
await expect(fixture.manifest.buildPullRequests()).rejects.toMatchObject({
|
|
status: 500,
|
|
message: "other side closed",
|
|
});
|
|
expect(fixture.pages).toHaveLength(1);
|
|
expect(sleep).not.toHaveBeenCalled();
|
|
});
|
|
|
|
it("exhausts bounded history retries without creating a partial proposal", async () => {
|
|
const sleep = vi
|
|
.spyOn(githubRuntime, "sleepInMs")
|
|
.mockResolvedValue(undefined);
|
|
const fixture = await releaseFixture({
|
|
historyFailures: Array.from({ length: 6 }, () => ({
|
|
errors: [internalError],
|
|
})),
|
|
});
|
|
await expect(fixture.manifest.createPullRequests()).rejects.toMatchObject({
|
|
name: "GraphqlResponseError",
|
|
errors: [internalError],
|
|
});
|
|
expect(fixture.pages).toHaveLength(6);
|
|
expect(fixture.pages.every((page) => page.cursor === undefined)).toBe(true);
|
|
expect(sleep.mock.calls).toEqual([[1000], [2000], [4000], [8000], [16000]]);
|
|
expect(
|
|
fixture.requests.every(
|
|
(request) => request.method === "GET" || request.pathname === "/graphql",
|
|
),
|
|
).toBe(true);
|
|
});
|
|
|
|
it("preserves a reached explicit last-release override", async () => {
|
|
const fixture = await releaseFixture({
|
|
config: { "last-release-sha": latest },
|
|
});
|
|
await expect(fixture.manifest.buildPullRequests()).resolves.toEqual([]);
|
|
});
|
|
|
|
it("preserves complete mixed bootstrap history with all known release boundaries", async () => {
|
|
const fixture = await releaseFixture({
|
|
releasedVersions: { ".": "6.7.0", pkg: "0.0.0" },
|
|
config: {
|
|
packages: {
|
|
".": { "package-name": "rea-agents" },
|
|
pkg: { "package-name": "unreleased" },
|
|
},
|
|
},
|
|
});
|
|
await expect(fixture.manifest.buildPullRequests()).resolves.toHaveLength(1);
|
|
});
|
|
|
|
it("requires complete local history when sizing the upstream search", async () => {
|
|
const directory = await createTestTempDirectory("rea-release-depth-");
|
|
await execute("git", ["init", "--quiet", directory]);
|
|
await execute("git", [
|
|
"-C",
|
|
directory,
|
|
"-c",
|
|
"user.name=Test",
|
|
"-c",
|
|
"user.email=test@example.com",
|
|
"commit",
|
|
"--quiet",
|
|
"--allow-empty",
|
|
"-m",
|
|
"fixture",
|
|
]);
|
|
const run = async (command: string, args: string[]) =>
|
|
(await execute(command, args, { cwd: directory })).stdout;
|
|
const head = (await run("git", ["rev-parse", "HEAD"])).trim();
|
|
await expect(releaseProposalSearchDepth(run, head)).resolves.toBe(1);
|
|
await writeFile(join(directory, ".git/shallow"), `${head}\n`);
|
|
await expect(releaseProposalSearchDepth(run, head)).rejects.toThrow(
|
|
"complete Git history",
|
|
);
|
|
});
|
|
|
|
const releasePatchFixture = async (outsideProject = false) => {
|
|
const root = await createTestTempDirectory("rea-release-git-patch-");
|
|
const project = join(root, "project space Ω");
|
|
const dependencies = join(project, "node_modules");
|
|
const directory = outsideProject
|
|
? join(root, "release dependency space Ω")
|
|
: join(dependencies, "release-please");
|
|
const upstreamDirectory = dirname(
|
|
require.resolve("release-please/package.json"),
|
|
);
|
|
const source = fileURLToPath(new URL("../../../", import.meta.url));
|
|
const patchPath = join(project, "patches/release-please+17.11.2.patch");
|
|
const patch = await readFile(
|
|
join(source, "patches/release-please+17.11.2.patch"),
|
|
"utf8",
|
|
);
|
|
const members = [...patch.matchAll(/^\+\+\+ b\/(.+)$/gmu)].map((match) => {
|
|
const member = match[1];
|
|
if (member === undefined) throw new Error("Patch header omitted its path");
|
|
return member;
|
|
});
|
|
await mkdir(dirname(patchPath), { recursive: true });
|
|
await mkdir(dependencies, { recursive: true });
|
|
await mkdir(directory, { recursive: true });
|
|
if (outsideProject)
|
|
await symlink(directory, join(dependencies, "release-please"), "junction");
|
|
await writeFile(join(project, "package.json"), '{"type":"module"}');
|
|
await writeFile(patchPath, patch);
|
|
await copyScriptsWithImports(
|
|
["scripts/lib/release-proposal.mjs"],
|
|
project,
|
|
source,
|
|
);
|
|
for (const dependency of ["markdown-it", "semver", "zod"])
|
|
await symlink(
|
|
dirname(require.resolve(`${dependency}/package.json`)),
|
|
join(dependencies, dependency),
|
|
"junction",
|
|
);
|
|
for (const member of ["package.json", ...members]) {
|
|
await mkdir(dirname(join(directory, member)), { recursive: true });
|
|
await copyFile(join(upstreamDirectory, member), join(directory, member));
|
|
}
|
|
const environment = {
|
|
...process.env,
|
|
GIT_CONFIG_COUNT: "1",
|
|
GIT_CONFIG_KEY_0: "core.protectNTFS",
|
|
GIT_CONFIG_VALUE_0: "true",
|
|
};
|
|
const git = (...args: string[]) =>
|
|
execute("git", args, { cwd: directory, env: environment });
|
|
// Installation owns the patched dependency. Reverse only the private copy
|
|
// to obtain the exact upstream input for the fresh-application control.
|
|
await git("apply", "--reverse", patchPath);
|
|
const apply = () =>
|
|
execute(
|
|
process.execPath,
|
|
[
|
|
"--input-type=module",
|
|
"-e",
|
|
`import { applyReleasePleasePatch } from ${JSON.stringify(pathToFileURL(join(project, "scripts/lib/release-proposal.mjs")).href)}; await applyReleasePleasePatch();`,
|
|
],
|
|
{ cwd: project, env: environment, timeout: 10_000 },
|
|
);
|
|
const contents = () =>
|
|
Promise.all(
|
|
members.map((member) => readFile(join(directory, member), "utf8")),
|
|
);
|
|
return { directory, apply, contents, git, patchPath };
|
|
};
|
|
|
|
it.each([
|
|
{ location: "inside the checkout", outsideProject: false },
|
|
{ location: "outside the checkout", outsideProject: true },
|
|
])(
|
|
"applies the private dependency patch $location and is idempotent",
|
|
async ({ outsideProject }) => {
|
|
const fixture = await releasePatchFixture(outsideProject);
|
|
const original = await fixture.contents();
|
|
await fixture.apply();
|
|
const patched = await fixture.contents();
|
|
expect(patched).not.toEqual(original);
|
|
expect(patched.join("\n")).toContain("const rootOnlyNode =");
|
|
await fixture.git("apply", "--check", "--reverse", fixture.patchPath);
|
|
await fixture.apply();
|
|
expect(await fixture.contents()).toEqual(patched);
|
|
},
|
|
);
|
|
|
|
it("rejects a different dependency version before patching", async () => {
|
|
const fixture = await createTestTempDirectory("rea-release-patch-");
|
|
await writeFile(
|
|
join(fixture, "package.json"),
|
|
JSON.stringify({ version: "17.4.0" }),
|
|
);
|
|
await expect(applyReleasePleasePatch(fixture)).rejects.toThrow(
|
|
"requires release-please 17.11.2",
|
|
);
|
|
});
|
|
|
|
it.each(["partial", "mismatched"])(
|
|
"rejects a %s private dependency patch without changing its files",
|
|
async (state) => {
|
|
const fixture = await releasePatchFixture();
|
|
const manifest = join(fixture.directory, "build/src/manifest.js");
|
|
const original = await readFile(manifest, "utf8");
|
|
await fixture.apply();
|
|
const patched = await readFile(manifest, "utf8");
|
|
await writeFile(
|
|
manifest,
|
|
state === "partial"
|
|
? original
|
|
: patched.replace(
|
|
"const rootOnlyNode =",
|
|
"const mismatchedRootOnlyNode =",
|
|
),
|
|
);
|
|
const before = await fixture.contents();
|
|
await expect(fixture.apply()).rejects.toThrow(
|
|
"does not match the installed source",
|
|
);
|
|
expect(await fixture.contents()).toEqual(before);
|
|
},
|
|
);
|