forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.ts
53 lines (46 loc) · 1.57 KB
/
test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const TestCommand = require('../ember-cli/lib/commands/test');
import TestTask from '../tasks/test';
import {CliConfig} from '../models/config';
export interface TestOptions {
watch?: boolean;
codeCoverage?: boolean;
lint?: boolean;
singleRun?: boolean;
browsers?: string;
colors?: boolean;
log?: string;
port?: number;
reporters?: string;
build?: boolean;
sourcemap?: boolean;
}
const NgCliTestCommand = TestCommand.extend({
availableOptions: [
{ name: 'watch', type: Boolean, default: true, aliases: ['w'] },
{ name: 'code-coverage', type: Boolean, default: false, aliases: ['cc'] },
{ name: 'lint', type: Boolean, default: false, aliases: ['l'] },
{ name: 'single-run', type: Boolean, default: false, aliases: ['sr'] },
{ name: 'browsers', type: String },
{ name: 'colors', type: Boolean },
{ name: 'log-level', type: String },
{ name: 'port', type: Number },
{ name: 'reporters', type: String },
{ name: 'build', type: Boolean, default: true },
{ name: 'sourcemap', type: Boolean, default: true, aliases: ['sm'] }
],
run: function(commandOptions: TestOptions) {
this.project.ngConfig = this.project.ngConfig || CliConfig.fromProject();
const testTask = new TestTask({
ui: this.ui,
analytics: this.analytics,
project: this.project
});
if (!commandOptions.watch) {
// if not watching ensure karma is doing a single run
commandOptions.singleRun = true;
}
return testTask.run(commandOptions);
}
});
NgCliTestCommand.overrideCore = true;
export default NgCliTestCommand;