backport 8.4.0 → 8.4.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 +11 -178
- package/dist/lib/author.d.ts +13 -0
- package/dist/lib/author.js +28 -0
- package/dist/lib/cherrypickAndCreateTargetPullRequest.js +50 -35
- package/dist/lib/cherrypickAndCreateTargetPullRequest.test.js +2 -0
- package/dist/lib/git.d.ts +11 -8
- package/dist/lib/git.js +32 -32
- package/dist/lib/git.private.test.js +13 -10
- package/dist/lib/git.test.js +52 -24
- package/dist/lib/github/v4/apiRequestV4.js +14 -8
- package/dist/lib/github/v4/fetchCommits/allFetchers.private.test.js +1 -0
- package/dist/lib/ora.d.ts +1 -0
- package/dist/options/options.js +2 -2
- package/dist/options/options.test.js +4 -4
- package/dist/test/e2e/cli/date-filters.private.test.js +1 -0
- package/dist/test/e2e/cli/different-merge-strategies.private.test.js +122 -6
- package/dist/test/e2e/cli/error-handling-interactive-mode.private.test.js +27 -13
- package/dist/test/e2e/cli/error-handling-non-interactive-mode.private.test.js +3 -2
- package/dist/test/e2e/cli/gracefully-handles-corrupt-repo.private.test.d.ts +1 -0
- package/dist/test/e2e/cli/gracefully-handles-corrupt-repo.private.test.js +52 -0
- package/dist/test/e2e/cli/repo-with-backportrc-removed.private.test.js +2 -2
- package/dist/test/e2e/cli/repo-with-programatically-added-commits.mutation.test.d.ts +1 -0
- package/dist/test/e2e/cli/repo-with-programatically-added-commits.mutation.test.js +114 -0
- package/dist/test/e2e/cli/runBackportViaCli.d.ts +8 -2
- package/dist/test/e2e/cli/runBackportViaCli.js +48 -18
- package/dist/test/e2e/cli/test-that-repo-can-be-cloned.private.test.js +7 -1
- package/dist/test/e2e/module/entrypoint.module.mutation.test.js +1 -1
- package/dist/test/handleUnbackportedPullRequests.private.test.js +1 -1
- package/dist/test/replaceStringAndLinebreaks.d.ts +5 -0
- package/dist/test/replaceStringAndLinebreaks.js +8 -0
- package/dist/test/sandbox.d.ts +1 -0
- package/dist/test/sandbox.js +8 -3
- package/dist/utils/packageVersion.d.ts +1 -1
- package/dist/utils/packageVersion.js +1 -1
- package/package.json +24 -24
- package/yarn.lock +886 -992
- package/dist/lib/getGitConfigAuthor.d.ts +0 -6
- package/dist/lib/getGitConfigAuthor.js +0 -15
|
@@ -9,6 +9,7 @@ const getDevAccessToken_1 = require("../../private/getDevAccessToken");
|
|
|
9
9
|
const sandbox_1 = require("../../sandbox");
|
|
10
10
|
const runBackportViaCli_1 = require("./runBackportViaCli");
|
|
11
11
|
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
12
|
+
jest.setTimeout(15000);
|
|
12
13
|
describe('non interactive (json) error handling', () => {
|
|
13
14
|
it(`when access token is missing`, async () => {
|
|
14
15
|
const configFilePath = await createConfigFile({ editor: 'code' });
|
|
@@ -25,7 +26,7 @@ describe('non interactive (json) error handling', () => {
|
|
|
25
26
|
"Please update your config file: \\"<GLOBAL_CONFIG_FILE>\\".
|
|
26
27
|
It must contain a valid \\"accessToken\\".
|
|
27
28
|
|
|
28
|
-
Read more: https://github.com/sqren/backport/blob/main/docs/
|
|
29
|
+
Read more: https://github.com/sqren/backport/blob/main/docs/config-file-options.md#global-config-backportconfigjson"
|
|
29
30
|
`);
|
|
30
31
|
});
|
|
31
32
|
it('when target branches cannot be inferred from pull request', async () => {
|
|
@@ -55,7 +56,7 @@ describe('non interactive (json) error handling', () => {
|
|
|
55
56
|
expect(backportResult.errorMessage).toMatchInlineSnapshot(`
|
|
56
57
|
"Please specify a target branch: \\"--branch 6.1\\".
|
|
57
58
|
|
|
58
|
-
Read more: https://github.com/sqren/backport/blob/main/docs/
|
|
59
|
+
Read more: https://github.com/sqren/backport/blob/main/docs/config-file-options.md#project-config-backportrcjson"
|
|
59
60
|
`);
|
|
60
61
|
});
|
|
61
62
|
it(`when argument is invalid`, async () => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const child_process_promisified_1 = require("../../../lib/child-process-promisified");
|
|
4
|
+
const getDevAccessToken_1 = require("../../private/getDevAccessToken");
|
|
5
|
+
const sandbox_1 = require("../../sandbox");
|
|
6
|
+
const runBackportViaCli_1 = require("./runBackportViaCli");
|
|
7
|
+
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
8
|
+
jest.setTimeout(15000);
|
|
9
|
+
describe('gracefully handle corrupted repo', () => {
|
|
10
|
+
it('backports correctly', async () => {
|
|
11
|
+
const sandboxPath = (0, sandbox_1.getSandboxPath)({ filename: __filename });
|
|
12
|
+
await (0, sandbox_1.resetSandbox)(sandboxPath);
|
|
13
|
+
// first run: backport should clone the repo
|
|
14
|
+
await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
15
|
+
'--repo=backport-org/integration-test',
|
|
16
|
+
'--sha=16cfd987b82f49a79ebc663506f5d215b7a81c5c',
|
|
17
|
+
'--branch=7.x',
|
|
18
|
+
`--accessToken=${accessToken}`,
|
|
19
|
+
`--dir=${sandboxPath}`,
|
|
20
|
+
'--dry-run',
|
|
21
|
+
], {
|
|
22
|
+
showOra: true,
|
|
23
|
+
timeoutSeconds: 10,
|
|
24
|
+
});
|
|
25
|
+
// remove all git objects and references
|
|
26
|
+
await (0, child_process_promisified_1.exec)('rm -rf .git', { cwd: sandboxPath });
|
|
27
|
+
await (0, child_process_promisified_1.exec)('git init', { cwd: sandboxPath });
|
|
28
|
+
const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
29
|
+
'--repo=backport-org/integration-test',
|
|
30
|
+
'--sha=16cfd987b82f49a79ebc663506f5d215b7a81c5c',
|
|
31
|
+
'--branch=7.x',
|
|
32
|
+
`--accessToken=${accessToken}`,
|
|
33
|
+
`--dir=${sandboxPath}`,
|
|
34
|
+
'--dry-run',
|
|
35
|
+
], {
|
|
36
|
+
showOra: true,
|
|
37
|
+
timeoutSeconds: 10,
|
|
38
|
+
});
|
|
39
|
+
// second run: backport should re-create remotes and branches correctly
|
|
40
|
+
expect(output).toMatchInlineSnapshot(`
|
|
41
|
+
"- Initializing...
|
|
42
|
+
? Select commit Bump to 8.0.0
|
|
43
|
+
|
|
44
|
+
Backporting to 7.x:
|
|
45
|
+
- Pulling latest changes
|
|
46
|
+
✔ Pulling latest changes
|
|
47
|
+
- Cherry-picking: Bump to 8.0.0
|
|
48
|
+
✔ Cherry-picking: Bump to 8.0.0
|
|
49
|
+
✔ Dry run complete"
|
|
50
|
+
`);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -9,7 +9,7 @@ describe('repo-with-backportrc-removed (missing .backportrc.json config file)',
|
|
|
9
9
|
'--branch=production',
|
|
10
10
|
'--repo=backport-org/repo-with-backportrc-removed',
|
|
11
11
|
`--accessToken=${accessToken}`,
|
|
12
|
-
], { waitForString: 'Select commit' });
|
|
12
|
+
], { waitForString: 'Select commit', timeoutSeconds: 4 });
|
|
13
13
|
expect(output).toMatchInlineSnapshot(`
|
|
14
14
|
"? Select commit (Use arrow keys)
|
|
15
15
|
❯ 1. Rename README.me to README.md
|
|
@@ -31,7 +31,7 @@ describe('repo-with-backportrc-removed (missing .backportrc.json config file)',
|
|
|
31
31
|
], {
|
|
32
32
|
showOra: true,
|
|
33
33
|
});
|
|
34
|
-
expect(output).toContain('Cherry-picking:
|
|
34
|
+
expect(output).toContain('Cherry-picking: Create README.me');
|
|
35
35
|
});
|
|
36
36
|
it('backport by commit sha', async () => {
|
|
37
37
|
const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* eslint-disable no-console */
|
|
4
|
+
const rest_1 = require("@octokit/rest");
|
|
5
|
+
const getDevAccessToken_1 = require("../../private/getDevAccessToken");
|
|
6
|
+
const sandbox_1 = require("../../sandbox");
|
|
7
|
+
const runBackportViaCli_1 = require("./runBackportViaCli");
|
|
8
|
+
jest.setTimeout(15000);
|
|
9
|
+
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
10
|
+
const octokit = new rest_1.Octokit({ auth: accessToken });
|
|
11
|
+
describe('Programatically add new commits', () => {
|
|
12
|
+
it('should backport commits added after the first run', async () => {
|
|
13
|
+
const sandboxPath = (0, sandbox_1.getSandboxPath)({ filename: __filename });
|
|
14
|
+
await (0, sandbox_1.resetSandbox)(sandboxPath);
|
|
15
|
+
// first run: backport should clone the repo
|
|
16
|
+
await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
17
|
+
'--repo=backport-org/repo-with-programatically-added-commits',
|
|
18
|
+
'--pr=1',
|
|
19
|
+
'--branch=7.x',
|
|
20
|
+
`--accessToken=${accessToken}`,
|
|
21
|
+
`--dir=${sandboxPath}`,
|
|
22
|
+
'--dry-run',
|
|
23
|
+
], { showOra: true });
|
|
24
|
+
const formattedDate = new Date().toLocaleString('da-DK');
|
|
25
|
+
const commitMessage = `Automatically added at ${formattedDate}`;
|
|
26
|
+
const sha = await createAndCommitFile({
|
|
27
|
+
commitMessage,
|
|
28
|
+
files: [
|
|
29
|
+
{
|
|
30
|
+
path: `files/${formattedDate}.md`,
|
|
31
|
+
sha: await createBlob(`# Hello\nSome content added @ ${formattedDate}`),
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
});
|
|
35
|
+
// second run: backport should find and backport the new commit
|
|
36
|
+
const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
37
|
+
'--repo=backport-org/repo-with-programatically-added-commits',
|
|
38
|
+
`--sha=${sha}`,
|
|
39
|
+
'--branch=7.x',
|
|
40
|
+
`--accessToken=${accessToken}`,
|
|
41
|
+
`--dir=${sandboxPath}`,
|
|
42
|
+
'--dry-run',
|
|
43
|
+
], { showOra: true });
|
|
44
|
+
expect(output).toContain(commitMessage);
|
|
45
|
+
expect(output).toContain('Dry run complete');
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
async function createAndCommitFile({ commitMessage, files, }) {
|
|
49
|
+
const latestCommitSha = await getLatestCommitSha();
|
|
50
|
+
const treeSha = await createTree(files);
|
|
51
|
+
const commitSha = await createCommit({
|
|
52
|
+
latestCommitSha,
|
|
53
|
+
commitMessage,
|
|
54
|
+
treeSha,
|
|
55
|
+
});
|
|
56
|
+
await updateRef(commitSha);
|
|
57
|
+
return commitSha;
|
|
58
|
+
}
|
|
59
|
+
async function updateRef(sha) {
|
|
60
|
+
try {
|
|
61
|
+
const res = await octokit.rest.git.updateRef({
|
|
62
|
+
owner: 'backport-org',
|
|
63
|
+
repo: 'repo-with-programatically-added-commits',
|
|
64
|
+
ref: 'heads/main',
|
|
65
|
+
sha,
|
|
66
|
+
});
|
|
67
|
+
return res.data;
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
console.log(e);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async function createCommit({ latestCommitSha, commitMessage, treeSha, }) {
|
|
74
|
+
const res = await octokit.rest.git.createCommit({
|
|
75
|
+
owner: 'backport-org',
|
|
76
|
+
repo: 'repo-with-programatically-added-commits',
|
|
77
|
+
message: commitMessage,
|
|
78
|
+
parents: [latestCommitSha],
|
|
79
|
+
tree: treeSha,
|
|
80
|
+
});
|
|
81
|
+
return res.data.sha;
|
|
82
|
+
}
|
|
83
|
+
async function createTree(files) {
|
|
84
|
+
const res = await octokit.git.createTree({
|
|
85
|
+
owner: 'backport-org',
|
|
86
|
+
repo: 'repo-with-programatically-added-commits',
|
|
87
|
+
tree: files.map((f) => {
|
|
88
|
+
return {
|
|
89
|
+
path: f.path,
|
|
90
|
+
sha: f.sha,
|
|
91
|
+
mode: '100644',
|
|
92
|
+
type: 'blob',
|
|
93
|
+
};
|
|
94
|
+
}),
|
|
95
|
+
});
|
|
96
|
+
return res.data.sha;
|
|
97
|
+
}
|
|
98
|
+
async function createBlob(content) {
|
|
99
|
+
const res = await octokit.rest.git.createBlob({
|
|
100
|
+
owner: 'backport-org',
|
|
101
|
+
repo: 'repo-with-programatically-added-commits',
|
|
102
|
+
content: content,
|
|
103
|
+
encoding: 'utf-8',
|
|
104
|
+
});
|
|
105
|
+
return res.data.sha;
|
|
106
|
+
}
|
|
107
|
+
async function getLatestCommitSha() {
|
|
108
|
+
const res = await octokit.repos.getBranch({
|
|
109
|
+
owner: 'backport-org',
|
|
110
|
+
repo: 'repo-with-programatically-added-commits',
|
|
111
|
+
branch: 'main',
|
|
112
|
+
});
|
|
113
|
+
return res.data.commit.sha;
|
|
114
|
+
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
declare type RunBackportOptions = {
|
|
2
2
|
timeoutSeconds?: number;
|
|
3
3
|
showOra?: boolean;
|
|
4
4
|
waitForString?: string;
|
|
5
5
|
cwd?: string;
|
|
6
|
-
|
|
6
|
+
keepAlive?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function runBackportViaCli(backportArgs: string[], runBackportOptions?: RunBackportOptions): Promise<{
|
|
7
9
|
output: string;
|
|
8
10
|
code: number | null;
|
|
11
|
+
keypress: (keyCode: "up" | "down" | "enter", runBackportOptions?: RunBackportOptions | undefined) => Promise<{
|
|
12
|
+
output: string;
|
|
13
|
+
}>;
|
|
9
14
|
}>;
|
|
15
|
+
export {};
|
|
@@ -9,10 +9,11 @@ const path_1 = __importDefault(require("path"));
|
|
|
9
9
|
const lodash_1 = require("lodash");
|
|
10
10
|
const strip_ansi_1 = __importDefault(require("strip-ansi"));
|
|
11
11
|
const sandbox_1 = require("../../sandbox");
|
|
12
|
+
const tsNodeBinary = path_1.default.resolve('./node_modules/.bin/ts-node');
|
|
13
|
+
const entrypointFile = path_1.default.resolve('./src/entrypoint.cli.ts');
|
|
12
14
|
jest.setTimeout(15000);
|
|
13
|
-
function runBackportViaCli(backportArgs,
|
|
14
|
-
const
|
|
15
|
-
const entrypointFile = path_1.default.resolve('./src/entrypoint.cli.ts');
|
|
15
|
+
function runBackportViaCli(backportArgs, runBackportOptions = {}) {
|
|
16
|
+
const chunks = '';
|
|
16
17
|
const randomString = Math.random().toString(36).slice(2);
|
|
17
18
|
const sandboxPath = (0, sandbox_1.getSandboxPath)({
|
|
18
19
|
filename: __filename,
|
|
@@ -22,36 +23,58 @@ function runBackportViaCli(backportArgs, { timeoutSeconds = 3, showOra, waitForS
|
|
|
22
23
|
const cmdArgs = [
|
|
23
24
|
'--transpile-only',
|
|
24
25
|
entrypointFile,
|
|
25
|
-
|
|
26
|
+
`--log-file-path=${sandbox_1.SANDBOX_PATH}/backport.log`,
|
|
26
27
|
...(backportArgs.some((arg) => arg.includes('--dir'))
|
|
27
28
|
? []
|
|
28
29
|
: [`--dir=${sandboxPath}`]),
|
|
29
30
|
...backportArgs,
|
|
30
31
|
];
|
|
31
|
-
const proc = (0, child_process_1.spawn)(tsNodeBinary, cmdArgs, { cwd });
|
|
32
|
+
const proc = (0, child_process_1.spawn)(tsNodeBinary, cmdArgs, { cwd: runBackportOptions.cwd });
|
|
33
|
+
return getPromise(proc, runBackportOptions, cmdArgs, chunks);
|
|
34
|
+
}
|
|
35
|
+
exports.runBackportViaCli = runBackportViaCli;
|
|
36
|
+
const keyCodeMap = {
|
|
37
|
+
down: '\x1B\x5B\x42',
|
|
38
|
+
up: '\x1B\x5B\x41',
|
|
39
|
+
enter: '\x0D',
|
|
40
|
+
};
|
|
41
|
+
function getPromise(proc, runBackportOptions, cmdArgs, chunks) {
|
|
42
|
+
if (proc.killed) {
|
|
43
|
+
throw new Error('Process is already killed. Did you forget `keepAlive: true`?');
|
|
44
|
+
}
|
|
45
|
+
const { timeoutSeconds = 3, waitForString, showOra, keepAlive, } = runBackportOptions;
|
|
32
46
|
return new Promise((resolve, reject) => {
|
|
33
|
-
let data = '';
|
|
34
47
|
const postponeTimeout = (0, lodash_1.debounce)(() => {
|
|
35
|
-
const
|
|
48
|
+
const formattedChunks = formatChunk(chunks);
|
|
36
49
|
const cmd = [tsNodeBinary, ...cmdArgs].join(' ');
|
|
37
50
|
reject(waitForString
|
|
38
|
-
? `Expectation '${waitForString}' not found within ${timeoutSeconds} second in:\n\n${
|
|
39
|
-
: `
|
|
40
|
-
}, timeoutSeconds * 1000, { maxWait:
|
|
41
|
-
function
|
|
51
|
+
? `Expectation '${waitForString}' not found within ${timeoutSeconds} second in:\n\n${formattedChunks}\n\nCommand: ${cmd}`
|
|
52
|
+
: `Process did not complete within ${timeoutSeconds} seconds. Received:\n${formattedChunks}\n\nCommand: ${cmd}`);
|
|
53
|
+
}, timeoutSeconds * 1000, { maxWait: 10000 });
|
|
54
|
+
function formatChunk(data) {
|
|
42
55
|
return (0, strip_ansi_1.default)(data.toString()).trim();
|
|
43
56
|
}
|
|
57
|
+
function keypress(keyCode, runBackportOptions = {}) {
|
|
58
|
+
const p = getPromise(proc, runBackportOptions, cmdArgs, chunks);
|
|
59
|
+
proc.stdin.write(keyCodeMap[keyCode]);
|
|
60
|
+
return p;
|
|
61
|
+
}
|
|
44
62
|
const onChunk = (chunk) => {
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
if (waitForString &&
|
|
63
|
+
chunks += chunk;
|
|
64
|
+
const formattedChunk = formatChunk(chunk);
|
|
65
|
+
if (waitForString && formattedChunk.includes(waitForString)) {
|
|
48
66
|
postponeTimeout.cancel();
|
|
49
|
-
resolve({ output, code: null });
|
|
67
|
+
resolve({ output: formatChunk(chunks), code: null, keypress });
|
|
50
68
|
}
|
|
51
69
|
};
|
|
52
70
|
proc.on('exit', (code) => {
|
|
53
71
|
postponeTimeout.cancel();
|
|
54
|
-
|
|
72
|
+
if (waitForString) {
|
|
73
|
+
reject(`runBackportViaCli exited before finding: ${waitForString}. Output: ${formatChunk(chunks)}`);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
resolve({ output: formatChunk(chunks), code, keypress });
|
|
77
|
+
}
|
|
55
78
|
});
|
|
56
79
|
proc.stdout.on('data', (chunk) => {
|
|
57
80
|
postponeTimeout();
|
|
@@ -68,7 +91,14 @@ function runBackportViaCli(backportArgs, { timeoutSeconds = 3, showOra, waitForS
|
|
|
68
91
|
reject(`runBackportViaCli failed with: ${err}`);
|
|
69
92
|
});
|
|
70
93
|
}).finally(() => {
|
|
71
|
-
|
|
94
|
+
if (!keepAlive) {
|
|
95
|
+
proc.kill();
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
proc.removeAllListeners('exit');
|
|
99
|
+
proc.stdout.removeAllListeners('data');
|
|
100
|
+
proc.stderr.removeAllListeners('data');
|
|
101
|
+
proc.removeAllListeners('errors');
|
|
102
|
+
}
|
|
72
103
|
});
|
|
73
104
|
}
|
|
74
|
-
exports.runBackportViaCli = runBackportViaCli;
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const child_process_promisified_1 = require("../../../lib/child-process-promisified");
|
|
4
4
|
const getDevAccessToken_1 = require("../../private/getDevAccessToken");
|
|
5
|
+
const replaceStringAndLinebreaks_1 = require("../../replaceStringAndLinebreaks");
|
|
5
6
|
const sandbox_1 = require("../../sandbox");
|
|
6
7
|
const runBackportViaCli_1 = require("./runBackportViaCli");
|
|
7
8
|
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
|
+
jest.setTimeout(15000);
|
|
8
10
|
describe('test-that-repo-can-be-cloned', () => {
|
|
9
11
|
describe('when local repo does not exist', () => {
|
|
10
12
|
let sandboxPath;
|
|
@@ -75,7 +77,11 @@ describe('test-that-repo-can-be-cloned', () => {
|
|
|
75
77
|
}
|
|
76
78
|
it('clones using the local repo', async () => {
|
|
77
79
|
const { output } = await run();
|
|
78
|
-
expect(
|
|
80
|
+
expect((0, replaceStringAndLinebreaks_1.replaceStringAndLinebreaks)({
|
|
81
|
+
haystack: output,
|
|
82
|
+
stringBefore: sourceRepo,
|
|
83
|
+
stringAfter: '<SOURCE_REPO>',
|
|
84
|
+
})).toContain('✔ 100% Cloning repository from <SOURCE_REPO> (one-time operation)');
|
|
79
85
|
});
|
|
80
86
|
});
|
|
81
87
|
});
|
|
@@ -8,7 +8,7 @@ const sandbox_1 = require("../../sandbox");
|
|
|
8
8
|
jest.unmock('find-up');
|
|
9
9
|
jest.unmock('del');
|
|
10
10
|
jest.unmock('make-dir');
|
|
11
|
-
jest.setTimeout(
|
|
11
|
+
jest.setTimeout(15000);
|
|
12
12
|
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
13
13
|
const octokit = new rest_1.Octokit({ auth: accessToken });
|
|
14
14
|
const sandboxPath = (0, sandbox_1.getSandboxPath)({ filename: __filename });
|
|
@@ -5,7 +5,7 @@ const getDevAccessToken_1 = require("./private/getDevAccessToken");
|
|
|
5
5
|
const sandbox_1 = require("./sandbox");
|
|
6
6
|
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
7
7
|
jest.unmock('find-up');
|
|
8
|
-
jest.setTimeout(
|
|
8
|
+
jest.setTimeout(20000);
|
|
9
9
|
describe('Handle unbackported pull requests', () => {
|
|
10
10
|
it('shows missing backports for PR number 8', async () => {
|
|
11
11
|
const commits = await (0, entrypoint_module_1.getCommits)({
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replaceStringAndLinebreaks = void 0;
|
|
4
|
+
function replaceStringAndLinebreaks({ haystack, stringBefore, stringAfter, }) {
|
|
5
|
+
const regex = stringBefore.split('').join('\\s?');
|
|
6
|
+
return haystack.replace(new RegExp(regex, 'g'), stringAfter);
|
|
7
|
+
}
|
|
8
|
+
exports.replaceStringAndLinebreaks = replaceStringAndLinebreaks;
|
package/dist/test/sandbox.d.ts
CHANGED
package/dist/test/sandbox.js
CHANGED
|
@@ -26,19 +26,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.resetSandbox = exports.getSandboxPath = void 0;
|
|
29
|
+
exports.resetSandbox = exports.getSandboxPath = exports.SANDBOX_PATH = void 0;
|
|
30
|
+
const os_1 = require("os");
|
|
30
31
|
const path_1 = __importStar(require("path"));
|
|
31
32
|
const del_1 = __importDefault(require("del"));
|
|
32
33
|
const make_dir_1 = __importDefault(require("make-dir"));
|
|
33
34
|
jest.unmock('make-dir');
|
|
34
35
|
jest.unmock('del');
|
|
36
|
+
exports.SANDBOX_PATH = `${(0, os_1.homedir)()}/.backport_testing/`;
|
|
35
37
|
function getSandboxPath({ filename, specname, }) {
|
|
36
38
|
const baseFilename = getFilenameWithoutExtension(filename);
|
|
37
|
-
return (0, path_1.resolve)(`${
|
|
39
|
+
return (0, path_1.resolve)(`${exports.SANDBOX_PATH}/${baseFilename}${specname ? `/${specname}` : ''}`);
|
|
38
40
|
}
|
|
39
41
|
exports.getSandboxPath = getSandboxPath;
|
|
40
42
|
async function resetSandbox(sandboxPath) {
|
|
41
|
-
|
|
43
|
+
if (sandboxPath.length < 30) {
|
|
44
|
+
throw new Error(`sandboxPath "${sandboxPath}" is too short. Reset aborted`);
|
|
45
|
+
}
|
|
46
|
+
await (0, del_1.default)(sandboxPath, { force: true });
|
|
42
47
|
await (0, make_dir_1.default)(sandboxPath);
|
|
43
48
|
}
|
|
44
49
|
exports.resetSandbox = resetSandbox;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "8.4.
|
|
1
|
+
export declare const PACKAGE_VERSION = "8.4.3";
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"branches",
|
|
15
15
|
"branching"
|
|
16
16
|
],
|
|
17
|
-
"version": "8.4.
|
|
17
|
+
"version": "8.4.3",
|
|
18
18
|
"main": "./dist/entrypoint.module.js",
|
|
19
19
|
"types": "dist/entrypoint.module.d.ts",
|
|
20
20
|
"bin": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"lint-and-test": "yarn tsc && yarn lint && yarn test-all",
|
|
31
31
|
"lint": "echo \"Running lint\" && eslint './**/*.{ts,js}'",
|
|
32
32
|
"start": "ts-node --transpile-only ./src/entrypoint.cli.ts",
|
|
33
|
-
"test-all": "
|
|
33
|
+
"test-all": "jest --config ./jest.config.all.js",
|
|
34
34
|
"test-mutation": "jest --config ./jest.config.mutation.js",
|
|
35
35
|
"test-private": "jest --config ./jest.config.private.js",
|
|
36
36
|
"test": "jest"
|
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@octokit/rest": "^18.12.0",
|
|
67
|
-
"axios": "^0.
|
|
67
|
+
"axios": "^0.27.2",
|
|
68
68
|
"dedent": "^0.7.0",
|
|
69
|
-
"del": "^6.
|
|
70
|
-
"dotenv": "^16.0.
|
|
69
|
+
"del": "^6.1.1",
|
|
70
|
+
"dotenv": "^16.0.1",
|
|
71
71
|
"find-up": "^5.0.0",
|
|
72
|
-
"graphql": "^16.
|
|
72
|
+
"graphql": "^16.5.0",
|
|
73
73
|
"graphql-tag": "^2.12.6",
|
|
74
|
-
"inquirer": "^8.2.
|
|
74
|
+
"inquirer": "^8.2.3",
|
|
75
75
|
"lodash": "^4.17.21",
|
|
76
76
|
"make-dir": "^3.1.0",
|
|
77
77
|
"ora": "^5.4.1",
|
|
@@ -79,37 +79,37 @@
|
|
|
79
79
|
"strip-json-comments": "^3.1.1",
|
|
80
80
|
"terminal-link": "^2.1.1",
|
|
81
81
|
"utility-types": "^3.10.0",
|
|
82
|
-
"winston": "^3.
|
|
83
|
-
"yargs": "^17.
|
|
82
|
+
"winston": "^3.7.2",
|
|
83
|
+
"yargs": "^17.5.1",
|
|
84
84
|
"yargs-parser": "^21.0.1"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@types/core-js": "^2.5.5",
|
|
88
88
|
"@types/dedent": "^0.7.0",
|
|
89
89
|
"@types/inquirer": "^8.2.1",
|
|
90
|
-
"@types/jest": "^27.
|
|
91
|
-
"@types/lodash": "^4.14.
|
|
92
|
-
"@types/node": "^17.0.
|
|
90
|
+
"@types/jest": "^27.5.1",
|
|
91
|
+
"@types/lodash": "^4.14.182",
|
|
92
|
+
"@types/node": "^17.0.35",
|
|
93
93
|
"@types/safe-json-stringify": "^1.1.2",
|
|
94
94
|
"@types/yargs": "^17.0.10",
|
|
95
95
|
"@types/yargs-parser": "^21.0.0",
|
|
96
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
97
|
-
"@typescript-eslint/parser": "^5.
|
|
98
|
-
"eslint": "^8.
|
|
96
|
+
"@typescript-eslint/eslint-plugin": "^5.26.0",
|
|
97
|
+
"@typescript-eslint/parser": "^5.26.0",
|
|
98
|
+
"eslint": "^8.16.0",
|
|
99
99
|
"eslint-config-prettier": "^8.5.0",
|
|
100
|
-
"eslint-plugin-import": "^2.
|
|
101
|
-
"eslint-plugin-jest": "^26.
|
|
100
|
+
"eslint-plugin-import": "^2.26.0",
|
|
101
|
+
"eslint-plugin-jest": "^26.2.2",
|
|
102
102
|
"eslint-plugin-prettier": "^4.0.0",
|
|
103
|
-
"graphql-config": "^4.
|
|
104
|
-
"husky": "^
|
|
105
|
-
"jest": "^
|
|
103
|
+
"graphql-config": "^4.3.1",
|
|
104
|
+
"husky": "^8.0.1",
|
|
105
|
+
"jest": "^28.1.0",
|
|
106
106
|
"jest-snapshot-serializer-ansi": "^1.0.0",
|
|
107
|
-
"lint-staged": "^12.
|
|
107
|
+
"lint-staged": "^12.4.2",
|
|
108
108
|
"nock": "^13.2.4",
|
|
109
109
|
"prettier": "^2.6.2",
|
|
110
110
|
"strip-ansi": "^6.0.1",
|
|
111
|
-
"ts-jest": "^
|
|
112
|
-
"ts-node": "^10.
|
|
113
|
-
"typescript": "^4.
|
|
111
|
+
"ts-jest": "^28.0.3",
|
|
112
|
+
"ts-node": "^10.8.0",
|
|
113
|
+
"typescript": "^4.7.2"
|
|
114
114
|
}
|
|
115
115
|
}
|