From e7d9acaabf621ed557347c04ec2ab1375641355c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Louv-Jansen?= Date: Thu, 23 Jul 2020 00:30:22 +0200 Subject: [PATCH] Remove dedent --- ...herrypickAndCreatePullRequest.test.ts.snap | 2 +- src/ui/cherrypickAndCreatePullRequest.test.ts | 33 ++++++++++++++----- .../cherrypickAndCreateTargetPullRequest.ts | 15 ++++----- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/ui/__snapshots__/cherrypickAndCreatePullRequest.test.ts.snap b/src/ui/__snapshots__/cherrypickAndCreatePullRequest.test.ts.snap index fc0e831f..14257d2e 100644 --- a/src/ui/__snapshots__/cherrypickAndCreatePullRequest.test.ts.snap +++ b/src/ui/__snapshots__/cherrypickAndCreatePullRequest.test.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`cherrypickAndCreateTargetPullRequest when cherry-picking fails should start conflict resolution mode 5`] = ` +exports[`cherrypickAndCreateTargetPullRequest when cherry-picking fails should start conflict resolution mode 4`] = ` Array [ Array [ "git reset --hard && git clean -d --force && git fetch elastic 6.x && git checkout -B backport/6.x/commit-mySha elastic/6.x --no-track", diff --git a/src/ui/cherrypickAndCreatePullRequest.test.ts b/src/ui/cherrypickAndCreatePullRequest.test.ts index 09cf60fd..4d777e3b 100644 --- a/src/ui/cherrypickAndCreatePullRequest.test.ts +++ b/src/ui/cherrypickAndCreatePullRequest.test.ts @@ -233,26 +233,41 @@ describe('cherrypickAndCreateTargetPullRequest', () => { number: 1337, }); - expect(promptSpy.mock.calls[0]).toMatchInlineSnapshot(` + expect(promptSpy.mock.calls).toMatchInlineSnapshot(` Array [ - "The following files have conflicts: + Array [ + " + The following files have conflicts: - /myHomeDir/.backport/repositories/elastic/kibana/conflicting-file.txt Repository: /myHomeDir/.backport/repositories/elastic/kibana - Press ENTER when the conflicts are resolved and files are staged", - ] - `); + Press ENTER when the conflicts are resolved and files are staged + ", + ], + Array [ + " + The following files have conflicts: + - /myHomeDir/.backport/repositories/elastic/kibana/conflicting-file.txt - expect(promptSpy.mock.calls[2]).toMatchInlineSnapshot(` - Array [ - "The following files are unstaged: + + Repository: /myHomeDir/.backport/repositories/elastic/kibana + + Press ENTER when the conflicts are resolved and files are staged + ", + ], + Array [ + " + + The following files are unstaged: - /myHomeDir/.backport/repositories/elastic/kibana/conflicting-file.txt Repository: /myHomeDir/.backport/repositories/elastic/kibana - Press ENTER when the conflicts are resolved and files are staged", + Press ENTER when the conflicts are resolved and files are staged + ", + ], ] `); diff --git a/src/ui/cherrypickAndCreateTargetPullRequest.ts b/src/ui/cherrypickAndCreateTargetPullRequest.ts index 52350460..90c41d89 100644 --- a/src/ui/cherrypickAndCreateTargetPullRequest.ts +++ b/src/ui/cherrypickAndCreateTargetPullRequest.ts @@ -1,5 +1,4 @@ import chalk from 'chalk'; -import dedent from 'dedent'; import difference from 'lodash.difference'; import isEmpty from 'lodash.isempty'; import ora = require('ora'); @@ -233,16 +232,14 @@ async function listConflictingAndUnstagedFiles(options: BackportOptions) { : ''; consoleLog(''); // linebreak - const res = await confirmPrompt( - dedent(` - ${conflictSection} - ${unstagedSection} + const res = await confirmPrompt(` +${conflictSection} +${unstagedSection} - ${chalk.reset(`Repository: ${getRepoPath(options)}`)} +${chalk.reset(`Repository: ${getRepoPath(options)}`)} - Press ENTER when the conflicts are resolved and files are staged - `) - ); +Press ENTER when the conflicts are resolved and files are staged +`); if (!res) { throw new HandledError('Aborted'); }