@@ -230,6 +230,26 @@ describe('program', () => {
230
230
) ;
231
231
} ) ;
232
232
233
+ it ( 'should display the errors that could be ignored' , ( ) => {
234
+ looselyTypeCheckedFiles = [ 'a' , 'b' ] ;
235
+ ignoredErrorCodes = [ 'TS1234' ] ;
236
+ const result = program ( cliDependencies , [
237
+ createErrorLine ( 'a' , 'TS1234' ) ,
238
+ createErrorLine ( 'a' , 'TS1597' ) ,
239
+ createErrorLine ( 'c' , 'TS1111' ) ,
240
+ createErrorLine ( 'c' , 'TS1234' ) ,
241
+ createErrorLine ( 'd' , 'TS1234' ) ,
242
+ ] ) ;
243
+
244
+ expect ( result ?. error ) . toBe ( true ) ;
245
+ expect ( cliDependencies . log ) . toHaveBeenCalledWith (
246
+ createErrorLine ( 'c' , 'TS1234' ) ,
247
+ ) ;
248
+ expect ( cliDependencies . log ) . toHaveBeenCalledWith (
249
+ createErrorLine ( 'd' , 'TS1234' ) ,
250
+ ) ;
251
+ } ) ;
252
+
233
253
it ( 'should report the number of files that no longer have to be ignored' , ( ) => {
234
254
looselyTypeCheckedFiles = [ 'a' , 'b' ] ;
235
255
ignoredErrorCodes = [ 'TS1234' ] ;
@@ -266,6 +286,25 @@ describe('program', () => {
266
286
) ;
267
287
} ) ;
268
288
289
+ it ( 'should display valid TSC errors' , ( ) => {
290
+ looselyTypeCheckedFiles = [ 'a' , 'b' ] ;
291
+ ignoredErrorCodes = [ 'TS1234' ] ;
292
+ const result = program ( cliDependencies , [
293
+ createErrorLine ( 'a' , 'TS1234' ) ,
294
+ createErrorLine ( 'a' , 'TS1597' ) ,
295
+ createErrorLine ( 'c' , 'TS1111' ) ,
296
+ createErrorLine ( 'c' , 'TS1234' ) ,
297
+ ] ) ;
298
+
299
+ expect ( result ?. error ) . toBe ( true ) ;
300
+ expect ( cliDependencies . log ) . toHaveBeenCalledWith (
301
+ createErrorLine ( 'a' , 'TS1597' ) ,
302
+ ) ;
303
+ expect ( cliDependencies . log ) . toHaveBeenCalledWith (
304
+ createErrorLine ( 'c' , 'TS1111' ) ,
305
+ ) ;
306
+ } ) ;
307
+
269
308
it ( 'should report the number of ignored errors that did not occur' , ( ) => {
270
309
looselyTypeCheckedFiles = [ 'a' ] ;
271
310
ignoredErrorCodes = [ 'TS1111' , 'TS2222' , 'TS3333' ] ;
0 commit comments