Skip to content

Commit 9171206

Browse files
committed
Fix rmdir for windows
1 parent 0ca0eb2 commit 9171206

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/runTest.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ function installExtension(vscodeExePath: string, extId: string) {
1313
});
1414
}
1515

16-
function showDirContens(dir: string) {
17-
console.log(dir);
16+
function forDirContents(dir: string, cb: (file: fs.Dirent, absPath: string) => void) {
1817
const files = fs.readdirSync(dir, { withFileTypes: true });
1918
files.forEach((file: fs.Dirent) => {
2019
const absPath = path.resolve(dir, file.name);
2120
if (file.isDirectory()) {
22-
showDirContens(absPath);
21+
forDirContents(absPath, cb);
2322
}
23+
cb(file, absPath);
2424
});
2525
}
2626

@@ -54,10 +54,12 @@ async function main() {
5454
});
5555

5656
console.log('Test workspace contents: ');
57-
showDirContens(testWorkspace);
57+
forDirContents(testWorkspace, () => console.log);
5858
if (exitCode === 0) {
59-
console.log(`Tests were succesfull, deleting test workspace in ${testWorkspace}`)
60-
fs.rmdirSync(testWorkspace, { recursive: true });
59+
console.log(`Tests were succesfull, deleting test workspace in ${testWorkspace}`);
60+
forDirContents(testWorkspace, (file: fs.Dirent) => {
61+
return file.isDirectory() ? fs.rmdirSync : fs.unlinkSync;
62+
});
6163
}
6264
} catch (err) {
6365
console.error(err);

0 commit comments

Comments
 (0)