1
1
import * as ts from 'typescript' ;
2
- import { dirname } from 'path' ;
2
+ import { dirname , join } from 'path' ;
3
3
import { createPassiveFileSystem } from '../file-system/PassiveFileSystem' ;
4
4
import forwardSlash from '../../utils/path/forwardSlash' ;
5
5
import { createRealFileSystem } from '../file-system/RealFileSystem' ;
@@ -198,9 +198,7 @@ function createControlledTypeScriptSystem(
198
198
controlledSystem . invokeFileDeleted ( path ) ;
199
199
} ,
200
200
directoryExists ( path : string ) : boolean {
201
- const stats = getReadFileSystem ( path ) . readStats ( path ) ;
202
-
203
- return ! ! stats && stats . isDirectory ( ) ;
201
+ return Boolean ( getReadFileSystem ( path ) . readStats ( path ) ?. isDirectory ( ) ) ;
204
202
} ,
205
203
createDirectory ( path : string ) : void {
206
204
getWriteFileSystem ( path ) . createDir ( path ) ;
@@ -210,7 +208,13 @@ function createControlledTypeScriptSystem(
210
208
getDirectories ( path : string ) : string [ ] {
211
209
const dirents = getReadFileSystem ( path ) . readDir ( path ) ;
212
210
213
- return dirents . filter ( ( dirent ) => dirent . isDirectory ( ) ) . map ( ( dirent ) => dirent . name ) ;
211
+ return dirents
212
+ . filter (
213
+ ( dirent ) =>
214
+ dirent . isDirectory ( ) ||
215
+ ( dirent . isSymbolicLink ( ) && controlledSystem . directoryExists ( join ( path , dirent . name ) ) )
216
+ )
217
+ . map ( ( dirent ) => dirent . name ) ;
214
218
} ,
215
219
getModifiedTime ( path : string ) : Date | undefined {
216
220
const stats = getReadFileSystem ( path ) . readStats ( path ) ;
0 commit comments