Skip to content

Commit b5252ed

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 ffb01c5 commit b5252ed

File tree

5 files changed

+0
-36
lines changed

5 files changed

+0
-36
lines changed

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
@@ -90,7 +90,6 @@ export default function (options: ModuleOptions): Rule {
9090
options.path = parsedPath.path;
9191

9292
const templateSource = apply(url('./files'), [
93-
options.spec ? noop() : filter(path => !path.endsWith('.spec.ts')),
9493
options.routing ? noop() : filter(path => !path.endsWith('-routing.module.ts')),
9594
template({
9695
...strings,

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

-13
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ describe('Module Schematic', () => {
1919
);
2020
const defaultOptions: ModuleOptions = {
2121
name: 'foo',
22-
spec: true,
2322
module: undefined,
2423
flat: false,
2524
project: 'bar',
@@ -51,7 +50,6 @@ describe('Module Schematic', () => {
5150

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

@@ -96,24 +94,13 @@ describe('Module Schematic', () => {
9694
expect(routingModuleContent).toMatch(/RouterModule.forChild\(routes\)/);
9795
});
9896

99-
it('should respect the spec flag', () => {
100-
const options = { ...defaultOptions, spec: false };
101-
102-
const tree = schematicRunner.runSchematic('module', options, appTree);
103-
const files = tree.files;
104-
expect(files.indexOf('/projects/bar/src/app/foo/foo.module.ts')).toBeGreaterThanOrEqual(0);
105-
expect(files.indexOf('/projects/bar/src/app/foo/foo.module.spec.ts')).toEqual(-1);
106-
});
107-
10897
it('should dasherize a name', () => {
10998
const options = { ...defaultOptions, name: 'TwoWord' };
11099

111100
const tree = schematicRunner.runSchematic('module', options, appTree);
112101
const files = tree.files;
113102
expect(files.indexOf('/projects/bar/src/app/two-word/two-word.module.ts'))
114103
.toBeGreaterThanOrEqual(0);
115-
expect(files.indexOf('/projects/bar/src/app/two-word/two-word.module.spec.ts'))
116-
.toBeGreaterThanOrEqual(0);
117104
});
118105

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

Diff for: packages/schematics/angular/module/schema.d.ts

-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ export interface Schema {
2727
* The scope for the generated routing.
2828
*/
2929
routingScope?: ('Child' | 'Root');
30-
/**
31-
* Specifies if a spec file is generated.
32-
*/
33-
spec?: boolean;
3430
/**
3531
* Flag to indicate if a dir is created.
3632
*/

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)