build(deps): bump jest to 29.7.0 (#166)

Signed-off-by: Andrea Lamparelli <a.lamparelli95@gmail.com>
This commit is contained in:
Andrea Lamparelli
2025-11-17 17:45:43 +01:00
committed by GitHub
parent 179191633c
commit a31f1f1976
6 changed files with 1392 additions and 1225 deletions

2
dist/cli/index.js vendored
View File

@@ -25712,7 +25712,7 @@ module.exports = axios;
/***/ ((module) => {
"use strict";
module.exports = JSON.parse('{"name":"@kie/git-backporting","version":"4.8.6","description":"Git backporting is a tool to execute automatic pull request git backporting.","author":"","license":"MIT","private":false,"main":"./dist/gha/index.js","bin":{"git-backporting":"./dist/cli/index.js"},"files":["dist/cli/index.js"],"publishConfig":{"access":"public"},"scripts":{"prepare":"husky install","clean":"rm -rf ./build ./dist","compile":"tsc -p tsconfig.json && tsc-alias -p tsconfig.json","package":"npm run package:cli && npm run package:gha","package:cli":"ncc build ./build/src/bin/cli.js -o dist/cli","package:gha":"ncc build ./build/src/bin/gha.js -o dist/gha","build":"npm run clean && npm run compile && npm run package","test":"jest --silent","test:report":"npm test -- --coverage --testResultsProcessor=jest-sonar-reporter","lint":"eslint . --ext .ts","lint:fix":"npm run lint -- --fix","ts-node":"ts-node","postversion":"npm run build && git add dist && rm -rf build","release":"release-it","release:branch":"git checkout -b release/$(release-it --release-version) main","release:prepare":"release-it --no-npm.publish --no-github.release --no-git.push --no-git.tag --no-git.requireUpstream","release:prepare:all":"npm run release:branch && npm run release:prepare"},"repository":{"type":"git","url":"git+https://github.com/kiegroup/git-backporting.git"},"keywords":["backporting","pull-requests","merge-requests","github-action","cherry-pick"],"bugs":{"url":"https://github.com/kiegroup/git-backporting/issues"},"homepage":"https://github.com/kiegroup/git-backporting#readme","devDependencies":{"@commitlint/cli":"^17.4.0","@commitlint/config-conventional":"^17.4.0","@gitbeaker/rest":"^39.1.0","@kie/mock-github":"^1.1.0","@octokit/webhooks-types":"^6.8.0","@release-it/conventional-changelog":"^10.0.0","@types/fs-extra":"^9.0.13","@types/jest":"^29.2.4","@types/node":"^18.11.17","@typescript-eslint/eslint-plugin":"^5.47.0","@typescript-eslint/parser":"^5.47.0","@vercel/ncc":"^0.36.0","eslint":"^8.30.0","husky":"^8.0.2","jest":"^29.0.0","jest-sonar-reporter":"^2.0.0","release-it":"^19.0.2","semver":"^7.3.8","ts-jest":"^29.0.0","ts-node":"^10.8.1","tsc-alias":"^1.8.2","tsconfig-paths":"^4.1.0","typescript":"^4.9.3"},"dependencies":{"@actions/core":"^1.10.0","@octokit/rest":"^18.12.0","axios":"^1.4.0","commander":"^9.3.0","fs-extra":"^11.1.0","https":"^1.0.0","simple-git":"^3.15.1"}}');
module.exports = JSON.parse('{"name":"@kie/git-backporting","version":"4.8.6","description":"Git backporting is a tool to execute automatic pull request git backporting.","author":"","license":"MIT","private":false,"main":"./dist/gha/index.js","bin":{"git-backporting":"./dist/cli/index.js"},"files":["dist/cli/index.js"],"publishConfig":{"access":"public"},"scripts":{"prepare":"husky install","clean":"rm -rf ./build ./dist","compile":"tsc -p tsconfig.json && tsc-alias -p tsconfig.json","package":"npm run package:cli && npm run package:gha","package:cli":"ncc build ./build/src/bin/cli.js -o dist/cli","package:gha":"ncc build ./build/src/bin/gha.js -o dist/gha","build":"npm run clean && npm run compile && npm run package","test":"jest --silent","test:report":"npm test -- --coverage --testResultsProcessor=jest-sonar-reporter","lint":"eslint . --ext .ts","lint:fix":"npm run lint -- --fix","ts-node":"ts-node","postversion":"npm run build && git add dist && rm -rf build","release":"release-it","release:branch":"git checkout -b release/$(release-it --release-version) main","release:prepare":"release-it --no-npm.publish --no-github.release --no-git.push --no-git.tag --no-git.requireUpstream","release:prepare:all":"npm run release:branch && npm run release:prepare"},"repository":{"type":"git","url":"git+https://github.com/kiegroup/git-backporting.git"},"keywords":["backporting","pull-requests","merge-requests","github-action","cherry-pick"],"bugs":{"url":"https://github.com/kiegroup/git-backporting/issues"},"homepage":"https://github.com/kiegroup/git-backporting#readme","devDependencies":{"@commitlint/cli":"^17.4.0","@commitlint/config-conventional":"^17.4.0","@gitbeaker/rest":"^39.1.0","@kie/mock-github":"^1.1.0","@octokit/webhooks-types":"^6.8.0","@release-it/conventional-changelog":"^10.0.0","@types/fs-extra":"^9.0.13","@types/jest":"^29.2.4","@types/node":"^18.11.17","@typescript-eslint/eslint-plugin":"^5.47.0","@typescript-eslint/parser":"^5.47.0","@vercel/ncc":"^0.36.0","eslint":"^8.30.0","husky":"^8.0.2","jest":"^29.7.0","jest-sonar-reporter":"^2.0.0","release-it":"^19.0.2","semver":"^7.3.8","ts-jest":"^29.4.5","ts-node":"^10.8.1","tsc-alias":"^1.8.2","tsconfig-paths":"^4.1.0","typescript":"^4.9.3"},"dependencies":{"@actions/core":"^1.10.0","@octokit/rest":"^18.12.0","axios":"^1.4.0","commander":"^9.3.0","fs-extra":"^11.1.0","https":"^1.0.0","simple-git":"^3.15.1"}}');
/***/ }),

View File

@@ -9,7 +9,8 @@ const jestConfig: Config.InitialOptions = {
"^@bp/(.*)$": "<rootDir>/src/$1",
},
clearMocks: true,
resetMocks: true,
restoreMocks: false,
resetMocks: false,
modulePathIgnorePatterns: ["<rootDir>/build/", "<rootDir>/dist/"],
coveragePathIgnorePatterns: ["<rootDir>/node_modules/", "<rootDir>/test/", "<rootDir>/build/", "<rootDir>/dist/"]
};

2582
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -64,11 +64,11 @@
"@vercel/ncc": "^0.36.0",
"eslint": "^8.30.0",
"husky": "^8.0.2",
"jest": "^29.0.0",
"jest": "^29.7.0",
"jest-sonar-reporter": "^2.0.0",
"release-it": "^19.0.2",
"semver": "^7.3.8",
"ts-jest": "^29.0.0",
"ts-jest": "^29.4.5",
"ts-node": "^10.8.1",
"tsc-alias": "^1.8.2",
"tsconfig-paths": "^4.1.0",

View File

@@ -1075,8 +1075,7 @@ describe("cli runner", () => {
});
test("with multiple target branches and one failure", async () => {
jest.spyOn(GitHubClient.prototype, "createPullRequest").mockImplementation((_backport: BackportPullRequest) => {
const createPullRequestSpy = jest.spyOn(GitHubClient.prototype, "createPullRequest").mockImplementation((_backport: BackportPullRequest) => {
throw new Error("Mocked error");
});
@@ -1160,6 +1159,8 @@ describe("cli runner", () => {
});
expect(GitHubClient.prototype.createPullRequest).toThrowError();
expect(GitHubClient.prototype.createPullRequestComment).toBeCalledTimes(0);
createPullRequestSpy.mockReset();
});
test("auth using CODEBERG_TOKEN takes precedence over GIT_TOKEN env variable", async () => {
@@ -1237,7 +1238,7 @@ describe("cli runner", () => {
});
test("with multiple target branches, one failure and error notification enabled", async () => {
jest.spyOn(GitHubClient.prototype, "createPullRequest").mockImplementation((backport: BackportPullRequest) => {
const createPullRequestSpy = jest.spyOn(GitHubClient.prototype, "createPullRequest").mockImplementation((backport: BackportPullRequest) => {
throw new Error(`Mocked error: ${backport.base}`);
});
@@ -1325,10 +1326,12 @@ describe("cli runner", () => {
expect(GitHubClient.prototype.createPullRequestComment).toBeCalledWith("https://codeberg.org/api/v1/repos/owner/reponame/pulls/2368", "The backport to `v1` failed. Check the latest run for more details.");
expect(GitHubClient.prototype.createPullRequestComment).toBeCalledWith("https://codeberg.org/api/v1/repos/owner/reponame/pulls/2368", "The backport to `v2` failed. Check the latest run for more details.");
expect(GitHubClient.prototype.createPullRequestComment).toBeCalledWith("https://codeberg.org/api/v1/repos/owner/reponame/pulls/2368", "The backport to `v3` failed. Check the latest run for more details.");
createPullRequestSpy.mockReset();
});
test("with some failures and dry run enabled", async () => {
jest.spyOn(GitCLIService.prototype, "cherryPick").mockImplementation((cwd: string, sha: string) => {
const cherryPickSpy = jest.spyOn(GitCLIService.prototype, "cherryPick").mockImplementation((cwd: string, sha: string) => {
throw new Error(`Forced error: ${sha}`);
});
@@ -1372,5 +1375,7 @@ describe("cli runner", () => {
expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(0);
expect(GitHubClient.prototype.createPullRequestComment).toBeCalledTimes(0);
cherryPickSpy.mockReset();
});
});

View File

@@ -1075,8 +1075,7 @@ describe("cli runner", () => {
});
test("with multiple target branches and one failure", async () => {
jest.spyOn(GitHubClient.prototype, "createPullRequest").mockImplementation((_backport: BackportPullRequest) => {
const createPullRequestSpy = jest.spyOn(GitHubClient.prototype, "createPullRequest").mockImplementation((_backport: BackportPullRequest) => {
throw new Error("Mocked error");
});
@@ -1160,6 +1159,8 @@ describe("cli runner", () => {
});
expect(GitHubClient.prototype.createPullRequest).toThrowError();
expect(GitHubClient.prototype.createPullRequestComment).toBeCalledTimes(0);
createPullRequestSpy.mockReset();
});
test("auth using GITHUB_TOKEN takes precedence over GIT_TOKEN env variable", async () => {
@@ -1237,7 +1238,7 @@ describe("cli runner", () => {
});
test("with multiple target branches, one failure and error notification enabled", async () => {
jest.spyOn(GitHubClient.prototype, "createPullRequest").mockImplementation((backport: BackportPullRequest) => {
const createPullRequestSpy = jest.spyOn(GitHubClient.prototype, "createPullRequest").mockImplementation((backport: BackportPullRequest) => {
throw new Error(`Mocked error: ${backport.base}`);
});
@@ -1325,10 +1326,12 @@ describe("cli runner", () => {
expect(GitHubClient.prototype.createPullRequestComment).toBeCalledWith("https://api.github.com/repos/owner/reponame/pulls/2368", "The backport to `v1` failed. Check the latest run for more details.");
expect(GitHubClient.prototype.createPullRequestComment).toBeCalledWith("https://api.github.com/repos/owner/reponame/pulls/2368", "The backport to `v2` failed. Check the latest run for more details.");
expect(GitHubClient.prototype.createPullRequestComment).toBeCalledWith("https://api.github.com/repos/owner/reponame/pulls/2368", "The backport to `v3` failed. Check the latest run for more details.");
createPullRequestSpy.mockReset();
});
test("with some failures and dry run enabled", async () => {
jest.spyOn(GitCLIService.prototype, "cherryPick").mockImplementation((cwd: string, sha: string) => {
const cherryPickSpy = jest.spyOn(GitCLIService.prototype, "cherryPick").mockImplementation((cwd: string, sha: string) => {
throw new Error(`Forced error: ${sha}`);
});
@@ -1372,5 +1375,7 @@ describe("cli runner", () => {
expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(0);
expect(GitHubClient.prototype.createPullRequestComment).toBeCalledTimes(0);
cherryPickSpy.mockReset();
});
});