backport 7.2.0-beta.1 → 7.2.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/entrypoint.cli.js +0 -0
  2. package/dist/entrypoint.module.d.ts +4 -3
  3. package/dist/entrypoint.module.js +2 -7
  4. package/dist/options/ConfigOptions.d.ts +1 -1
  5. package/dist/options/cliArgs.d.ts +1 -0
  6. package/dist/options/cliArgs.js +4 -0
  7. package/dist/options/config/config.d.ts +1 -1
  8. package/dist/options/config/readConfigFile.d.ts +1 -1
  9. package/dist/options/options.d.ts +2 -1
  10. package/dist/services/github/v3/createStatusComment.js +1 -1
  11. package/dist/services/github/v4/apiRequestV4.d.ts +2 -3
  12. package/dist/services/github/v4/apiRequestV4.js +15 -14
  13. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +2 -2
  14. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +2 -2
  15. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +2 -2
  16. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +2 -2
  17. package/dist/services/github/v4/fetchRemoteProjectConfig.js +1 -1
  18. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +1 -1
  19. package/dist/services/github/v4/getOptionsFromGithub/query.js +1 -1
  20. package/dist/services/github/v4/throwOnInvalidAccessToken.js +6 -6
  21. package/dist/services/remoteConfig.js +2 -2
  22. package/dist/services/sourceCommit/getExpectedTargetPullRequests.d.ts +4 -1
  23. package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +5 -1
  24. package/dist/services/sourceCommit/getMockSourceCommit.js +19 -18
  25. package/dist/services/sourceCommit/parseSourceCommit.d.ts +2 -2
  26. package/dist/services/sourceCommit/parseSourceCommit.js +9 -15
  27. package/dist/ui/cherrypickAndCreateTargetPullRequest.js +12 -18
  28. package/dist/ui/getCommits.js +6 -4
  29. package/dist/ui/maybeSetupRepo.js +7 -14
  30. package/dist/utils/packageVersion.d.ts +1 -1
  31. package/dist/utils/packageVersion.js +1 -1
  32. package/package.json +9 -9
  33. package/yarn.lock +121 -114
  34. package/dist/entrypoint.cli.e2e.private.test.d.ts +0 -1
  35. package/dist/entrypoint.cli.e2e.private.test.js +0 -386
  36. package/dist/entrypoint.cli.private.test.d.ts +0 -1
  37. package/dist/entrypoint.cli.private.test.js +0 -46
  38. package/dist/options/cliArgs.test.d.ts +0 -1
  39. package/dist/options/cliArgs.test.js +0 -182
  40. package/dist/options/config/config.test.d.ts +0 -1
  41. package/dist/options/config/config.test.js +0 -32
  42. package/dist/options/config/globalConfig.test.d.ts +0 -1
  43. package/dist/options/config/globalConfig.test.js +0 -61
  44. package/dist/options/config/projectConfig.test.d.ts +0 -1
  45. package/dist/options/config/projectConfig.test.js +0 -109
  46. package/dist/options/options.test.d.ts +0 -1
  47. package/dist/options/options.test.js +0 -384
  48. package/dist/runSequentially.test.d.ts +0 -1
  49. package/dist/runSequentially.test.js +0 -219
  50. package/dist/scripts/postinstall.test.d.ts +0 -1
  51. package/dist/scripts/postinstall.test.js +0 -53
  52. package/dist/services/env.test.d.ts +0 -1
  53. package/dist/services/env.test.js +0 -21
  54. package/dist/services/git.integration.test.d.ts +0 -1
  55. package/dist/services/git.integration.test.js +0 -320
  56. package/dist/services/git.test.d.ts +0 -1
  57. package/dist/services/git.test.js +0 -532
  58. package/dist/services/github/commitFormatters.test.d.ts +0 -1
  59. package/dist/services/github/commitFormatters.test.js +0 -11
  60. package/dist/services/github/v3/addAssigneesToPullRequest.test.d.ts +0 -1
  61. package/dist/services/github/v3/addAssigneesToPullRequest.test.js +0 -27
  62. package/dist/services/github/v3/createPullRequest.test.d.ts +0 -1
  63. package/dist/services/github/v3/createPullRequest.test.js +0 -325
  64. package/dist/services/github/v3/createStatusComment.test.d.ts +0 -1
  65. package/dist/services/github/v3/createStatusComment.test.js +0 -386
  66. package/dist/services/github/v4/apiRequestV4.test.d.ts +0 -1
  67. package/dist/services/github/v4/apiRequestV4.test.js +0 -109
  68. package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.d.ts +0 -1
  69. package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +0 -112
  70. package/dist/services/github/v4/fetchAuthorId.private.test.d.ts +0 -1
  71. package/dist/services/github/v4/fetchAuthorId.private.test.js +0 -28
  72. package/dist/services/github/v4/fetchCommits/allFetchers.private.test.d.ts +0 -1
  73. package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +0 -93
  74. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +0 -1
  75. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +0 -134
  76. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +0 -1
  77. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +0 -116
  78. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +0 -1
  79. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +0 -195
  80. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +0 -1
  81. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +0 -152
  82. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +0 -1
  83. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +0 -102
  84. package/dist/services/github/v4/fetchExistingPullRequest.private.test.d.ts +0 -1
  85. package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +0 -47
  86. package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.d.ts +0 -1
  87. package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.js +0 -52
  88. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +0 -1
  89. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +0 -117
  90. package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.d.ts +0 -1
  91. package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +0 -71
  92. package/dist/services/github/v4/mocks/commitsByAuthorMock.d.ts +0 -2
  93. package/dist/services/github/v4/mocks/commitsByAuthorMock.js +0 -159
  94. package/dist/services/github/v4/throwOnInvalidAccessToken.test.d.ts +0 -1
  95. package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +0 -87
  96. package/dist/services/prompt.test.d.ts +0 -1
  97. package/dist/services/prompt.test.js +0 -134
  98. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.d.ts +0 -1
  99. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +0 -433
  100. package/dist/services/sourceCommit/parseSourceCommit.test.d.ts +0 -1
  101. package/dist/services/sourceCommit/parseSourceCommit.test.js +0 -225
  102. package/dist/test/ExecError.d.ts +0 -16
  103. package/dist/test/ExecError.js +0 -15
  104. package/dist/test/backport-e2e.mutation.test.d.ts +0 -1
  105. package/dist/test/backport-e2e.mutation.test.js +0 -347
  106. package/dist/test/handleUnbackportedPullRequests.private.test.d.ts +0 -1
  107. package/dist/test/handleUnbackportedPullRequests.private.test.js +0 -57
  108. package/dist/test/mockConfigFiles.d.ts +0 -5
  109. package/dist/test/mockConfigFiles.js +0 -21
  110. package/dist/test/mocks.d.ts +0 -10
  111. package/dist/test/mocks.js +0 -23
  112. package/dist/test/nockHelpers.d.ts +0 -16
  113. package/dist/test/nockHelpers.js +0 -36
  114. package/dist/test/private/getDevAccessToken.d.ts +0 -2
  115. package/dist/test/private/getDevAccessToken.js +0 -12
  116. package/dist/test/sandbox.d.ts +0 -5
  117. package/dist/test/sandbox.js +0 -43
  118. package/dist/test/setupFiles/automatic-mocks.d.ts +0 -1
  119. package/dist/test/setupFiles/automatic-mocks.js +0 -63
  120. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.d.ts +0 -1
  121. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +0 -459
  122. package/dist/ui/getCommitsWithoutBackports.test.d.ts +0 -1
  123. package/dist/ui/getCommitsWithoutBackports.test.js +0 -311
  124. package/dist/ui/getTargetBranches.test.d.ts +0 -1
  125. package/dist/ui/getTargetBranches.test.js +0 -198
  126. package/dist/ui/maybeSetupRepo.test.d.ts +0 -1
  127. package/dist/ui/maybeSetupRepo.test.js +0 -204
  128. package/dist/utils/excludeUndefined.test.d.ts +0 -1
  129. package/dist/utils/excludeUndefined.test.js +0 -24
@@ -1,325 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const createPullRequest_1 = require("./createPullRequest");
4
- describe('getPullRequestBody', () => {
5
- it('when single pull request is backported', () => {
6
- expect((0, createPullRequest_1.getPullRequestBody)({
7
- options: {},
8
- commits: [
9
- {
10
- sourcePullRequest: {
11
- number: 55,
12
- url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
13
- mergeCommit: {
14
- sha: 'abcdefghi',
15
- message: 'My commit message (#55)',
16
- },
17
- },
18
- sourceCommit: {
19
- committedDate: '2020',
20
- sha: 'abcdefghi',
21
- message: 'My commit message (#55)',
22
- },
23
- expectedTargetPullRequests: [],
24
- sourceBranch: 'master',
25
- },
26
- ],
27
- targetBranch: '7.x',
28
- })).toMatchInlineSnapshot(`
29
- "# Backport
30
-
31
- This will backport the following commits from \`master\` to \`7.x\`:
32
- - [My commit message (#55)](https://github.com/backport-org/different-merge-strategies/pull/55)
33
-
34
- <!--- Backport version: 1.2.3-mocked -->
35
-
36
- ### Questions ?
37
- Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
38
- `);
39
- });
40
- it('when a single commit (non pull request) is backported', () => {
41
- expect((0, createPullRequest_1.getPullRequestBody)({
42
- options: {},
43
- commits: [
44
- {
45
- sourceCommit: {
46
- committedDate: '',
47
- sha: 'abcdefghijklmw',
48
- message: 'My commit message',
49
- },
50
- sourceBranch: 'main',
51
- expectedTargetPullRequests: [],
52
- },
53
- ],
54
- targetBranch: '7.x',
55
- })).toMatchInlineSnapshot(`
56
- "# Backport
57
-
58
- This will backport the following commits from \`main\` to \`7.x\`:
59
- - My commit message (abcdefgh)
60
-
61
- <!--- Backport version: 1.2.3-mocked -->
62
-
63
- ### Questions ?
64
- Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
65
- `);
66
- });
67
- it('when multiple commits are backported', () => {
68
- expect((0, createPullRequest_1.getPullRequestBody)({
69
- options: {},
70
- commits: [
71
- {
72
- sourcePullRequest: {
73
- number: 55,
74
- url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
75
- mergeCommit: {
76
- sha: 'abcdefghijklm',
77
- message: 'My commit message (#55)',
78
- },
79
- },
80
- sourceCommit: {
81
- committedDate: '',
82
- sha: 'abcdefghijklm',
83
- message: 'My commit message (#55)',
84
- },
85
- sourceBranch: 'main',
86
- expectedTargetPullRequests: [],
87
- },
88
- {
89
- sourceCommit: {
90
- committedDate: '',
91
- sha: 'qwertyuiop',
92
- message: 'Another commit message',
93
- },
94
- sourceBranch: 'main',
95
- expectedTargetPullRequests: [],
96
- },
97
- ],
98
- targetBranch: '7.x',
99
- })).toMatchInlineSnapshot(`
100
- "# Backport
101
-
102
- This will backport the following commits from \`main\` to \`7.x\`:
103
- - [My commit message (#55)](https://github.com/backport-org/different-merge-strategies/pull/55)
104
- - Another commit message (qwertyui)
105
-
106
- <!--- Backport version: 1.2.3-mocked -->
107
-
108
- ### Questions ?
109
- Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
110
- `);
111
- });
112
- it('when a PR is merged (instead of squashed) and the individual commits are selected', () => {
113
- expect((0, createPullRequest_1.getPullRequestBody)({
114
- options: {},
115
- commits: [
116
- {
117
- sourceCommit: {
118
- committedDate: '2022-02-07T23:53:14Z',
119
- message: 'Merge strategy: Second commit',
120
- sha: 'e8df5eaa4db7b94474b48e2320b02d33a830d9fb',
121
- },
122
- sourcePullRequest: {
123
- number: 1,
124
- url: 'https://github.com/backport-org/different-merge-strategies/pull/1',
125
- mergeCommit: {
126
- message: 'Merge pull request #1 from backport-org/merge-strategy\n\nMerge commits to `main`',
127
- sha: '0db7f1ac1233461563d8708511d1c14adbab46da',
128
- },
129
- },
130
- sourceBranch: 'main',
131
- expectedTargetPullRequests: [],
132
- },
133
- {
134
- sourceCommit: {
135
- committedDate: '2022-02-07T23:51:59Z',
136
- message: 'Merge strategy: First commit',
137
- sha: '5411b1c1144093e422220008f23f2c2b909ed113',
138
- },
139
- sourcePullRequest: {
140
- number: 1,
141
- url: 'https://github.com/backport-org/different-merge-strategies/pull/1',
142
- mergeCommit: {
143
- message: 'Merge pull request #1 from backport-org/merge-strategy\n\nMerge commits to `main`',
144
- sha: '0db7f1ac1233461563d8708511d1c14adbab46da',
145
- },
146
- },
147
- sourceBranch: 'main',
148
- expectedTargetPullRequests: [],
149
- },
150
- ],
151
- targetBranch: '7.x',
152
- })).toMatchInlineSnapshot(`
153
- "# Backport
154
-
155
- This will backport the following commits from \`main\` to \`7.x\`:
156
- - [Merge strategy: Second commit](https://github.com/backport-org/different-merge-strategies/pull/1)
157
- - [Merge strategy: First commit](https://github.com/backport-org/different-merge-strategies/pull/1)
158
-
159
- <!--- Backport version: 1.2.3-mocked -->
160
-
161
- ### Questions ?
162
- Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
163
- `);
164
- });
165
- it('replaces template variables in PR description', () => {
166
- expect((0, createPullRequest_1.getPullRequestBody)({
167
- options: {
168
- prDescription: 'Backporting the following to {targetBranch}:\n{commitMessages}',
169
- },
170
- commits: [
171
- {
172
- sourcePullRequest: {
173
- number: 55,
174
- url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
175
- mergeCommit: {
176
- sha: 'abcdefghijklm',
177
- message: 'My commit message (#55)',
178
- },
179
- },
180
- sourceCommit: {
181
- committedDate: '',
182
- sha: 'abcdefghijklm',
183
- message: 'My commit message (#55)',
184
- },
185
- sourceBranch: 'main',
186
- expectedTargetPullRequests: [],
187
- },
188
- {
189
- sourceCommit: {
190
- committedDate: '',
191
- sha: 'qwertyuiop',
192
- message: 'Another commit message',
193
- },
194
- sourceBranch: 'main',
195
- expectedTargetPullRequests: [],
196
- },
197
- ],
198
- targetBranch: '7.x',
199
- })).toMatchInlineSnapshot(`
200
- "Backporting the following to 7.x:
201
- - [My commit message (#55)](https://github.com/backport-org/different-merge-strategies/pull/55)
202
- - Another commit message (qwertyui)"
203
- `);
204
- });
205
- it('appends text to the default descriptions', () => {
206
- expect((0, createPullRequest_1.getPullRequestBody)({
207
- options: {
208
- prDescription: '{defaultPrDescription}\n\ntext to append',
209
- },
210
- commits: [
211
- {
212
- sourcePullRequest: {
213
- number: 55,
214
- url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
215
- mergeCommit: {
216
- sha: 'abcdefghijklm',
217
- message: 'My commit message (#55)',
218
- },
219
- },
220
- sourceCommit: {
221
- committedDate: '',
222
- sha: 'abcdefghijklm',
223
- message: 'My commit message (#55)',
224
- },
225
- sourceBranch: 'main',
226
- expectedTargetPullRequests: [],
227
- },
228
- {
229
- sourceCommit: {
230
- committedDate: '',
231
- sha: 'qwertyuiop',
232
- message: 'Another commit message',
233
- },
234
- sourceBranch: 'main',
235
- expectedTargetPullRequests: [],
236
- },
237
- ],
238
- targetBranch: '7.x',
239
- })).toMatchInlineSnapshot(`
240
- "# Backport
241
-
242
- This will backport the following commits from \`main\` to \`7.x\`:
243
- - [My commit message (#55)](https://github.com/backport-org/different-merge-strategies/pull/55)
244
- - Another commit message (qwertyui)
245
-
246
- <!--- Backport version: 1.2.3-mocked -->
247
-
248
- ### Questions ?
249
- Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
250
-
251
- text to append"
252
- `);
253
- });
254
- });
255
- describe('getTitle', () => {
256
- it('has the default title', () => {
257
- expect((0, createPullRequest_1.getTitle)({
258
- options: {},
259
- commits: [
260
- {
261
- sourceBranch: 'main',
262
- sourcePullRequest: {
263
- number: 55,
264
- url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
265
- mergeCommit: {
266
- sha: 'abcdefghi',
267
- message: 'My commit message (#55)',
268
- },
269
- },
270
- sourceCommit: {
271
- committedDate: '2020',
272
- sha: 'abcdefghi',
273
- message: 'My commit message (#55)',
274
- },
275
- expectedTargetPullRequests: [],
276
- },
277
- {
278
- sourcePullRequest: {
279
- number: 56,
280
- url: 'https://github.com/backport-org/different-merge-strategies/pull/56',
281
- mergeCommit: {
282
- sha: 'jklmnopqr',
283
- message: 'Another commit message (#56)',
284
- },
285
- },
286
- sourceCommit: {
287
- committedDate: '2020',
288
- sha: 'jklmnopqr',
289
- message: 'Another commit message (#56)',
290
- },
291
- sourceBranch: 'main',
292
- expectedTargetPullRequests: [],
293
- },
294
- ],
295
- targetBranch: '7.x',
296
- })).toEqual('[7.x] My commit message (#55) | Another commit message (#56)');
297
- });
298
- it('replaces template variables in PR title', () => {
299
- expect((0, createPullRequest_1.getTitle)({
300
- options: {
301
- prTitle: 'Branch: "{targetBranch}". Messages: {commitMessages}',
302
- },
303
- commits: [
304
- {
305
- sourcePullRequest: {
306
- number: 55,
307
- url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
308
- mergeCommit: {
309
- sha: 'abcdefghi',
310
- message: 'My commit message (#55)',
311
- },
312
- },
313
- sourceCommit: {
314
- committedDate: '',
315
- sha: 'abcdefghi',
316
- message: 'My commit message (#55)',
317
- },
318
- sourceBranch: 'main',
319
- expectedTargetPullRequests: [],
320
- },
321
- ],
322
- targetBranch: '7.x',
323
- })).toEqual('Branch: "7.x". Messages: My commit message (#55)');
324
- });
325
- });
@@ -1 +0,0 @@
1
- export {};