File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,12 +10,16 @@ namespace ts {
1010 expectedDiagnosticTexts ?: string [ ] ;
1111 }
1212
13- function checkDiagnostics ( diagnostics : Diagnostic [ ] , expectedDiagnosticCodes : number [ ] = [ ] , expectedDiagnosticTexts : string [ ] = [ ] ) {
13+ function checkDiagnostics ( diagnostics : Diagnostic [ ] , expectedDiagnosticCodes : number [ ] = [ ] , expectedDiagnosticTexts ? : string [ ] ) {
1414 const n = expectedDiagnosticCodes . length ;
15- assert . equal ( n , expectedDiagnosticTexts . length ) ;
15+ if ( expectedDiagnosticTexts ) {
16+ assert . equal ( n , expectedDiagnosticTexts . length ) ;
17+ }
1618 for ( let i = 0 ; i < n ; i ++ ) {
1719 assert . equal ( expectedDiagnosticCodes [ i ] , diagnostics [ i ] && diagnostics [ i ] . code , `Could not find expected diagnostic.` ) ;
18- assert . equal ( expectedDiagnosticTexts [ i ] , diagnostics [ i ] && diagnostics [ i ] . messageText ) ;
20+ if ( expectedDiagnosticTexts ) {
21+ assert . equal ( expectedDiagnosticTexts [ i ] , diagnostics [ i ] && diagnostics [ i ] . messageText ) ;
22+ }
1923 }
2024 assert . equal ( diagnostics . length , n , "Resuting diagnostics count does not match expected" ) ;
2125 }
You can’t perform that action at this time.
0 commit comments