From ec086b0df11b2fa66e7feecfdf87fab2dc81a4e3 Mon Sep 17 00:00:00 2001 From: Dan Imhoff Date: Thu, 24 Sep 2020 04:18:56 -0700 Subject: [PATCH] fix(cli): halt update upon failure (#3595) --- cli/src/tasks/update.ts | 18 +++++++----------- cli/test/update.android.spec.ts | 5 +---- cli/test/update.ios.spec.ts | 5 +---- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/cli/src/tasks/update.ts b/cli/src/tasks/update.ts index ff945a4c0..87b576ee3 100644 --- a/cli/src/tasks/update.ts +++ b/cli/src/tasks/update.ts @@ -58,15 +58,11 @@ export function updateChecks(config: Config, platforms: string[]): CheckFunction } export async function update(config: Config, platformName: string, deployment: boolean) { - try { - await runTask(chalk`{green {bold update}} {bold ${platformName}}`, async () => { - if (platformName === config.ios.name) { - await updateIOS(config, deployment); - } else if (platformName === config.android.name) { - await updateAndroid(config); - } - }); - } catch (e) { - logError('Error running update:', e); - } + await runTask(chalk`{green {bold update}} {bold ${platformName}}`, async () => { + if (platformName === config.ios.name) { + await updateIOS(config, deployment); + } else if (platformName === config.android.name) { + await updateAndroid(config); + } + }); } diff --git a/cli/test/update.android.spec.ts b/cli/test/update.android.spec.ts index 375e1ef22..41efeb362 100644 --- a/cli/test/update.android.spec.ts +++ b/cli/test/update.android.spec.ts @@ -1,5 +1,4 @@ -import { APP_ID, APP_NAME, CORDOVA_PLUGIN_ID, MappedFS, makeAppDir, makeConfig, run } from './util'; -import { updateCommand } from '../src/tasks/update'; +import { APP_ID, APP_NAME, CORDOVA_PLUGIN_ID, MappedFS, makeAppDir, run } from './util'; describe.each([false, true])('Update: Android (monoRepoLike: %p)', (monoRepoLike) => { let appDirObj; @@ -14,8 +13,6 @@ describe.each([false, true])('Update: Android (monoRepoLike: %p)', (monoRepoLike // Init in this directory so we can test add await run(appDir, `init "${APP_NAME}" "${APP_ID}" --npm-client npm`); await run(appDir, `add android`); - // Redundant, because add does this, but called explicitly for thoroughness - await updateCommand(makeConfig(appDir), 'android', false); FS = new MappedFS(appDir); }); diff --git a/cli/test/update.ios.spec.ts b/cli/test/update.ios.spec.ts index 8221562a0..0484b95e6 100644 --- a/cli/test/update.ios.spec.ts +++ b/cli/test/update.ios.spec.ts @@ -1,5 +1,4 @@ -import { APP_ID, APP_NAME, CORDOVA_PLUGIN_ID, MappedFS, makeAppDir, makeConfig, run } from './util'; -import { updateCommand } from '../src/tasks/update'; +import { APP_ID, APP_NAME, CORDOVA_PLUGIN_ID, MappedFS, makeAppDir, run } from './util'; describe.each([false, true])('Update: iOS (monoRepoLike: %p)', (monoRepoLike) => { let appDirObj; @@ -14,8 +13,6 @@ describe.each([false, true])('Update: iOS (monoRepoLike: %p)', (monoRepoLike) => // Init in this directory so we can test add await run(appDir, `init "${APP_NAME}" "${APP_ID}" --npm-client npm`); await run(appDir, `add ios`); - // Redundant, because add does this, but called explicitly for thoroughness - await updateCommand(makeConfig(appDir), 'ios', false); FS = new MappedFS(appDir); });