feat(issue-54): backport pr commits without squash (#55)

* feat(issue-54): backport pr commits without squash

fix https://github.com/kiegroup/git-backporting/issues/54

* feat(issue-54): fixed readme
This commit is contained in:
Andrea Lamparelli 2023-07-11 11:22:01 +02:00 committed by GitHub
parent a737aa7c4c
commit c4dbb26c1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 990 additions and 145 deletions

View file

@ -48,10 +48,6 @@ describe("gha args parser", () => {
parser = new GHAArgsParser();
});
afterEach(() => {
jest.clearAllMocks();
});
test("valid execution [default]", () => {
spyGetInput({
"target-branch": "target",
@ -73,6 +69,7 @@ describe("gha args parser", () => {
expect(args.inheritReviewers).toEqual(true);
expect(args.labels).toEqual([]);
expect(args.inheritLabels).toEqual(false);
expect(args.squash).toEqual(true);
});
test("valid execution [override]", () => {
@ -111,6 +108,7 @@ describe("gha args parser", () => {
expect(args.inheritReviewers).toEqual(false);
expectArrayEqual(args.labels!, ["cherry-pick :cherries:", "another spaced label"]);
expect(args.inheritLabels).toEqual(true);
expect(args.squash).toEqual(true);
});
test("using config file", () => {
@ -135,6 +133,7 @@ describe("gha args parser", () => {
expect(args.inheritReviewers).toEqual(true);
expectArrayEqual(args.labels!, []);
expect(args.inheritLabels).toEqual(false);
expect(args.squash).toEqual(true);
});
test("ignore custom options when using config file", () => {
@ -174,5 +173,31 @@ describe("gha args parser", () => {
expect(args.inheritReviewers).toEqual(true);
expectArrayEqual(args.labels!, ["cherry-pick :cherries:"]);
expect(args.inheritLabels).toEqual(true);
expect(args.squash).toEqual(true);
});
test("override squash to false", () => {
spyGetInput({
"target-branch": "target",
"pull-request": "https://localhost/whatever/pulls/1",
"no-squash": "true",
});
const args: Args = parser.parse();
expect(args.dryRun).toEqual(false);
expect(args.auth).toEqual(undefined);
expect(args.gitUser).toEqual(undefined);
expect(args.gitEmail).toEqual(undefined);
expect(args.folder).toEqual(undefined);
expect(args.targetBranch).toEqual("target");
expect(args.pullRequest).toEqual("https://localhost/whatever/pulls/1");
expect(args.title).toEqual(undefined);
expect(args.body).toEqual(undefined);
expect(args.reviewers).toEqual([]);
expect(args.assignees).toEqual([]);
expect(args.inheritReviewers).toEqual(true);
expect(args.labels).toEqual([]);
expect(args.inheritLabels).toEqual(false);
expect(args.squash).toEqual(false);
});
});