2121/// <reference path="sourceMapRecorder.ts"/>
2222/// <reference path="runnerbase.ts"/>
2323/// <reference path="./vfs.ts" />
24- /// <reference path="./vfsutils.ts" />
2524/// <reference types="node" />
2625/// <reference types="mocha" />
2726/// <reference types="chai" />
@@ -525,17 +524,12 @@ namespace Harness {
525524 getExecutingFilePath ( ) : string ;
526525 exit ( exitCode ?: number ) : void ;
527526 readDirectory ( path : string , extension ?: ReadonlyArray < string > , exclude ?: ReadonlyArray < string > , include ?: ReadonlyArray < string > , depth ?: number ) : string [ ] ;
528- getAccessibleFileSystemEntries ( dirname : string ) : FileSystemEntries ;
527+ getAccessibleFileSystemEntries ( dirname : string ) : ts . FileSystemEntries ;
529528 tryEnableSourceMapsForHost ?( ) : void ;
530529 getEnvironmentVariable ?( name : string ) : string ;
531530 getMemoryUsage ?( ) : number ;
532531 }
533532
534- export interface FileSystemEntries {
535- files : string [ ] ;
536- directories : string [ ] ;
537- }
538-
539533 export let IO : IO ;
540534
541535 // harness always uses one kind of new line
@@ -591,7 +585,7 @@ namespace Harness {
591585 return filesInFolder ( path ) ;
592586 }
593587
594- function getAccessibleFileSystemEntries ( dirname : string ) : FileSystemEntries {
588+ function getAccessibleFileSystemEntries ( dirname : string ) : ts . FileSystemEntries {
595589 try {
596590 const entries : string [ ] = fs . readdirSync ( dirname || "." ) . sort ( ts . sys . useCaseSensitiveFileNames ? ts . compareStringsCaseSensitive : ts . compareStringsCaseInsensitive ) ;
597591 const files : string [ ] = [ ] ;
@@ -944,20 +938,22 @@ namespace Harness {
944938
945939 function readDirectory ( path : string , extension ?: string [ ] , exclude ?: string [ ] , include ?: string [ ] , depth ?: number ) {
946940 const fs = new vfs . FileSystem ( ! useCaseSensitiveFileNames ( ) , { cwd : path , files : { [ path ] : { } } } ) ;
941+ const sys = new fakes . System ( fs ) ;
947942 for ( const file of IO . listFiles ( path ) ) {
948943 fs . mkdirpSync ( vpath . dirname ( file ) ) ;
949944 fs . writeFileSync ( file , "" ) ;
950945 }
951- return ts . matchFiles ( path , extension , exclude , include , useCaseSensitiveFileNames ( ) , /*currentDirectory*/ "" , depth , path => vfsutils . getAccessibleFileSystemEntries ( fs , path ) ) ;
946+ return sys . readDirectory ( path , extension , exclude , include , depth ) ;
952947 }
953948
954- function getAccessibleFileSystemEntries ( dirname : string ) : FileSystemEntries {
949+ function getAccessibleFileSystemEntries ( dirname : string ) : ts . FileSystemEntries {
955950 const fs = new vfs . FileSystem ( ! useCaseSensitiveFileNames ( ) , { cwd : dirname , files : { [ dirname ] : { } } } ) ;
951+ const sys = new fakes . System ( fs ) ;
956952 for ( const file of IO . listFiles ( path ) ) {
957953 fs . mkdirpSync ( vpath . dirname ( file ) ) ;
958954 fs . writeFileSync ( file , "" ) ;
959955 }
960- return vfsutils . getAccessibleFileSystemEntries ( fs , dirname ) ;
956+ return sys . getAccessibleFileSystemEntries ( dirname ) ;
961957 }
962958
963959 return {
@@ -1220,7 +1216,7 @@ namespace Harness {
12201216 options . skipDefaultLibCheck = typeof options . skipDefaultLibCheck === "undefined" ? true : options . skipDefaultLibCheck ;
12211217
12221218 if ( typeof currentDirectory === "undefined" ) {
1223- currentDirectory = vfsutils . srcFolder ;
1219+ currentDirectory = vfs . srcFolder ;
12241220 }
12251221
12261222 // Parse settings
@@ -1237,27 +1233,20 @@ namespace Harness {
12371233 // Files from built\local that are requested by test "@includeBuiltFiles" to be in the context.
12381234 // Treat them as library files, so include them in build, but not in baselines.
12391235 if ( options . includeBuiltFile ) {
1240- programFileNames . push ( vpath . combine ( vfsutils . builtFolder , options . includeBuiltFile ) ) ;
1236+ programFileNames . push ( vpath . combine ( vfs . builtFolder , options . includeBuiltFile ) ) ;
12411237 }
12421238
12431239 // Files from tests\lib that are requested by "@libFiles"
12441240 if ( options . libFiles ) {
12451241 for ( const fileName of options . libFiles . split ( "," ) ) {
1246- programFileNames . push ( vpath . combine ( vfsutils . testLibFolder , fileName ) ) ;
1242+ programFileNames . push ( vpath . combine ( vfs . testLibFolder , fileName ) ) ;
12471243 }
12481244 }
12491245
1250- return compiler . compileFiles (
1251- new fakes . CompilerHost (
1252- vfsutils . createFromDocuments (
1253- useCaseSensitiveFileNames ,
1254- inputFiles . concat ( otherFiles ) . map ( documents . TextDocument . fromTestFile ) ,
1255- { currentDirectory, overwrite : true }
1256- ) ,
1257- options
1258- ) ,
1259- programFileNames ,
1260- options ) ;
1246+ const docs = inputFiles . concat ( otherFiles ) . map ( documents . TextDocument . fromTestFile ) ;
1247+ const fs = vfs . FileSystem . createFromFileSystem ( IO , ! useCaseSensitiveFileNames , { documents : docs , cwd : currentDirectory } ) ;
1248+ const host = new fakes . CompilerHost ( fs , options ) ;
1249+ return compiler . compileFiles ( host , programFileNames , options ) ;
12611250 }
12621251
12631252 export interface DeclarationCompilationContext {
@@ -1298,10 +1287,10 @@ namespace Harness {
12981287 }
12991288
13001289 function addDtsFile ( file : TestFile , dtsFiles : TestFile [ ] ) {
1301- if ( vfsutils . isDeclaration ( file . unitName ) ) {
1290+ if ( vpath . isDeclaration ( file . unitName ) ) {
13021291 dtsFiles . push ( file ) ;
13031292 }
1304- else if ( vfsutils . isTypeScript ( file . unitName ) ) {
1293+ else if ( vpath . isTypeScript ( file . unitName ) ) {
13051294 const declFile = findResultCodeFile ( file . unitName ) ;
13061295 if ( declFile && ! findUnit ( declFile . file , declInputFiles ) && ! findUnit ( declFile . file , declOtherFiles ) ) {
13071296 dtsFiles . push ( { unitName : declFile . file , content : core . removeByteOrderMark ( declFile . text ) } ) ;
@@ -2114,7 +2103,7 @@ namespace Harness {
21142103
21152104 export function isBuiltFile ( filePath : string ) : boolean {
21162105 return filePath . indexOf ( libFolder ) === 0 ||
2117- filePath . indexOf ( vpath . addTrailingSeparator ( vfsutils . builtFolder ) ) === 0 ;
2106+ filePath . indexOf ( vpath . addTrailingSeparator ( vfs . builtFolder ) ) === 0 ;
21182107 }
21192108
21202109 export function getDefaultLibraryFile ( filePath : string , io : IO ) : Compiler . TestFile {
0 commit comments