@@ -10,12 +10,16 @@ namespace ts.textStorage {
1010 }`
1111 } ;
1212
13+ function getDummyScriptInfo ( ) {
14+ return { closeSourceMapFileWatcher : noop } as server . ScriptInfo ;
15+ }
16+
1317 it ( "text based storage should be have exactly the same as script version cache" , ( ) => {
1418
1519 const host = projectSystem . createServerHost ( [ f ] ) ;
1620 // Since script info is not used in these tests, just cheat by passing undefined
17- const ts1 = new server . TextStorage ( host , server . asNormalizedPath ( f . path ) , /*initialVersion*/ undefined , { } as server . ScriptInfo ) ;
18- const ts2 = new server . TextStorage ( host , server . asNormalizedPath ( f . path ) , /*initialVersion*/ undefined , { } as server . ScriptInfo ) ;
21+ const ts1 = new server . TextStorage ( host , server . asNormalizedPath ( f . path ) , /*initialVersion*/ undefined , getDummyScriptInfo ( ) ) ;
22+ const ts2 = new server . TextStorage ( host , server . asNormalizedPath ( f . path ) , /*initialVersion*/ undefined , getDummyScriptInfo ( ) ) ;
1923
2024 ts1 . useScriptVersionCache_TestOnly ( ) ;
2125 ts2 . useText ( ) ;
@@ -49,7 +53,7 @@ namespace ts.textStorage {
4953 it ( "should switch to script version cache if necessary" , ( ) => {
5054 const host = projectSystem . createServerHost ( [ f ] ) ;
5155 // Since script info is not used in these tests, just cheat by passing undefined
52- const ts1 = new server . TextStorage ( host , server . asNormalizedPath ( f . path ) , /*initialVersion*/ undefined , { } as server . ScriptInfo ) ;
56+ const ts1 = new server . TextStorage ( host , server . asNormalizedPath ( f . path ) , /*initialVersion*/ undefined , getDummyScriptInfo ( ) ) ;
5357
5458 ts1 . getSnapshot ( ) ;
5559 assert . isFalse ( ts1 . hasScriptVersionCache_TestOnly ( ) , "should not have script version cache - 1" ) ;
@@ -67,15 +71,15 @@ namespace ts.textStorage {
6771 it ( "should be able to return the file size immediately after construction" , ( ) => {
6872 const host = projectSystem . createServerHost ( [ f ] ) ;
6973 // Since script info is not used in these tests, just cheat by passing undefined
70- const ts1 = new server . TextStorage ( host , server . asNormalizedPath ( f . path ) , /*initialVersion*/ undefined , { } as server . ScriptInfo ) ;
74+ const ts1 = new server . TextStorage ( host , server . asNormalizedPath ( f . path ) , /*initialVersion*/ undefined , getDummyScriptInfo ( ) ) ;
7175
7276 assert . strictEqual ( f . content . length , ts1 . getTelemetryFileSize ( ) ) ;
7377 } ) ;
7478
7579 it ( "should be able to return the file size when backed by text" , ( ) => {
7680 const host = projectSystem . createServerHost ( [ f ] ) ;
7781 // Since script info is not used in these tests, just cheat by passing undefined
78- const ts1 = new server . TextStorage ( host , server . asNormalizedPath ( f . path ) , /*initialVersion*/ undefined , { } as server . ScriptInfo ) ;
82+ const ts1 = new server . TextStorage ( host , server . asNormalizedPath ( f . path ) , /*initialVersion*/ undefined , getDummyScriptInfo ( ) ) ;
7983
8084 ts1 . useText ( f . content ) ;
8185 assert . isFalse ( ts1 . hasScriptVersionCache_TestOnly ( ) ) ;
@@ -86,7 +90,7 @@ namespace ts.textStorage {
8690 it ( "should be able to return the file size when backed by a script version cache" , ( ) => {
8791 const host = projectSystem . createServerHost ( [ f ] ) ;
8892 // Since script info is not used in these tests, just cheat by passing undefined
89- const ts1 = new server . TextStorage ( host , server . asNormalizedPath ( f . path ) , /*initialVersion*/ undefined , { } as server . ScriptInfo ) ;
93+ const ts1 = new server . TextStorage ( host , server . asNormalizedPath ( f . path ) , /*initialVersion*/ undefined , getDummyScriptInfo ( ) ) ;
9094
9195 ts1 . useScriptVersionCache_TestOnly ( ) ;
9296 assert . isTrue ( ts1 . hasScriptVersionCache_TestOnly ( ) ) ;
@@ -126,7 +130,7 @@ namespace ts.textStorage {
126130
127131 const host = projectSystem . createServerHost ( [ changingFile ] ) ;
128132 // Since script info is not used in these tests, just cheat by passing undefined
129- const ts1 = new server . TextStorage ( host , server . asNormalizedPath ( changingFile . path ) , /*initialVersion*/ undefined , { } as server . ScriptInfo ) ;
133+ const ts1 = new server . TextStorage ( host , server . asNormalizedPath ( changingFile . path ) , /*initialVersion*/ undefined , getDummyScriptInfo ( ) ) ;
130134
131135 assert . isTrue ( ts1 . reloadFromDisk ( ) ) ;
132136
0 commit comments