Skip to content

Commit f46a883

Browse files
alan-agius4clydin
authored andcommitted
refactor(@angular/cli): remove extra await
An async function always wraps the return value in a Promise. Using return await just adds extra time before the overreaching promise is resolved without changing the semantics.
1 parent 5c1cafe commit f46a883

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

packages/angular/cli/commands/e2e.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default class E2eCommand extends ArchitectCommand {
2222
this.configurationOption,
2323
];
2424

25-
public run(options: ArchitectCommandOptions) {
25+
public async run(options: ArchitectCommandOptions) {
2626
return this.runArchitectTarget(options);
2727
}
2828
}

packages/angular/cli/models/architect-command.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ export abstract class ArchitectCommand extends Command<ArchitectCommandOptions>
177177
return await from(this.getProjectNamesByTarget(this.target)).pipe(
178178
concatMap(project => runSingleTarget({ ...targetSpec, project })),
179179
toArray(),
180-
).toPromise().then(results => results.every(res => res === 0) ? 0 : 1);
180+
map(results => results.every(res => res === 0) ? 0 : 1),
181+
)
182+
.toPromise();
181183
} else {
182184
return await runSingleTarget(targetSpec).toPromise();
183185
}

packages/angular/cli/models/command-runner.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export async function runCommand(commandMap: CommandMap,
169169
return 1;
170170
}
171171

172-
return await command.run(options);
172+
return command.run(options);
173173
}
174174
}
175175

0 commit comments

Comments
 (0)