backport 6.2.0 → 6.3.0-beta-3
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/README.md +15 -6
- package/dist/backportRun.d.ts +2 -2
- package/dist/backportRun.js +13 -8
- package/dist/{entrypoint.api.private.test.d.ts → entrypoint.cli.e2e.private.test.d.ts} +0 -0
- package/dist/entrypoint.cli.e2e.private.test.js +277 -0
- package/dist/entrypoint.cli.js +3 -5
- package/dist/{entrypoint.module.private.test.d.ts → entrypoint.cli.private.test.d.ts} +0 -0
- package/dist/{entrypoint.module.private.test.js → entrypoint.cli.private.test.js} +17 -8
- package/dist/entrypoint.module.d.ts +2 -2
- package/dist/entrypoint.module.js +4 -4
- package/dist/options/ConfigOptions.d.ts +7 -3
- package/dist/options/cliArgs.d.ts +16 -14
- package/dist/options/cliArgs.js +31 -5
- package/dist/options/cliArgs.test.js +28 -10
- package/dist/options/config/config.d.ts +11 -11
- package/dist/options/config/config.js +7 -6
- package/dist/options/config/config.test.js +11 -1
- package/dist/options/config/globalConfig.d.ts +1 -1
- package/dist/options/config/globalConfig.js +15 -9
- package/dist/options/config/globalConfig.test.js +17 -30
- package/dist/options/config/projectConfig.d.ts +3 -1
- package/dist/options/config/projectConfig.js +5 -2
- package/dist/options/config/projectConfig.test.js +41 -31
- package/dist/options/config/readConfigFile.d.ts +21 -23
- package/dist/options/config/readConfigFile.js +2 -2
- package/dist/options/options.d.ts +19 -46
- package/dist/options/options.js +40 -32
- package/dist/options/options.test.js +83 -50
- package/dist/runSequentially.d.ts +0 -1
- package/dist/runSequentially.js +1 -1
- package/dist/runSequentially.test.js +37 -18
- package/dist/scripts/postinstall.js +3 -3
- package/dist/services/HandledError.d.ts +6 -4
- package/dist/services/HandledError.js +18 -3
- package/dist/services/child-process-promisified.d.ts +3 -1
- package/dist/services/env.d.ts +3 -1
- package/dist/services/env.js +4 -1
- package/dist/services/env.test.js +2 -2
- package/dist/services/git.d.ts +22 -9
- package/dist/services/git.integration.test.js +123 -24
- package/dist/services/git.js +66 -54
- package/dist/services/git.test.js +35 -20
- package/dist/services/github/commitFormatters.d.ts +0 -1
- package/dist/services/github/commitFormatters.js +1 -8
- package/dist/services/github/v3/createPullRequest.js +16 -10
- package/dist/services/github/v3/createPullRequest.test.js +248 -33
- package/dist/services/github/v3/createStatusComment.d.ts +1 -1
- package/dist/services/github/v3/createStatusComment.js +26 -15
- package/dist/services/github/v3/createStatusComment.test.js +132 -72
- package/dist/services/github/v3/getGithubV3ErrorMessage.d.ts +2 -1
- package/dist/{options/getValidatedOptions.test.d.ts → services/github/v3/index.d.ts} +0 -0
- package/dist/services/github/v3/index.js +61 -0
- package/dist/services/github/v4/FetchPullRequestId.d.ts +0 -7
- package/dist/services/github/v4/apiRequestV4.d.ts +21 -17
- package/dist/services/github/v4/apiRequestV4.js +46 -28
- package/dist/services/github/v4/apiRequestV4.test.js +4 -4
- package/dist/services/github/v4/disablePullRequestAutoMerge.d.ts +0 -7
- package/dist/services/github/v4/enablePullRequestAutoMerge.d.ts +0 -7
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +37 -19
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +17 -8
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +3 -3
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +23 -14
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +2 -2
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +4 -4
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +41 -19
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +1 -8
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +31 -14
- package/dist/services/github/v4/fetchExistingPullRequest.d.ts +0 -4
- package/dist/services/github/v4/fetchExistingPullRequest.js +1 -2
- package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.d.ts +0 -9
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +7 -9
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +48 -40
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +6 -0
- package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +15 -23
- package/dist/services/github/v4/getOptionsFromGithub/query.js +17 -25
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.d.ts +29 -0
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.js +56 -0
- package/dist/{options/parseRequiredOptions.test.d.ts → services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.d.ts} +0 -0
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +71 -0
- package/dist/services/github/v4/mocks/commitsByAuthorMock.js +11 -11
- package/dist/services/github/v4/throwOnInvalidAccessToken.d.ts +4 -5
- package/dist/services/github/v4/throwOnInvalidAccessToken.js +10 -7
- package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +5 -5
- package/dist/services/logger.d.ts +11 -17
- package/dist/services/logger.js +29 -66
- package/dist/services/prompt.test.js +66 -19
- package/dist/services/prompts.js +12 -10
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +1 -1
- package/dist/services/sourceCommit/getMockSourceCommit.js +6 -6
- package/dist/services/sourceCommit/parseSourceCommit.d.ts +18 -10
- package/dist/services/sourceCommit/parseSourceCommit.js +20 -14
- package/dist/services/sourceCommit/parseSourceCommit.test.js +18 -20
- package/dist/{runWithOptions.test.d.ts → test/backport-e2e.mutation.test.d.ts} +0 -0
- package/dist/test/{backport-e2e.private.test.js → backport-e2e.mutation.test.js} +136 -116
- package/dist/test/handleUnbackportedPullRequests.private.test.js +26 -12
- package/dist/test/mockConfigFiles.js +4 -20
- package/dist/test/mocks.d.ts +10 -0
- package/dist/test/mocks.js +23 -0
- package/dist/test/private/getDevAccessToken.js +5 -4
- package/dist/test/sandbox.d.ts +5 -0
- package/dist/{react-components/0-loadOptions.js → test/sandbox.js} +18 -20
- package/dist/test/setupFiles/automatic-mocks.d.ts +1 -0
- package/dist/test/setupFiles/automatic-mocks.js +27 -11
- package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +0 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +12 -13
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +50 -27
- package/dist/ui/getCommits.js +8 -14
- package/dist/ui/getCommitsWithoutBackports.js +6 -6
- package/dist/ui/getCommitsWithoutBackports.test.js +91 -39
- package/dist/ui/getTargetBranches.js +1 -1
- package/dist/ui/getTargetBranches.test.js +26 -8
- package/dist/ui/maybeSetupRepo.js +25 -5
- package/dist/ui/maybeSetupRepo.test.js +144 -18
- package/dist/utils/maybe.d.ts +1 -0
- package/dist/utils/maybe.js +7 -0
- package/dist/utils/packageVersion.d.ts +1 -0
- package/dist/{types/PromiseReturnType.js → utils/packageVersion.js} +2 -0
- package/package.json +26 -21
- package/yarn.lock +165 -237
- package/dist/entrypoint.api.d.ts +0 -22
- package/dist/entrypoint.api.js +0 -57
- package/dist/entrypoint.api.private.test.js +0 -37
- package/dist/index.d.ts +0 -783
- package/dist/index.js +0 -8001
- package/dist/ink.d.ts +0 -1
- package/dist/ink.js +0 -49
- package/dist/main.d.ts +0 -14
- package/dist/main.js +0 -68
- package/dist/options/config/getOptionsFromGit.d.ts +0 -4
- package/dist/options/config/getOptionsFromGit.js +0 -8
- package/dist/options/config/getProjectConfig.d.ts +0 -0
- package/dist/options/config/getProjectConfig.js +0 -1
- package/dist/options/getValidatedOptions.d.ts +0 -49
- package/dist/options/getValidatedOptions.js +0 -45
- package/dist/options/getValidatedOptions.test.js +0 -97
- package/dist/options/parseRequiredOptions.d.ts +0 -71
- package/dist/options/parseRequiredOptions.js +0 -68
- package/dist/options/parseRequiredOptions.test.js +0 -122
- package/dist/react-components/0-loadOptions.d.ts +0 -6
- package/dist/react-components/1-loadCommit.d.ts +0 -8
- package/dist/react-components/1-loadCommit.js +0 -88
- package/dist/react-components/1a-loadCommit.d.ts +0 -5
- package/dist/react-components/1a-loadCommit.js +0 -76
- package/dist/react-components/1b-commitChoices.d.ts +0 -5
- package/dist/react-components/1b-commitChoices.js +0 -98
- package/dist/react-components/2-commitChoices.d.ts +0 -8
- package/dist/react-components/2-commitChoices.js +0 -96
- package/dist/react-components/2-commitsPrompt.d.ts +0 -8
- package/dist/react-components/2-commitsPrompt.js +0 -96
- package/dist/react-components/2-targetBranchChoices.d.ts +0 -9
- package/dist/react-components/2-targetBranchChoices.js +0 -109
- package/dist/react-components/3-cherrypick.d.ts +0 -1
- package/dist/react-components/3-cherrypick.js +0 -2
- package/dist/react-components/App.d.ts +0 -2
- package/dist/react-components/App.js +0 -35
- package/dist/react-components/BackportStateContext.d.ts +0 -33
- package/dist/react-components/BackportStateContext.js +0 -42
- package/dist/react-components/CommitPrompt/2-commitsPrompt.d.ts +0 -8
- package/dist/react-components/CommitPrompt/2-commitsPrompt.js +0 -96
- package/dist/react-components/CommitPrompt/CommitPrompt.d.ts +0 -8
- package/dist/react-components/CommitPrompt/CommitPrompt.js +0 -96
- package/dist/react-components/CommitPrompt/getCommits.d.ts +0 -2
- package/dist/react-components/CommitPrompt/getCommits.js +0 -27
- package/dist/react-components/CommitPrompt.d.ts +0 -8
- package/dist/react-components/CommitPrompt.js +0 -96
- package/dist/react-components/CustomMultiSelect.d.ts +0 -13
- package/dist/react-components/CustomMultiSelect.js +0 -21
- package/dist/react-components/CustomMultiSelectItem.d.ts +0 -5
- package/dist/react-components/CustomMultiSelectItem.js +0 -12
- package/dist/react-components/CustomSelect.d.ts +0 -14
- package/dist/react-components/CustomSelect.js +0 -34
- package/dist/react-components/ErrorBoundary.d.ts +0 -15
- package/dist/react-components/ErrorBoundary.js +0 -53
- package/dist/react-components/MultiSelect.d.ts +0 -7
- package/dist/react-components/MultiSelect.js +0 -16
- package/dist/react-components/hooks/useAsync.d.ts +0 -12
- package/dist/react-components/hooks/useAsync.js +0 -73
- package/dist/runWithOptions.d.ts +0 -9
- package/dist/runWithOptions.js +0 -43
- package/dist/runWithOptions.test.js +0 -304
- package/dist/scripts/generate-gql.d.ts +0 -1
- package/dist/scripts/generate-gql.js +0 -15
- package/dist/services/backportRun/backportRun.ci.d.ts +0 -6
- package/dist/services/backportRun/backportRun.ci.js +0 -81
- package/dist/services/backportRun/backportRun.d.ts +0 -14
- package/dist/services/backportRun/backportRun.interactive.d.ts +0 -1
- package/dist/services/backportRun/backportRun.interactive.js +0 -4
- package/dist/services/backportRun/backportRun.js +0 -14
- package/dist/services/backportRun/backportState.d.ts +0 -4
- package/dist/services/backportRun/backportState.js +0 -28
- package/dist/services/backportRun/getCommits.d.ts +0 -2
- package/dist/services/backportRun/getCommits.js +0 -20
- package/dist/services/backportRun/runSequentially.d.ts +0 -20
- package/dist/services/backportRun/runSequentially.js +0 -41
- package/dist/services/backportRun/runSequentially.test.d.ts +0 -1
- package/dist/services/backportRun/runSequentially.test.js +0 -199
- package/dist/services/cherrypickAndCreateTargetPullRequest.d.ts +0 -12
- package/dist/services/cherrypickAndCreateTargetPullRequest.js +0 -206
- package/dist/services/cherrypickAndCreateTargetPullRequest.test.d.ts +0 -1
- package/dist/services/cherrypickAndCreateTargetPullRequest.test.js +0 -403
- package/dist/services/fs-promisified.d.ts +0 -6
- package/dist/services/fs-promisified.js +0 -12
- package/dist/services/getCommits.d.ts +0 -2
- package/dist/services/getCommits.js +0 -38
- package/dist/services/getCommitsWithoutBackports.d.ts +0 -11
- package/dist/services/getCommitsWithoutBackports.js +0 -68
- package/dist/services/getCommitsWithoutBackports.test.d.ts +0 -1
- package/dist/services/getCommitsWithoutBackports.test.js +0 -259
- package/dist/services/getExpectedTarget.d.ts +0 -9
- package/dist/services/getExpectedTarget.js +0 -77
- package/dist/services/getExpectedTargetPullRequests.d.ts +0 -9
- package/dist/services/getExpectedTargetPullRequests.js +0 -77
- package/dist/services/getTargetBranches.d.ts +0 -5
- package/dist/services/getTargetBranches.js +0 -60
- package/dist/services/getTargetBranches.test.d.ts +0 -1
- package/dist/services/getTargetBranches.test.js +0 -180
- package/dist/services/github/v4/fetchCommitByPullNumber.d.ts +0 -5
- package/dist/services/github/v4/fetchCommitByPullNumber.js +0 -86
- package/dist/services/github/v4/fetchCommitByPullNumber.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitByPullNumber.private.test.js +0 -57
- package/dist/services/github/v4/fetchCommitBySha.d.ts +0 -5
- package/dist/services/github/v4/fetchCommitBySha.js +0 -95
- package/dist/services/github/v4/fetchCommitBySha.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitBySha.private.test.js +0 -50
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.d.ts +0 -28
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.js +0 -52
- package/dist/services/github/v4/fetchCommits/fetchProjectConfig.d.ts +0 -3
- package/dist/services/github/v4/fetchCommits/fetchProjectConfig.js +0 -55
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.js +0 -252
- package/dist/services/github/v4/fetchCommitsByAuthor.d.ts +0 -28
- package/dist/services/github/v4/fetchCommitsByAuthor.js +0 -161
- package/dist/services/github/v4/fetchCommitsByAuthor.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitsByAuthor.private.test.js +0 -115
- package/dist/services/github/v4/fetchCommitsByAuthor.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitsByAuthor.test.js +0 -272
- package/dist/services/github/v4/fetchDefaultBranch.d.ts +0 -9
- package/dist/services/github/v4/fetchDefaultBranch.js +0 -24
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.d.ts +0 -4
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.js +0 -52
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.js +0 -32
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.d.ts +0 -4
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.js +0 -72
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.js +0 -34
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.d.ts +0 -40
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.js +0 -72
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.d.ts +0 -17
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.js +0 -69
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.js +0 -32
- package/dist/services/github/v4/fetchMergedPullRequests.d.ts +0 -37
- package/dist/services/github/v4/fetchMergedPullRequests.js +0 -37
- package/dist/services/github/v4/fetchMergedPullRequests.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchMergedPullRequests.private.test.js +0 -59
- package/dist/services/github/v4/fetchMergedPullRequests.test.d.ts +0 -1
- package/dist/services/github/v4/fetchMergedPullRequests.test.js +0 -22
- package/dist/services/github/v4/fetchProjectConfig.d.ts +0 -8
- package/dist/services/github/v4/fetchProjectConfig.js +0 -56
- package/dist/services/github/v4/fetchProjectConfig.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchProjectConfig.private.test.js +0 -52
- package/dist/services/github/v4/fetchProjectConfig.test.d.ts +0 -1
- package/dist/services/github/v4/fetchProjectConfig.test.js +0 -37
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.d.ts +0 -9
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.js +0 -92
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.js +0 -66
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.d.ts +0 -1
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.js +0 -242
- package/dist/services/github/v4/getExistingTargetPullRequests.d.ts +0 -7
- package/dist/services/github/v4/getExistingTargetPullRequests.js +0 -45
- package/dist/services/github/v4/getOptionsFromGithub/index.d.ts +0 -63
- package/dist/services/github/v4/getOptionsFromGithub/index.js +0 -139
- package/dist/services/github/v4/getOptionsFromGithub/index.private.test.d.ts +0 -1
- package/dist/services/github/v4/getOptionsFromGithub/index.private.test.js +0 -147
- package/dist/services/github/v4/getTargetBranchesFromLabels.d.ts +0 -5
- package/dist/services/github/v4/getTargetBranchesFromLabels.js +0 -20
- package/dist/services/github/v4/getTargetBranchesFromLabels.test.d.ts +0 -1
- package/dist/services/github/v4/getTargetBranchesFromLabels.test.js +0 -201
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.d.ts +0 -2
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.js +0 -843
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.d.ts +0 -2
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.js +0 -73
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.d.ts +0 -12
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.js +0 -44
- package/dist/services/maybeSetupRepo.d.ts +0 -2
- package/dist/services/maybeSetupRepo.js +0 -33
- package/dist/services/maybeSetupRepo.test.d.ts +0 -1
- package/dist/services/maybeSetupRepo.test.js +0 -78
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.d.ts +0 -5
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.js +0 -20
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.d.ts +0 -1
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.js +0 -201
- package/dist/services/sourceCommit/sourceCommit.d.ts +0 -78
- package/dist/services/sourceCommit/sourceCommit.js +0 -86
- package/dist/services/sourceCommit/sourceCommit.test.d.ts +0 -1
- package/dist/services/sourceCommit/sourceCommit.test.js +0 -287
- package/dist/services/sourceCommit.d.ts +0 -78
- package/dist/services/sourceCommit.js +0 -86
- package/dist/services/sourceCommit.test.d.ts +0 -1
- package/dist/services/sourceCommit.test.js +0 -280
- package/dist/test/backport-e2e.private.test.d.ts +0 -1
- package/dist/test/inquirer.private.test.d.ts +0 -1
- package/dist/test/inquirer.private.test.js +0 -168
- package/dist/test/integration/createSpies.d.ts +0 -17
- package/dist/test/integration/createSpies.js +0 -85
- package/dist/test/integration/envConstants.d.ts +0 -5
- package/dist/test/integration/envConstants.js +0 -9
- package/dist/test/integration/helpers.d.ts +0 -7
- package/dist/test/integration/helpers.js +0 -31
- package/dist/test/integration/integration.private.test.d.ts +0 -1
- package/dist/test/integration/integration.private.test.js +0 -327
- package/dist/test/integration/integration.test.d.ts +0 -1
- package/dist/test/integration/integration.test.js +0 -214
- package/dist/todo-delete.d.ts +0 -1
- package/dist/todo-delete.js +0 -17
- package/dist/types/Commit.d.ts +0 -85
- package/dist/types/Commit.js +0 -139
- package/dist/types/PromiseReturnType.d.ts +0 -1
- package/dist/types/commitNode.d.ts +0 -89
- package/dist/types/commitNode.js +0 -139
- package/dist/types/commitNode.test.d.ts +0 -1
- package/dist/types/commitNode.test.js +0 -255
- package/dist/types/commitWithAssociatedPullRequests.d.ts +0 -86
- package/dist/types/commitWithAssociatedPullRequests.js +0 -145
- package/dist/ui/cherrypickAndCreatePullRequest.test.d.ts +0 -1
- package/dist/ui/cherrypickAndCreatePullRequest.test.js +0 -617
- package/dist/ui/getTargetBranchesFromLabels.d.ts +0 -6
- package/dist/ui/getTargetBranchesFromLabels.js +0 -40
- package/dist/ui/getTargetBranchesFromLabels.test.d.ts +0 -1
- package/dist/ui/getTargetBranchesFromLabels.test.js +0 -288
- package/dist/utils/sequentially.d.ts +0 -1
- package/dist/utils/sequentially.js +0 -10
|
@@ -5,9 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
/* eslint-disable jest/no-commented-out-tests */
|
|
7
7
|
const os_1 = __importDefault(require("os"));
|
|
8
|
-
const path_1 = require("path");
|
|
9
8
|
const rest_1 = require("@octokit/rest");
|
|
10
|
-
const del = require("del");
|
|
11
9
|
const nock_1 = __importDefault(require("nock"));
|
|
12
10
|
const options_1 = require("../options/options");
|
|
13
11
|
const runSequentially_1 = require("../runSequentially");
|
|
@@ -15,22 +13,23 @@ const getCommits_1 = require("../ui/getCommits");
|
|
|
15
13
|
const mockConfigFiles_1 = require("./mockConfigFiles");
|
|
16
14
|
const nockHelpers_1 = require("./nockHelpers");
|
|
17
15
|
const getDevAccessToken_1 = require("./private/getDevAccessToken");
|
|
18
|
-
|
|
19
|
-
jest.unmock('del');
|
|
16
|
+
const sandbox_1 = require("./sandbox");
|
|
20
17
|
jest.setTimeout(10000);
|
|
21
|
-
const
|
|
22
|
-
const HOMEDIR_PATH = (0, path_1.resolve)('./src/test/tmp-mock-environments/backport-e2e/homedir');
|
|
18
|
+
const sandboxPath = (0, sandbox_1.getSandboxPath)({ filename: __filename });
|
|
23
19
|
const REPO_OWNER = 'backport-org';
|
|
24
20
|
const REPO_NAME = 'integration-test';
|
|
25
|
-
const
|
|
26
|
-
const
|
|
21
|
+
const BRANCH_WITH_ONE_COMMIT = 'backport/7.x/commit-5bf29b7d';
|
|
22
|
+
const BRANCH_WITH_TWO_COMMITS = 'backport/7.x/commit-5bf29b7d_commit-59d6ff1c';
|
|
23
|
+
const AUTHOR = 'sqren';
|
|
27
24
|
describe('backport e2e', () => {
|
|
25
|
+
let accessToken;
|
|
28
26
|
afterAll(() => {
|
|
29
27
|
nock_1.default.cleanAll();
|
|
30
28
|
});
|
|
31
|
-
beforeAll(() => {
|
|
29
|
+
beforeAll(async () => {
|
|
32
30
|
// set alternative homedir
|
|
33
|
-
jest.spyOn(os_1.default, 'homedir').mockReturnValue(
|
|
31
|
+
jest.spyOn(os_1.default, 'homedir').mockReturnValue(`${sandboxPath}/homedir`);
|
|
32
|
+
accessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
34
33
|
(0, mockConfigFiles_1.mockConfigFiles)({
|
|
35
34
|
globalConfig: {},
|
|
36
35
|
projectConfig: {},
|
|
@@ -38,23 +37,21 @@ describe('backport e2e', () => {
|
|
|
38
37
|
});
|
|
39
38
|
describe('when a single commit is backported', () => {
|
|
40
39
|
let res;
|
|
41
|
-
let accessToken;
|
|
42
40
|
let createPullRequestsMockCalls;
|
|
43
41
|
beforeAll(async () => {
|
|
44
|
-
accessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
45
42
|
await resetState(accessToken);
|
|
46
43
|
createPullRequestsMockCalls = mockCreatePullRequest({
|
|
47
44
|
number: 1337,
|
|
48
45
|
html_url: 'myHtmlUrl',
|
|
49
46
|
});
|
|
50
47
|
const options = await (0, options_1.getOptions)([], {
|
|
51
|
-
githubApiBaseUrlV3: 'https://api.foo.com',
|
|
52
|
-
ci: true,
|
|
53
|
-
sha: '5bf29b7d847ea3dbde9280448f0f62ad0f22d3ad',
|
|
54
|
-
author: AUHTOR,
|
|
55
48
|
accessToken,
|
|
56
|
-
|
|
49
|
+
author: AUTHOR,
|
|
50
|
+
ci: true,
|
|
51
|
+
githubApiBaseUrlV3: 'https://api.foo.com',
|
|
57
52
|
repoName: 'integration-test',
|
|
53
|
+
repoOwner: 'backport-org',
|
|
54
|
+
sha: '5bf29b7d847ea3dbde9280448f0f62ad0f22d3ad',
|
|
58
55
|
});
|
|
59
56
|
const commits = await (0, getCommits_1.getCommits)(options);
|
|
60
57
|
const targetBranches = ['7.x'];
|
|
@@ -78,12 +75,13 @@ describe('backport e2e', () => {
|
|
|
78
75
|
"base": "7.x",
|
|
79
76
|
"body": "# Backport
|
|
80
77
|
|
|
81
|
-
This
|
|
78
|
+
This will backport the following commits from \`master\` to \`7.x\`:
|
|
82
79
|
- Add ❤️ emoji (5bf29b7d)
|
|
83
80
|
|
|
81
|
+
<!--- Backport version: 1.2.3 -->
|
|
82
|
+
|
|
84
83
|
### Questions ?
|
|
85
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
86
|
-
",
|
|
84
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
87
85
|
"head": "sqren:backport/7.x/commit-5bf29b7d",
|
|
88
86
|
"title": "[7.x] Add ❤️ emoji",
|
|
89
87
|
},
|
|
@@ -101,107 +99,117 @@ describe('backport e2e', () => {
|
|
|
101
99
|
it('should create branch in the fork (sqren/integration-test)', async () => {
|
|
102
100
|
const branches = await getBranches({
|
|
103
101
|
accessToken,
|
|
104
|
-
repoOwner:
|
|
102
|
+
repoOwner: AUTHOR,
|
|
105
103
|
repoName: REPO_NAME,
|
|
106
104
|
});
|
|
107
105
|
expect(branches.map((b) => b.name)).toEqual([
|
|
108
106
|
'7.x',
|
|
109
|
-
|
|
107
|
+
BRANCH_WITH_ONE_COMMIT,
|
|
110
108
|
'master',
|
|
111
109
|
]);
|
|
112
110
|
});
|
|
113
|
-
|
|
111
|
+
});
|
|
112
|
+
describe('when two commits are backported', () => {
|
|
113
|
+
let createPullRequestsMockCalls;
|
|
114
|
+
let res;
|
|
115
|
+
beforeAll(async () => {
|
|
116
|
+
await resetState(accessToken);
|
|
117
|
+
createPullRequestsMockCalls = mockCreatePullRequest({
|
|
118
|
+
number: 1337,
|
|
119
|
+
html_url: 'myHtmlUrl',
|
|
120
|
+
});
|
|
121
|
+
const options = await (0, options_1.getOptions)([], {
|
|
122
|
+
accessToken,
|
|
123
|
+
author: AUTHOR,
|
|
124
|
+
ci: true,
|
|
125
|
+
githubApiBaseUrlV3: 'https://api.foo.com',
|
|
126
|
+
repoName: 'integration-test',
|
|
127
|
+
repoOwner: 'backport-org',
|
|
128
|
+
});
|
|
129
|
+
const commits = [
|
|
130
|
+
...(await (0, getCommits_1.getCommits)({
|
|
131
|
+
...options,
|
|
132
|
+
sha: '5bf29b7d847ea3dbde9280448f0f62ad0f22d3ad',
|
|
133
|
+
})),
|
|
134
|
+
...(await (0, getCommits_1.getCommits)({
|
|
135
|
+
...options,
|
|
136
|
+
sha: '59d6ff1ca90a4ce210c0a4f0e159214875c19d60',
|
|
137
|
+
})),
|
|
138
|
+
];
|
|
139
|
+
const targetBranches = ['7.x'];
|
|
140
|
+
res = await (0, runSequentially_1.runSequentially)({ options, commits, targetBranches });
|
|
141
|
+
});
|
|
142
|
+
it('contains both commits in the pull request body', () => {
|
|
143
|
+
expect(createPullRequestsMockCalls).toMatchInlineSnapshot(`
|
|
144
|
+
Array [
|
|
145
|
+
Object {
|
|
146
|
+
"base": "7.x",
|
|
147
|
+
"body": "# Backport
|
|
148
|
+
|
|
149
|
+
This will backport the following commits from \`master\` to \`7.x\`:
|
|
150
|
+
- Add ❤️ emoji (5bf29b7d)
|
|
151
|
+
- Add family emoji (#2) (59d6ff1c)
|
|
152
|
+
|
|
153
|
+
<!--- Backport version: 1.2.3 -->
|
|
154
|
+
|
|
155
|
+
### Questions ?
|
|
156
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
157
|
+
"head": "sqren:backport/7.x/commit-5bf29b7d_commit-59d6ff1c",
|
|
158
|
+
"title": "[7.x] Add ❤️ emoji | Add family emoji (#2)",
|
|
159
|
+
},
|
|
160
|
+
]
|
|
161
|
+
`);
|
|
162
|
+
});
|
|
163
|
+
it('returns the pull request response', () => {
|
|
164
|
+
expect(res).toEqual([
|
|
165
|
+
{
|
|
166
|
+
didUpdate: false,
|
|
167
|
+
pullRequestNumber: 1337,
|
|
168
|
+
status: 'success',
|
|
169
|
+
pullRequestUrl: 'myHtmlUrl',
|
|
170
|
+
targetBranch: '7.x',
|
|
171
|
+
},
|
|
172
|
+
]);
|
|
173
|
+
});
|
|
174
|
+
it('should not create new branches in origin (backport-org/integration-test)', async () => {
|
|
114
175
|
const branches = await getBranches({
|
|
115
176
|
accessToken,
|
|
116
|
-
repoOwner:
|
|
177
|
+
repoOwner: REPO_OWNER,
|
|
178
|
+
repoName: REPO_NAME,
|
|
179
|
+
});
|
|
180
|
+
expect(branches.map((b) => b.name)).toEqual(['7.x', 'master']);
|
|
181
|
+
});
|
|
182
|
+
it('should create branch in the fork (sqren/integration-test)', async () => {
|
|
183
|
+
const branches = await getBranches({
|
|
184
|
+
accessToken,
|
|
185
|
+
repoOwner: AUTHOR,
|
|
117
186
|
repoName: REPO_NAME,
|
|
118
187
|
});
|
|
119
|
-
|
|
120
|
-
|
|
188
|
+
expect(branches.map((b) => b.name)).toEqual([
|
|
189
|
+
'7.x',
|
|
190
|
+
BRANCH_WITH_TWO_COMMITS,
|
|
191
|
+
'master',
|
|
192
|
+
]);
|
|
121
193
|
});
|
|
122
194
|
});
|
|
123
|
-
// describe.skip('when two commits are backported', () => {
|
|
124
|
-
// let createPullRequestsMockCalls: unknown[];
|
|
125
|
-
// let res: Awaited<ReturnType<typeof runSequentially>>;
|
|
126
|
-
// let accessToken: string;
|
|
127
|
-
// beforeAll(async () => {
|
|
128
|
-
// accessToken = await getDevAccessToken();
|
|
129
|
-
// await resetState(accessToken);
|
|
130
|
-
// createPullRequestsMockCalls = mockCreatePullRequest({
|
|
131
|
-
// number: 1337,
|
|
132
|
-
// html_url: 'myHtmlUrl',
|
|
133
|
-
// });
|
|
134
|
-
// const options = {
|
|
135
|
-
// githubApiBaseUrlV3: 'https://api.foo.com',
|
|
136
|
-
// ci: true,
|
|
137
|
-
// sha: '5bf29b7d847ea3dbde9280448f0f62ad0f22d3ad',
|
|
138
|
-
// author: AUHTOR,
|
|
139
|
-
// accessToken,
|
|
140
|
-
// repoOwner: 'backport-org',
|
|
141
|
-
// reponame: 'integration-test',
|
|
142
|
-
// } as ValidConfigOptions;
|
|
143
|
-
// const commits = await getCommits(options);
|
|
144
|
-
// const targetBranches: string[] = ['7.x'];
|
|
145
|
-
// res = await runSequentially({ options, commits, targetBranches });
|
|
146
|
-
// });
|
|
147
|
-
// it('sends the correct http body when creating pull request', () => {
|
|
148
|
-
// expect(createPullRequestsMockCalls).toMatchInlineSnapshot();
|
|
149
|
-
// });
|
|
150
|
-
// it('returns pull request', () => {
|
|
151
|
-
// expect(res).toEqual([
|
|
152
|
-
// { pullRequestUrl: 'myHtmlUrl', success: true, targetBranch: '6.0' },
|
|
153
|
-
// ]);
|
|
154
|
-
// });
|
|
155
|
-
// it('should not create new branches in origin (backport-org/integration-test)', async () => {
|
|
156
|
-
// const branches = await getBranches({
|
|
157
|
-
// accessToken,
|
|
158
|
-
// repoOwner: REPO_OWNER,
|
|
159
|
-
// repoName: REPO_NAME,
|
|
160
|
-
// });
|
|
161
|
-
// expect(branches.map((b) => b.name)).toEqual(['7.x', '* master']);
|
|
162
|
-
// });
|
|
163
|
-
// it('should create branch in the fork (sqren/integration-test)', async () => {
|
|
164
|
-
// const branches = await getBranches({
|
|
165
|
-
// accessToken,
|
|
166
|
-
// repoOwner: AUHTOR,
|
|
167
|
-
// repoName: REPO_NAME,
|
|
168
|
-
// });
|
|
169
|
-
// expect(branches.map((b) => b.name)).toEqual([
|
|
170
|
-
// '7.x',
|
|
171
|
-
// 'backport/6.0/pr-85_commit-2e63475c',
|
|
172
|
-
// 'master',
|
|
173
|
-
// ]);
|
|
174
|
-
// });
|
|
175
|
-
// it('should have cherry picked the correct commit', async () => {
|
|
176
|
-
// const branches = await getBranches({
|
|
177
|
-
// accessToken,
|
|
178
|
-
// repoOwner: AUHTOR,
|
|
179
|
-
// repoName: REPO_NAME,
|
|
180
|
-
// });
|
|
181
|
-
// const sha = branches.find((branch) => branch.name === '7.x')?.commit.sha;
|
|
182
|
-
// expect(sha).toEqual('foo');
|
|
183
|
-
// });
|
|
184
|
-
// });
|
|
185
195
|
describe('when disabling fork mode', () => {
|
|
186
196
|
let res;
|
|
187
|
-
let accessToken;
|
|
188
197
|
let createPullRequestsMockCalls;
|
|
189
198
|
beforeAll(async () => {
|
|
190
|
-
accessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
191
199
|
await resetState(accessToken);
|
|
192
200
|
createPullRequestsMockCalls = mockCreatePullRequest({
|
|
193
201
|
number: 1337,
|
|
194
202
|
html_url: 'myHtmlUrl',
|
|
195
203
|
});
|
|
196
204
|
const options = await (0, options_1.getOptions)([], {
|
|
197
|
-
author: AUHTOR,
|
|
198
|
-
githubApiBaseUrlV3: 'https://api.foo.com',
|
|
199
|
-
ci: true,
|
|
200
|
-
sha: '5bf29b7d847ea3dbde9280448f0f62ad0f22d3ad',
|
|
201
205
|
accessToken,
|
|
202
|
-
|
|
203
|
-
|
|
206
|
+
author: AUTHOR,
|
|
207
|
+
ci: true,
|
|
204
208
|
fork: false,
|
|
209
|
+
githubApiBaseUrlV3: 'https://api.foo.com',
|
|
210
|
+
repoName: 'integration-test',
|
|
211
|
+
repoOwner: 'backport-org',
|
|
212
|
+
sha: '5bf29b7d847ea3dbde9280448f0f62ad0f22d3ad',
|
|
205
213
|
});
|
|
206
214
|
const commits = await (0, getCommits_1.getCommits)(options);
|
|
207
215
|
const targetBranches = ['7.x'];
|
|
@@ -214,12 +222,13 @@ describe('backport e2e', () => {
|
|
|
214
222
|
"base": "7.x",
|
|
215
223
|
"body": "# Backport
|
|
216
224
|
|
|
217
|
-
This
|
|
225
|
+
This will backport the following commits from \`master\` to \`7.x\`:
|
|
218
226
|
- Add ❤️ emoji (5bf29b7d)
|
|
219
227
|
|
|
228
|
+
<!--- Backport version: 1.2.3 -->
|
|
229
|
+
|
|
220
230
|
### Questions ?
|
|
221
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
222
|
-
",
|
|
231
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
223
232
|
"head": "backport-org:backport/7.x/commit-5bf29b7d",
|
|
224
233
|
"title": "[7.x] Add ❤️ emoji",
|
|
225
234
|
},
|
|
@@ -245,27 +254,18 @@ describe('backport e2e', () => {
|
|
|
245
254
|
});
|
|
246
255
|
expect(branches.map((b) => b.name)).toEqual([
|
|
247
256
|
'7.x',
|
|
248
|
-
|
|
257
|
+
BRANCH_WITH_ONE_COMMIT,
|
|
249
258
|
'master',
|
|
250
259
|
]);
|
|
251
260
|
});
|
|
252
261
|
it('should NOT create branch in the fork (sqren/integration-test)', async () => {
|
|
253
262
|
const branches = await getBranches({
|
|
254
263
|
accessToken,
|
|
255
|
-
repoOwner:
|
|
264
|
+
repoOwner: AUTHOR,
|
|
256
265
|
repoName: REPO_NAME,
|
|
257
266
|
});
|
|
258
267
|
expect(branches.map((b) => b.name)).toEqual(['7.x', 'master']);
|
|
259
268
|
});
|
|
260
|
-
it('should cherry pick the correct commit', async () => {
|
|
261
|
-
const branches = await getBranches({
|
|
262
|
-
accessToken,
|
|
263
|
-
repoOwner: REPO_OWNER,
|
|
264
|
-
repoName: REPO_NAME,
|
|
265
|
-
});
|
|
266
|
-
const sha = branches.find((branch) => branch.name === '7.x')?.commit.sha;
|
|
267
|
-
expect(sha).toEqual('b68e4fcaaf4427fe1e902c718b3bb3f07b560fb5');
|
|
268
|
-
});
|
|
269
269
|
});
|
|
270
270
|
});
|
|
271
271
|
function mockCreatePullRequest(response) {
|
|
@@ -311,17 +311,37 @@ async function deleteBranch({ accessToken, repoOwner, repoName, branchName, }) {
|
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
async function resetState(accessToken) {
|
|
314
|
-
await
|
|
314
|
+
const ownerBranches = await getBranches({
|
|
315
315
|
accessToken,
|
|
316
316
|
repoOwner: REPO_OWNER,
|
|
317
317
|
repoName: REPO_NAME,
|
|
318
|
-
branchName: BRANCH_NAME,
|
|
319
318
|
});
|
|
320
|
-
|
|
319
|
+
// delete all branches except master and 7.x
|
|
320
|
+
await Promise.all(ownerBranches
|
|
321
|
+
.filter((b) => b.name !== 'master' && b.name !== '7.x')
|
|
322
|
+
.map((b) => {
|
|
323
|
+
return deleteBranch({
|
|
324
|
+
accessToken,
|
|
325
|
+
repoOwner: REPO_OWNER,
|
|
326
|
+
repoName: REPO_NAME,
|
|
327
|
+
branchName: b.name,
|
|
328
|
+
});
|
|
329
|
+
}));
|
|
330
|
+
const forkBranches = await getBranches({
|
|
321
331
|
accessToken,
|
|
322
|
-
repoOwner:
|
|
332
|
+
repoOwner: AUTHOR,
|
|
323
333
|
repoName: REPO_NAME,
|
|
324
|
-
branchName: BRANCH_NAME,
|
|
325
334
|
});
|
|
326
|
-
|
|
335
|
+
// delete all branches except master and 7.x
|
|
336
|
+
await Promise.all(forkBranches
|
|
337
|
+
.filter((b) => b.name !== 'master' && b.name !== '7.x')
|
|
338
|
+
.map((b) => {
|
|
339
|
+
return deleteBranch({
|
|
340
|
+
accessToken,
|
|
341
|
+
repoOwner: AUTHOR,
|
|
342
|
+
repoName: REPO_NAME,
|
|
343
|
+
branchName: b.name,
|
|
344
|
+
});
|
|
345
|
+
}));
|
|
346
|
+
await (0, sandbox_1.resetSandbox)(sandboxPath);
|
|
327
347
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const path_1 = require("path");
|
|
4
3
|
const entrypoint_module_1 = require("../entrypoint.module");
|
|
4
|
+
const child_process_promisified_1 = require("../services/child-process-promisified");
|
|
5
5
|
const getDevAccessToken_1 = require("./private/getDevAccessToken");
|
|
6
|
+
const sandbox_1 = require("./sandbox");
|
|
6
7
|
jest.unmock('find-up');
|
|
7
8
|
jest.setTimeout(15000);
|
|
8
9
|
describe('Handle unbackported pull requests', () => {
|
|
@@ -14,30 +15,43 @@ describe('Handle unbackported pull requests', () => {
|
|
|
14
15
|
repoName: 'repo-with-conflicts',
|
|
15
16
|
pullNumber: 8,
|
|
16
17
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
const expectedCommit = {
|
|
19
|
+
sourceCommit: {
|
|
20
|
+
committedDate: '2021-12-16T00:03:34Z',
|
|
21
|
+
message: 'Change Barca to Braithwaite (#8)',
|
|
22
|
+
sha: '343402a748be2375325b2730fa979bcea5b96ba1',
|
|
23
|
+
},
|
|
24
|
+
sourcePullRequest: {
|
|
25
|
+
number: 8,
|
|
26
|
+
url: 'https://github.com/backport-org/repo-with-conflicts/pull/8',
|
|
27
|
+
mergeCommit: {
|
|
28
|
+
message: 'Change Barca to Braithwaite (#8)',
|
|
29
|
+
sha: '343402a748be2375325b2730fa979bcea5b96ba1',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
24
32
|
sourceBranch: 'main',
|
|
25
|
-
|
|
33
|
+
expectedTargetPullRequests: [{ branch: '7.x', state: 'MISSING' }],
|
|
34
|
+
};
|
|
35
|
+
expect(commits[0]).toEqual(expectedCommit);
|
|
26
36
|
});
|
|
27
37
|
it('shows that backport failed because PR number 8 was not backported', async () => {
|
|
28
38
|
const accessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
39
|
+
const sandboxPath = (0, sandbox_1.getSandboxPath)({ filename: __filename });
|
|
40
|
+
await (0, sandbox_1.resetSandbox)(sandboxPath);
|
|
41
|
+
await (0, child_process_promisified_1.exec)('git init', { cwd: sandboxPath });
|
|
29
42
|
const result = await (0, entrypoint_module_1.backportRun)({
|
|
30
43
|
accessToken: accessToken,
|
|
31
44
|
repoOwner: 'backport-org',
|
|
32
45
|
repoName: 'repo-with-conflicts',
|
|
33
46
|
pullNumber: 12,
|
|
34
47
|
targetBranches: ['7.x'],
|
|
35
|
-
dir:
|
|
48
|
+
dir: sandboxPath,
|
|
36
49
|
ci: true,
|
|
37
50
|
publishStatusComment: false,
|
|
38
51
|
});
|
|
39
|
-
|
|
52
|
+
const commit =
|
|
40
53
|
//@ts-expect-error
|
|
41
|
-
result.results[0].error.
|
|
54
|
+
result.results[0].error.errorContext?.commitsWithoutBackports[0].commit;
|
|
55
|
+
expect(commit.sourcePullRequest?.number).toBe(8);
|
|
42
56
|
});
|
|
43
57
|
});
|
|
@@ -1,29 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
4
|
};
|
|
21
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
6
|
exports.mockConfigFiles = void 0;
|
|
23
|
-
const
|
|
7
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
24
8
|
function mockConfigFiles({ projectConfig, globalConfig, }) {
|
|
25
9
|
jest
|
|
26
|
-
.spyOn(
|
|
10
|
+
.spyOn(promises_1.default, 'readFile')
|
|
27
11
|
//@ts-expect-error
|
|
28
12
|
.mockImplementation(async (filepath) => {
|
|
29
13
|
if (filepath === '/path/to/project/config') {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
export declare function mockOra(): void;
|
|
3
|
+
export declare function getOraMock(): {
|
|
4
|
+
start: () => any;
|
|
5
|
+
succeed: () => jest.Mock<any, any>;
|
|
6
|
+
stop: () => jest.Mock<any, any>;
|
|
7
|
+
fail: () => jest.Mock<any, any>;
|
|
8
|
+
stopAndPersist: () => jest.Mock<any, any>;
|
|
9
|
+
text: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getOraMock = exports.mockOra = void 0;
|
|
5
|
+
const oraMock = {
|
|
6
|
+
start: () => oraMock,
|
|
7
|
+
succeed: () => jest.fn(),
|
|
8
|
+
stop: () => jest.fn(),
|
|
9
|
+
fail: () => jest.fn(),
|
|
10
|
+
stopAndPersist: () => jest.fn(),
|
|
11
|
+
set text(value) { },
|
|
12
|
+
};
|
|
13
|
+
function mockOra() {
|
|
14
|
+
const ora = jest.fn(() => oraMock);
|
|
15
|
+
//@ts-expect-error
|
|
16
|
+
ora.oraMock = oraMock;
|
|
17
|
+
jest.mock('ora', () => ora);
|
|
18
|
+
}
|
|
19
|
+
exports.mockOra = mockOra;
|
|
20
|
+
function getOraMock() {
|
|
21
|
+
return oraMock;
|
|
22
|
+
}
|
|
23
|
+
exports.getOraMock = getOraMock;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDevAccessToken = void 0;
|
|
4
|
-
const
|
|
4
|
+
const promises_1 = require("fs/promises");
|
|
5
|
+
const path_1 = require("path");
|
|
5
6
|
// get global config: either from .backport/config.json or via env variables
|
|
6
7
|
async function getDevAccessToken() {
|
|
7
8
|
const accessToken = process.env.accessToken;
|
|
@@ -10,15 +11,15 @@ async function getDevAccessToken() {
|
|
|
10
11
|
return accessToken;
|
|
11
12
|
}
|
|
12
13
|
// get credentials from config file
|
|
13
|
-
const accessTokenFile = './src/test/private/accessToken.txt';
|
|
14
|
+
const accessTokenFile = (0, path_1.resolve)('./src/test/private/accessToken.txt');
|
|
14
15
|
try {
|
|
15
|
-
const accessToken = await
|
|
16
|
+
const accessToken = await (0, promises_1.readFile)(accessTokenFile, {
|
|
16
17
|
encoding: 'utf-8',
|
|
17
18
|
});
|
|
18
19
|
return accessToken.trim();
|
|
19
20
|
}
|
|
20
21
|
catch (e) {
|
|
21
|
-
throw new Error(`Missing accessToken in "${accessTokenFile}"`);
|
|
22
|
+
throw new Error(`Missing accessToken in "${accessTokenFile}":\n${e.message}`);
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
exports.getDevAccessToken = getDevAccessToken;
|
|
@@ -22,24 +22,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
function
|
|
32
|
-
const
|
|
33
|
-
(0,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"\u00A0Initializing..."));
|
|
25
|
+
exports.resetSandbox = exports.getSandboxPath = void 0;
|
|
26
|
+
const path_1 = __importStar(require("path"));
|
|
27
|
+
const del_1 = __importDefault(require("del"));
|
|
28
|
+
const make_dir_1 = __importDefault(require("make-dir"));
|
|
29
|
+
jest.unmock('make-dir');
|
|
30
|
+
jest.unmock('del');
|
|
31
|
+
function getSandboxPath({ filename, specname, }) {
|
|
32
|
+
const baseFilename = getFilenameWithoutExtension(filename);
|
|
33
|
+
return (0, path_1.resolve)(`${__dirname}/_tmp_sandbox_/${baseFilename}${specname ? `/${specname}` : ''}`);
|
|
34
|
+
}
|
|
35
|
+
exports.getSandboxPath = getSandboxPath;
|
|
36
|
+
async function resetSandbox(sandboxPath) {
|
|
37
|
+
await (0, del_1.default)(sandboxPath);
|
|
38
|
+
await (0, make_dir_1.default)(sandboxPath);
|
|
39
|
+
}
|
|
40
|
+
exports.resetSandbox = resetSandbox;
|
|
41
|
+
function getFilenameWithoutExtension(filename) {
|
|
42
|
+
return path_1.default.basename(filename, path_1.default.extname(filename));
|
|
44
43
|
}
|
|
45
|
-
exports.LoadOptions = LoadOptions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,27 +3,42 @@
|
|
|
3
3
|
* This file is included in `setupFiles` in jest.config.js
|
|
4
4
|
* It will be run once per test file
|
|
5
5
|
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
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
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const packageVersionModule = __importStar(require("../../utils/packageVersion"));
|
|
27
|
+
const mocks_1 = require("../mocks");
|
|
6
28
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
7
29
|
jest.mock('find-up', () => {
|
|
8
30
|
return jest.fn(async () => '/path/to/project/config');
|
|
9
31
|
});
|
|
32
|
+
// @ts-expect-error
|
|
33
|
+
// eslint-disable-next-line no-import-assign
|
|
34
|
+
packageVersionModule.PACKAGE_VERSION = '1.2.3';
|
|
10
35
|
jest.mock('make-dir', () => {
|
|
11
36
|
return jest.fn(() => Promise.resolve('/some/path'));
|
|
12
37
|
});
|
|
13
38
|
jest.mock('del', () => {
|
|
14
39
|
return jest.fn(async (path) => `Attempted to delete ${path}`);
|
|
15
40
|
});
|
|
16
|
-
|
|
17
|
-
const ora = {
|
|
18
|
-
start: () => ({
|
|
19
|
-
succeed: () => { },
|
|
20
|
-
stop: () => { },
|
|
21
|
-
fail: () => { },
|
|
22
|
-
stopAndPersist: () => { },
|
|
23
|
-
}),
|
|
24
|
-
};
|
|
25
|
-
return jest.fn(() => ora);
|
|
26
|
-
});
|
|
41
|
+
(0, mocks_1.mockOra)();
|
|
27
42
|
// silence logger
|
|
28
43
|
jest.mock('../../services/logger', () => {
|
|
29
44
|
const spy = jest.fn();
|
|
@@ -37,6 +52,7 @@ jest.mock('../../services/logger', () => {
|
|
|
37
52
|
info: (msg, meta) => spy(`[INFO] ${msg}`, meta),
|
|
38
53
|
verbose: (msg, meta) => spy(`[VERBOSE] ${msg}`, meta),
|
|
39
54
|
warn: (msg, meta) => spy(`[WARN] ${msg}`, meta),
|
|
55
|
+
error: (msg, meta) => spy(`[ERROR] ${msg}`, meta),
|
|
40
56
|
debug: (msg, meta) => spy(`[DEBUG] ${msg}`, meta),
|
|
41
57
|
},
|
|
42
58
|
};
|