Skip to content

Commit 3f5f43d

Browse files
Broccohansl
authored andcommitted
Update test command to use architect
1 parent fd04936 commit 3f5f43d

File tree

2 files changed

+23
-40
lines changed

2 files changed

+23
-40
lines changed
Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,36 @@
1-
import { Command, CommandScope, Option } from '../models/command';
2-
import TestTask from '../tasks/test';
1+
import { CommandScope, Option } from '../models/command';
2+
import { ArchitectCommand } from '../models/architect-command';
33

4-
5-
export interface TestOptions {
6-
watch?: boolean;
7-
codeCoverage?: boolean;
8-
singleRun?: boolean;
9-
browsers?: string;
10-
colors?: boolean;
11-
log?: string;
12-
port?: number;
13-
reporters?: string;
14-
sourcemaps?: boolean;
15-
progress?: boolean;
16-
config: string;
17-
poll?: number;
18-
environment?: string;
4+
export interface Options {
195
app?: string;
20-
preserveSymlinks?: boolean;
6+
configuration?: string;
7+
prod: boolean;
218
}
229

23-
export default class TestCommand extends Command {
10+
export default class TestCommand extends ArchitectCommand {
2411
public readonly name = 'test';
12+
public readonly target = 'karma';
2513
public readonly description = 'Run unit tests in existing project.';
2614
public static aliases = ['t'];
2715
public readonly scope = CommandScope.inProject;
2816
public readonly arguments: string[] = [];
29-
public readonly options: Option[] = [];
17+
public readonly options: Option[] = [
18+
this.prodOption,
19+
this.configurationOption
20+
];
3021

31-
public async run(options: TestOptions) {
32-
const testTask = new TestTask({
33-
ui: this.ui,
34-
project: this.project
22+
public async run(options: Options) {
23+
let configuration = options.configuration;
24+
if (!configuration && options.prod) {
25+
configuration = 'production';
26+
}
27+
const overrides = {...options};
28+
delete overrides.app;
29+
delete overrides.prod;
30+
return this.runArchitect({
31+
app: options.app,
32+
configuration,
33+
overrides
3534
});
36-
37-
return await testTask.run(options);
3835
}
3936
}

packages/@angular/cli/tasks/test.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)