Skip to content

Commit 65f4c02

Browse files
nlm-proalexeagle
authored andcommitted
fix(@schematics/angular): --minimal should prevent generating e2e (#12742)
* fix(@schematics/angular): --minimal should prevent generating e2e Don't run the e2e schematic when using application or ng-new schematics with option.minimal set to true. fix #12739 * style: inverse logic according to feedback * test(@schematics/angular): app and ng-new --minimal shouldn't generate e2e
1 parent da2554a commit 65f4c02

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

packages/schematics/angular/application/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ export default function (options: ApplicationOptions): Rule {
368368
}),
369369
move(sourceDir),
370370
]), MergeStrategy.Overwrite),
371-
schematic('e2e', e2eOptions),
371+
options.minimal ? noop() : schematic('e2e', e2eOptions),
372372
]);
373373
};
374374
}

packages/schematics/angular/application/index_spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@ describe('Application Schematic', () => {
136136
expect(content.rules['component-selector'][2]).toMatch('app');
137137
});
138138

139+
it('minimal=true should not create e2e project', () => {
140+
const options = { ...defaultOptions, minimal: true };
141+
142+
const tree = schematicRunner.runSchematic('application', options, workspaceTree);
143+
const files = tree.files;
144+
expect(files.indexOf('/projects/foo-e2e')).toEqual(-1);
145+
const confContent = JSON.parse(tree.readContent('/angular.json'));
146+
expect(confContent.projects['foo-e2e']).toBeUndefined();
147+
});
148+
139149
describe(`update package.json`, () => {
140150
it(`should add build-angular to devDependencies`, () => {
141151
const tree = schematicRunner.runSchematic('application', defaultOptions, workspaceTree);

packages/schematics/angular/ng-new/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export default function (options: NgNewOptions): Rule {
5555
style: options.style,
5656
skipTests: options.skipTests,
5757
skipPackageJson: false,
58+
minimal: options.minimal,
5859
};
5960

6061
return chain([

packages/schematics/angular/ng-new/index_spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,14 @@ describe('Ng New Schematic', () => {
6565
expect(files.indexOf('/bar/angular.json')).toBeGreaterThanOrEqual(0);
6666
expect(files.indexOf('/bar/src')).toBe(-1);
6767
});
68+
69+
it('minimal=true should not create e2e project', () => {
70+
const options = { ...defaultOptions, minimal: true };
71+
72+
const tree = schematicRunner.runSchematic('ng-new', options);
73+
const files = tree.files;
74+
expect(files.indexOf('/bar/e2e')).toEqual(-1);
75+
const confContent = JSON.parse(tree.readContent('/bar/angular.json'));
76+
expect(confContent.projects['foo-e2e']).toBeUndefined();
77+
});
6878
});

0 commit comments

Comments
 (0)