@@ -246,7 +246,7 @@ namespace ts.projectSystem {
246246
247247
248248 callsTrackingHost . clear ( ) ;
249- host . reloadFS ( [ root , imported ] ) ;
249+ host . writeFile ( imported . path , imported . content ) ;
250250 host . runQueuedTimeoutCallbacks ( ) ;
251251 diags = project . getLanguageService ( ) . getSemanticDiagnostics ( root . path ) ;
252252 assert . equal ( diags . length , 0 ) ;
@@ -400,7 +400,7 @@ namespace ts.projectSystem {
400400
401401 // Create file cookie.ts
402402 projectFiles . push ( file3 ) ;
403- host . reloadFS ( projectFiles ) ;
403+ host . writeFile ( file3 . path , file3 . content ) ;
404404 host . runQueuedTimeoutCallbacks ( ) ;
405405
406406 const canonicalFile3Path = useCaseSensitiveFileNames ? file3 . path : file3 . path . toLocaleLowerCase ( ) ;
@@ -482,7 +482,7 @@ namespace ts.projectSystem {
482482 content : "export {}"
483483 } ;
484484 files . push ( debugTypesFile ) ;
485- host . reloadFS ( files ) ;
485+ host . writeFile ( debugTypesFile . path , debugTypesFile . content ) ;
486486 host . runQueuedTimeoutCallbacks ( ) ;
487487 checkProjectActualFiles ( project , files . map ( f => f . path ) ) ;
488488 assert . deepEqual ( project . getLanguageService ( ) . getSemanticDiagnostics ( file1 . path ) . map ( diag => diag . messageText ) , [ ] ) ;
@@ -575,12 +575,13 @@ namespace ts.projectSystem {
575575 { path : "/a/b/node_modules/.staging/rxjs-22375c61/add/operator" } ,
576576 { path : "/a/b/node_modules/.staging/@types/lodash-e56c4fe7/package.json" , content : "{\n \"name\": \"@types/lodash\",\n \"version\": \"4.14.74\",\n \"description\": \"TypeScript definitions for Lo-Dash\",\n \"license\": \"MIT\",\n \"contributors\": [\n {\n \"name\": \"Brian Zengel\",\n \"url\": \"https://github.com/bczengel\"\n },\n {\n \"name\": \"Ilya Mochalov\",\n \"url\": \"https://github.com/chrootsu\"\n },\n {\n \"name\": \"Stepan Mikhaylyuk\",\n \"url\": \"https://github.com/stepancar\"\n },\n {\n \"name\": \"Eric L Anderson\",\n \"url\": \"https://github.com/ericanderson\"\n },\n {\n \"name\": \"AJ Richardson\",\n \"url\": \"https://github.com/aj-r\"\n },\n {\n \"name\": \"Junyoung Clare Jang\",\n \"url\": \"https://github.com/ailrun\"\n }\n ],\n \"main\": \"\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://www.github.com/DefinitelyTyped/DefinitelyTyped.git\"\n },\n \"scripts\": {},\n \"dependencies\": {},\n \"typesPublisherContentHash\": \"12af578ffaf8d86d2df37e591857906a86b983fa9258414326544a0fe6af0de8\",\n \"typeScriptVersion\": \"2.2\"\n}" } ,
577577 { path : "/a/b/node_modules/.staging/lodash-b0733faa/index.js" , content : "module.exports = require('./lodash');" } ,
578- { path : "/a/b/node_modules/.staging/typescript-8493ea5d/package.json.3017591594" }
578+ { path : "/a/b/node_modules/.staging/typescript-8493ea5d/package.json.3017591594" , content : "" }
579579 ] . map ( getRootedFileOrFolder ) ) ;
580580 // Since we added/removed in .staging no timeout
581581 verifyAfterPartialOrCompleteNpmInstall ( 0 ) ;
582582
583583 // Remove file "/a/b/node_modules/.staging/typescript-8493ea5d/package.json.3017591594"
584+ host . deleteFile ( last ( filesAndFoldersToAdd ) . path ) ;
584585 filesAndFoldersToAdd . length -- ;
585586 verifyAfterPartialOrCompleteNpmInstall ( 0 ) ;
586587
@@ -602,6 +603,7 @@ namespace ts.projectSystem {
602603 verifyAfterPartialOrCompleteNpmInstall ( 0 ) ;
603604
604605 // remove /a/b/node_modules/.staging/rxjs-22375c61/package.json.2252192041
606+ host . deleteFile ( last ( filesAndFoldersToAdd ) . path ) ;
605607 filesAndFoldersToAdd . length -- ;
606608 // and add few more folders/files
607609 filesAndFoldersToAdd . push ( ...[
@@ -622,6 +624,7 @@ namespace ts.projectSystem {
622624 . replace ( / [ \- \. ] [ \d \w ] [ \d \w ] [ \d \w ] [ \d \w ] [ \d \w ] [ \d \w ] [ \d \w ] [ \d \w ] / g, "" ) ;
623625 } ) ;
624626
627+ host . deleteFolder ( root + "/a/b/node_modules/.staging" , /*recursive*/ true ) ;
625628 const lodashIndexPath = root + "/a/b/node_modules/@types/lodash/index.d.ts" ;
626629 projectFiles . push ( find ( filesAndFoldersToAdd , f => f . path === lodashIndexPath ) ! ) ;
627630 // we would now not have failed lookup in the parent of appFolder since lodash is available
@@ -631,7 +634,7 @@ namespace ts.projectSystem {
631634 verifyAfterPartialOrCompleteNpmInstall ( 2 ) ;
632635
633636 function verifyAfterPartialOrCompleteNpmInstall ( timeoutQueueLengthWhenRunningTimeouts : number ) {
634- host . reloadFS ( projectFiles . concat ( otherFiles , filesAndFoldersToAdd ) ) ;
637+ filesAndFoldersToAdd . forEach ( f => host . ensureFileOrFolder ( f ) ) ;
635638 if ( npmInstallComplete || timeoutDuringPartialInstallation ) {
636639 host . checkTimeoutQueueLengthAndRun ( timeoutQueueLengthWhenRunningTimeouts ) ;
637640 }
@@ -696,7 +699,7 @@ namespace ts.projectSystem {
696699 invoker . call ( host , fullPath , eventName , entryFullPath ) ;
697700 }
698701 } ;
699- host . reloadFS ( files ) ;
702+ host . writeFile ( debugTypesFile . path , debugTypesFile . content ) ;
700703 host . runQueuedTimeoutCallbacks ( ) ;
701704 checkProjectActualFiles ( project , files . map ( f => f . path ) ) ;
702705 assert . deepEqual ( project . getLanguageService ( ) . getSemanticDiagnostics ( app . path ) . map ( diag => diag . messageText ) , [ ] ) ;
0 commit comments