backport 5.6.6 → 6.0.0

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 (206) hide show
  1. package/README.md +48 -39
  2. package/dist/entrypoint.cli.js +1 -1
  3. package/dist/entrypoint.module.d.ts +6 -5
  4. package/dist/entrypoint.module.js +8 -6
  5. package/dist/ink.d.ts +1 -0
  6. package/dist/ink.js +49 -0
  7. package/dist/main.d.ts +11 -6
  8. package/dist/main.js +40 -24
  9. package/dist/options/ConfigOptions.d.ts +13 -8
  10. package/dist/options/cliArgs.d.ts +11 -9
  11. package/dist/options/cliArgs.js +74 -36
  12. package/dist/options/cliArgs.test.js +33 -37
  13. package/dist/options/config/config.d.ts +17 -15
  14. package/dist/options/config/config.js +8 -8
  15. package/dist/options/config/config.test.js +3 -2
  16. package/dist/options/config/getOptionsFromGit.js +1 -1
  17. package/dist/options/config/globalConfig.d.ts +2 -51
  18. package/dist/options/config/globalConfig.js +8 -8
  19. package/dist/options/config/globalConfig.test.js +7 -3
  20. package/dist/options/config/projectConfig.d.ts +2 -51
  21. package/dist/options/config/projectConfig.js +2 -2
  22. package/dist/options/config/projectConfig.test.js +3 -3
  23. package/dist/options/config/readConfigFile.d.ts +2 -51
  24. package/dist/options/config/readConfigFile.js +2 -2
  25. package/dist/options/options.d.ts +19 -14
  26. package/dist/options/options.js +5 -6
  27. package/dist/options/options.test.js +48 -11
  28. package/dist/options/parseRequiredOptions.d.ts +18 -13
  29. package/dist/options/parseRequiredOptions.js +8 -12
  30. package/dist/options/parseRequiredOptions.test.js +25 -16
  31. package/dist/runSequentially.d.ts +20 -0
  32. package/dist/runSequentially.js +41 -0
  33. package/dist/runSequentially.test.d.ts +1 -0
  34. package/dist/runSequentially.test.js +235 -0
  35. package/dist/runWithOptions.js +7 -14
  36. package/dist/runWithOptions.test.js +138 -17
  37. package/dist/scripts/generate-gql.d.ts +1 -0
  38. package/dist/scripts/generate-gql.js +15 -0
  39. package/dist/scripts/postinstall.js +4 -4
  40. package/dist/scripts/postinstall.test.js +9 -2
  41. package/dist/scripts/runPostinstall.js +1 -1
  42. package/dist/services/HandledError.d.ts +11 -1
  43. package/dist/services/HandledError.js +2 -1
  44. package/dist/services/child-process-promisified.d.ts +1 -1
  45. package/dist/services/child-process-promisified.js +1 -1
  46. package/dist/services/env.js +5 -5
  47. package/dist/services/env.test.js +11 -4
  48. package/dist/services/fs-promisified.js +4 -4
  49. package/dist/services/getExpectedTarget.d.ts +9 -0
  50. package/dist/services/getExpectedTarget.js +77 -0
  51. package/dist/services/getExpectedTargetPullRequests.d.ts +9 -0
  52. package/dist/services/getExpectedTargetPullRequests.js +77 -0
  53. package/dist/services/git.d.ts +15 -4
  54. package/dist/services/git.integration.test.d.ts +1 -0
  55. package/dist/services/git.integration.test.js +168 -0
  56. package/dist/services/git.js +86 -61
  57. package/dist/services/git.test.js +61 -64
  58. package/dist/services/github/commitFormatters.d.ts +3 -7
  59. package/dist/services/github/commitFormatters.js +10 -19
  60. package/dist/services/github/commitFormatters.test.js +2 -24
  61. package/dist/services/github/v3/addAssigneesToPullRequest.d.ts +1 -1
  62. package/dist/services/github/v3/addAssigneesToPullRequest.js +2 -6
  63. package/dist/services/github/v3/addAssigneesToPullRequest.test.js +2 -3
  64. package/dist/services/github/v3/addLabelsToPullRequest.d.ts +1 -1
  65. package/dist/services/github/v3/addLabelsToPullRequest.js +2 -6
  66. package/dist/services/github/v3/addReviewersToPullRequest.d.ts +2 -0
  67. package/dist/services/github/v3/addReviewersToPullRequest.js +34 -0
  68. package/dist/services/github/v3/createPullRequest.d.ts +3 -2
  69. package/dist/services/github/v3/createPullRequest.js +32 -23
  70. package/dist/services/github/v3/createStatusComment.d.ts +11 -0
  71. package/dist/services/github/v3/createStatusComment.js +97 -0
  72. package/dist/services/github/v3/createStatusComment.test.d.ts +1 -0
  73. package/dist/services/github/v3/createStatusComment.test.js +209 -0
  74. package/dist/services/github/v4/FetchPullRequestId.js +1 -1
  75. package/dist/services/github/v4/apiRequestV4.d.ts +1 -1
  76. package/dist/services/github/v4/apiRequestV4.js +5 -7
  77. package/dist/services/github/v4/apiRequestV4.test.js +7 -7
  78. package/dist/services/github/v4/disablePullRequestAutoMerge.js +3 -4
  79. package/dist/services/github/v4/enablePullRequestAutoMerge.js +8 -7
  80. package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +94 -33
  81. package/dist/services/github/v4/fetchAuthorId.js +1 -1
  82. package/dist/services/github/v4/fetchAuthorId.private.test.js +3 -3
  83. package/dist/services/github/v4/fetchCommitByPullNumber.js +11 -9
  84. package/dist/services/github/v4/fetchCommitByPullNumber.private.test.js +4 -4
  85. package/dist/services/github/v4/fetchCommitBySha.js +14 -12
  86. package/dist/services/github/v4/fetchCommitBySha.private.test.js +4 -4
  87. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +5 -0
  88. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +46 -0
  89. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +1 -0
  90. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +67 -0
  91. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.d.ts +5 -0
  92. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +36 -0
  93. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +1 -0
  94. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +55 -0
  95. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +16 -0
  96. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +90 -0
  97. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +1 -0
  98. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +130 -0
  99. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +1 -0
  100. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +127 -0
  101. package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.d.ts +28 -0
  102. package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.js +52 -0
  103. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +10 -0
  104. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +49 -0
  105. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +1 -0
  106. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +81 -0
  107. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.d.ts +1 -0
  108. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.js +252 -0
  109. package/dist/services/github/v4/fetchCommitsByAuthor.d.ts +2 -1
  110. package/dist/services/github/v4/fetchCommitsByAuthor.js +81 -70
  111. package/dist/services/github/v4/fetchCommitsByAuthor.private.test.js +78 -5
  112. package/dist/services/github/v4/fetchCommitsByAuthor.test.js +29 -21
  113. package/dist/services/github/v4/fetchDefaultBranch.js +1 -1
  114. package/dist/services/github/v4/fetchExistingPullRequest.js +2 -3
  115. package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +3 -3
  116. package/dist/services/github/v4/fetchMergedPullRequests.d.ts +18 -19
  117. package/dist/services/github/v4/fetchMergedPullRequests.js +22 -69
  118. package/dist/services/github/v4/fetchMergedPullRequests.private.test.js +8 -9
  119. package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.js +2 -3
  120. package/dist/services/github/v4/fetchPullRequestBySearchQuery.js +12 -10
  121. package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.js +3 -3
  122. package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.js +2 -2
  123. package/dist/services/github/v4/getExistingTargetPullRequests.d.ts +4 -58
  124. package/dist/services/github/v4/getExistingTargetPullRequests.js +3 -58
  125. package/dist/services/github/v4/getOptionsFromGithub/index.d.ts +16 -10
  126. package/dist/services/github/v4/getOptionsFromGithub/index.js +52 -22
  127. package/dist/services/github/v4/getOptionsFromGithub/index.private.test.js +25 -7
  128. package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +13 -16
  129. package/dist/services/github/v4/getOptionsFromGithub/query.js +13 -15
  130. package/dist/services/github/v4/getTargetBranchesFromLabels.d.ts +0 -7
  131. package/dist/services/github/v4/getTargetBranchesFromLabels.js +1 -26
  132. package/dist/services/github/v4/getTargetBranchesFromLabels.test.js +69 -32
  133. package/dist/services/github/v4/mocks/commitsByAuthorMock.d.ts +2 -2
  134. package/dist/services/github/v4/mocks/commitsByAuthorMock.js +39 -25
  135. package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.d.ts +1 -1
  136. package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.js +10 -0
  137. package/dist/services/github/v4/mocks/getCommitsByAuthorMock.d.ts +1 -1
  138. package/dist/services/github/v4/mocks/getCommitsByAuthorMock.js +2 -0
  139. package/dist/services/github/v4/mocks/getPullRequestNodeMock.d.ts +1 -1
  140. package/dist/services/github/v4/mocks/getPullRequestNodeMock.js +1 -0
  141. package/dist/services/github/v4/throwOnInvalidAccessToken.js +10 -15
  142. package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +7 -7
  143. package/dist/services/logger.d.ts +3 -3
  144. package/dist/services/logger.js +16 -15
  145. package/dist/services/prompt.test.d.ts +1 -0
  146. package/dist/services/prompt.test.js +87 -0
  147. package/dist/services/prompts.d.ts +10 -4
  148. package/dist/services/prompts.js +85 -22
  149. package/dist/services/sourceCommit/getExpectedTargetPullRequests.d.ts +9 -0
  150. package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +92 -0
  151. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.d.ts +1 -0
  152. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +396 -0
  153. package/dist/services/sourceCommit/getMockSourceCommit.d.ts +21 -0
  154. package/dist/services/sourceCommit/getMockSourceCommit.js +67 -0
  155. package/dist/services/sourceCommit/getTargetBranchesFromLabels.d.ts +5 -0
  156. package/dist/services/sourceCommit/getTargetBranchesFromLabels.js +20 -0
  157. package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.d.ts +1 -0
  158. package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.js +201 -0
  159. package/dist/services/sourceCommit/parseSourceCommit.d.ts +78 -0
  160. package/dist/services/sourceCommit/parseSourceCommit.js +96 -0
  161. package/dist/services/sourceCommit/parseSourceCommit.test.d.ts +1 -0
  162. package/dist/services/sourceCommit/parseSourceCommit.test.js +114 -0
  163. package/dist/services/sourceCommit/sourceCommit.d.ts +78 -0
  164. package/dist/services/sourceCommit/sourceCommit.js +86 -0
  165. package/dist/services/sourceCommit/sourceCommit.test.d.ts +1 -0
  166. package/dist/services/sourceCommit/sourceCommit.test.js +287 -0
  167. package/dist/services/sourceCommit.d.ts +78 -0
  168. package/dist/services/sourceCommit.js +86 -0
  169. package/dist/services/sourceCommit.test.d.ts +1 -0
  170. package/dist/services/sourceCommit.test.js +280 -0
  171. package/dist/test/inquirer.private.test.js +22 -15
  172. package/dist/test/integration/createSpies.js +6 -6
  173. package/dist/test/integration/envConstants.js +5 -6
  174. package/dist/test/integration/helpers.js +1 -1
  175. package/dist/test/integration/integration.private.test.d.ts +1 -0
  176. package/dist/test/integration/integration.private.test.js +308 -0
  177. package/dist/test/integration/integration.test.js +28 -29
  178. package/dist/test/nockHelpers.js +3 -7
  179. package/dist/test/setupFiles/automatic-mocks.d.ts +0 -1
  180. package/dist/test/setupFiles/automatic-mocks.js +0 -22
  181. package/dist/types/Commit.d.ts +85 -0
  182. package/dist/types/Commit.js +139 -0
  183. package/dist/types/commitNode.d.ts +89 -0
  184. package/dist/types/commitNode.js +139 -0
  185. package/dist/types/commitNode.test.d.ts +1 -0
  186. package/dist/types/commitNode.test.js +255 -0
  187. package/dist/types/commitWithAssociatedPullRequests.d.ts +86 -0
  188. package/dist/types/commitWithAssociatedPullRequests.js +145 -0
  189. package/dist/ui/cherrypickAndCreatePullRequest.test.js +277 -59
  190. package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +11 -1
  191. package/dist/ui/cherrypickAndCreateTargetPullRequest.js +131 -68
  192. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.d.ts +1 -0
  193. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +468 -0
  194. package/dist/ui/getCommits.d.ts +1 -1
  195. package/dist/ui/getCommits.js +55 -25
  196. package/dist/ui/getTargetBranches.d.ts +2 -2
  197. package/dist/ui/getTargetBranches.js +16 -17
  198. package/dist/ui/getTargetBranches.test.js +75 -99
  199. package/dist/ui/getTargetBranchesFromLabels.d.ts +6 -0
  200. package/dist/ui/getTargetBranchesFromLabels.js +40 -0
  201. package/dist/ui/getTargetBranchesFromLabels.test.d.ts +1 -0
  202. package/dist/ui/getTargetBranchesFromLabels.test.js +288 -0
  203. package/dist/ui/maybeSetupRepo.js +9 -9
  204. package/dist/ui/maybeSetupRepo.test.js +5 -1
  205. package/package.json +36 -51
  206. package/yarn.lock +2387 -2987
@@ -1,51 +1,2 @@
1
- export declare function getProjectConfig(): Promise<Partial<{
2
- accessToken: string;
3
- all: boolean;
4
- assignees: string[];
5
- author: string;
6
- autoAssign: boolean;
7
- autoMerge: boolean;
8
- autoMergeMethod: string;
9
- autoFixConflicts: ({ files, directory, logger, targetBranch, }: {
10
- files: string[];
11
- directory: string;
12
- logger: {
13
- error: (message: string, meta?: unknown) => void;
14
- warn: (message: string, meta?: unknown) => void;
15
- info: (message: string, meta?: unknown) => void;
16
- verbose: (message: string, meta?: unknown) => void;
17
- debug: (message: string, meta?: unknown) => void;
18
- };
19
- targetBranch: string;
20
- }) => boolean | Promise<boolean>;
21
- branchLabelMapping: Record<string, string>;
22
- ci: boolean;
23
- editor: string;
24
- forceLocalConfig: boolean;
25
- fork: boolean;
26
- gitHostname: string;
27
- githubApiBaseUrlV3: string;
28
- githubApiBaseUrlV4: string;
29
- maxNumber: number;
30
- multiple: boolean;
31
- multipleBranches: boolean;
32
- multipleCommits: boolean;
33
- noVerify: boolean;
34
- path: string;
35
- prDescription: string;
36
- prFilter: string;
37
- prTitle: string;
38
- pullNumber: number;
39
- resetAuthor: boolean;
40
- sha: string;
41
- sourceBranch: string;
42
- sourcePRLabels: string[];
43
- targetBranchChoices: import("../ConfigOptions").BranchChoiceRaw[];
44
- targetBranches: string[];
45
- targetPRLabels: string[];
46
- upstream: string;
47
- username: string;
48
- verbose: boolean;
49
- branches: import("../ConfigOptions").BranchChoiceRaw[];
50
- labels: string[];
51
- }> | undefined>;
1
+ import { ConfigFileOptions } from '../ConfigOptions';
2
+ export declare function getProjectConfig(): Promise<ConfigFileOptions | undefined>;
@@ -7,10 +7,10 @@ exports.getProjectConfig = void 0;
7
7
  const find_up_1 = __importDefault(require("find-up"));
8
8
  const readConfigFile_1 = require("../config/readConfigFile");
9
9
  async function getProjectConfig() {
10
- const filepath = await find_up_1.default('.backportrc.json');
10
+ const filepath = await (0, find_up_1.default)('.backportrc.json');
11
11
  if (!filepath) {
12
12
  return;
13
13
  }
14
- return readConfigFile_1.readConfigFile(filepath);
14
+ return (0, readConfigFile_1.readConfigFile)(filepath);
15
15
  }
16
16
  exports.getProjectConfig = getProjectConfig;
@@ -33,7 +33,7 @@ describe('getProjectConfig', () => {
33
33
  jest
34
34
  .spyOn(fs, 'readFile')
35
35
  .mockResolvedValueOnce(JSON.stringify({ upstream: 'elastic/kibana', branches: ['6.x'] }));
36
- projectConfig = await projectConfig_1.getProjectConfig();
36
+ projectConfig = await (0, projectConfig_1.getProjectConfig)();
37
37
  });
38
38
  it('should call findUp', () => {
39
39
  expect(find_up_1.default).toHaveBeenCalledWith('.backportrc.json');
@@ -48,14 +48,14 @@ describe('getProjectConfig', () => {
48
48
  describe('when projectConfig is empty', () => {
49
49
  it('should return empty config', async () => {
50
50
  jest.spyOn(fs, 'readFile').mockResolvedValueOnce('{}');
51
- const projectConfig = await projectConfig_1.getProjectConfig();
51
+ const projectConfig = await (0, projectConfig_1.getProjectConfig)();
52
52
  expect(projectConfig).toEqual({ targetBranchChoices: undefined });
53
53
  });
54
54
  });
55
55
  describe('when projectConfig is missing', () => {
56
56
  it('should return empty config', async () => {
57
57
  find_up_1.default.mockReturnValueOnce(undefined);
58
- const projectConfig = await projectConfig_1.getProjectConfig();
58
+ const projectConfig = await (0, projectConfig_1.getProjectConfig)();
59
59
  expect(projectConfig).toEqual(undefined);
60
60
  });
61
61
  });
@@ -1,51 +1,2 @@
1
- export declare function readConfigFile(filepath: string): Promise<Partial<{
2
- accessToken: string;
3
- all: boolean;
4
- assignees: string[];
5
- author: string;
6
- autoAssign: boolean;
7
- autoMerge: boolean;
8
- autoMergeMethod: string;
9
- autoFixConflicts: ({ files, directory, logger, targetBranch, }: {
10
- files: string[];
11
- directory: string;
12
- logger: {
13
- error: (message: string, meta?: unknown) => void;
14
- warn: (message: string, meta?: unknown) => void;
15
- info: (message: string, meta?: unknown) => void;
16
- verbose: (message: string, meta?: unknown) => void;
17
- debug: (message: string, meta?: unknown) => void;
18
- };
19
- targetBranch: string;
20
- }) => boolean | Promise<boolean>;
21
- branchLabelMapping: Record<string, string>;
22
- ci: boolean;
23
- editor: string;
24
- forceLocalConfig: boolean;
25
- fork: boolean;
26
- gitHostname: string;
27
- githubApiBaseUrlV3: string;
28
- githubApiBaseUrlV4: string;
29
- maxNumber: number;
30
- multiple: boolean;
31
- multipleBranches: boolean;
32
- multipleCommits: boolean;
33
- noVerify: boolean;
34
- path: string;
35
- prDescription: string;
36
- prFilter: string;
37
- prTitle: string;
38
- pullNumber: number;
39
- resetAuthor: boolean;
40
- sha: string;
41
- sourceBranch: string;
42
- sourcePRLabels: string[];
43
- targetBranchChoices: import("../ConfigOptions").BranchChoiceRaw[];
44
- targetBranches: string[];
45
- targetPRLabels: string[];
46
- upstream: string;
47
- username: string;
48
- verbose: boolean;
49
- branches: import("../ConfigOptions").BranchChoiceRaw[];
50
- labels: string[];
51
- }>>;
1
+ import { ConfigFileOptions } from '../ConfigOptions';
2
+ export declare function readConfigFile(filepath: string): Promise<ConfigFileOptions>;
@@ -8,8 +8,8 @@ const strip_json_comments_1 = __importDefault(require("strip-json-comments"));
8
8
  const HandledError_1 = require("../../services/HandledError");
9
9
  const fs_promisified_1 = require("../../services/fs-promisified");
10
10
  async function readConfigFile(filepath) {
11
- const fileContents = await fs_promisified_1.readFile(filepath, 'utf8');
12
- const configWithoutComments = strip_json_comments_1.default(fileContents);
11
+ const fileContents = await (0, fs_promisified_1.readFile)(filepath, 'utf8');
12
+ const configWithoutComments = (0, strip_json_comments_1.default)(fileContents);
13
13
  try {
14
14
  return JSON.parse(configWithoutComments);
15
15
  }
@@ -1,8 +1,7 @@
1
- import { PromiseReturnType } from '../types/PromiseReturnType';
2
- import { ConfigOptions } from './ConfigOptions';
3
- export declare type ValidConfigOptions = Readonly<PromiseReturnType<typeof getOptions>>;
4
- export declare function getOptions(argv: string[], optionsFromModule?: ConfigOptions): Promise<{
5
- targetBranchChoices: import("./ConfigOptions").BranchChoice[];
1
+ import { ConfigFileOptions } from './ConfigOptions';
2
+ export declare type ValidConfigOptions = Readonly<Awaited<ReturnType<typeof getOptions>>>;
3
+ export declare function getOptions(argv: string[], optionsFromModule?: ConfigFileOptions): Promise<{
4
+ targetBranchChoices: import("./ConfigOptions").TargetBranchChoice[];
6
5
  accessToken: string;
7
6
  username: string;
8
7
  repoName: string;
@@ -12,31 +11,33 @@ export declare function getOptions(argv: string[], optionsFromModule?: ConfigOpt
12
11
  all: boolean;
13
12
  multipleBranches: boolean;
14
13
  multipleCommits: boolean;
14
+ commitPaths: string[];
15
+ reviewers: string[];
16
+ sourcePRLabels: (string[] | undefined) & (string[] | never[]);
17
+ targetBranches: (string[] | undefined) & (string[] | never[]);
18
+ targetPRLabels: string[];
19
+ cherrypickRef: boolean;
20
+ fork: boolean;
15
21
  noVerify: boolean;
16
22
  autoAssign: boolean;
17
23
  autoMerge: boolean;
18
24
  autoMergeMethod: string;
19
25
  ci: boolean;
20
- dryRun: boolean;
26
+ details: boolean;
21
27
  editor: string | undefined;
22
28
  forceLocalConfig: boolean | undefined;
23
- fork: boolean;
24
29
  gitHostname: string;
25
30
  githubApiBaseUrlV3: string;
26
31
  githubApiBaseUrlV4: string;
27
32
  mainline: number | undefined;
28
33
  maxNumber: number;
29
- path: string | undefined;
30
- prTitle: string;
31
34
  prDescription: string | undefined;
35
+ prTitle: string;
32
36
  prFilter: string | undefined;
33
37
  pullNumber: number | undefined;
34
38
  resetAuthor: boolean;
35
39
  sha: string | undefined;
36
40
  sourceBranch: string;
37
- sourcePRLabels: string[] | (string[] & never[]);
38
- targetBranches: string[] | (string[] & never[]);
39
- targetPRLabels: string[];
40
41
  upstream: string | undefined;
41
42
  verbose: boolean;
42
43
  autoFixConflicts?: (({ files, directory, logger, targetBranch, }: {
@@ -51,8 +52,12 @@ export declare function getOptions(argv: string[], optionsFromModule?: ConfigOpt
51
52
  };
52
53
  targetBranch: string;
53
54
  }) => boolean | Promise<boolean>) | undefined;
54
- branchLabelMapping?: Record<string, string> | undefined;
55
55
  multiple?: boolean | undefined;
56
- branches?: import("./ConfigOptions").BranchChoiceRaw[] | undefined;
56
+ branchLabelMapping?: Record<string, string> | undefined;
57
+ branches?: import("./ConfigOptions").TargetBranchChoiceOrString[] | undefined;
57
58
  labels?: string[] | undefined;
59
+ historicalBranchLabelMappings: {
60
+ branchLabelMapping: Record<string, string>;
61
+ committedDate: string;
62
+ }[];
58
63
  }>;
@@ -7,13 +7,12 @@ const cliArgs_1 = require("./cliArgs");
7
7
  const config_1 = require("./config/config");
8
8
  const parseRequiredOptions_1 = require("./parseRequiredOptions");
9
9
  async function getOptions(argv, optionsFromModule) {
10
- const optionsFromConfigFiles = await config_1.getOptionsFromConfigFiles(optionsFromModule);
11
- const optionsFromCliArgs = cliArgs_1.getOptionsFromCliArgs(argv);
10
+ const optionsFromConfigFiles = await (0, config_1.getOptionsFromConfigFiles)(optionsFromModule);
11
+ const optionsFromCliArgs = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
12
12
  // update logger
13
- logger_1.updateLogger({ ...optionsFromConfigFiles, ...optionsFromCliArgs });
14
- // TODO: make `username` optional by defaulting to `currentUsername`
15
- const optionsFromGithub = await getOptionsFromGithub_1.getOptionsFromGithub(optionsFromConfigFiles, optionsFromCliArgs);
16
- const parsedOptions = parseRequiredOptions_1.parseRequiredOptions(optionsFromConfigFiles, optionsFromCliArgs, optionsFromGithub);
13
+ (0, logger_1.updateLogger)({ ...optionsFromConfigFiles, ...optionsFromCliArgs });
14
+ const optionsFromGithub = await (0, getOptionsFromGithub_1.getOptionsFromGithub)(optionsFromConfigFiles, optionsFromCliArgs);
15
+ const parsedOptions = (0, parseRequiredOptions_1.parseRequiredOptions)(optionsFromConfigFiles, optionsFromCliArgs, optionsFromGithub);
17
16
  return parsedOptions;
18
17
  }
19
18
  exports.getOptions = getOptions;
@@ -27,7 +27,7 @@ const logger = __importStar(require("../services/logger"));
27
27
  const nockHelpers_1 = require("../test/nockHelpers");
28
28
  const options_1 = require("./options");
29
29
  function mockGetGithubConfigOptions({ defaultBranch, refName, }) {
30
- return nockHelpers_1.mockGqlRequest({
30
+ return (0, nockHelpers_1.mockGqlRequest)({
31
31
  name: 'GithubConfigOptions',
32
32
  statusCode: 200,
33
33
  body: {
@@ -38,7 +38,7 @@ function mockGetGithubConfigOptions({ defaultBranch, refName, }) {
38
38
  ref: refName ? { name: refName } : null,
39
39
  defaultBranchRef: {
40
40
  name: defaultBranch,
41
- target: { jsonConfigFile: { edges: [] } },
41
+ target: { history: { edges: [] } },
42
42
  },
43
43
  },
44
44
  },
@@ -65,7 +65,7 @@ describe('getOptions', () => {
65
65
  const mockCalls = mockGetGithubConfigOptions({
66
66
  defaultBranch: 'my-default-branch',
67
67
  });
68
- const options = await options_1.getOptions(defaultArgs);
68
+ const options = await (0, options_1.getOptions)(defaultArgs);
69
69
  expect(mockCalls.length).toBe(1);
70
70
  expect(options.sourceBranch).toBe('my-default-branch');
71
71
  });
@@ -83,7 +83,7 @@ describe('getOptions', () => {
83
83
  'http://localhost/graphql',
84
84
  ];
85
85
  mockGetGithubConfigOptions({ defaultBranch: 'my-default-branch' });
86
- const options = await options_1.getOptions(argv);
86
+ const options = await (0, options_1.getOptions)(argv);
87
87
  expect(options.sourceBranch).toBe('my-source-branch');
88
88
  });
89
89
  it('should ensure that "backport" branch does not exist', async () => {
@@ -91,22 +91,22 @@ describe('getOptions', () => {
91
91
  defaultBranch: 'my-default-branch',
92
92
  refName: 'backport',
93
93
  });
94
- await expect(options_1.getOptions(defaultArgs)).rejects.toThrowError('You must delete the branch "backport" to continue. See https://github.com/sqren/backport/issues/155 for details');
94
+ await expect((0, options_1.getOptions)(defaultArgs)).rejects.toThrowError('You must delete the branch "backport" to continue. See https://github.com/sqren/backport/issues/155 for details');
95
95
  });
96
96
  it('should merge config options and module options', async () => {
97
97
  mockGetGithubConfigOptions({ defaultBranch: 'my-default-branch' });
98
98
  const myFn = async () => true;
99
- const options = await options_1.getOptions(defaultArgs, { autoFixConflicts: myFn });
99
+ const options = await (0, options_1.getOptions)(defaultArgs, { autoFixConflicts: myFn });
100
100
  expect(options.autoFixConflicts).toBe(myFn);
101
101
  });
102
102
  it('should call updateLogger', async () => {
103
103
  mockGetGithubConfigOptions({ defaultBranch: 'my-default-branch' });
104
- await options_1.getOptions(defaultArgs);
104
+ await (0, options_1.getOptions)(defaultArgs);
105
105
  expect(logger.updateLogger).toHaveBeenCalledTimes(1);
106
106
  });
107
107
  it('should return options', async () => {
108
- mockGetGithubConfigOptions({ defaultBranch: 'some-branch-name' });
109
- const options = await options_1.getOptions(defaultArgs);
108
+ mockGetGithubConfigOptions({ defaultBranch: 'default-branch-from-github' });
109
+ const options = await (0, options_1.getOptions)(defaultArgs);
110
110
  expect(options).toEqual({
111
111
  accessToken: 'myAccessToken',
112
112
  all: false,
@@ -116,11 +116,14 @@ describe('getOptions', () => {
116
116
  autoMerge: false,
117
117
  autoMergeMethod: 'merge',
118
118
  ci: false,
119
- dryRun: false,
119
+ cherrypickRef: true,
120
+ details: false,
120
121
  fork: true,
121
122
  gitHostname: 'github.com',
122
123
  githubApiBaseUrlV3: 'https://api.github.com',
123
124
  githubApiBaseUrlV4: 'http://localhost/graphql',
125
+ commitPaths: [],
126
+ mainline: 1,
124
127
  maxNumber: 10,
125
128
  multipleBranches: true,
126
129
  multipleCommits: false,
@@ -129,7 +132,8 @@ describe('getOptions', () => {
129
132
  repoName: 'kibana',
130
133
  repoOwner: 'elastic',
131
134
  resetAuthor: false,
132
- sourceBranch: 'some-branch-name',
135
+ reviewers: [],
136
+ sourceBranch: 'default-branch-from-github',
133
137
  sourcePRLabels: [],
134
138
  targetBranchChoices: [
135
139
  { checked: false, name: '6.0' },
@@ -142,4 +146,37 @@ describe('getOptions', () => {
142
146
  verbose: false,
143
147
  });
144
148
  });
149
+ describe('cherrypickRef', () => {
150
+ beforeEach(() => {
151
+ mockGetGithubConfigOptions({ defaultBranch: 'my-default-branch' });
152
+ });
153
+ const defaultArgs = [
154
+ // use localhost to avoid CORS issues with nock
155
+ '--github-api-base-url-v4',
156
+ 'http://localhost/graphql',
157
+ ];
158
+ it('should default to true', async () => {
159
+ const { cherrypickRef } = await (0, options_1.getOptions)(defaultArgs);
160
+ expect(cherrypickRef).toBe(true);
161
+ });
162
+ it('should negate with `noCherrypickRef` cli arg', async () => {
163
+ const { cherrypickRef } = await (0, options_1.getOptions)([
164
+ ...defaultArgs,
165
+ '--no-cherrypick-ref',
166
+ ]);
167
+ expect(cherrypickRef).toBe(false);
168
+ });
169
+ it('should be settable via config file', async () => {
170
+ const { cherrypickRef } = await (0, options_1.getOptions)([...defaultArgs], {
171
+ cherrypickRef: false,
172
+ });
173
+ expect(cherrypickRef).toBe(false);
174
+ });
175
+ it('cli args overwrites config', async () => {
176
+ const { cherrypickRef } = await (0, options_1.getOptions)([...defaultArgs, '--cherrypick-ref'], {
177
+ cherrypickRef: false,
178
+ });
179
+ expect(cherrypickRef).toBe(true);
180
+ });
181
+ });
145
182
  });
@@ -1,10 +1,9 @@
1
1
  import { OptionsFromGithub } from '../services/github/v4/getOptionsFromGithub';
2
- import { BranchChoiceRaw, BranchChoice, ConfigOptions } from './ConfigOptions';
2
+ import { TargetBranchChoiceOrString, TargetBranchChoice, ConfigFileOptions } from './ConfigOptions';
3
3
  import { OptionsFromCliArgs } from './cliArgs';
4
4
  import { OptionsFromConfigFiles } from './config/config';
5
- export declare type ValidatedOptions = ReturnType<typeof parseRequiredOptions>;
6
5
  export declare function parseRequiredOptions(optionsFromConfigFiles: OptionsFromConfigFiles, optionsFromCliArgs: OptionsFromCliArgs, optionsFromGithub: OptionsFromGithub): {
7
- targetBranchChoices: BranchChoice[];
6
+ targetBranchChoices: TargetBranchChoice[];
8
7
  accessToken: string;
9
8
  username: string;
10
9
  repoName: string;
@@ -14,31 +13,33 @@ export declare function parseRequiredOptions(optionsFromConfigFiles: OptionsFrom
14
13
  all: boolean;
15
14
  multipleBranches: boolean;
16
15
  multipleCommits: boolean;
16
+ commitPaths: string[];
17
+ reviewers: string[];
18
+ sourcePRLabels: (string[] | undefined) & (string[] | never[]);
19
+ targetBranches: (string[] | undefined) & (string[] | never[]);
20
+ targetPRLabels: string[];
21
+ cherrypickRef: boolean;
22
+ fork: boolean;
17
23
  noVerify: boolean;
18
24
  autoAssign: boolean;
19
25
  autoMerge: boolean;
20
26
  autoMergeMethod: string;
21
27
  ci: boolean;
22
- dryRun: boolean;
28
+ details: boolean;
23
29
  editor: string | undefined;
24
30
  forceLocalConfig: boolean | undefined;
25
- fork: boolean;
26
31
  gitHostname: string;
27
32
  githubApiBaseUrlV3: string;
28
33
  githubApiBaseUrlV4: string;
29
34
  mainline: number | undefined;
30
35
  maxNumber: number;
31
- path: string | undefined;
32
- prTitle: string;
33
36
  prDescription: string | undefined;
37
+ prTitle: string;
34
38
  prFilter: string | undefined;
35
39
  pullNumber: number | undefined;
36
40
  resetAuthor: boolean;
37
41
  sha: string | undefined;
38
42
  sourceBranch: string;
39
- sourcePRLabels: string[] | (string[] & never[]);
40
- targetBranches: string[] | (string[] & never[]);
41
- targetPRLabels: string[];
42
43
  upstream: string | undefined;
43
44
  verbose: boolean;
44
45
  autoFixConflicts?: (({ files, directory, logger, targetBranch, }: {
@@ -53,12 +54,16 @@ export declare function parseRequiredOptions(optionsFromConfigFiles: OptionsFrom
53
54
  };
54
55
  targetBranch: string;
55
56
  }) => boolean | Promise<boolean>) | undefined;
56
- branchLabelMapping?: Record<string, string> | undefined;
57
57
  multiple?: boolean | undefined;
58
- branches?: BranchChoiceRaw[] | undefined;
58
+ branchLabelMapping?: Record<string, string> | undefined;
59
+ branches?: TargetBranchChoiceOrString[] | undefined;
59
60
  labels?: string[] | undefined;
61
+ historicalBranchLabelMappings: {
62
+ branchLabelMapping: Record<string, string>;
63
+ committedDate: string;
64
+ }[];
60
65
  };
61
- export declare function getRequiredOptions({ accessToken, username, upstream, }: ConfigOptions): {
66
+ export declare function getRequiredOptions({ accessToken, username, upstream, }: ConfigFileOptions): {
62
67
  accessToken: string;
63
68
  username: string;
64
69
  repoOwner: string;
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.getRequiredOptions = exports.parseRequiredOptions = void 0;
7
- const lodash_isempty_1 = __importDefault(require("lodash.isempty"));
8
- const lodash_isstring_1 = __importDefault(require("lodash.isstring"));
4
+ const lodash_1 = require("lodash");
9
5
  const HandledError_1 = require("../services/HandledError");
10
6
  const env_1 = require("../services/env");
11
7
  const PROJECT_CONFIG_DOCS_LINK = 'https://github.com/sqren/backport/blob/e119d71d6dc03cd061f6ad9b9a8b1cd995f98961/docs/configuration.md#project-config-backportrcjson';
@@ -20,10 +16,10 @@ function parseRequiredOptions(optionsFromConfigFiles, optionsFromCliArgs, option
20
16
  ...optionsFromCliArgs,
21
17
  };
22
18
  // ensure `targetBranches` or `targetBranchChoices` are given
23
- if (lodash_isempty_1.default(options.targetBranches) &&
24
- lodash_isempty_1.default(options.targetBranchChoices) &&
19
+ if ((0, lodash_1.isEmpty)(options.targetBranches) &&
20
+ (0, lodash_1.isEmpty)(options.targetBranchChoices) &&
25
21
  // this is primarily necessary on CI where `targetBranches` and `targetBranchChoices` and not given
26
- lodash_isempty_1.default(options.branchLabelMapping)) {
22
+ (0, lodash_1.isEmpty)(options.branchLabelMapping)) {
27
23
  throw new HandledError_1.HandledError(`You must specify a target branch\n\nYou can specify it via either:\n - Config file (recommended): ".backportrc.json". Read more: ${PROJECT_CONFIG_DOCS_LINK}\n - CLI: "--branch 6.1"`);
28
24
  }
29
25
  const { accessToken, username, repoName, repoOwner } = getRequiredOptions(options);
@@ -37,7 +33,7 @@ function parseRequiredOptions(optionsFromConfigFiles, optionsFromCliArgs, option
37
33
  repoName,
38
34
  repoOwner,
39
35
  // auto-assign the current user or default to the specified assignees
40
- assignees: options.autoAssign
36
+ assignees: options.autoAssign && options.username
41
37
  ? [options.username]
42
38
  : options.assignees,
43
39
  author: options.author || username,
@@ -49,7 +45,7 @@ exports.parseRequiredOptions = parseRequiredOptions;
49
45
  // It must be transformed so it is always treated as an object troughout the application
50
46
  function getTargetBranchChoicesAsObject(targetBranchChoices) {
51
47
  return targetBranchChoices.map((choice) => {
52
- if (lodash_isstring_1.default(choice)) {
48
+ if ((0, lodash_1.isString)(choice)) {
53
49
  return {
54
50
  name: choice,
55
51
  checked: false,
@@ -61,11 +57,11 @@ function getTargetBranchChoicesAsObject(targetBranchChoices) {
61
57
  function getRequiredOptions({ accessToken, username, upstream, }) {
62
58
  // accessToken and username must be supplied in config or via cli args
63
59
  if (!accessToken || !username) {
64
- const globalConfigPath = env_1.getGlobalConfigPath();
60
+ const globalConfigPath = (0, env_1.getGlobalConfigPath)();
65
61
  throw new HandledError_1.HandledError(`Please update your config file: ${globalConfigPath}.\nIt must contain a valid "username" and "accessToken".\n\nRead more: ${GLOBAL_CONFIG_DOCS_LINK}`);
66
62
  }
67
63
  // upstream must be specified via config or cli args
68
- const [repoOwner, repoName] = (upstream !== null && upstream !== void 0 ? upstream : '').split('/');
64
+ const [repoOwner, repoName] = (upstream ?? '').split('/');
69
65
  if (!repoOwner || !repoName) {
70
66
  throw new HandledError_1.HandledError(`You must specify a valid Github repository\n\nYou can specify it via either:\n - Config file (recommended): ".backportrc.json". Read more: ${PROJECT_CONFIG_DOCS_LINK}\n - CLI: "--upstream elastic/kibana"`);
71
67
  }
@@ -1,8 +1,15 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const os_1 = __importDefault(require("os"));
3
7
  const config_1 = require("./config/config");
4
8
  const parseRequiredOptions_1 = require("./parseRequiredOptions");
5
9
  describe('parseRequiredOptions', () => {
10
+ beforeEach(() => {
11
+ jest.spyOn(os_1.default, 'homedir').mockReturnValue('/myHomeDir');
12
+ });
6
13
  const optionsFromConfigFiles = {
7
14
  ...config_1.defaultConfigOptions,
8
15
  accessToken: 'myAccessToken',
@@ -11,13 +18,15 @@ describe('parseRequiredOptions', () => {
11
18
  targetBranches: ['branchA', 'branchB'],
12
19
  };
13
20
  const optionsFromCliArgs = {};
14
- const optionsFromGithub = { sourceBranch: 'main' };
21
+ const optionsFromGithub = {
22
+ sourceBranch: 'source-branch-from-github',
23
+ };
15
24
  describe('should not throw', () => {
16
25
  it('when all options are valid and `branches` is given', () => {
17
- expect(() => parseRequiredOptions_1.parseRequiredOptions(optionsFromConfigFiles, optionsFromCliArgs, optionsFromGithub)).not.toThrow();
26
+ expect(() => (0, parseRequiredOptions_1.parseRequiredOptions)(optionsFromConfigFiles, optionsFromCliArgs, optionsFromGithub)).not.toThrow();
18
27
  });
19
28
  it('when `targetBranchChoices` is given instead of `targetBranches`', () => {
20
- expect(() => parseRequiredOptions_1.parseRequiredOptions({
29
+ expect(() => (0, parseRequiredOptions_1.parseRequiredOptions)({
21
30
  ...optionsFromConfigFiles,
22
31
  targetBranchChoices: [{ name: 'branchA' }],
23
32
  targetBranches: [],
@@ -25,21 +34,21 @@ describe('parseRequiredOptions', () => {
25
34
  });
26
35
  describe('autoAssign/assignees', () => {
27
36
  it('should set `assignees` to current user if `autoAssign` is true', () => {
28
- const options = parseRequiredOptions_1.parseRequiredOptions({ ...optionsFromConfigFiles, assignees: ['john'] }, { autoAssign: true }, optionsFromGithub);
37
+ const options = (0, parseRequiredOptions_1.parseRequiredOptions)({ ...optionsFromConfigFiles, assignees: ['john'] }, { autoAssign: true }, optionsFromGithub);
29
38
  expect(options.assignees).toEqual(['sqren']);
30
39
  });
31
40
  it('should set `assignees` to specified value if `autoAssign` is false', () => {
32
- const options = parseRequiredOptions_1.parseRequiredOptions({ ...optionsFromConfigFiles, assignees: ['john'] }, { autoAssign: false }, optionsFromGithub);
41
+ const options = (0, parseRequiredOptions_1.parseRequiredOptions)({ ...optionsFromConfigFiles, assignees: ['john'] }, { autoAssign: false }, optionsFromGithub);
33
42
  expect(options.assignees).toEqual(['john']);
34
43
  });
35
44
  it('should set `assignees` to empty if neither `assignees` or `autoAssign` is specified', () => {
36
- const options = parseRequiredOptions_1.parseRequiredOptions({ ...optionsFromConfigFiles, assignees: [] }, { autoAssign: false }, optionsFromGithub);
45
+ const options = (0, parseRequiredOptions_1.parseRequiredOptions)({ ...optionsFromConfigFiles, assignees: [] }, { autoAssign: false }, optionsFromGithub);
37
46
  expect(options.assignees).toEqual([]);
38
47
  });
39
48
  });
40
49
  describe('targetBranchChoices', () => {
41
50
  it('should convert primitives', () => {
42
- const options = parseRequiredOptions_1.parseRequiredOptions({
51
+ const options = (0, parseRequiredOptions_1.parseRequiredOptions)({
43
52
  ...optionsFromConfigFiles,
44
53
  targetBranchChoices: ['choice 1', 'choice 2'],
45
54
  }, optionsFromCliArgs, optionsFromGithub);
@@ -49,7 +58,7 @@ describe('parseRequiredOptions', () => {
49
58
  ]);
50
59
  });
51
60
  it('should preserve objects as-is', () => {
52
- const options = parseRequiredOptions_1.parseRequiredOptions({
61
+ const options = (0, parseRequiredOptions_1.parseRequiredOptions)({
53
62
  ...optionsFromConfigFiles,
54
63
  targetBranchChoices: [
55
64
  { name: 'choice 1', checked: false },
@@ -65,19 +74,19 @@ describe('parseRequiredOptions', () => {
65
74
  });
66
75
  describe('should throw', () => {
67
76
  it('when accessToken is missing', () => {
68
- expect(() => parseRequiredOptions_1.parseRequiredOptions({
77
+ expect(() => (0, parseRequiredOptions_1.parseRequiredOptions)({
69
78
  ...optionsFromConfigFiles,
70
79
  accessToken: undefined,
71
80
  }, optionsFromCliArgs, optionsFromGithub)).toThrowErrorMatchingSnapshot();
72
81
  });
73
82
  it('when accessToken is empty', () => {
74
- expect(() => parseRequiredOptions_1.parseRequiredOptions({
83
+ expect(() => (0, parseRequiredOptions_1.parseRequiredOptions)({
75
84
  ...optionsFromConfigFiles,
76
85
  accessToken: '',
77
86
  }, optionsFromCliArgs, optionsFromGithub)).toThrowErrorMatchingSnapshot();
78
87
  });
79
88
  it('when `targetBranches`, `targetBranchChoices` and `branchLabelMapping` are all empty', () => {
80
- expect(() => parseRequiredOptions_1.parseRequiredOptions({
89
+ expect(() => (0, parseRequiredOptions_1.parseRequiredOptions)({
81
90
  ...optionsFromConfigFiles,
82
91
  targetBranchChoices: [],
83
92
  targetBranches: [],
@@ -85,31 +94,31 @@ describe('parseRequiredOptions', () => {
85
94
  }, optionsFromCliArgs, optionsFromGithub)).toThrowErrorMatchingSnapshot();
86
95
  });
87
96
  it('when upstream is missing', () => {
88
- expect(() => parseRequiredOptions_1.parseRequiredOptions({
97
+ expect(() => (0, parseRequiredOptions_1.parseRequiredOptions)({
89
98
  ...optionsFromConfigFiles,
90
99
  upstream: undefined,
91
100
  }, optionsFromCliArgs, optionsFromGithub)).toThrowErrorMatchingSnapshot();
92
101
  });
93
102
  it('when upstream is empty', () => {
94
- expect(() => parseRequiredOptions_1.parseRequiredOptions({
103
+ expect(() => (0, parseRequiredOptions_1.parseRequiredOptions)({
95
104
  ...optionsFromConfigFiles,
96
105
  upstream: '',
97
106
  }, optionsFromCliArgs, optionsFromGithub)).toThrowErrorMatchingSnapshot();
98
107
  });
99
108
  it('when upstream is invalid', () => {
100
- expect(() => parseRequiredOptions_1.parseRequiredOptions({
109
+ expect(() => (0, parseRequiredOptions_1.parseRequiredOptions)({
101
110
  ...optionsFromConfigFiles,
102
111
  upstream: 'foobar',
103
112
  }, optionsFromCliArgs, optionsFromGithub)).toThrowErrorMatchingSnapshot();
104
113
  });
105
114
  it('when username is missing', () => {
106
- expect(() => parseRequiredOptions_1.parseRequiredOptions({
115
+ expect(() => (0, parseRequiredOptions_1.parseRequiredOptions)({
107
116
  ...optionsFromConfigFiles,
108
117
  username: undefined,
109
118
  }, optionsFromCliArgs, optionsFromGithub)).toThrowErrorMatchingSnapshot();
110
119
  });
111
120
  it('when username is empty', () => {
112
- expect(() => parseRequiredOptions_1.parseRequiredOptions({
121
+ expect(() => (0, parseRequiredOptions_1.parseRequiredOptions)({
113
122
  ...optionsFromConfigFiles,
114
123
  username: '',
115
124
  }, optionsFromCliArgs, optionsFromGithub)).toThrowErrorMatchingSnapshot();