@@ -567,7 +567,7 @@ export namespace Compiler {
567
567
diagnostics = ts . sort ( diagnostics , ts . compareDiagnostics ) ;
568
568
let outputLines = "" ;
569
569
// Count up all errors that were found in files other than lib.d.ts so we don't miss any
570
- let totalErrorsReportedInNonLibraryFiles = 0 ;
570
+ let totalErrorsReportedInNonLibraryNonTsconfigFiles = 0 ;
571
571
572
572
let errorsReported = 0 ;
573
573
@@ -609,10 +609,11 @@ export namespace Compiler {
609
609
// do not count errors from lib.d.ts here, they are computed separately as numLibraryDiagnostics
610
610
// if lib.d.ts is explicitly included in input files and there are some errors in it (i.e. because of duplicate identifiers)
611
611
// then they will be added twice thus triggering 'total errors' assertion with condition
612
- // 'totalErrorsReportedInNonLibraryFiles + numLibraryDiagnostics + numTest262HarnessDiagnostics, diagnostics.length
612
+ // Similarly for tsconfig, which may be in the input files and contain errors.
613
+ // 'totalErrorsReportedInNonLibraryNonTsconfigFiles + numLibraryDiagnostics + numTsconfigDiagnostics + numTest262HarnessDiagnostics, diagnostics.length
613
614
614
- if ( ! error . file || ! isDefaultLibraryFile ( error . file . fileName ) ) {
615
- totalErrorsReportedInNonLibraryFiles ++ ;
615
+ if ( ! error . file || ! isDefaultLibraryFile ( error . file . fileName ) && ! vpath . isTsConfigFile ( error . file . fileName ) ) {
616
+ totalErrorsReportedInNonLibraryNonTsconfigFiles ++ ;
616
617
}
617
618
}
618
619
@@ -704,7 +705,7 @@ export namespace Compiler {
704
705
// Case-duplicated files on a case-insensitive build will have errors reported in both the dupe and the original
705
706
// thanks to the canse-insensitive path comparison on the error file path - We only want to count those errors once
706
707
// for the assert below, so we subtract them here.
707
- totalErrorsReportedInNonLibraryFiles -= errorsReported ;
708
+ totalErrorsReportedInNonLibraryNonTsconfigFiles -= errorsReported ;
708
709
}
709
710
outputLines = "" ;
710
711
errorsReported = 0 ;
@@ -714,13 +715,17 @@ export namespace Compiler {
714
715
return ! ! diagnostic . file && ( isDefaultLibraryFile ( diagnostic . file . fileName ) || isBuiltFile ( diagnostic . file . fileName ) ) ;
715
716
} ) ;
716
717
718
+ const numTsconfigDiagnostics = ts . countWhere ( diagnostics , diagnostic => {
719
+ return ! ! diagnostic . file && ( vpath . isTsConfigFile ( diagnostic . file . fileName ) ) ;
720
+ } ) ;
721
+
717
722
const numTest262HarnessDiagnostics = ts . countWhere ( diagnostics , diagnostic => {
718
723
// Count an error generated from tests262-harness folder.This should only apply for test262
719
724
return ! ! diagnostic . file && diagnostic . file . fileName . indexOf ( "test262-harness" ) >= 0 ;
720
725
} ) ;
721
726
722
727
// Verify we didn't miss any errors in total
723
- assert . equal ( totalErrorsReportedInNonLibraryFiles + numLibraryDiagnostics + numTest262HarnessDiagnostics , diagnostics . length , "total number of errors" ) ;
728
+ assert . equal ( totalErrorsReportedInNonLibraryNonTsconfigFiles + numLibraryDiagnostics + numTsconfigDiagnostics + numTest262HarnessDiagnostics , diagnostics . length , "total number of errors" ) ;
724
729
}
725
730
726
731
export function doErrorBaseline ( baselinePath : string , inputFiles : readonly TestFile [ ] , errors : readonly ts . Diagnostic [ ] , pretty ?: boolean ) {
0 commit comments