(diags: ReadonlyArray<ts.Diagnostic> | undefined)
| 306 | } |
| 307 | |
| 308 | export function exitCodeFromResult(diags: ReadonlyArray<ts.Diagnostic> | undefined): number { |
| 309 | if (!diags) return 0; |
| 310 | if (diags.every((diag) => diag.category !== ts.DiagnosticCategory.Error)) { |
| 311 | // If we have a result and didn't get any errors, we succeeded. |
| 312 | return 0; |
| 313 | } |
| 314 | |
| 315 | // Return 2 if any of the errors were unknown. |
| 316 | return diags.some((d) => d.source === 'angular' && d.code === api.UNKNOWN_ERROR_CODE) ? 2 : 1; |
| 317 | } |
| 318 | |
| 319 | export function performCompilation<CbEmitRes extends ts.EmitResult = ts.EmitResult>({ |
| 320 | rootNames, |
no test coverage detected