Skip to content

Commit

Permalink
Modified code for await
Browse files Browse the repository at this point in the history
  • Loading branch information
SuparnaSuresh committed Jan 15, 2025
1 parent 79d8690 commit 60d7d28
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/test/utils/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,20 +217,20 @@ export async function getProjectWithSpaceInDir(existingProjectPath: string, copy
*/
export async function removeProjectFolderWithContent(projectPath: string): Promise<void> {
try {
await fs.accessSync(projectPath);
const projectContent = await fs.readdirSync(projectPath);
fs.accessSync(projectPath);
const projectContent = fs.readdirSync(projectPath);
await Promise.all(
projectContent.map(async (projectFiles) => {
const projectContentPath = path.join(projectPath, projectFiles);
const stats = await fs.lstatSync(projectContentPath);
const stats = fs.lstatSync(projectContentPath);
if (stats.isDirectory()) {
await removeProjectFolderWithContent(projectContentPath);
} else {
await fs.unlinkSync(projectContentPath);
fs.unlinkSync(projectContentPath);
}
})
);
await fs.rmdirSync(projectPath);
fs.rmdirSync(projectPath);
} catch (error) {
console.error(`Error removing new project: ${error}`);
}
Expand Down

0 comments on commit 60d7d28

Please sign in to comment.