UNPKG

backport

Version:

A CLI tool that automates the process of backporting commits

59 lines (57 loc) • 2.39 kB
"use strict"; 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