Skip to content

Commit 3f6c1b5

Browse files
Alanalexeagle
Alan
authored andcommitted
fix(@schematics/angular): minimal should not add test target
At the moment when using minimal flag, test targets are being created even though they cannot be used as test setup files are not created nor are testing dependencies
1 parent a0a583a commit 3f6c1b5

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

packages/schematics/angular/application/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ function addAppToWorkspaceFile(options: ApplicationOptions, workspace: Workspace
289289
browserTarget: `${options.name}:build`,
290290
},
291291
},
292-
test: {
292+
test: options.minimal ? undefined : {
293293
builder: Builders.Karma,
294294
options: {
295295
main: `${sourceRoot}/test.ts`,

packages/schematics/angular/application/index_spec.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,13 @@ describe('Application Schematic', () => {
163163
expect(karmaConf).toContain(`dir: require('path').join(__dirname, '../../coverage/foo')`);
164164
});
165165

166-
it('minimal=true should not create e2e project', () => {
166+
it('minimal=true should not create e2e and test targets', () => {
167167
const options = { ...defaultOptions, minimal: true };
168-
169168
const tree = schematicRunner.runSchematic('application', options, workspaceTree);
170-
const files = tree.files;
171-
expect(files).not.toContain('/projects/foo-e2e');
172-
const confContent = JSON.parse(tree.readContent('/angular.json'));
173-
expect(confContent.projects['foo-e2e']).toBeUndefined();
169+
const config = JSON.parse(tree.readContent('/angular.json'));
170+
const architect = config.projects.foo.architect;
171+
expect(architect.test).not.toBeDefined();
172+
expect(architect.e2e).not.toBeDefined();
174173
});
175174

176175
it('should create correct files when using minimal', () => {

0 commit comments

Comments
 (0)