From c032a88bacc024a7bcd4fbb3d88bc0559188a144 Mon Sep 17 00:00:00 2001 From: Attila Hajdrik Date: Fri, 10 Sep 2021 11:56:48 -0700 Subject: [PATCH] test: fix version gating e2e test deletion (#8156) --- .../amplify-e2e-tests/src/__tests__/version-gating.test.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/amplify-e2e-tests/src/__tests__/version-gating.test.ts b/packages/amplify-e2e-tests/src/__tests__/version-gating.test.ts index 3f06dfd796c..c16c848ab75 100644 --- a/packages/amplify-e2e-tests/src/__tests__/version-gating.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/version-gating.test.ts @@ -22,6 +22,7 @@ type VersionGatingMetadata = { describe('version gating', () => { let projRoot: string; + let projectInitialized = false; const projName = 'versiongating'; // Extreme version numbers for testing purposes @@ -56,7 +57,10 @@ describe('version gating', () => { }); afterEach(async () => { - await deleteProject(projRoot); + if (projectInitialized) { + await deleteProject(projRoot); + } + deleteProjectDir(projRoot); }); @@ -72,6 +76,7 @@ describe('version gating', () => { updateVersionInPackageJson(baseCLIVersion, baseMinimumCLIVersion); await initJSProjectWithProfile(projRoot, { name: projName }); + projectInitialized = true; const meta = stateManager.getMeta(projRoot);