mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 10:33:43 +08:00
test(@angular-devkit/build-angular): avoid crashing during test failure in utility function
Previously, if a browser build failed using the `browserBuild` test utility function, the test utility would try to access properties that did not exist and would crash. This increased the complexity to debug failing tests. With the new behavior, the `browserBuild` test utility will return with an empty `files` object and the failed builder result.
This commit is contained in:
parent
2327ddc2f9
commit
8e5b83ba66
@ -81,6 +81,15 @@ export async function browserBuild(
|
||||
const output = (await run.result) as BrowserBuilderOutput;
|
||||
expect(output.success).toBe(true);
|
||||
|
||||
if (!output.success) {
|
||||
await run.stop();
|
||||
|
||||
return {
|
||||
output,
|
||||
files: {},
|
||||
};
|
||||
}
|
||||
|
||||
expect(output.outputPaths[0]).not.toBeUndefined();
|
||||
const outputPath = normalize(output.outputPaths[0]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user