Skip to content

Commit fdea2df

Browse files
sumitarorahansl
authored andcommitted
feat(@angular/cli): adding skip e2e test option
1 parent 3141673 commit fdea2df

5 files changed

Lines changed: 31 additions & 4 deletions

File tree

docs/documentation/new.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@ Default applications are created in a directory of the same name, with an initia
108108
</p>
109109
</details>
110110

111+
<details>
112+
<summary>skip-e2e</summary>
113+
<p>
114+
`--skip-e2e` (alias: `-se`) _default value: false_
115+
</p>
116+
<p>
117+
Skip creating e2e spec files.
118+
</p>
119+
</details>
120+
111121
<details>
112122
<summary>source-dir</summary>
113123
<p>

packages/@angular/cli/blueprints/ng/files/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
"karma-cli": "~1.0.1",
3838
"karma-jasmine": "~1.1.0",
3939
"karma-jasmine-html-reporter": "^0.2.2",
40-
"karma-coverage-istanbul-reporter": "^0.2.0",
40+
"karma-coverage-istanbul-reporter": "^0.2.0",<% if(e2e) { %>
4141
"protractor": "~5.1.0",
42-
"ts-node": "~2.0.0",
42+
"ts-node": "~2.0.0",<% } %>
4343
"tslint": "~4.5.0",
4444
"typescript": "~2.2.0"
4545
}

packages/@angular/cli/blueprints/ng/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default Blueprint.extend({
3535
// set this.tests to opposite of skipTest options,
3636
// meaning if tests are being skipped then the default.spec.BLUEPRINT will be false
3737
this.tests = options.skipTests ? false : true;
38+
this.e2e = options.skipE2e ? false : true;
3839

3940
// Split/join with / not path.sep as reference to typings require forward slashes.
4041
const relativeRootPath = options.sourceDir.split('/').map(() => '..').join('/');
@@ -54,7 +55,8 @@ export default Blueprint.extend({
5455
routing: options.routing,
5556
inlineStyle: options.inlineStyle,
5657
inlineTemplate: options.inlineTemplate,
57-
tests: this.tests
58+
tests: this.tests,
59+
e2e: this.e2e,
5860
};
5961
},
6062

@@ -78,6 +80,13 @@ export default Blueprint.extend({
7880
fileList = fileList.filter(p => p.indexOf('app.component.spec.ts') < 0);
7981
}
8082

83+
if (this.options && this.options.skipE2e) {
84+
fileList = fileList
85+
.filter(p => p.indexOf('protractor.conf.js') < 0)
86+
.filter(p => p.indexOf('app.po.ts') < 0)
87+
.filter(p => p.indexOf('app.e2e-spec.ts') < 0);
88+
}
89+
8190
const cliConfig = CliConfig.fromProject();
8291
const ngConfig = cliConfig && cliConfig.config;
8392
if (!ngConfig || ngConfig.packageManager != 'yarn') {

packages/@angular/cli/commands/new.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ const NewCommand = Command.extend({
6262
aliases: ['st'],
6363
description: 'Skip creating spec files.'
6464
},
65+
{
66+
name: 'skip-e2e',
67+
type: Boolean,
68+
default: false,
69+
aliases: ['s2'],
70+
description: 'Skip creating e2e files.'
71+
},
6572
{
6673
name: 'skip-commit',
6774
type: Boolean,

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ export default Task.extend({
7878
inlineTemplate: commandOptions.inlineTemplate,
7979
ignoredUpdateFiles: ['favicon.ico'],
8080
skipGit: commandOptions.skipGit,
81-
skipTests: commandOptions.skipTests
81+
skipTests: commandOptions.skipTests,
82+
skipE2e: commandOptions.skipE2e
8283
};
8384

8485
validateProjectName(packageName);

0 commit comments

Comments
 (0)