Skip to content

Commit 0e682bb

Browse files
authored
fix: list symlinked dirs in controlled typescript system (#625)
1 parent a341f06 commit 0e682bb

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/typescript-reporter/reporter/ControlledTypeScriptSystem.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as ts from 'typescript';
2-
import { dirname } from 'path';
2+
import { dirname, join } from 'path';
33
import { createPassiveFileSystem } from '../file-system/PassiveFileSystem';
44
import forwardSlash from '../../utils/path/forwardSlash';
55
import { createRealFileSystem } from '../file-system/RealFileSystem';
@@ -198,9 +198,7 @@ function createControlledTypeScriptSystem(
198198
controlledSystem.invokeFileDeleted(path);
199199
},
200200
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());
204202
},
205203
createDirectory(path: string): void {
206204
getWriteFileSystem(path).createDir(path);
@@ -210,7 +208,13 @@ function createControlledTypeScriptSystem(
210208
getDirectories(path: string): string[] {
211209
const dirents = getReadFileSystem(path).readDir(path);
212210

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);
214218
},
215219
getModifiedTime(path: string): Date | undefined {
216220
const stats = getReadFileSystem(path).readStats(path);

0 commit comments

Comments
 (0)