backport 6.3.0-beta-7 → 6.3.0-beta-8

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.
@@ -79,6 +79,8 @@ describe('inquirer cli', () => {
79
79
  -b, --targetBranch, --branch Branch(es) to backport to [array]
80
80
  --targetBranchChoice List branches to backport to [array]
81
81
  -l, --targetPRLabel, --label Add labels to the target (backport) PR [array]
82
+ --username User repo that branch will be pushed to. Defaults to the
83
+ authenticated user [string]
82
84
  --verbose Show additional debug information [boolean]
83
85
  --verify Opposite of no-verify [boolean]
84
86
  --help Show help [boolean]
@@ -62,11 +62,11 @@ describe('getOptions', () => {
62
62
  });
63
63
  await expect(() => (0, options_1.getOptions)([], { ci: true })).rejects
64
64
  .toThrowErrorMatchingInlineSnapshot(`
65
- "Please update your config file: \\"/myHomeDir/.backport/config.json\\".
66
- It must contain a valid \\"accessToken\\".
65
+ "Please update your config file: \\"/myHomeDir/.backport/config.json\\".
66
+ It must contain a valid \\"accessToken\\".
67
67
 
68
- Read more: https://github.com/sqren/backport/blob/main/docs/configuration.md#global-config-backportconfigjson"
69
- `);
68
+ Read more: https://github.com/sqren/backport/blob/main/docs/configuration.md#global-config-backportconfigjson"
69
+ `);
70
70
  });
71
71
  it('when `targetBranches`, `targetBranchChoices` and `branchLabelMapping` are all empty', async () => {
72
72
  mockProjectConfig({
@@ -81,6 +81,23 @@ describe('getOptions', () => {
81
81
  Read more: https://github.com/sqren/backport/blob/main/docs/configuration.md#project-config-backportrcjson"
82
82
  `);
83
83
  });
84
+ describe('whe option is an empty string', () => {
85
+ it('throws for "username"', async () => {
86
+ await expect(() => (0, options_1.getOptions)([], { username: '', author: 'sqren' })).rejects.toThrowErrorMatchingInlineSnapshot(`"\\"username\\" cannot be empty!"`);
87
+ });
88
+ it('throws for "author"', async () => {
89
+ await expect(() => (0, options_1.getOptions)([], { author: '' })).rejects.toThrowErrorMatchingInlineSnapshot(`"\\"author\\" cannot be empty!"`);
90
+ });
91
+ it('throws for "accessToken"', async () => {
92
+ await expect(() => (0, options_1.getOptions)([], { accessToken: '' })).rejects
93
+ .toThrowErrorMatchingInlineSnapshot(`
94
+ "Please update your config file: \\"/myHomeDir/.backport/config.json\\".
95
+ It must contain a valid \\"accessToken\\".
96
+
97
+ Read more: https://github.com/sqren/backport/blob/main/docs/configuration.md#global-config-backportconfigjson"
98
+ `);
99
+ });
100
+ });
84
101
  describe('when repoName and repoOwner are missing', () => {
85
102
  beforeEach(() => {
86
103
  mockProjectConfig({ repoName: undefined, repoOwner: undefined });
@@ -89,10 +106,10 @@ describe('getOptions', () => {
89
106
  jest.spyOn(git, 'getRepoInfoFromGitRemotes').mockResolvedValue([]);
90
107
  await expect(() => (0, options_1.getOptions)([], {})).rejects
91
108
  .toThrowErrorMatchingInlineSnapshot(`
92
- "Please specify a repo name: \\"--repo-name kibana\\".
109
+ "Please specify a repo name: \\"--repo-name kibana\\".
93
110
 
94
- Read more: https://github.com/sqren/backport/blob/main/docs/configuration.md#project-config-backportrcjson"
95
- `);
111
+ Read more: https://github.com/sqren/backport/blob/main/docs/configuration.md#project-config-backportrcjson"
112
+ `);
96
113
  });
97
114
  it('should get repoName from the remote', async () => {
98
115
  mockRepoOwnerAndName({
@@ -66,8 +66,8 @@ function getCommentBody({ options, pullNumber, backportResponse, }) {
66
66
  if (backportResponse.error instanceof HandledError_1.HandledError &&
67
67
  backportResponse.error.errorContext?.code === 'no-branches-exception') {
68
68
  return `## ⚪ Backport skipped
69
- The pull request was not backported as there were no branches to backport to. If this is a mistake, please apply the desired version labels or run the backport tool manually.
70
- ${manualBackportCommand}${questionsAndLinkToBackport}${packageVersionSection}`;
69
+ The pull request was not backported as there were no branches to backport to. If this is a mistake, please apply the desired version labels or run the backport tool manually.
70
+ ${manualBackportCommand}${questionsAndLinkToBackport}${packageVersionSection}`;
71
71
  }
72
72
  return `## 💔 Backport failed
73
73
  The pull request could not be backported due to the following error:
@@ -365,8 +365,8 @@ describe('getCommentBody', () => {
365
365
  const params = getParams({ ci: true });
366
366
  expect((0, createStatusComment_1.getCommentBody)(params)).toMatchInlineSnapshot(`
367
367
  "## ⚪ Backport skipped
368
- The pull request was not backported as there were no branches to backport to. If this is a mistake, please apply the desired version labels or run the backport tool manually.
369
-
368
+ The pull request was not backported as there were no branches to backport to. If this is a mistake, please apply the desired version labels or run the backport tool manually.
369
+
370
370
  ### Manual backport
371
371
  To create the backport manually run:
372
372
  \`\`\`
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "6.3.0-beta-6";
1
+ export declare const PACKAGE_VERSION = "6.3.0-beta-8";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PACKAGE_VERSION = void 0;
4
- exports.PACKAGE_VERSION = '6.3.0-beta-6';
4
+ exports.PACKAGE_VERSION = '6.3.0-beta-8';
@@ -0,0 +1 @@
1
+ exports.PACKAGE_VERSION = "6.3.0-beta-7";
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "branches",
15
15
  "branching"
16
16
  ],
17
- "version": "6.3.0-beta-7",
17
+ "version": "6.3.0-beta-8",
18
18
  "main": "./dist/entrypoint.module.js",
19
19
  "types": "dist/entrypoint.module.d.ts",
20
20
  "bin": {
@@ -23,9 +23,8 @@
23
23
  "license": "MIT",
24
24
  "scripts": {
25
25
  "postinstall": "test -f ./dist/scripts/runPostinstall.js && node ./dist/scripts/runPostinstall.js || echo 'Dist folder missing'",
26
- "postversion": "yarn extractPackageVersion && yarn build",
26
+ "version": "yarn extractPackageVersion && yarn build",
27
27
  "prepare": "husky install",
28
- "prepublishOnly": "yarn build",
29
28
  "build": "tsc --project ./tsconfig.prod.json",
30
29
  "extractPackageVersion": "node -p \"'export const PACKAGE_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" | prettier > src/utils/packageVersion.ts",
31
30
  "lint": "tsc --project ./tsconfig.test.json && eslint './**/*.{ts,js}'",