backport
Version:
A CLI tool that automates the process of backporting commits
59 lines (57 loc) ⢠2.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const childProcessHelper_1 = require("../../childProcessHelper");
const getDevAccessToken_1 = require("../../private/getDevAccessToken");
const sandbox_1 = require("../../sandbox");
const runBackportViaCli_1 = require("./runBackportViaCli");
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
jest.setTimeout(25000);
describe('gracefully handle corrupted repo', () => {
it('backports correctly', async () => {
const sandboxPath = (0, sandbox_1.getSandboxPath)({ filename: __filename });
await (0, sandbox_1.resetSandbox)(sandboxPath);
// first run: backport should clone the repo
await (0, runBackportViaCli_1.runBackportViaCli)([
'--repo=backport-org/integration-test',
'--sha=16cfd987b82f49a79ebc663506f5d215b7a81c5c',
'--branch=7.x',
`--accessToken=${accessToken}`,
`--dir=${sandboxPath}`,
'--dry-run',
], {
showOra: true,
timeoutSeconds: 10,
});
// remove all git objects and references
await (0, childProcessHelper_1.exec)('rm -rf .git', { cwd: sandboxPath });
await (0, childProcessHelper_1.exec)('git init', { cwd: sandboxPath });
const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
'--repo=backport-org/integration-test',
'--sha=16cfd987b82f49a79ebc663506f5d215b7a81c5c',
'--branch=7.x',
`--accessToken=${accessToken}`,
`--dir=${sandboxPath}`,
'--dry-run',
], {
showOra: true,
timeoutSeconds: 10,
});
// second run: backport should re-create remotes and branches correctly
expect(output).toMatchInlineSnapshot(`
"- Initializing...
repo: backport-org/integration-test š¹ sourceBranch: master š¹ sha: 16cfd987b82f49a79ebc663506f5d215b7a81c5c š¹ author: sorenlouv
? Select commit Bump to 8.0.0
Backporting to 7.x:
- Pulling latest changes
ā Pulling latest changes
- Cherry-picking: Bump to 8.0.0
ā Cherry-picking: Bump to 8.0.0
- Creating pull request
ā Creating pull request
- Adding labels: backport
ā Adding labels: backport
View pull request: this-is-a-dry-run"
`);
});
});
//# sourceMappingURL=gracefully-handles-corrupt-repo.private.test.js.map