mirror of
https://code.forgejo.org/actions/git-backporting.git
synced 2025-02-22 10:35:43 -05:00
test: fix process.argv reset during cli tests (#60)
This commit is contained in:
parent
49a7350406
commit
91782505ce
6 changed files with 15 additions and 18 deletions
2
dist/cli/index.js
vendored
2
dist/cli/index.js
vendored
|
@ -23396,7 +23396,7 @@ module.exports = axios;
|
|||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = JSON.parse('{"name":"@kie/git-backporting","version":"4.1.0","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","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","@release-it/conventional-changelog":"^5.1.1","@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":"^15.6.0","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","@octokit/webhooks-types":"^6.8.0"},"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.1.0","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","@release-it/conventional-changelog":"^5.1.1","@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":"^15.6.0","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","@octokit/webhooks-types":"^6.8.0"},"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"}}');
|
||||
|
||||
/***/ }),
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
"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",
|
||||
"test": "jest --silent",
|
||||
"test:report": "npm test -- --coverage --testResultsProcessor=jest-sonar-reporter",
|
||||
"lint": "eslint . --ext .ts",
|
||||
"lint:fix": "npm run lint -- --fix",
|
||||
|
|
|
@ -44,11 +44,11 @@ describe("cli args parser", () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
// create a fresh new instance every time
|
||||
parser = new CLIArgsParser();
|
||||
|
||||
// reset process.env variables
|
||||
resetProcessArgs();
|
||||
|
||||
// create a fresh new instance every time
|
||||
parser = new CLIArgsParser();
|
||||
});
|
||||
|
||||
test("valid execution [default, short]", () => {
|
||||
|
|
|
@ -63,11 +63,12 @@ describe("github pull request config parser", () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
mockGitHubClient("http://localhost/api/v3");
|
||||
|
||||
// reset process.env variables
|
||||
resetProcessArgs();
|
||||
|
||||
// mock octokit
|
||||
mockGitHubClient("http://localhost/api/v3");
|
||||
|
||||
// create a fresh new instance every time
|
||||
argsParser = new CLIArgsParser();
|
||||
configParser = new PullRequestConfigsParser();
|
||||
|
|
|
@ -45,6 +45,10 @@ afterAll(() => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
// reset process.env variables
|
||||
resetProcessArgs();
|
||||
|
||||
// mock octokit
|
||||
mockGitHubClient();
|
||||
|
||||
// create CLI arguments parser
|
||||
|
@ -54,11 +58,6 @@ beforeEach(() => {
|
|||
runner = new Runner(parser);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// reset process.env variables
|
||||
resetProcessArgs();
|
||||
});
|
||||
|
||||
describe("cli runner", () => {
|
||||
|
||||
test("with dry run", async () => {
|
||||
|
|
|
@ -60,6 +60,9 @@ afterAll(() => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
// reset process.env variables
|
||||
resetProcessArgs();
|
||||
|
||||
// create CLI arguments parser
|
||||
parser = new CLIArgsParser();
|
||||
|
||||
|
@ -67,13 +70,7 @@ beforeEach(() => {
|
|||
runner = new Runner(parser);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// reset process.env variables
|
||||
resetProcessArgs();
|
||||
});
|
||||
|
||||
describe("cli runner", () => {
|
||||
|
||||
test("with dry run", async () => {
|
||||
addProcessArgs([
|
||||
"-d",
|
||||
|
|
Loading…
Add table
Reference in a new issue