@@ -9,6 +9,7 @@ namespace ts.projectSystem {
99 et . service . openClientFile ( file . path ) ;
1010 assert . equal ( et . getEvents ( ) . length , 0 ) ;
1111 } ) ;
12+
1213 it ( "only sends an event once" , ( ) => {
1314 const file = makeFile ( "/a.ts" ) ;
1415 const tsconfig = makeFile ( "/tsconfig.json" , { } ) ;
@@ -46,12 +47,13 @@ namespace ts.projectSystem {
4647 const et = new EventTracker ( [ file1 ] ) ;
4748 const compilerOptions : ts . CompilerOptions = { strict : true } ;
4849
49- const projectFileName = "foo.csproj" ;
50+ const projectFileName = "/hunter2/ foo.csproj" ;
5051
5152 open ( ) ;
5253
5354 // TODO: Apparently compilerOptions is mutated, so have to repeat it here!
5455 et . assertProjectInfoTelemetryEvent ( {
56+ projectId : Harness . LanguageService . mockHash ( "/hunter2/foo.csproj" ) ,
5557 compilerOptions : { strict : true } ,
5658 compileOnSave : true ,
5759 // These properties can't be present for an external project, so they are undefined instead of false.
@@ -195,6 +197,7 @@ namespace ts.projectSystem {
195197 const et = new EventTracker ( [ jsconfig , file ] ) ;
196198 et . service . openClientFile ( file . path ) ;
197199 et . assertProjectInfoTelemetryEvent ( {
200+ projectId : Harness . LanguageService . mockHash ( "/jsconfig.json" ) ,
198201 fileStats : fileStats ( { js : 1 } ) ,
199202 compilerOptions : autoJsCompilerOptions ,
200203 typeAcquisition : {
@@ -214,6 +217,7 @@ namespace ts.projectSystem {
214217 et . service . openClientFile ( file . path ) ;
215218 et . getEvent < server . ProjectLanguageServiceStateEvent > ( server . ProjectLanguageServiceStateEvent , /*mayBeMore*/ true ) ;
216219 et . assertProjectInfoTelemetryEvent ( {
220+ projectId : Harness . LanguageService . mockHash ( "/jsconfig.json" ) ,
217221 fileStats : fileStats ( { js : 1 } ) ,
218222 compilerOptions : autoJsCompilerOptions ,
219223 configFileName : "jsconfig.json" ,
@@ -248,7 +252,26 @@ namespace ts.projectSystem {
248252 }
249253
250254 assertProjectInfoTelemetryEvent ( partial : Partial < server . ProjectInfoTelemetryEventData > ) : void {
251- assert . deepEqual ( this . getEvent < server . ProjectInfoTelemetryEvent > ( ts . server . ProjectInfoTelemetryEvent ) , makePayload ( partial ) ) ;
255+ assert . deepEqual ( this . getEvent < server . ProjectInfoTelemetryEvent > ( ts . server . ProjectInfoTelemetryEvent ) , {
256+ projectId : Harness . LanguageService . mockHash ( "/tsconfig.json" ) ,
257+ fileStats : fileStats ( { ts : 1 } ) ,
258+ compilerOptions : { } ,
259+ extends : false ,
260+ files : false ,
261+ include : false ,
262+ exclude : false ,
263+ compileOnSave : false ,
264+ typeAcquisition : {
265+ enable : false ,
266+ exclude : false ,
267+ include : false ,
268+ } ,
269+ configFileName : "tsconfig.json" ,
270+ projectType : "configured" ,
271+ languageServiceEnabled : true ,
272+ version : ts . version ,
273+ ...partial ,
274+ } ) ;
252275 }
253276
254277 getEvent < T extends server . ProjectServiceEvent > ( eventName : T [ "eventName" ] , mayBeMore = false ) : T [ "data" ] {
@@ -260,28 +283,6 @@ namespace ts.projectSystem {
260283 }
261284 }
262285
263- function makePayload ( partial : Partial < server . ProjectInfoTelemetryEventData > ) : server . ProjectInfoTelemetryEventData {
264- return {
265- fileStats : fileStats ( { ts : 1 } ) ,
266- compilerOptions : { } ,
267- extends : false ,
268- files : false ,
269- include : false ,
270- exclude : false ,
271- compileOnSave : false ,
272- typeAcquisition : {
273- enable : false ,
274- exclude : false ,
275- include : false ,
276- } ,
277- configFileName : "tsconfig.json" ,
278- projectType : "configured" ,
279- languageServiceEnabled : true ,
280- version : ts . version ,
281- ...partial
282- } ;
283- }
284-
285286 function makeFile ( path : string , content : { } = "" ) : projectSystem . FileOrFolder {
286287 return { path, content : typeof content === "string" ? "" : JSON . stringify ( content ) } ;
287288 }
0 commit comments