backport 8.9.3 → 8.9.4

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 (33) hide show
  1. package/README.md +2 -2
  2. package/dist/entrypoint.module.private.test.js +51 -51
  3. package/dist/lib/cherrypickAndCreateTargetPullRequest/cherrypickAndCreateTargetPullRequest.test.js +8 -8
  4. package/dist/lib/child-process-promisified.js +1 -0
  5. package/dist/lib/getTargetBranches.test.js +1 -1
  6. package/dist/lib/git.js +25 -2
  7. package/dist/lib/git.private.test.js +9 -9
  8. package/dist/lib/git.test.js +7 -7
  9. package/dist/lib/github/v3/createPullRequest.test.js +1 -1
  10. package/dist/lib/github/v3/createStatusComment.test.js +6 -6
  11. package/dist/lib/github/v4/apiRequestV4.test.js +5 -5
  12. package/dist/lib/github/v4/enablePullRequestAutoMerge.mutation.test.js +3 -3
  13. package/dist/lib/github/v4/fetchCommits/allFetchers.private.test.js +1 -1
  14. package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +2 -2
  15. package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.private.test.js +3 -3
  16. package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +2 -2
  17. package/dist/lib/github/v4/throwOnInvalidAccessToken.test.js +2 -2
  18. package/dist/lib/github/v4/validateTargetBranch.private.test.js +1 -1
  19. package/dist/lib/setupRepo.js +2 -0
  20. package/dist/lib/setupRepo.test.js +3 -3
  21. package/dist/options/cliArgs.test.js +3 -3
  22. package/dist/options/config/globalConfig.test.js +1 -1
  23. package/dist/options/config/readConfigFile.d.ts +1 -1
  24. package/dist/options/options.test.js +17 -17
  25. package/dist/scripts/postinstall.test.js +4 -4
  26. package/dist/test/e2e/cli/different-merge-strategies.private.test.js +3 -3
  27. package/dist/test/e2e/cli/entrypoint.cli.private.test.js +5 -5
  28. package/dist/test/e2e/cli/error-handling-interactive-mode.private.test.js +8 -8
  29. package/dist/test/e2e/cli/error-handling-non-interactive-mode.private.test.js +7 -7
  30. package/dist/utils/packageVersion.d.ts +1 -1
  31. package/dist/utils/packageVersion.js +1 -1
  32. package/package.json +22 -22
  33. package/yarn.lock +616 -559
package/README.md CHANGED
@@ -58,9 +58,9 @@ Add a [project config](/docs/config-file-options.md#project-config-backportrcjso
58
58
  "autoMergeMethod": "squash",
59
59
 
60
60
  // Optional: Automatically detect which branches a pull request should be backported to based on the pull request labels.
61
- // In this case, adding the label "backport-to-production" will backport the PR to the "production" branch
61
+ // In this case, adding the label "auto-backport-to-production" will backport the PR to the "production" branch
62
62
  "branchLabelMapping": {
63
- "^backport-to-(.+)$": "$1"
63
+ "^auto-backport-to-(.+)$": "$1"
64
64
  }
65
65
  }
66
66
  ```
@@ -172,7 +172,7 @@ describe('entrypoint.module', () => {
172
172
  sha: 'd1b348e6213c5ad48653dfaad6eaf4928b2c688b',
173
173
  },
174
174
  sourcePullRequest: {
175
- labels: ['Team:apm', 'release_note:skip', 'v7.11.0'],
175
+ labels: ['Team:APM', 'release_note:skip', 'v7.11.0'],
176
176
  number: 88188,
177
177
  url: 'https://github.com/elastic/kibana/pull/88188',
178
178
  mergeCommit: {
@@ -232,7 +232,7 @@ describe('entrypoint.module', () => {
232
232
  sha: 'd1b348e6213c5ad48653dfaad6eaf4928b2c688b',
233
233
  },
234
234
  sourcePullRequest: {
235
- labels: ['Team:apm', 'release_note:skip', 'v7.11.0'],
235
+ labels: ['Team:APM', 'release_note:skip', 'v7.11.0'],
236
236
  number: 88188,
237
237
  url: 'https://github.com/elastic/kibana/pull/88188',
238
238
  mergeCommit: {
@@ -276,7 +276,7 @@ describe('entrypoint.module', () => {
276
276
  repoName: 'kibana',
277
277
  repoOwner: 'elastic',
278
278
  dateUntil: '2021-06-02',
279
- prFilter: 'label:Team:apm base:master',
279
+ prFilter: 'label:Team:APM base:master',
280
280
  maxNumber: 3,
281
281
  });
282
282
  const commitMessage = commits.map((commit) => {
@@ -287,23 +287,23 @@ describe('entrypoint.module', () => {
287
287
  };
288
288
  });
289
289
  expect(commitMessage).toMatchInlineSnapshot(`
290
- Array [
291
- Object {
290
+ [
291
+ {
292
292
  "branchLabelMapping": undefined,
293
293
  "committedDate": "2021-05-28T12:41:42Z",
294
294
  "message": "[Observability] Fix typo in readme for new navigation (#100861)",
295
295
  "sha": "79945fe0275b2ec9c93747e26154110133ec51fb",
296
296
  },
297
- Object {
297
+ {
298
298
  "branchLabelMapping": undefined,
299
299
  "committedDate": "2021-05-28T19:43:30Z",
300
300
  "message": "[APM] Move APM tutorial from apm_oss to x-pack/apm (#100780)",
301
301
  "sha": "0bcd78b0e999feb95057f5e6eafdb572b9b2fe39",
302
302
  },
303
- Object {
303
+ {
304
304
  "branchLabelMapping": undefined,
305
305
  "committedDate": "2021-05-18T10:33:16Z",
306
- "message": "Migrate from Joi to @kbn/config-schema in \\"home\\" and \\"features\\" plugins (#100201)",
306
+ "message": "Migrate from Joi to @kbn/config-schema in "home" and "features" plugins (#100201)",
307
307
  "sha": "574f6595ad2e5452fa90e6a3111220a599e473c0",
308
308
  },
309
309
  ]
@@ -319,16 +319,16 @@ describe('entrypoint.module', () => {
319
319
  maxNumber: 3,
320
320
  });
321
321
  expect(commits).toMatchInlineSnapshot(`
322
- Array [
323
- Object {
324
- "author": Object {
322
+ [
323
+ {
324
+ "author": {
325
325
  "email": "sorenlouv@gmail.com",
326
326
  "name": "Søren Louv-Jansen",
327
327
  },
328
328
  "sourceBranch": "master",
329
- "sourceCommit": Object {
330
- "branchLabelMapping": Object {
331
- "^v(\\\\d+).(\\\\d+).\\\\d+$": "$1.$2",
329
+ "sourceCommit": {
330
+ "branchLabelMapping": {
331
+ "^v(\\d+).(\\d+).\\d+$": "$1.$2",
332
332
  "^v7.11.0$": "7.x",
333
333
  "^v8.0.0$": "master",
334
334
  },
@@ -336,29 +336,29 @@ describe('entrypoint.module', () => {
336
336
  "message": "[APM] Fix broken link to ML when time range is not set (#85976)",
337
337
  "sha": "744d6809ded7e1055bfda280c351cee3e8c0e3bf",
338
338
  },
339
- "sourcePullRequest": Object {
340
- "labels": Array [
339
+ "sourcePullRequest": {
340
+ "labels": [
341
341
  "release_note:fix",
342
- "Team:apm",
342
+ "Team:APM",
343
343
  "apm:test-plan-done",
344
344
  "v7.11.0",
345
345
  "apm:test-plan-7.11.0",
346
346
  ],
347
- "mergeCommit": Object {
347
+ "mergeCommit": {
348
348
  "message": "[APM] Fix broken link to ML when time range is not set (#85976)",
349
349
  "sha": "744d6809ded7e1055bfda280c351cee3e8c0e3bf",
350
350
  },
351
351
  "number": 85976,
352
352
  "url": "https://github.com/elastic/kibana/pull/85976",
353
353
  },
354
- "suggestedTargetBranches": Array [],
355
- "targetPullRequestStates": Array [
356
- Object {
354
+ "suggestedTargetBranches": [],
355
+ "targetPullRequestStates": [
356
+ {
357
357
  "branch": "7.x",
358
358
  "isSourceBranch": false,
359
359
  "label": "v7.11.0",
360
360
  "labelRegex": "^v7.11.0$",
361
- "mergeCommit": Object {
361
+ "mergeCommit": {
362
362
  "message": "[APM] Fix broken link to ML when time range is not set (#85976) (#86227)
363
363
 
364
364
  Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>",
@@ -368,9 +368,9 @@ describe('entrypoint.module', () => {
368
368
  "state": "MERGED",
369
369
  "url": "https://github.com/elastic/kibana/pull/86227",
370
370
  },
371
- Object {
371
+ {
372
372
  "branch": "7.11",
373
- "mergeCommit": Object {
373
+ "mergeCommit": {
374
374
  "message": "[APM] Fix broken link to ML when time range is not set (#85976) (#86228)",
375
375
  "sha": "c6c0015e01601cd852730d5cd20e1a906cbee900",
376
376
  },
@@ -380,15 +380,15 @@ describe('entrypoint.module', () => {
380
380
  },
381
381
  ],
382
382
  },
383
- Object {
384
- "author": Object {
383
+ {
384
+ "author": {
385
385
  "email": "sorenlouv@gmail.com",
386
386
  "name": "Søren Louv-Jansen",
387
387
  },
388
388
  "sourceBranch": "master",
389
- "sourceCommit": Object {
390
- "branchLabelMapping": Object {
391
- "^v(\\\\d+).(\\\\d+).\\\\d+$": "$1.$2",
389
+ "sourceCommit": {
390
+ "branchLabelMapping": {
391
+ "^v(\\d+).(\\d+).\\d+$": "$1.$2",
392
392
  "^v7.11.0$": "7.x",
393
393
  "^v8.0.0$": "master",
394
394
  },
@@ -398,13 +398,13 @@ describe('entrypoint.module', () => {
398
398
  Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>",
399
399
  "sha": "20638a64e2a895d4e4a6597d4a37b5db7003f1e9",
400
400
  },
401
- "sourcePullRequest": Object {
402
- "labels": Array [
403
- "Team:apm",
401
+ "sourcePullRequest": {
402
+ "labels": [
403
+ "Team:APM",
404
404
  "release_note:skip",
405
405
  "v7.11.0",
406
406
  ],
407
- "mergeCommit": Object {
407
+ "mergeCommit": {
408
408
  "message": "[APM] Correlations polish (#85116)
409
409
 
410
410
  Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>",
@@ -413,14 +413,14 @@ describe('entrypoint.module', () => {
413
413
  "number": 85116,
414
414
  "url": "https://github.com/elastic/kibana/pull/85116",
415
415
  },
416
- "suggestedTargetBranches": Array [],
417
- "targetPullRequestStates": Array [
418
- Object {
416
+ "suggestedTargetBranches": [],
417
+ "targetPullRequestStates": [
418
+ {
419
419
  "branch": "7.x",
420
420
  "isSourceBranch": false,
421
421
  "label": "v7.11.0",
422
422
  "labelRegex": "^v7.11.0$",
423
- "mergeCommit": Object {
423
+ "mergeCommit": {
424
424
  "message": "[7.x] [APM] Correlations polish (#85116) (#85940)
425
425
 
426
426
  Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>",
@@ -432,15 +432,15 @@ describe('entrypoint.module', () => {
432
432
  },
433
433
  ],
434
434
  },
435
- Object {
436
- "author": Object {
435
+ {
436
+ "author": {
437
437
  "email": "sorenlouv@gmail.com",
438
438
  "name": "Søren Louv-Jansen",
439
439
  },
440
440
  "sourceBranch": "master",
441
- "sourceCommit": Object {
442
- "branchLabelMapping": Object {
443
- "^v(\\\\d+).(\\\\d+).\\\\d+$": "$1.$2",
441
+ "sourceCommit": {
442
+ "branchLabelMapping": {
443
+ "^v(\\d+).(\\d+).\\d+$": "$1.$2",
444
444
  "^v7.11.0$": "7.x",
445
445
  "^v8.0.0$": "master",
446
446
  },
@@ -448,27 +448,27 @@ describe('entrypoint.module', () => {
448
448
  "message": "[APM] Improve pointer event hook (#85117)",
449
449
  "sha": "cee681afb3c5f87371112fab9a7e5dddbafea0a8",
450
450
  },
451
- "sourcePullRequest": Object {
452
- "labels": Array [
453
- "Team:apm",
451
+ "sourcePullRequest": {
452
+ "labels": [
453
+ "Team:APM",
454
454
  "release_note:skip",
455
455
  "v7.11.0",
456
456
  ],
457
- "mergeCommit": Object {
457
+ "mergeCommit": {
458
458
  "message": "[APM] Improve pointer event hook (#85117)",
459
459
  "sha": "cee681afb3c5f87371112fab9a7e5dddbafea0a8",
460
460
  },
461
461
  "number": 85117,
462
462
  "url": "https://github.com/elastic/kibana/pull/85117",
463
463
  },
464
- "suggestedTargetBranches": Array [],
465
- "targetPullRequestStates": Array [
466
- Object {
464
+ "suggestedTargetBranches": [],
465
+ "targetPullRequestStates": [
466
+ {
467
467
  "branch": "7.x",
468
468
  "isSourceBranch": false,
469
469
  "label": "v7.11.0",
470
470
  "labelRegex": "^v7.11.0$",
471
- "mergeCommit": Object {
471
+ "mergeCommit": {
472
472
  "message": "[7.x] [APM] Improve pointer event hook (#85117) (#85142)",
473
473
  "sha": "3b72a4f3cc7c0abd0541073e1d0246b85cea3def",
474
474
  },
@@ -487,7 +487,7 @@ describe('entrypoint.module', () => {
487
487
  repoName: 'kibana',
488
488
  repoOwner: 'elastic',
489
489
  maxNumber: 3,
490
- })).rejects.toThrowError('Must supply one of: `pullNumber`, `sha`, `prFilter` or `author`');
490
+ })).rejects.toThrow('Must supply one of: `pullNumber`, `sha`, `prFilter` or `author`');
491
491
  });
492
492
  });
493
493
  });
@@ -147,8 +147,8 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
147
147
  });
148
148
  it('creates the pull request with multiple PR references', () => {
149
149
  expect(createPullRequestCalls).toMatchInlineSnapshot(`
150
- Array [
151
- Object {
150
+ [
151
+ {
152
152
  "base": "6.x",
153
153
  "body": "# Backport
154
154
 
@@ -183,12 +183,12 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
183
183
  it('should start the spinner with the correct text', () => {
184
184
  expect(ora_1.default.mock.calls.map((call) => call[0].text))
185
185
  .toMatchInlineSnapshot(`
186
- Array [
186
+ [
187
187
  "",
188
188
  "Pulling latest changes",
189
189
  "Cherry-picking: My original commit message (#1000)",
190
190
  "Cherry-picking: My other commit message (#2000)",
191
- "Pushing branch \\"sqren:backport/6.x/pr-1000_pr-2000\\"",
191
+ "Pushing branch "sqren:backport/6.x/pr-1000_pr-2000"",
192
192
  undefined,
193
193
  "Creating pull request",
194
194
  "Adding labels: backport",
@@ -250,8 +250,8 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
250
250
  });
251
251
  it('creates the pull request with commit reference', () => {
252
252
  expect(createPullRequestCalls).toMatchInlineSnapshot(`
253
- Array [
254
- Object {
253
+ [
254
+ {
255
255
  "base": "6.x",
256
256
  "body": "# Backport
257
257
 
@@ -326,8 +326,8 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
326
326
  });
327
327
  it('creates the pull request with commit reference', () => {
328
328
  expect(createPullRequestCalls).toMatchInlineSnapshot(`
329
- Array [
330
- Object {
329
+ [
330
+ {
331
331
  "base": "6.x",
332
332
  "body": "# Backport
333
333
 
@@ -37,6 +37,7 @@ async function spawnPromise(cmd, cmdArgs, cwd) {
37
37
  });
38
38
  subprocess.on('close', (code) => {
39
39
  if (code === 0 || code === null) {
40
+ logger_1.logger.verbose(`Spawn success: code=${code} stderr=${stderr} stdout=${stdout}`);
40
41
  resolve({ cmdArgs, code, stderr, stdout });
41
42
  }
42
43
  else {
@@ -100,7 +100,7 @@ describe('getTargetBranches', () => {
100
100
  return (0, getTargetBranches_1.getTargetBranches)({
101
101
  interactive: false,
102
102
  }, commits);
103
- }).rejects.toThrowError('There are no branches to backport to. Aborting.');
103
+ }).rejects.toThrow('There are no branches to backport to. Aborting.');
104
104
  });
105
105
  it('should return missing backports', async () => {
106
106
  const commits = [
package/dist/lib/git.js CHANGED
@@ -1,7 +1,30 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.getLocalSourceRepoPath = exports.pushBackportBranch = exports.getRepoForkOwner = exports.deleteBackportBranch = exports.createBackportBranch = exports.getUnstagedFiles = exports.getConflictingFiles = exports.commitChanges = exports.cherrypick = exports.getShasInMergeCommit = exports.getIsMergeCommit = exports.fetchBranch = exports.addRemote = exports.deleteRemote = exports.getIsCommitInBranch = exports.getGitProjectRootPath = exports.getRepoInfoFromGitRemotes = exports.isLocalConfigFileModified = exports.isLocalConfigFileUntracked = exports.getLocalConfigFileCommitDate = exports.cloneRepo = exports.getRemoteUrl = void 0;
4
- const path_1 = require("path");
27
+ const path_1 = __importStar(require("path"));
5
28
  const lodash_1 = require("lodash");
6
29
  const ora_1 = require("../lib/ora");
7
30
  const filterEmpty_1 = require("../utils/filterEmpty");
@@ -113,7 +136,7 @@ async function getGitProjectRootPath(dir) {
113
136
  try {
114
137
  const cwd = dir;
115
138
  const { stdout } = await (0, child_process_promisified_1.spawnPromise)('git', ['rev-parse', '--show-toplevel'], cwd);
116
- return stdout.trim();
139
+ return path_1.default.normalize(stdout.trim());
117
140
  }
118
141
  catch (e) {
119
142
  logger_1.logger.error('An error occurred while retrieving git project root', e);
@@ -129,7 +129,7 @@ describe('git.private', () => {
129
129
  targetBranch: 'foo',
130
130
  backportBranch: 'my-backport-branch',
131
131
  });
132
- }).rejects.toThrowError('The branch "foo" is invalid or doesn\'t exist');
132
+ }).rejects.toThrow('The branch "foo" is invalid or doesn\'t exist');
133
133
  });
134
134
  });
135
135
  describe('pushBackportBranch', () => {
@@ -162,9 +162,9 @@ describe('git.private', () => {
162
162
  backportBranch: 'my-backport-branch',
163
163
  });
164
164
  }).rejects.toThrowErrorMatchingInlineSnapshot(`
165
- "Error pushing to https://github.com/sqren/repo-with-conflicts. Repository does not exist. Either fork the repository (https://github.com/sqren/repo-with-conflicts) or disable fork mode via \\"--no-fork\\".
166
- Read more about fork mode in the docs: https://github.com/sqren/backport/blob/main/docs/config-file-options.md#fork"
167
- `);
165
+ "Error pushing to https://github.com/sqren/repo-with-conflicts. Repository does not exist. Either fork the repository (https://github.com/sqren/repo-with-conflicts) or disable fork mode via "--no-fork".
166
+ Read more about fork mode in the docs: https://github.com/sqren/backport/blob/main/docs/config-file-options.md#fork"
167
+ `);
168
168
  });
169
169
  });
170
170
  describe('cherrypick', () => {
@@ -215,7 +215,7 @@ describe('git.private', () => {
215
215
  options: { dir: cwd },
216
216
  sha: firstSha,
217
217
  commitAuthor: { name: 'Soren L', email: 'soren@mail.dk' },
218
- })).rejects.toThrowError(`Cherrypick failed because the selected commit (${shortSha}) is empty. Did you already backport this commit?`);
218
+ })).rejects.toThrow(`Cherrypick failed because the selected commit (${shortSha}) is empty. Did you already backport this commit?`);
219
219
  });
220
220
  it('should cherrypick commit cleanly', async () => {
221
221
  const res = await (0, git_1.cherrypick)({
@@ -285,7 +285,7 @@ describe('git.private', () => {
285
285
  });
286
286
  expect(async () => {
287
287
  return await (0, git_1.commitChanges)({ commit, commitAuthor, options });
288
- }).not.toThrowError();
288
+ }).not.toThrow();
289
289
  const message = await getMostRecentCommitMessage(cwd);
290
290
  expect(message).toBe('Update my-file-1.txt');
291
291
  });
@@ -350,10 +350,10 @@ describe('git.private', () => {
350
350
  cwd: sourceRepo,
351
351
  });
352
352
  // file should not exist before clone
353
- await expect(() => (0, promises_1.access)(`${backportRepo}/my-file.txt`)).rejects.toThrowError();
353
+ await expect(() => (0, promises_1.access)(`${backportRepo}/my-file.txt`)).rejects.toThrow();
354
354
  await (0, git_1.cloneRepo)({ sourcePath: sourceRepo, targetPath: backportRepo }, () => null);
355
355
  //file should exist after clone
356
- await expect(() => (0, promises_1.access)(`${backportRepo}/my-file.txt`)).not.toThrowError();
356
+ await expect(() => (0, promises_1.access)(`${backportRepo}/my-file.txt`)).not.toThrow();
357
357
  });
358
358
  it('clones a remote repo and continously updates the progress', async () => {
359
359
  const onProgressSpy = jest.fn();
@@ -367,7 +367,7 @@ describe('git.private', () => {
367
367
  await expect(() => (0, git_1.cloneRepo)({
368
368
  sourcePath: `${sandboxPath}/source-repo-incorrect`,
369
369
  targetPath: backportRepo,
370
- }, () => null)).rejects.toThrowError('Git clone failed with exit code: 128');
370
+ }, () => null)).rejects.toThrow('Git clone failed with exit code: 128');
371
371
  });
372
372
  });
373
373
  describe('getLocalConfigFileCommitDate', () => {
@@ -255,7 +255,7 @@ describe('createBackportBranch', () => {
255
255
  sourceBranch,
256
256
  targetBranch,
257
257
  backportBranch,
258
- })).rejects.toThrowErrorMatchingInlineSnapshot(`"The branch \\"4.x\\" is invalid or doesn't exist"`);
258
+ })).rejects.toThrowErrorMatchingInlineSnapshot(`"The branch "4.x" is invalid or doesn't exist"`);
259
259
  });
260
260
  it('should throw "Invalid refspec" error', async () => {
261
261
  expect.assertions(1);
@@ -271,7 +271,7 @@ describe('createBackportBranch', () => {
271
271
  sourceBranch,
272
272
  targetBranch,
273
273
  backportBranch,
274
- })).rejects.toThrowErrorMatchingInlineSnapshot(`"The branch \\"4.x\\" is invalid or doesn't exist"`);
274
+ })).rejects.toThrowErrorMatchingInlineSnapshot(`"The branch "4.x" is invalid or doesn't exist"`);
275
275
  });
276
276
  it('should rethrow normal error', async () => {
277
277
  expect.assertions(1);
@@ -428,7 +428,7 @@ describe('cherrypick', () => {
428
428
  sha: 'abcd',
429
429
  commitAuthor,
430
430
  })).rejects
431
- .toThrowError(`Cherrypick failed because the selected commit was a merge commit. Please try again by specifying the parent with the \`mainline\` argument:
431
+ .toThrow(`Cherrypick failed because the selected commit was a merge commit. Please try again by specifying the parent with the \`mainline\` argument:
432
432
 
433
433
  > backport --mainline
434
434
 
@@ -452,7 +452,7 @@ Or refer to the git documentation for more information: https://git-scm.com/docs
452
452
  options,
453
453
  sha: 'abcd',
454
454
  commitAuthor,
455
- })).rejects.toThrowError(`Cherrypick failed because the selected commit (abcd) is empty. Did you already backport this commit?`);
455
+ })).rejects.toThrow(`Cherrypick failed because the selected commit (abcd) is empty. Did you already backport this commit?`);
456
456
  });
457
457
  it('should re-throw non-cherrypick errors', async () => {
458
458
  jest
@@ -629,8 +629,8 @@ describe('pushBackportBranch', () => {
629
629
  }));
630
630
  await expect((0, git_1.pushBackportBranch)({ options, backportBranch })).rejects
631
631
  .toThrowErrorMatchingInlineSnapshot(`
632
- "Error pushing to https://github.com/the_fork_owner/kibana. Repository does not exist. Either fork the repository (https://github.com/elastic/kibana) or disable fork mode via \\"--no-fork\\".
633
- Read more about fork mode in the docs: https://github.com/sqren/backport/blob/main/docs/config-file-options.md#fork"
634
- `);
632
+ "Error pushing to https://github.com/the_fork_owner/kibana. Repository does not exist. Either fork the repository (https://github.com/elastic/kibana) or disable fork mode via "--no-fork".
633
+ Read more about fork mode in the docs: https://github.com/sqren/backport/blob/main/docs/config-file-options.md#fork"
634
+ `);
635
635
  });
636
636
  });
@@ -311,7 +311,7 @@ describe('getPullRequestBody', () => {
311
311
  const options = {
312
312
  prDescription: 'Just output the commits: {commits}',
313
313
  };
314
- expect((0, createPullRequest_1.getPullRequestBody)({ options, commits, targetBranch: '7.x' })).toMatchInlineSnapshot(`"Just output the commits: [{\\"sourceCommit\\":{\\"sha\\":\\"foo\\",\\"message\\":\\"My commit message (#55)\\"}},{\\"sourceCommit\\":{\\"sha\\":\\"bar\\",\\"message\\":\\"Another commit message\\"}}]"`);
314
+ expect((0, createPullRequest_1.getPullRequestBody)({ options, commits, targetBranch: '7.x' })).toMatchInlineSnapshot(`"Just output the commits: [{"sourceCommit":{"sha":"foo","message":"My commit message (#55)"}},{"sourceCommit":{"sha":"bar","message":"Another commit message"}}]"`);
315
315
  });
316
316
  });
317
317
  describe('getTitle', () => {
@@ -112,8 +112,8 @@ describe('getCommentBody', () => {
112
112
 
113
113
  | Status | Branch | Result |
114
114
  |:------:|:------:|:------|
115
- |✅|7.x|[<img src=\\"https://img.shields.io/github/pulls/detail/state/elastic/kibana/55\\">](url-to-pr)|
116
- |✅|7.1|[<img src=\\"https://img.shields.io/github/pulls/detail/state/elastic/kibana/66\\">](url-to-pr)|
115
+ |✅|7.x|[<img src="https://img.shields.io/github/pulls/detail/state/elastic/kibana/55">](url-to-pr)|
116
+ |✅|7.1|[<img src="https://img.shields.io/github/pulls/detail/state/elastic/kibana/66">](url-to-pr)|
117
117
 
118
118
  Note: Successful backport PRs will be merged automatically after passing CI.
119
119
 
@@ -215,7 +215,7 @@ describe('getCommentBody', () => {
215
215
 
216
216
  | Status | Branch | Result |
217
217
  |:------:|:------:|:------|
218
- |✅|7.x|[<img src=\\"https://img.shields.io/github/pulls/detail/state/elastic/kibana/55\\">](url-to-pr-55)|
218
+ |✅|7.x|[<img src="https://img.shields.io/github/pulls/detail/state/elastic/kibana/55">](url-to-pr-55)|
219
219
  |❌|7.1|An unhandled error occurred. Please see the logs for details|
220
220
 
221
221
  Note: Successful backport PRs will be merged automatically after passing CI.
@@ -339,7 +339,7 @@ describe('getCommentBody', () => {
339
339
 
340
340
  | Status | Branch | Result |
341
341
  |:------:|:------:|:------|
342
- |✅|7.x|[<img src=\\"https://img.shields.io/github/pulls/detail/state/elastic/kibana/55\\">](url-to-pr-55)|
342
+ |✅|7.x|[<img src="https://img.shields.io/github/pulls/detail/state/elastic/kibana/55">](url-to-pr-55)|
343
343
  |❌|7.1|**Backport failed because of merge conflicts**<br><br>You might need to backport the following PRs to 7.1:<br> - [New Zealand commit message](url-to-pr-5)<br> - [Australia commit](url-to-pr-44)|
344
344
  |❌|7.2|Backport failed because of merge conflicts|
345
345
 
@@ -499,7 +499,7 @@ describe('getCommentBody', () => {
499
499
 
500
500
  | Status | Branch | Result |
501
501
  |:------:|:------:|:------|
502
- |❌|main|The branch \\"main\\" is invalid or doesn't exist|
502
+ |❌|main|The branch "main" is invalid or doesn't exist|
503
503
 
504
504
  ### Manual backport
505
505
  To create the backport manually run:
@@ -619,7 +619,7 @@ describe('getCommentBody', () => {
619
619
 
620
620
  | Status | Branch | Result |
621
621
  |:------:|:------:|:------|
622
- |✅|7.x|[<img src=\\"https://img.shields.io/github/pulls/detail/state/elastic/kibana/55\\">](url-to-pr)|
622
+ |✅|7.x|[<img src="https://img.shields.io/github/pulls/detail/state/elastic/kibana/55">](url-to-pr)|
623
623
 
624
624
  Note: Successful backport PRs will be merged automatically after passing CI.
625
625
 
@@ -39,14 +39,14 @@ describe('apiRequestV4', () => {
39
39
  });
40
40
  it('should call with correct args', async () => {
41
41
  expect(commitsByAuthorCalls).toMatchInlineSnapshot(`
42
- Array [
43
- Object {
42
+ [
43
+ {
44
44
  "query": "query MyQuery {
45
45
  viewer {
46
46
  login
47
47
  }
48
48
  }",
49
- "variables": Object {
49
+ "variables": {
50
50
  "foo": "bar",
51
51
  },
52
52
  },
@@ -78,7 +78,7 @@ describe('apiRequestV4', () => {
78
78
  variables: {
79
79
  foo: 'bar',
80
80
  },
81
- })).rejects.toThrowError(new BackportError_1.BackportError(`some error,some other error (Github API v4)`));
81
+ })).rejects.toThrow(new BackportError_1.BackportError(`some error,some other error (Github API v4)`));
82
82
  });
83
83
  });
84
84
  describe('when request fails without error messages', () => {
@@ -103,7 +103,7 @@ describe('apiRequestV4', () => {
103
103
  variables: {
104
104
  foo: 'bar',
105
105
  },
106
- })).rejects.toThrowError('Request failed with status code 500');
106
+ })).rejects.toThrow('Request failed with status code 500');
107
107
  });
108
108
  });
109
109
  });
@@ -137,7 +137,7 @@ describe('enablePullRequestAutoMerge', () => {
137
137
  isMissingStatusChecks = res.isMissingStatusChecks;
138
138
  }
139
139
  expect(isMissingStatusChecks).toBe(false);
140
- expect(errorMessage).toMatchInlineSnapshot(`"[\\"Merge method rebase merging is not allowed on this repository\\"] (Github API v4)"`);
140
+ expect(errorMessage).toMatchInlineSnapshot(`"["Merge method rebase merging is not allowed on this repository"] (Github API v4)"`);
141
141
  // ensure Github API reflects the change before querying
142
142
  await sleep(100);
143
143
  const autoMergeMethod = await (0, fetchPullRequestAutoMergeMethod_1.fetchPullRequestAutoMergeMethod)(options, pullNumber);
@@ -192,7 +192,7 @@ describe('enablePullRequestAutoMerge', () => {
192
192
  errorMessage = err.message;
193
193
  isMissingStatusChecks = res.isMissingStatusChecks;
194
194
  }
195
- expect(errorMessage).toMatchInlineSnapshot(`"[\\"Pull request Pull request is in clean status\\"] (Github API v4)"`);
195
+ expect(errorMessage).toMatchInlineSnapshot(`"["Pull request Pull request is in clean status"] (Github API v4)"`);
196
196
  expect(isMissingStatusChecks).toBe(true);
197
197
  });
198
198
  });
@@ -237,7 +237,7 @@ describe('enablePullRequestAutoMerge', () => {
237
237
  errorMessage = err.message;
238
238
  isMissingStatusChecks = res.isMissingStatusChecks;
239
239
  }
240
- expect(errorMessage).toMatchInlineSnapshot(`"[\\"Pull request Pull request is in clean status\\"] (Github API v4)"`);
240
+ expect(errorMessage).toMatchInlineSnapshot(`"["Pull request Pull request is in clean status"] (Github API v4)"`);
241
241
  expect(isMissingStatusChecks).toBe(true);
242
242
  });
243
243
  });
@@ -76,7 +76,7 @@ describe('allFetchers', () => {
76
76
  },
77
77
  sourcePullRequest: {
78
78
  labels: [
79
- 'Team:apm',
79
+ 'Team:APM',
80
80
  'v8.0.0',
81
81
  'release_note:skip',
82
82
  'auto-backport',
@@ -144,7 +144,7 @@ describe('fetchCommitByPullNumber', () => {
144
144
  repoOwner: 'backport-org',
145
145
  sourceBranch: 'main',
146
146
  };
147
- await expect((0, fetchCommitByPullNumber_1.fetchCommitsByPullNumber)(options)).rejects.toThrowError(`The PR #11 is not merged`);
147
+ await expect((0, fetchCommitByPullNumber_1.fetchCommitsByPullNumber)(options)).rejects.toThrow(`The PR #11 is not merged`);
148
148
  });
149
149
  });
150
150
  describe('when PR does not exist', () => {
@@ -156,7 +156,7 @@ describe('fetchCommitByPullNumber', () => {
156
156
  repoOwner: 'backport-org',
157
157
  sourceBranch: 'main',
158
158
  };
159
- await expect((0, fetchCommitByPullNumber_1.fetchCommitsByPullNumber)(options)).rejects.toThrowError(`Could not resolve to a PullRequest with the number of 9999999999999. (Github API v4)`);
159
+ await expect((0, fetchCommitByPullNumber_1.fetchCommitsByPullNumber)(options)).rejects.toThrow(`Could not resolve to a PullRequest with the number of 9999999999999. (Github API v4)`);
160
160
  });
161
161
  });
162
162
  });