From 6ba6f0077b5a677aaf5b27bcffb419e142f67178 Mon Sep 17 00:00:00 2001 From: Blake Kostner Date: Thu, 14 Jun 2018 00:11:54 -0700 Subject: [PATCH] fix(shipit-deploy): only remove workspace if not shallow clone (#200) --- packages/shipit-deploy/src/tasks/deploy/update.js | 8 +++++--- .../shipit-deploy/src/tasks/deploy/update.test.js | 12 +++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/shipit-deploy/src/tasks/deploy/update.js b/packages/shipit-deploy/src/tasks/deploy/update.js index 0c7d406..76ec1ff 100644 --- a/packages/shipit-deploy/src/tasks/deploy/update.js +++ b/packages/shipit-deploy/src/tasks/deploy/update.js @@ -135,9 +135,11 @@ const updateTask = shipit => { } async function removeWorkspace() { - shipit.log(`Removing workspace "${shipit.workspace}"`) - await rmfr(shipit.workspace) - shipit.log(chalk.green('Workspace removed.')) + if (shipit.config.shallowClone) { + shipit.log(`Removing workspace "${shipit.workspace}"`) + await rmfr(shipit.workspace) + shipit.log(chalk.green('Workspace removed.')) + } } await setPreviousRelease() diff --git a/packages/shipit-deploy/src/tasks/deploy/update.test.js b/packages/shipit-deploy/src/tasks/deploy/update.test.js index cea3894..a766217 100644 --- a/packages/shipit-deploy/src/tasks/deploy/update.test.js +++ b/packages/shipit-deploy/src/tasks/deploy/update.test.js @@ -226,11 +226,21 @@ describe('deploy:update task', () => { }) }) - it('should remove workspace', async () => { + it('should remove workspace when shallow cloning', async () => { + shipit.config.shallowClone = true stubShipit(shipit) rmfr.mockClear() expect(rmfr).not.toHaveBeenCalled() await start(shipit, 'deploy:update') expect(rmfr).toHaveBeenCalledWith('/tmp/workspace') }) + + it('should keep workspace when not shallow cloning', async () => { + shipit.config.shallowClone = false + stubShipit(shipit) + rmfr.mockClear() + expect(rmfr).not.toHaveBeenCalled() + await start(shipit, 'deploy:update') + expect(rmfr).not.toHaveBeenCalledWith('/tmp/workspace') + }) })