Skip to content

Commit

Permalink
Fix jest snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenlouv committed Oct 16, 2023
1 parent 4671760 commit a8e561d
Show file tree
Hide file tree
Showing 10 changed files with 699 additions and 560 deletions.
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 +89,29 @@
"@types/core-js": "^2.5.5",
"@types/dedent": "^0.7.0",
"@types/inquirer": "^8.2.6",
"@types/jest": "^29.5.4",
"@types/lodash": "^4.14.197",
"@types/node": "^20.5.4",
"@types/safe-json-stringify": "^1.1.2",
"@types/yargs": "^17.0.24",
"@types/yargs-parser": "^21.0.0",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
"eslint": "^8.47.0",
"@types/jest": "^29.5.5",
"@types/lodash": "^4.14.199",
"@types/node": "^20.8.6",
"@types/safe-json-stringify": "^1.1.3",
"@types/yargs": "^17.0.28",
"@types/yargs-parser": "^21.0.1",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-prettier": "^5.0.0",
"graphql-config": "^5.0.2",
"eslint-plugin-jest": "^27.4.2",
"eslint-plugin-prettier": "^5.0.1",
"graphql-config": "^5.0.3",
"husky": "^8.0.3",
"jest": "^29.6.4",
"jest": "^29.7.0",
"jest-snapshot-serializer-ansi": "^1.0.0",
"lint-staged": "^14.0.1",
"nock": "^13.3.3",
"prettier": "^3.0.2",
"nock": "^13.3.4",
"prettier": "^3.0.3",
"strip-ansi": "^6.0.1",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "5.1.6"
"typescript": "5.2.2"
}
}
22 changes: 13 additions & 9 deletions src/test/e2e/cli/date-filters.private.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ describe('date filters (dateSince, dateUntil)', () => {
);

expect(output).toMatchInlineSnapshot(`
"? Select commit (Use arrow keys)
❯ 1. Bump to 8.0.0
2. Add package.json
3. Update .backportrc.json
4. Create .backportrc.json"
`);
"repo: backport-org/backport-e2e • since: 2020-08-15T10:00:00.000Z • until: 2020-08-15T10:30:00.000Z
? Select commit (Use arrow keys)
❯ 1. Bump to 8.0.0
2. Add package.json
3. Update .backportrc.json
4. Create .backportrc.json"
`);
});

it('combined with --pr-filter', async () => {
Expand Down Expand Up @@ -52,9 +54,11 @@ describe('date filters (dateSince, dateUntil)', () => {
{ waitForString: 'Select commit' },
);
expect(output).toMatchInlineSnapshot(`
"? Select commit (Use arrow keys)
❯ 1. [APM] Add link to officials docs for APM UI settings (#113396) 7.x"
`);
"repo: elastic/kibana • autoMerge: true • since: 2021-09-20T00:00:00.000Z • until: 2021-10-01T00:00:00.000Z
? Select commit (Use arrow keys)
❯ 1. [APM] Add link to officials docs for APM UI settings (#113396) 7.x"
`);
expect(output).toEqual(outputFromPrFilter);
});
});
198 changes: 102 additions & 96 deletions src/test/e2e/cli/different-merge-strategies.private.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,30 @@ describe('different-merge-strategies', () => {
);

expect(output).toMatchInlineSnapshot(`
"? Select commit (Use arrow keys)
❯ 1. Downsides with "Rebase and merge"
2. Add description for "Rebase and merge"
3. Add "Rebase and merge" header
4. Create rebase-and-merge.txt
5. Merge pull request #9 from backport-org/many-merge-commits 7.x
6. Merge strategy: Eighth of many merges 7.x
7. Merge strategy: Seventh of many merges 7.x
8. Merge strategy: Sixth of many merges 7.x
9. Merge strategy: Fifth of many merges 7.x
10.Merge strategy: Fourth of many merges 7.x
11.Merge strategy: Third of many merges 7.x
12.Merge strategy: Second of many merges 7.x
13.Merge strategy: First of many merges 7.x
14.Using squash to merge commits (#3)
15.Rebase strategy: Second commit
16.Rebase strategy: First commit
17.Merge pull request #1 from backport-org/merge-strategy
18.Merge strategy: Second commit
19.Merge strategy: First commit
20.Initial commit"
`);
"repo: backport-org/different-merge-strategies • maxNumber: 20
? Select commit (Use arrow keys)
❯ 1. Downsides with "Rebase and merge"
2. Add description for "Rebase and merge"
3. Add "Rebase and merge" header
4. Create rebase-and-merge.txt
5. Merge pull request #9 from backport-org/many-merge-commits 7.x
6. Merge strategy: Eighth of many merges 7.x
7. Merge strategy: Seventh of many merges 7.x
8. Merge strategy: Sixth of many merges 7.x
9. Merge strategy: Fifth of many merges 7.x
10.Merge strategy: Fourth of many merges 7.x
11.Merge strategy: Third of many merges 7.x
12.Merge strategy: Second of many merges 7.x
13.Merge strategy: First of many merges 7.x
14.Using squash to merge commits (#3)
15.Rebase strategy: Second commit
16.Rebase strategy: First commit
17.Merge pull request #1 from backport-org/merge-strategy
18.Merge strategy: Second commit
19.Merge strategy: First commit
20.Initial commit"
`);
});

describe('when selecting a merge commit with eight commits', () => {
Expand All @@ -68,33 +70,35 @@ describe('different-merge-strategies', () => {

it('runs to completion without errors', () => {
expect(output).toMatchInlineSnapshot(`
"- Initializing...
? Select pull request Merge pull request #9 from backport-org/many-merge-commits
✔ 100% Cloning repository from github.com (one-time operation)
Backporting to 7.x:
- Pulling latest changes
✔ Pulling latest changes
- Cherry-picking: Merge strategy: First of many merges
✔ Cherry-picking: Merge strategy: First of many merges
- Cherry-picking: Merge strategy: Second of many merges
✔ Cherry-picking: Merge strategy: Second of many merges
- Cherry-picking: Merge strategy: Third of many merges
✔ Cherry-picking: Merge strategy: Third of many merges
- Cherry-picking: Merge strategy: Fourth of many merges
✔ Cherry-picking: Merge strategy: Fourth of many merges
- Cherry-picking: Merge strategy: Fifth of many merges
✔ Cherry-picking: Merge strategy: Fifth of many merges
- Cherry-picking: Merge strategy: Sixth of many merges
✔ Cherry-picking: Merge strategy: Sixth of many merges
- Cherry-picking: Merge strategy: Seventh of many merges
✔ Cherry-picking: Merge strategy: Seventh of many merges
- Cherry-picking: Merge strategy: Eighth of many merges
✔ Cherry-picking: Merge strategy: Eighth of many merges
- Creating pull request
✔ Creating pull request
View pull request: this-is-a-dry-run"
`);
"- Initializing...
repo: backport-org/different-merge-strategies • pullNumber: 9
? Select pull request Merge pull request #9 from backport-org/many-merge-commits
✔ 100% Cloning repository from github.com (one-time operation)
Backporting to 7.x:
- Pulling latest changes
✔ Pulling latest changes
- Cherry-picking: Merge strategy: First of many merges
✔ Cherry-picking: Merge strategy: First of many merges
- Cherry-picking: Merge strategy: Second of many merges
✔ Cherry-picking: Merge strategy: Second of many merges
- Cherry-picking: Merge strategy: Third of many merges
✔ Cherry-picking: Merge strategy: Third of many merges
- Cherry-picking: Merge strategy: Fourth of many merges
✔ Cherry-picking: Merge strategy: Fourth of many merges
- Cherry-picking: Merge strategy: Fifth of many merges
✔ Cherry-picking: Merge strategy: Fifth of many merges
- Cherry-picking: Merge strategy: Sixth of many merges
✔ Cherry-picking: Merge strategy: Sixth of many merges
- Cherry-picking: Merge strategy: Seventh of many merges
✔ Cherry-picking: Merge strategy: Seventh of many merges
- Cherry-picking: Merge strategy: Eighth of many merges
✔ Cherry-picking: Merge strategy: Eighth of many merges
- Creating pull request
✔ Creating pull request
View pull request: this-is-a-dry-run"
`);
});

it('backports all immediate children of the merge commit', async () => {
Expand Down Expand Up @@ -185,53 +189,55 @@ describe('different-merge-strategies', () => {

it('has the right output', async () => {
expect(output).toMatchInlineSnapshot(`
"- Initializing...
? Select pull request Merge pull request #9 from backport-org/many-merge-commits
✔ 100% Cloning repository from github.com (one-time operation)
Backporting to 7.1:
- Pulling latest changes
✔ Pulling latest changes
- Cherry-picking: Merge strategy: First of many merges
✖ Cherry-picking: Merge strategy: First of many merges
The commit could not be backported due to conflicts
Please fix the conflicts in <SANDBOX_PATH>
? Fix the following conflicts manually:
Conflicting files:
- <SANDBOX_PATH>/new-fi
le-added-with-many-merge-commits.txt
Press ENTER when the conflicts are resolved and files are staged (Y/n) ? Fix the following conflicts manually:
Conflicting files:
- <SANDBOX_PATH>/new-fi
le-added-with-many-merge-commits.txt
Press ENTER when the conflicts are resolved and files are staged Yes
✔ Cherry-picking: Merge strategy: First of many merges
- Cherry-picking: Merge strategy: Second of many merges
✔ Cherry-picking: Merge strategy: Second of many merges
- Cherry-picking: Merge strategy: Third of many merges
✔ Cherry-picking: Merge strategy: Third of many merges
- Cherry-picking: Merge strategy: Fourth of many merges
✔ Cherry-picking: Merge strategy: Fourth of many merges
- Cherry-picking: Merge strategy: Fifth of many merges
✔ Cherry-picking: Merge strategy: Fifth of many merges
- Cherry-picking: Merge strategy: Sixth of many merges
✔ Cherry-picking: Merge strategy: Sixth of many merges
- Cherry-picking: Merge strategy: Seventh of many merges
✔ Cherry-picking: Merge strategy: Seventh of many merges
- Cherry-picking: Merge strategy: Eighth of many merges
✔ Cherry-picking: Merge strategy: Eighth of many merges
- Creating pull request
✔ Creating pull request
View pull request: this-is-a-dry-run"
`);
"- Initializing...
repo: backport-org/different-merge-strategies • pullNumber: 9
? Select pull request Merge pull request #9 from backport-org/many-merge-commits
✔ 100% Cloning repository from github.com (one-time operation)
Backporting to 7.1:
- Pulling latest changes
✔ Pulling latest changes
- Cherry-picking: Merge strategy: First of many merges
✖ Cherry-picking: Merge strategy: First of many merges
The commit could not be backported due to conflicts
Please fix the conflicts in <SANDBOX_PATH>
? Fix the following conflicts manually:
Conflicting files:
- <SANDBOX_PATH>/new-fi
le-added-with-many-merge-commits.txt
Press ENTER when the conflicts are resolved and files are staged (Y/n) ? Fix the following conflicts manually:
Conflicting files:
- <SANDBOX_PATH>/new-fi
le-added-with-many-merge-commits.txt
Press ENTER when the conflicts are resolved and files are staged Yes
✔ Cherry-picking: Merge strategy: First of many merges
- Cherry-picking: Merge strategy: Second of many merges
✔ Cherry-picking: Merge strategy: Second of many merges
- Cherry-picking: Merge strategy: Third of many merges
✔ Cherry-picking: Merge strategy: Third of many merges
- Cherry-picking: Merge strategy: Fourth of many merges
✔ Cherry-picking: Merge strategy: Fourth of many merges
- Cherry-picking: Merge strategy: Fifth of many merges
✔ Cherry-picking: Merge strategy: Fifth of many merges
- Cherry-picking: Merge strategy: Sixth of many merges
✔ Cherry-picking: Merge strategy: Sixth of many merges
- Cherry-picking: Merge strategy: Seventh of many merges
✔ Cherry-picking: Merge strategy: Seventh of many merges
- Cherry-picking: Merge strategy: Eighth of many merges
✔ Cherry-picking: Merge strategy: Eighth of many merges
- Creating pull request
✔ Creating pull request
View pull request: this-is-a-dry-run"
`);
});

it('backports all immediate children of the merge commit', async () => {
Expand Down
62 changes: 34 additions & 28 deletions src/test/e2e/cli/entrypoint.cli.private.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,20 @@ Or contact me directly: "
);

expect(output).toMatchInlineSnapshot(`
"? Select commit (Use arrow keys)
❯ 1. Add sheep emoji (#9) 7.8
2. Change Ulysses to Gretha (conflict) (#8) 7.x
3. Add 🍏 emoji (#5) 7.8, 7.x
4. Add family emoji (#2) 7.x
5. Add \`backport\` dep
6. Merge pull request #1 from backport-org/add-heart-emoji
7. Add ❤️ emoji
8. Update .backportrc.json
9. Bump to 8.0.0
10.Add package.json"
`);
"repo: backport-org/backport-e2e
? Select commit (Use arrow keys)
❯ 1. Add sheep emoji (#9) 7.8
2. Change Ulysses to Gretha (conflict) (#8) 7.x
3. Add 🍏 emoji (#5) 7.8, 7.x
4. Add family emoji (#2) 7.x
5. Add \`backport\` dep
6. Merge pull request #1 from backport-org/add-heart-emoji
7. Add ❤️ emoji
8. Update .backportrc.json
9. Bump to 8.0.0
10.Add package.json"
`);
});

it(`lists commits from master`, async () => {
Expand All @@ -176,14 +178,16 @@ Or contact me directly: "
);

expect(output).toMatchInlineSnapshot(`
"? Select commit (Use arrow keys)
❯ 1. Add sheep emoji (#9) 7.8
2. Change Ulysses to Gretha (conflict) (#8) 7.x
3. Add 🍏 emoji (#5) 7.8, 7.x
4. Add family emoji (#2) 7.x
5. Add \`backport\` dep
6. Merge pull request #1 from backport-org/add-heart-emoji"
`);
"repo: backport-org/backport-e2e • maxNumber: 6
? Select commit (Use arrow keys)
❯ 1. Add sheep emoji (#9) 7.8
2. Change Ulysses to Gretha (conflict) (#8) 7.x
3. Add 🍏 emoji (#5) 7.8, 7.x
4. Add family emoji (#2) 7.x
5. Add \`backport\` dep
6. Merge pull request #1 from backport-org/add-heart-emoji"
`);
});

it(`lists commits from 7.x`, async () => {
Expand All @@ -200,13 +204,15 @@ Or contact me directly: "
);

expect(output).toMatchInlineSnapshot(`
"? Select commit (Use arrow keys)
❯ 1. Add 🍏 emoji (#5) (#6)
2. Change Ulysses to Carol
3. Add family emoji (#2) (#4)
4. Update .backportrc.json
5. Branch off: 7.9.0 (7.x)
6. Bump to 8.0.0"
`);
"repo: backport-org/backport-e2e • maxNumber: 6
? Select commit (Use arrow keys)
❯ 1. Add 🍏 emoji (#5) (#6)
2. Change Ulysses to Carol
3. Add family emoji (#2) (#4)
4. Update .backportrc.json
5. Branch off: 7.9.0 (7.x)
6. Bump to 8.0.0"
`);
});
});
Loading

0 comments on commit a8e561d

Please sign in to comment.