MCPcopy Create free account
hub / github.com/angular/angular / exitCodeFromResult

Function exitCodeFromResult

packages/compiler-cli/src/perform_compile.ts:308–317  ·  view source on GitHub ↗
(diags: ReadonlyArray<ts.Diagnostic> | undefined)

Source from the content-addressed store, hash-verified

306}
307
308export 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
319export function performCompilation<CbEmitRes extends ts.EmitResult = ts.EmitResult>({
320 rootNames,

Callers 4

doCompilationFunction · 0.90
mainDiagnosticsForTestFunction · 0.90
reportErrorsAndExitFunction · 0.90

Calls 1

someMethod · 0.80

Tested by

no test coverage detected