backport 6.1.0 → 6.1.1
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.
- package/dist/entrypoint.module.private.test.js +13 -12
- package/dist/options/cliArgs.d.ts +3 -3
- package/dist/options/cliArgs.js +6 -5
- package/dist/options/options.d.ts +2 -0
- package/dist/options/options.js +5 -3
- package/dist/options/options.test.js +61 -5
- package/dist/runSequentially.test.js +6 -2
- package/dist/services/github/v3/createPullRequest.test.js +38 -6
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +17 -0
- package/dist/test/integration/integration.private.test.js +14 -4
- package/dist/ui/cherrypickAndCreatePullRequest.test.js +19 -6
- package/dist/utils/excludeUndefined.js +1 -1
- package/dist/utils/excludeUndefined.test.js +3 -3
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
jest.unmock('./services/logger');
|
|
3
4
|
const entrypoint_module_1 = require("./entrypoint.module");
|
|
4
5
|
const getDevAccessToken_1 = require("./test/private/getDevAccessToken");
|
|
5
6
|
describe('entrypoint.module', () => {
|
|
@@ -7,26 +8,26 @@ describe('entrypoint.module', () => {
|
|
|
7
8
|
const accessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
8
9
|
const commits = await (0, entrypoint_module_1.getCommits)({
|
|
9
10
|
accessToken: accessToken,
|
|
10
|
-
repoName: '
|
|
11
|
-
repoOwner: '
|
|
12
|
-
pullNumber:
|
|
11
|
+
repoName: 'backport-e2e',
|
|
12
|
+
repoOwner: 'backport-org',
|
|
13
|
+
pullNumber: 2,
|
|
13
14
|
});
|
|
14
15
|
expect(commits).toEqual([
|
|
15
16
|
{
|
|
16
|
-
committedDate: '
|
|
17
|
+
committedDate: '2020-08-15T10:44:04Z',
|
|
17
18
|
expectedTargetPullRequests: [
|
|
18
19
|
{
|
|
19
|
-
branch: '
|
|
20
|
-
number:
|
|
20
|
+
branch: '7.x',
|
|
21
|
+
number: 4,
|
|
21
22
|
state: 'MERGED',
|
|
22
|
-
url: 'https://github.com/
|
|
23
|
+
url: 'https://github.com/backport-org/backport-e2e/pull/4',
|
|
23
24
|
},
|
|
24
25
|
],
|
|
25
|
-
originalMessage: '
|
|
26
|
-
pullNumber:
|
|
27
|
-
pullUrl: 'https://github.com/
|
|
28
|
-
sha: '
|
|
29
|
-
sourceBranch: '
|
|
26
|
+
originalMessage: 'Add family emoji (#2)',
|
|
27
|
+
pullNumber: 2,
|
|
28
|
+
pullUrl: 'https://github.com/backport-org/backport-e2e/pull/2',
|
|
29
|
+
sha: '59d6ff1ca90a4ce210c0a4f0e159214875c19d60',
|
|
30
|
+
sourceBranch: 'master',
|
|
30
31
|
},
|
|
31
32
|
]);
|
|
32
33
|
});
|
|
@@ -5,14 +5,14 @@ export declare function getOptionsFromCliArgs(argv: readonly string[], { exitOnE
|
|
|
5
5
|
fork?: boolean | undefined;
|
|
6
6
|
verbose?: boolean | undefined;
|
|
7
7
|
accessToken?: string | undefined;
|
|
8
|
-
assignees
|
|
8
|
+
assignees?: string[] | undefined;
|
|
9
9
|
author?: string | null | undefined;
|
|
10
10
|
autoAssign?: boolean | undefined;
|
|
11
11
|
autoMerge?: boolean | undefined;
|
|
12
12
|
autoMergeMethod?: string | undefined;
|
|
13
13
|
cherrypickRef?: boolean | undefined;
|
|
14
14
|
ci?: boolean | undefined;
|
|
15
|
-
commitPaths
|
|
15
|
+
commitPaths?: string[] | undefined;
|
|
16
16
|
details?: boolean | undefined;
|
|
17
17
|
editor?: string | undefined;
|
|
18
18
|
gitHostname?: string | undefined;
|
|
@@ -29,7 +29,7 @@ export declare function getOptionsFromCliArgs(argv: readonly string[], { exitOnE
|
|
|
29
29
|
repoName?: string | undefined;
|
|
30
30
|
repoOwner?: string | undefined;
|
|
31
31
|
resetAuthor?: boolean | undefined;
|
|
32
|
-
reviewers
|
|
32
|
+
reviewers?: string[] | undefined;
|
|
33
33
|
sha?: string | undefined;
|
|
34
34
|
skipRemoteConfig?: boolean | undefined;
|
|
35
35
|
sourceBranch?: string | undefined;
|
package/dist/options/cliArgs.js
CHANGED
|
@@ -94,9 +94,10 @@ function getOptionsFromCliArgs(argv, { exitOnError = true } = {}) {
|
|
|
94
94
|
description: 'Parent id of merge commit. Defaults to 1 when supplied without arguments',
|
|
95
95
|
type: 'number',
|
|
96
96
|
coerce: (mainline) => {
|
|
97
|
-
// `--mainline` (default to 1 when no parent is given)
|
|
98
97
|
if (mainline === undefined) {
|
|
99
|
-
return 1
|
|
98
|
+
// return 1 if `--mainline` is given without a value
|
|
99
|
+
// return undefined if --mainline is not supplied at all
|
|
100
|
+
return argv.includes('--mainline') ? 1 : undefined;
|
|
100
101
|
}
|
|
101
102
|
// use specified mainline parent
|
|
102
103
|
if (Number.isInteger(mainline)) {
|
|
@@ -267,9 +268,9 @@ function getOptionsFromCliArgs(argv, { exitOnError = true } = {}) {
|
|
|
267
268
|
multipleBranches: multiple ?? multipleBranches,
|
|
268
269
|
multipleCommits: multiple ?? multipleCommits,
|
|
269
270
|
// rename array types to plural
|
|
270
|
-
assignees: assignee
|
|
271
|
-
commitPaths: path
|
|
272
|
-
reviewers: reviewer
|
|
271
|
+
assignees: assignee,
|
|
272
|
+
commitPaths: path,
|
|
273
|
+
reviewers: reviewer,
|
|
273
274
|
sourcePRLabels: sourcePRLabel,
|
|
274
275
|
targetBranchChoices: targetBranchChoice,
|
|
275
276
|
targetBranches: targetBranch,
|
|
@@ -7,6 +7,7 @@ export declare const defaultConfigOptions: {
|
|
|
7
7
|
autoMergeMethod: string;
|
|
8
8
|
cherrypickRef: boolean;
|
|
9
9
|
ci: boolean;
|
|
10
|
+
commitPaths: string[];
|
|
10
11
|
details: boolean;
|
|
11
12
|
fork: boolean;
|
|
12
13
|
maxNumber: number;
|
|
@@ -14,6 +15,7 @@ export declare const defaultConfigOptions: {
|
|
|
14
15
|
multipleCommits: boolean;
|
|
15
16
|
noVerify: boolean;
|
|
16
17
|
resetAuthor: boolean;
|
|
18
|
+
reviewers: string[];
|
|
17
19
|
sourcePRLabels: string[];
|
|
18
20
|
targetBranchChoices: TargetBranchChoiceOrString[];
|
|
19
21
|
targetBranches: string[];
|
package/dist/options/options.js
CHANGED
|
@@ -17,6 +17,7 @@ exports.defaultConfigOptions = {
|
|
|
17
17
|
autoMergeMethod: 'merge',
|
|
18
18
|
cherrypickRef: true,
|
|
19
19
|
ci: false,
|
|
20
|
+
commitPaths: [],
|
|
20
21
|
details: false,
|
|
21
22
|
fork: true,
|
|
22
23
|
maxNumber: 10,
|
|
@@ -24,6 +25,7 @@ exports.defaultConfigOptions = {
|
|
|
24
25
|
multipleCommits: false,
|
|
25
26
|
noVerify: true,
|
|
26
27
|
resetAuthor: false,
|
|
28
|
+
reviewers: [],
|
|
27
29
|
sourcePRLabels: [],
|
|
28
30
|
targetBranchChoices: [],
|
|
29
31
|
targetBranches: [],
|
|
@@ -88,13 +90,13 @@ function requireAccessToken(combinedOptions) {
|
|
|
88
90
|
}
|
|
89
91
|
function requireRepoName(combinedOptions) {
|
|
90
92
|
if (!combinedOptions.repoName) {
|
|
91
|
-
throw new HandledError_1.HandledError(`Please specify a repo name: "--repo-name kibana"
|
|
93
|
+
throw new HandledError_1.HandledError(`Please specify a repo name: "--repo-name kibana".\n\nRead more: ${PROJECT_CONFIG_DOCS_LINK}`);
|
|
92
94
|
}
|
|
93
95
|
return combinedOptions.repoName;
|
|
94
96
|
}
|
|
95
97
|
function requireRepoOwner(combinedOptions) {
|
|
96
98
|
if (!combinedOptions.repoOwner) {
|
|
97
|
-
throw new HandledError_1.HandledError(`Please specify a repo owner: "--repo-owner elastic"
|
|
99
|
+
throw new HandledError_1.HandledError(`Please specify a repo owner: "--repo-owner elastic".\n\nRead more: ${PROJECT_CONFIG_DOCS_LINK}`);
|
|
98
100
|
}
|
|
99
101
|
return combinedOptions.repoOwner;
|
|
100
102
|
}
|
|
@@ -104,6 +106,6 @@ function requireTargetBranch(config) {
|
|
|
104
106
|
(0, lodash_1.isEmpty)(config.targetBranchChoices) &&
|
|
105
107
|
// this is primarily necessary on CI where `targetBranches` and `targetBranchChoices` and not given
|
|
106
108
|
(0, lodash_1.isEmpty)(config.branchLabelMapping)) {
|
|
107
|
-
throw new HandledError_1.HandledError(`Please specify a target branch: "--branch 6.1"
|
|
109
|
+
throw new HandledError_1.HandledError(`Please specify a target branch: "--branch 6.1".\n\nRead more: ${PROJECT_CONFIG_DOCS_LINK}`);
|
|
108
110
|
}
|
|
109
111
|
}
|
|
@@ -234,6 +234,50 @@ describe('getOptions', () => {
|
|
|
234
234
|
verbose: false,
|
|
235
235
|
});
|
|
236
236
|
});
|
|
237
|
+
describe('fork', () => {
|
|
238
|
+
beforeEach(() => {
|
|
239
|
+
mockGithubConfigOptions({ viewerLogin: 'billy.bob' });
|
|
240
|
+
});
|
|
241
|
+
it('is enabled by default', async () => {
|
|
242
|
+
const { fork } = await (0, options_1.getOptions)([]);
|
|
243
|
+
expect(fork).toBe(true);
|
|
244
|
+
});
|
|
245
|
+
it('can be disabled via `--no-fork` flag', async () => {
|
|
246
|
+
const { fork } = await (0, options_1.getOptions)(['--no-fork']);
|
|
247
|
+
expect(fork).toBe(false);
|
|
248
|
+
});
|
|
249
|
+
it('can be disabled via config file', async () => {
|
|
250
|
+
(0, mockConfigFiles_1.mockConfigFiles)({
|
|
251
|
+
globalConfig: { accessToken: 'abc' },
|
|
252
|
+
projectConfig: {
|
|
253
|
+
...defaultConfigs.projectConfig,
|
|
254
|
+
fork: false,
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
const { fork } = await (0, options_1.getOptions)([]);
|
|
258
|
+
expect(fork).toBe(false);
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
describe('reviewers', () => {
|
|
262
|
+
beforeEach(() => {
|
|
263
|
+
mockGithubConfigOptions({ viewerLogin: 'billy.bob' });
|
|
264
|
+
});
|
|
265
|
+
it('can be set via `--reviewer` flag', async () => {
|
|
266
|
+
const { reviewers } = await (0, options_1.getOptions)(['--reviewer', 'peter']);
|
|
267
|
+
expect(reviewers).toEqual(['peter']);
|
|
268
|
+
});
|
|
269
|
+
it('can be set via config file', async () => {
|
|
270
|
+
(0, mockConfigFiles_1.mockConfigFiles)({
|
|
271
|
+
globalConfig: { accessToken: 'abc' },
|
|
272
|
+
projectConfig: {
|
|
273
|
+
...defaultConfigs.projectConfig,
|
|
274
|
+
reviewers: ['john'],
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
const { reviewers } = await (0, options_1.getOptions)([]);
|
|
278
|
+
expect(reviewers).toEqual(['john']);
|
|
279
|
+
});
|
|
280
|
+
});
|
|
237
281
|
describe('author', () => {
|
|
238
282
|
beforeEach(() => {
|
|
239
283
|
mockGithubConfigOptions({ viewerLogin: 'billy.bob' });
|
|
@@ -242,19 +286,31 @@ describe('getOptions', () => {
|
|
|
242
286
|
const { author } = await (0, options_1.getOptions)([]);
|
|
243
287
|
expect(author).toBe('billy.bob');
|
|
244
288
|
});
|
|
245
|
-
it('can be overridden via
|
|
289
|
+
it('can be overridden via `--author` flag', async () => {
|
|
246
290
|
const { author } = await (0, options_1.getOptions)(['--author', 'john.doe']);
|
|
247
291
|
expect(author).toBe('john.doe');
|
|
248
292
|
});
|
|
293
|
+
it('can be reset via `--all` flag', async () => {
|
|
294
|
+
const { author } = await (0, options_1.getOptions)(['--all']);
|
|
295
|
+
expect(author).toBe(null);
|
|
296
|
+
});
|
|
297
|
+
it('can be reset via config file (similar to `--all` flag)', async () => {
|
|
298
|
+
(0, mockConfigFiles_1.mockConfigFiles)({
|
|
299
|
+
globalConfig: { accessToken: 'abc' },
|
|
300
|
+
projectConfig: {
|
|
301
|
+
...defaultConfigs.projectConfig,
|
|
302
|
+
author: null,
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
const { author } = await (0, options_1.getOptions)([]);
|
|
306
|
+
expect(author).toBe(null);
|
|
307
|
+
});
|
|
249
308
|
it('can be overridden via config file', async () => {
|
|
250
309
|
(0, mockConfigFiles_1.mockConfigFiles)({
|
|
251
310
|
globalConfig: { accessToken: 'abc' },
|
|
252
311
|
projectConfig: {
|
|
312
|
+
...defaultConfigs.projectConfig,
|
|
253
313
|
author: 'jane.doe',
|
|
254
|
-
githubApiBaseUrlV4: 'http://localhost/graphql',
|
|
255
|
-
targetBranchChoices: ['7.9', '8.0'],
|
|
256
|
-
repoName: 'foo',
|
|
257
|
-
repoOwner: 'bar',
|
|
258
314
|
},
|
|
259
315
|
});
|
|
260
316
|
const { author } = await (0, options_1.getOptions)([]);
|
|
@@ -143,9 +143,13 @@ describe('runSequentially', () => {
|
|
|
143
143
|
Array [
|
|
144
144
|
Object {
|
|
145
145
|
"base": "7.x",
|
|
146
|
-
"body": "
|
|
146
|
+
"body": "# Backport
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
This is an automatic backport to 7.x of:
|
|
149
|
+
- #55
|
|
150
|
+
|
|
151
|
+
### Questions ?
|
|
152
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
149
153
|
|
|
150
154
|
myPrDescription",
|
|
151
155
|
"head": "sqren_authenticated:backport/7.x/pr-55",
|
|
@@ -14,9 +14,14 @@ describe('getPullRequestBody', () => {
|
|
|
14
14
|
],
|
|
15
15
|
targetBranch: '7.x',
|
|
16
16
|
})).toMatchInlineSnapshot(`
|
|
17
|
-
"
|
|
17
|
+
"# Backport
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
This is an automatic backport to 7.x of:
|
|
20
|
+
- #55
|
|
21
|
+
|
|
22
|
+
### Questions ?
|
|
23
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
24
|
+
"
|
|
20
25
|
`);
|
|
21
26
|
});
|
|
22
27
|
it('when a single commit (non pull request) is backported', () => {
|
|
@@ -30,9 +35,14 @@ describe('getPullRequestBody', () => {
|
|
|
30
35
|
],
|
|
31
36
|
targetBranch: '7.x',
|
|
32
37
|
})).toMatchInlineSnapshot(`
|
|
33
|
-
"
|
|
38
|
+
"# Backport
|
|
39
|
+
|
|
40
|
+
This is an automatic backport to 7.x of:
|
|
41
|
+
- My commit message (abcdefgh)
|
|
34
42
|
|
|
35
|
-
|
|
43
|
+
### Questions ?
|
|
44
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
45
|
+
"
|
|
36
46
|
`);
|
|
37
47
|
});
|
|
38
48
|
it('when multiple commits are backported', () => {
|
|
@@ -51,15 +61,37 @@ describe('getPullRequestBody', () => {
|
|
|
51
61
|
],
|
|
52
62
|
targetBranch: '7.x',
|
|
53
63
|
})).toMatchInlineSnapshot(`
|
|
54
|
-
"
|
|
64
|
+
"# Backport
|
|
65
|
+
|
|
66
|
+
This is an automatic backport to 7.x of:
|
|
55
67
|
- #55
|
|
56
68
|
- Another commit message (qwertyui)
|
|
57
69
|
|
|
58
|
-
|
|
70
|
+
### Questions ?
|
|
71
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
72
|
+
"
|
|
59
73
|
`);
|
|
60
74
|
});
|
|
61
75
|
});
|
|
62
76
|
describe('getTitle', () => {
|
|
77
|
+
it('when the default title is used', () => {
|
|
78
|
+
expect((0, createPullRequest_1.getTitle)({
|
|
79
|
+
options: {},
|
|
80
|
+
commits: [
|
|
81
|
+
{
|
|
82
|
+
pullNumber: 55,
|
|
83
|
+
sha: 'abcdefghi',
|
|
84
|
+
originalMessage: 'My commit message',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
pullNumber: 56,
|
|
88
|
+
sha: 'jklmnopqr',
|
|
89
|
+
originalMessage: 'Another commit message',
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
targetBranch: '7.x',
|
|
93
|
+
})).toEqual('[7.x] My commit message | Another commit message');
|
|
94
|
+
});
|
|
63
95
|
it('when a custom PR title is used', () => {
|
|
64
96
|
expect((0, createPullRequest_1.getTitle)({
|
|
65
97
|
options: {
|
|
@@ -285,6 +285,23 @@ describe('getExpectedTargetPullRequests', () => {
|
|
|
285
285
|
{ branch: 'master', state: 'MISSING' },
|
|
286
286
|
]);
|
|
287
287
|
});
|
|
288
|
+
it(`should support "backport-to" format`, () => {
|
|
289
|
+
const branchLabelMapping = {
|
|
290
|
+
'^backport-to-(.+)$': '$1',
|
|
291
|
+
};
|
|
292
|
+
const mockSourceCommit = (0, getMockSourceCommit_1.getMockSourceCommit)({
|
|
293
|
+
sourceCommit: { message: 'identical messages (#1234)' },
|
|
294
|
+
sourcePullRequest: {
|
|
295
|
+
number: 1234,
|
|
296
|
+
labels: ['backport-to-dev', 'backport-to-v3.1.0'],
|
|
297
|
+
},
|
|
298
|
+
});
|
|
299
|
+
const expectedTargetPullRequests = (0, getExpectedTargetPullRequests_1.getExpectedTargetPullRequests)(mockSourceCommit, branchLabelMapping);
|
|
300
|
+
expect(expectedTargetPullRequests).toEqual([
|
|
301
|
+
{ branch: 'dev', state: 'MISSING' },
|
|
302
|
+
{ branch: 'v3.1.0', state: 'MISSING' },
|
|
303
|
+
]);
|
|
304
|
+
});
|
|
288
305
|
it('should only get first match', () => {
|
|
289
306
|
const branchLabelMapping = {
|
|
290
307
|
'label-2': 'branch-b',
|
|
@@ -76,9 +76,14 @@ describe('integration', () => {
|
|
|
76
76
|
Array [
|
|
77
77
|
Object {
|
|
78
78
|
"base": "7.x",
|
|
79
|
-
"body": "
|
|
79
|
+
"body": "# Backport
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
This is an automatic backport to 7.x of:
|
|
82
|
+
- Add ❤️ emoji (5bf29b7d)
|
|
83
|
+
|
|
84
|
+
### Questions ?
|
|
85
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
86
|
+
",
|
|
82
87
|
"head": "sqren:backport/7.x/commit-5bf29b7d",
|
|
83
88
|
"title": "[7.x] Add ❤️ emoji",
|
|
84
89
|
},
|
|
@@ -207,9 +212,14 @@ describe('integration', () => {
|
|
|
207
212
|
Array [
|
|
208
213
|
Object {
|
|
209
214
|
"base": "7.x",
|
|
210
|
-
"body": "
|
|
215
|
+
"body": "# Backport
|
|
216
|
+
|
|
217
|
+
This is an automatic backport to 7.x of:
|
|
218
|
+
- Add ❤️ emoji (5bf29b7d)
|
|
211
219
|
|
|
212
|
-
|
|
220
|
+
### Questions ?
|
|
221
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
222
|
+
",
|
|
213
223
|
"head": "backport-org:backport/7.x/commit-5bf29b7d",
|
|
214
224
|
"title": "[7.x] Add ❤️ emoji",
|
|
215
225
|
},
|
|
@@ -111,11 +111,14 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
111
111
|
Array [
|
|
112
112
|
Object {
|
|
113
113
|
"base": "6.x",
|
|
114
|
-
"body": "
|
|
114
|
+
"body": "# Backport
|
|
115
|
+
|
|
116
|
+
This is an automatic backport to 6.x of:
|
|
115
117
|
- #1000
|
|
116
118
|
- #2000
|
|
117
119
|
|
|
118
|
-
|
|
120
|
+
### Questions ?
|
|
121
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
119
122
|
|
|
120
123
|
myPrSuffix",
|
|
121
124
|
"head": "sqren_authenticated:backport/6.x/pr-1000_pr-2000",
|
|
@@ -195,9 +198,14 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
195
198
|
Array [
|
|
196
199
|
Object {
|
|
197
200
|
"base": "6.x",
|
|
198
|
-
"body": "
|
|
201
|
+
"body": "# Backport
|
|
202
|
+
|
|
203
|
+
This is an automatic backport to 6.x of:
|
|
204
|
+
- My original commit message (mySha)
|
|
199
205
|
|
|
200
|
-
|
|
206
|
+
### Questions ?
|
|
207
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
208
|
+
",
|
|
201
209
|
"head": "sqren_authenticated:backport/6.x/commit-mySha",
|
|
202
210
|
"title": "[6.x] My original commit message",
|
|
203
211
|
},
|
|
@@ -263,9 +271,14 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
263
271
|
Array [
|
|
264
272
|
Object {
|
|
265
273
|
"base": "6.x",
|
|
266
|
-
"body": "
|
|
274
|
+
"body": "# Backport
|
|
275
|
+
|
|
276
|
+
This is an automatic backport to 6.x of:
|
|
277
|
+
- My original commit message (mySha)
|
|
267
278
|
|
|
268
|
-
|
|
279
|
+
### Questions ?
|
|
280
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
281
|
+
",
|
|
269
282
|
"head": "sqren_authenticated:backport/6.x/commit-mySha",
|
|
270
283
|
"title": "[6.x] My original commit message",
|
|
271
284
|
},
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.excludeUndefined = void 0;
|
|
4
4
|
function excludeUndefined(obj) {
|
|
5
|
-
return Object.fromEntries(Object.entries(obj).filter(([, v]) => v
|
|
5
|
+
return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined));
|
|
6
6
|
}
|
|
7
7
|
exports.excludeUndefined = excludeUndefined;
|
|
@@ -7,9 +7,9 @@ describe('excludeUndefined', () => {
|
|
|
7
7
|
foo: 'foo',
|
|
8
8
|
bar: undefined,
|
|
9
9
|
baz: null,
|
|
10
|
-
})).toEqual({ foo: 'foo' });
|
|
10
|
+
})).toEqual({ foo: 'foo', baz: null });
|
|
11
11
|
});
|
|
12
|
-
it('has the correct types', () => {
|
|
12
|
+
it('has the correct types after merging', () => {
|
|
13
13
|
const obj = (0, excludeUndefined_1.excludeUndefined)({
|
|
14
14
|
foo: 'foo',
|
|
15
15
|
bar: undefined,
|
|
@@ -19,6 +19,6 @@ describe('excludeUndefined', () => {
|
|
|
19
19
|
bar: 'bar',
|
|
20
20
|
...obj,
|
|
21
21
|
};
|
|
22
|
-
expect(res).toEqual({ bar: 'bar', foo: 'foo' });
|
|
22
|
+
expect(res).toEqual({ bar: 'bar', foo: 'foo', baz: null });
|
|
23
23
|
});
|
|
24
24
|
});
|