Skip to content

Commit 0b62566

Browse files
committed
fix(@schematics/angular): remove module test
The `module` schematic was generating a useless `module.spec.ts` file. This commit removes such test. Fixes #11277
1 parent c3cffc3 commit 0b62566

File tree

6 files changed

+0
-34
lines changed

6 files changed

+0
-34
lines changed

Diff for: packages/schematics/angular/application/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ export default function (options: ApplicationOptions): Rule {
324324
routing: options.routing,
325325
routingScope: 'Root',
326326
path: sourceDir,
327-
spec: false,
328327
project: options.name,
329328
}),
330329
schematic('component', {

Diff for: packages/schematics/angular/library/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ export default function (options: LibraryOptions): Rule {
226226
commonModule: false,
227227
flat: true,
228228
path: sourceDir,
229-
spec: false,
230229
project: options.name,
231230
}),
232231
schematic('component', {

Diff for: packages/schematics/angular/module/files/__name@dasherize@if-flat__/__name@dasherize__.module.spec.ts

-13
This file was deleted.

Diff for: packages/schematics/angular/module/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ export default function (options: ModuleOptions): Rule {
8888
options.path = parsedPath.path;
8989

9090
const templateSource = apply(url('./files'), [
91-
options.spec ? noop() : filter(path => !path.endsWith('.spec.ts')),
9291
options.routing ? noop() : filter(path => !path.endsWith('-routing.module.ts')),
9392
template({
9493
...strings,

Diff for: packages/schematics/angular/module/index_spec.ts

-13
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ describe('Module Schematic', () => {
1818
);
1919
const defaultOptions: ModuleOptions = {
2020
name: 'foo',
21-
spec: true,
2221
module: undefined,
2322
flat: false,
2423
project: 'bar',
@@ -50,7 +49,6 @@ describe('Module Schematic', () => {
5049

5150
const tree = schematicRunner.runSchematic('module', options, appTree);
5251
const files = tree.files;
53-
expect(files.indexOf('/projects/bar/src/app/foo/foo.module.spec.ts')).toBeGreaterThanOrEqual(0);
5452
expect(files.indexOf('/projects/bar/src/app/foo/foo.module.ts')).toBeGreaterThanOrEqual(0);
5553
});
5654

@@ -104,24 +102,13 @@ describe('Module Schematic', () => {
104102
expect(routingModuleContent).toMatch(/RouterModule.forChild\(routes\)/);
105103
});
106104

107-
it('should respect the spec flag', () => {
108-
const options = { ...defaultOptions, spec: false };
109-
110-
const tree = schematicRunner.runSchematic('module', options, appTree);
111-
const files = tree.files;
112-
expect(files.indexOf('/projects/bar/src/app/foo/foo.module.ts')).toBeGreaterThanOrEqual(0);
113-
expect(files.indexOf('/projects/bar/src/app/foo/foo.module.spec.ts')).toEqual(-1);
114-
});
115-
116105
it('should dasherize a name', () => {
117106
const options = { ...defaultOptions, name: 'TwoWord' };
118107

119108
const tree = schematicRunner.runSchematic('module', options, appTree);
120109
const files = tree.files;
121110
expect(files.indexOf('/projects/bar/src/app/two-word/two-word.module.ts'))
122111
.toBeGreaterThanOrEqual(0);
123-
expect(files.indexOf('/projects/bar/src/app/two-word/two-word.module.spec.ts'))
124-
.toBeGreaterThanOrEqual(0);
125112
});
126113

127114
it('should respect the sourceRoot value', () => {

Diff for: packages/schematics/angular/module/schema.json

-5
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@
3636
"description": "The scope for the generated routing.",
3737
"default": "Child"
3838
},
39-
"spec": {
40-
"type": "boolean",
41-
"description": "Specifies if a spec file is generated.",
42-
"default": true
43-
},
4439
"flat": {
4540
"type": "boolean",
4641
"description": "Flag to indicate if a dir is created.",

0 commit comments

Comments
 (0)