@@ -152,6 +152,25 @@ fnErr();
152
152
} ) ;
153
153
}
154
154
155
+ function verifyConfigFileErrors ( { openFiles, expectedConfigFileDiagEvents } : VerifyScenario ) {
156
+ it ( "verify config file errors" , ( ) => {
157
+ const host = createServerHost ( [ dependencyTs , dependencyConfig , usageTs , usageConfig , libFile ] ) ;
158
+ const { session, events } = createSessionWithEventTracking < server . ConfigFileDiagEvent > ( host , server . ConfigFileDiagEvent ) ;
159
+
160
+ for ( const file of openFiles ( ) ) {
161
+ session . executeCommandSeq < protocol . OpenRequest > ( {
162
+ command : protocol . CommandTypes . Open ,
163
+ arguments : { file : file . path }
164
+ } ) ;
165
+ }
166
+
167
+ assert . deepEqual ( events , expectedConfigFileDiagEvents ( ) . map ( data => ( {
168
+ eventName : server . ConfigFileDiagEvent ,
169
+ data
170
+ } ) ) ) ;
171
+ } ) ;
172
+ }
173
+
155
174
interface GetErrDiagnostics {
156
175
file : File ;
157
176
syntax : protocol . Diagnostic [ ] ;
@@ -170,11 +189,13 @@ fnErr();
170
189
expectedGetErr : ( ) => readonly GetErrDiagnostics [ ] ;
171
190
expectedGetErrForProject : ( ) => readonly GetErrForProjectDiagnostics [ ] ;
172
191
expectedSyncDiagnostics : ( ) => readonly SyncDiagnostics [ ] ;
192
+ expectedConfigFileDiagEvents : ( ) => readonly server . ConfigFileDiagEvent [ "data" ] [ ] ;
173
193
}
174
194
function verifyScenario ( scenario : VerifyScenario ) {
175
195
verifyErrorsUsingGeterr ( scenario ) ;
176
196
verifyErrorsUsingGeterrForProject ( scenario ) ;
177
197
verifyErrorsUsingSyncMethods ( scenario ) ;
198
+ verifyConfigFileErrors ( scenario ) ;
178
199
}
179
200
180
201
function emptyDiagnostics ( file : File ) : GetErrDiagnostics {
@@ -243,6 +264,22 @@ fnErr();
243
264
return { project, ...diagnostics } ;
244
265
}
245
266
267
+ function usageConfigDiag ( ) : server . ConfigFileDiagEvent [ "data" ] {
268
+ return {
269
+ triggerFile : usageTs . path ,
270
+ configFileName : usageConfig . path ,
271
+ diagnostics : emptyArray
272
+ } ;
273
+ }
274
+
275
+ function dependencyConfigDiag ( ) : server . ConfigFileDiagEvent [ "data" ] {
276
+ return {
277
+ triggerFile : dependencyTs . path ,
278
+ configFileName : dependencyConfig . path ,
279
+ diagnostics : emptyArray
280
+ } ;
281
+ }
282
+
246
283
describe ( "when dependency project is not open" , ( ) => {
247
284
verifyScenario ( {
248
285
openFiles : ( ) => [ usageTs ] ,
@@ -267,6 +304,9 @@ fnErr();
267
304
syncDiagnostics ( usageDiagnostics ( ) , usageConfig . path ) ,
268
305
syncDiagnostics ( emptyDiagnostics ( dependencyTs ) , usageConfig . path ) ,
269
306
] ,
307
+ expectedConfigFileDiagEvents : ( ) => [
308
+ usageConfigDiag ( )
309
+ ] ,
270
310
} ) ;
271
311
} ) ;
272
312
@@ -290,6 +330,10 @@ fnErr();
290
330
syncDiagnostics ( emptyDiagnostics ( dependencyTs ) , usageConfig . path ) ,
291
331
syncDiagnostics ( dependencyDiagnostics ( ) , dependencyConfig . path ) ,
292
332
] ,
333
+ expectedConfigFileDiagEvents : ( ) => [
334
+ usageConfigDiag ( ) ,
335
+ dependencyConfigDiag ( )
336
+ ] ,
293
337
} ) ;
294
338
} ) ;
295
339
} ) ;
0 commit comments