(program: api.Program)
| 326 | } |
| 327 | } |
| 328 | export function defaultGatherDiagnostics(program: api.Program): ReadonlyArray<ts.Diagnostic> { |
| 329 | const allDiagnostics: Array<ts.Diagnostic> = []; |
| 330 | |
| 331 | function checkDiagnostics(diags: ReadonlyArray<ts.Diagnostic> | undefined) { |
| 332 | if (diags) { |
| 333 | allDiagnostics.push(...diags); |
| 334 | return !hasErrors(diags); |
| 335 | } |
| 336 | return true; |
| 337 | } |
| 338 | |
| 339 | let checkOtherDiagnostics = true; |
| 340 | // Check parameter diagnostics |
| 341 | checkOtherDiagnostics = |
| 342 | checkOtherDiagnostics && |
| 343 | checkDiagnostics([...program.getTsOptionDiagnostics(), ...program.getNgOptionDiagnostics()]); |
| 344 | |
| 345 | // Check syntactic diagnostics |
| 346 | checkOtherDiagnostics = |
| 347 | checkOtherDiagnostics && checkDiagnostics(program.getTsSyntacticDiagnostics()); |
| 348 | |
| 349 | // Check TypeScript semantic and Angular structure diagnostics |
| 350 | checkOtherDiagnostics = |
| 351 | checkOtherDiagnostics && |
| 352 | checkDiagnostics([ |
| 353 | ...program.getTsSemanticDiagnostics(), |
| 354 | ...program.getNgStructuralDiagnostics(), |
| 355 | ]); |
| 356 | |
| 357 | // Check Angular semantic diagnostics |
| 358 | checkOtherDiagnostics = |
| 359 | checkOtherDiagnostics && checkDiagnostics(program.getNgSemanticDiagnostics()); |
| 360 | |
| 361 | return allDiagnostics; |
| 362 | } |
| 363 | |
| 364 | function hasErrors(diags: ReadonlyArray<ts.Diagnostic>) { |
| 365 | return diags.some((d) => d.category === ts.DiagnosticCategory.Error); |
no test coverage detected
searching dependent graphs…