(program: api.Program)
| 390 | } |
| 391 | } |
| 392 | export function defaultGatherDiagnostics(program: api.Program): ReadonlyArray<ts.Diagnostic> { |
| 393 | const allDiagnostics: Array<ts.Diagnostic> = []; |
| 394 | |
| 395 | function checkDiagnostics(diags: ReadonlyArray<ts.Diagnostic> | undefined) { |
| 396 | if (diags) { |
| 397 | allDiagnostics.push(...diags); |
| 398 | return !hasErrors(diags); |
| 399 | } |
| 400 | return true; |
| 401 | } |
| 402 | |
| 403 | let checkOtherDiagnostics = true; |
| 404 | // Check parameter diagnostics |
| 405 | checkOtherDiagnostics = |
| 406 | checkOtherDiagnostics && |
| 407 | checkDiagnostics([...program.getTsOptionDiagnostics(), ...program.getNgOptionDiagnostics()]); |
| 408 | |
| 409 | // Check syntactic diagnostics |
| 410 | checkOtherDiagnostics = |
| 411 | checkOtherDiagnostics && checkDiagnostics(program.getTsSyntacticDiagnostics()); |
| 412 | |
| 413 | // Check TypeScript semantic and Angular structure diagnostics |
| 414 | checkOtherDiagnostics = |
| 415 | checkOtherDiagnostics && |
| 416 | checkDiagnostics([ |
| 417 | ...program.getTsSemanticDiagnostics(), |
| 418 | ...program.getNgStructuralDiagnostics(), |
| 419 | ]); |
| 420 | |
| 421 | // Check Angular semantic diagnostics |
| 422 | checkOtherDiagnostics = |
| 423 | checkOtherDiagnostics && checkDiagnostics(program.getNgSemanticDiagnostics()); |
| 424 | |
| 425 | return allDiagnostics; |
| 426 | } |
| 427 | |
| 428 | function hasErrors(diags: ReadonlyArray<ts.Diagnostic>) { |
| 429 | return diags.some((d) => d.category === ts.DiagnosticCategory.Error); |
no test coverage detected