File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -13,14 +13,14 @@ function installExtension(vscodeExePath: string, extId: string) {
13
13
} ) ;
14
14
}
15
15
16
- function showDirContens ( dir : string ) {
17
- console . log ( dir ) ;
16
+ function forDirContents ( dir : string , cb : ( file : fs . Dirent , absPath : string ) => void ) {
18
17
const files = fs . readdirSync ( dir , { withFileTypes : true } ) ;
19
18
files . forEach ( ( file : fs . Dirent ) => {
20
19
const absPath = path . resolve ( dir , file . name ) ;
21
20
if ( file . isDirectory ( ) ) {
22
- showDirContens ( absPath ) ;
21
+ forDirContents ( absPath , cb ) ;
23
22
}
23
+ cb ( file , absPath ) ;
24
24
} ) ;
25
25
}
26
26
@@ -54,10 +54,12 @@ async function main() {
54
54
} ) ;
55
55
56
56
console . log ( 'Test workspace contents: ' ) ;
57
- showDirContens ( testWorkspace ) ;
57
+ forDirContents ( testWorkspace , ( ) => console . log ) ;
58
58
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
+ } ) ;
61
63
}
62
64
} catch ( err ) {
63
65
console . error ( err ) ;
You can’t perform that action at this time.
0 commit comments