Skip to content

Commit 0851d2e

Browse files
committed
fix(@angular/build): show full aggregate errors from vitest
Vitest may throw an `AggregateError` which can contain one or more specific errors. The output console logging will now show each of these specific errors in addition to the main thrown error. (cherry picked from commit d556c60)
1 parent c4fd220 commit 0851d2e

File tree

1 file changed

+7
-0
lines changed
  • packages/angular/build/src/builders/unit-test

1 file changed

+7
-0
lines changed

packages/angular/build/src/builders/unit-test/builder.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ async function* runBuildAndTest(
146146
} catch (e) {
147147
assertIsError(e);
148148
context.logger.error(`An exception occurred during test execution:\n${e.stack ?? e.message}`);
149+
if (e instanceof AggregateError) {
150+
e.errors.forEach((inner) => {
151+
assertIsError(inner);
152+
context.logger.error(inner.stack ?? inner.message);
153+
});
154+
}
155+
149156
yield { success: false };
150157
consecutiveErrorCount++;
151158
}

0 commit comments

Comments
 (0)