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);