From 4d2fa917635272c825f3bdb8146894aec7750030 Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Wed, 4 Dec 2024 23:22:43 +0530 Subject: [PATCH] updated the function removeConfigDir --- src/test/GradleSingleModLCLSTest.ts | 2 +- src/test/utils/testUtils.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/test/GradleSingleModLCLSTest.ts b/src/test/GradleSingleModLCLSTest.ts index 6db333fc..2f05a1fc 100755 --- a/src/test/GradleSingleModLCLSTest.ts +++ b/src/test/GradleSingleModLCLSTest.ts @@ -72,7 +72,7 @@ describe('LCLS Test for Gradle Project', function () { after(() => { - utils.removeProjectFolderWithContent(path.join(utils.getGradleProjectPath(), 'src', 'main', 'liberty', 'config2')); + utils.removeConfigDir(path.join(utils.getGradleProjectPath(), 'src', 'main', 'liberty', 'config2')); console.log("Removed new config folder:"); }); diff --git a/src/test/utils/testUtils.ts b/src/test/utils/testUtils.ts index af60da64..dac3e348 100755 --- a/src/test/utils/testUtils.ts +++ b/src/test/utils/testUtils.ts @@ -197,7 +197,7 @@ export async function clearCommandPalette() { /** * Remove newly created Project folder with content */ -export async function removeProjectFolderWithContent(projectPath: string): Promise { +export async function removeConfigDir(projectPath: string): Promise { try { await fs.accessSync(projectPath); const projectContent = await fs.readdirSync(projectPath); @@ -206,7 +206,7 @@ export async function removeProjectFolderWithContent(projectPath: string): Promi const projectContentPath = path.join(projectPath, projectFiles); const stats = await fs.lstatSync(projectContentPath); if (stats.isDirectory()) { - await removeProjectFolderWithContent(projectContentPath); + await removeConfigDir(projectContentPath); } else { await fs.unlinkSync(projectContentPath); } @@ -218,6 +218,9 @@ export async function removeProjectFolderWithContent(projectPath: string): Promi } } +/** + * Copy config directory and create new config + */ export async function copyConfig(existingConfigPath: string, copyConfigPath: string): Promise { fse.copy(existingConfigPath, copyConfigPath) .then(() => console.log("New config folder created :" + copyConfigPath))