Skip to content

Commit e92c46a

Browse files
alan-agius4vikerman
authored andcommitted
refactor(@schematics/angular): remove deprecated spec and styleext options
BREAKING CHANGE: Deprecated `styleext` and `spec` options have been removed. Use `style` and `skipTests` options instead.
1 parent 613f7db commit e92c46a

File tree

15 files changed

+3
-118
lines changed

15 files changed

+3
-118
lines changed

packages/angular/cli/lib/config/schema.json

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,6 @@
134134
"description": "Flag to skip the module import.",
135135
"default": false
136136
},
137-
"spec": {
138-
"type": "boolean",
139-
"description": "Specifies if a spec file is generated.",
140-
"default": true
141-
},
142-
"styleext": {
143-
"description": "The file extension to be used for style files.",
144-
"type": "string",
145-
"default": "css"
146-
},
147137
"style": {
148138
"description": "The file extension or preprocessor to use for style files.",
149139
"type": "string",
@@ -199,11 +189,6 @@
199189
"description": "Flag to skip the module import.",
200190
"default": false
201191
},
202-
"spec": {
203-
"type": "boolean",
204-
"description": "Specifies if a spec file is generated.",
205-
"default": true
206-
},
207192
"skipTests": {
208193
"type": "boolean",
209194
"description": "When true, does not create test files.",
@@ -251,11 +236,6 @@
251236
"default": true,
252237
"description": "Flag to indicate if a directory is created."
253238
},
254-
"spec": {
255-
"type": "boolean",
256-
"description": "Specifies if a spec file is generated.",
257-
"default": true
258-
},
259239
"skipTests": {
260240
"type": "boolean",
261241
"description": "When true, does not create test files.",
@@ -271,11 +251,6 @@
271251
"default": true,
272252
"description": "Flag to indicate if a directory is created."
273253
},
274-
"spec": {
275-
"type": "boolean",
276-
"description": "Specifies if a spec file is generated.",
277-
"default": true
278-
},
279254
"skipTests": {
280255
"type": "boolean",
281256
"description": "When true, does not create test files.",
@@ -302,11 +277,6 @@
302277
"@schematics/angular:class": {
303278
"type": "object",
304279
"properties": {
305-
"spec": {
306-
"type": "boolean",
307-
"description": "Specifies if a spec file is generated.",
308-
"default": true
309-
},
310280
"skipTests": {
311281
"type": "boolean",
312282
"description": "When true, does not create test files.",

packages/schematics/angular/class/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ export default function (options: ClassOptions): Rule {
3535
options.name = parsedPath.name;
3636
options.path = parsedPath.path;
3737

38-
// todo remove these when we remove the deprecations
39-
options.skipTests = options.skipTests || !options.spec;
40-
4138
const templateSource = apply(url('./files'), [
4239
options.skipTests ? filter(path => !path.endsWith('.spec.ts.template')) : noop(),
4340
applyTemplates({

packages/schematics/angular/class/index_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('Class Schematic', () => {
1919
const defaultOptions: ClassOptions = {
2020
name: 'foo',
2121
type: '',
22-
spec: false,
22+
skipTests: true,
2323
project: 'bar',
2424
};
2525

@@ -55,7 +55,7 @@ describe('Class Schematic', () => {
5555
it('should create the class and spec file', async () => {
5656
const options = {
5757
...defaultOptions,
58-
spec: true,
58+
skipTests: false,
5959
};
6060
const tree = await schematicRunner.runSchematicAsync('class', options, appTree)
6161
.toPromise();

packages/schematics/angular/class/schema.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@
2727
"$source": "projectName"
2828
}
2929
},
30-
"spec": {
31-
"type": "boolean",
32-
"description": "When true (the default), generates a \"spec.ts\" test file for the new class.",
33-
"default": true,
34-
"x-deprecated": "Use \"skipTests\" instead."
35-
},
3630
"skipTests": {
3731
"type": "boolean",
3832
"description": "When true, does not create \"spec.ts\" test files for the new class.",

packages/schematics/angular/component/index.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,6 @@ export default function (options: ComponentOptions): Rule {
143143
options.path = parsedPath.path;
144144
options.selector = options.selector || buildSelector(options, project && project.prefix || '');
145145

146-
// todo remove these when we remove the deprecations
147-
options.style = (
148-
options.style && options.style !== Style.Css
149-
? options.style : options.styleext as Style
150-
) || Style.Css;
151-
options.skipTests = options.skipTests || !options.spec;
152-
153146
validateName(options.name);
154147
validateHtmlSelector(options.selector);
155148

packages/schematics/angular/component/index_spec.ts

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -333,33 +333,4 @@ describe('Component Schematic', () => {
333333
.toPromise();
334334
expect(appTree.files).toContain('/projects/bar/custom/app/foo/foo.component.ts');
335335
});
336-
337-
// testing deprecating options don't cause conflicts
338-
it('should respect the deprecated styleext (scss) option', async () => {
339-
const options = { ...defaultOptions, style: undefined, styleext: 'scss' };
340-
const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
341-
const files = tree.files;
342-
expect(files).toContain('/projects/bar/src/app/foo/foo.component.scss');
343-
});
344-
345-
it('should respect the deprecated styleext (css) option', async () => {
346-
const options = { ...defaultOptions, style: undefined, styleext: 'css' };
347-
const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
348-
const files = tree.files;
349-
expect(files).toContain('/projects/bar/src/app/foo/foo.component.css');
350-
});
351-
352-
it('should respect the deprecated spec option when false', async () => {
353-
const options = { ...defaultOptions, skipTests: undefined, spec: false };
354-
const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
355-
const files = tree.files;
356-
expect(files).not.toContain('/projects/bar/src/app/foo/foo.component.spec.ts');
357-
});
358-
359-
it('should respect the deprecated spec option when true', async () => {
360-
const options = { ...defaultOptions, skipTests: false, spec: true };
361-
const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
362-
const files = tree.files;
363-
expect(files).toContain('/projects/bar/src/app/foo/foo.component.spec.ts');
364-
});
365336
});

packages/schematics/angular/component/schema.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@
6969
}
7070
]
7171
},
72-
"styleext": {
73-
"description": "The file extension to use for style files.",
74-
"type": "string",
75-
"default": "css",
76-
"x-deprecated": "Use \"style\" instead."
77-
},
7872
"style": {
7973
"description": "The file extension or preprocessor to use for style files.",
8074
"type": "string",
@@ -93,12 +87,6 @@
9387
"description": "Adds a developer-defined type to the filename, in the format \"name.type.ts\".",
9488
"default": "Component"
9589
},
96-
"spec": {
97-
"type": "boolean",
98-
"description": "When true (the default), generates a \"spec.ts\" test file for the new component.",
99-
"default": true,
100-
"x-deprecated": "Use \"skipTests\" instead."
101-
},
10290
"skipTests": {
10391
"type": "boolean",
10492
"description": "When true, does not create \"spec.ts\" test files for the new component.",

packages/schematics/angular/directive/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,6 @@ export default function (options: DirectiveOptions): Rule {
121121

122122
validateHtmlSelector(options.selector);
123123

124-
// todo remove these when we remove the deprecations
125-
options.skipTests = options.skipTests || !options.spec;
126-
127124
const templateSource = apply(url('./files'), [
128125
options.skipTests ? filter(path => !path.endsWith('.spec.ts.template')) : noop(),
129126
applyTemplates({

packages/schematics/angular/directive/schema.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@
4141
}
4242
]
4343
},
44-
"spec": {
45-
"type": "boolean",
46-
"description": "When true (the default), generates a \"spec.ts\" test file for the new directive.",
47-
"default": true,
48-
"x-deprecated": "Use \"skipTests\" instead."
49-
},
5044
"skipTests": {
5145
"type": "boolean",
5246
"description": "When true, does not create \"spec.ts\" test files for the new class.",

packages/schematics/angular/pipe/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@ export default function (options: PipeOptions): Rule {
9696
options.name = parsedPath.name;
9797
options.path = parsedPath.path;
9898

99-
// todo remove these when we remove the deprecations
100-
options.skipTests = options.skipTests || !options.spec;
101-
10299
const templateSource = apply(url('./files'), [
103100
options.skipTests ? filter(path => !path.endsWith('.spec.ts.template')) : noop(),
104101
applyTemplates({

packages/schematics/angular/pipe/index_spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ describe('Pipe Schematic', () => {
1919
);
2020
const defaultOptions: PipeOptions = {
2121
name: 'foo',
22-
spec: true,
2322
module: undefined,
2423
export: false,
2524
flat: true,

packages/schematics/angular/pipe/schema.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@
3232
"default": true,
3333
"description": "When true (the default) creates files at the top level of the project."
3434
},
35-
"spec": {
36-
"type": "boolean",
37-
"default": true,
38-
"description": "When true (the default), generates a \"spec.ts\" test file for the new pipe.",
39-
"x-deprecated": "Use \"skipTests\" instead."
40-
},
4135
"skipTests": {
4236
"type": "boolean",
4337
"description": "When true, does not create \"spec.ts\" test files for the new pipe.",

packages/schematics/angular/service/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ export default function (options: ServiceOptions): Rule {
3333
options.name = parsedPath.name;
3434
options.path = parsedPath.path;
3535

36-
// todo remove these when we remove the deprecations
37-
options.skipTests = options.skipTests || !options.spec;
38-
3936
const templateSource = apply(url('./files'), [
4037
options.skipTests ? filter(path => !path.endsWith('.spec.ts.template')) : noop(),
4138
applyTemplates({

packages/schematics/angular/service/schema.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@
3232
"default": true,
3333
"description": "When true (the default), creates files at the top level of the project."
3434
},
35-
"spec": {
36-
"type": "boolean",
37-
"default": true,
38-
"description": "When true (the default), generates a \"spec.ts\" test file for the new service.",
39-
"x-deprecated": "Use \"skipTests\" instead."
40-
},
4135
"skipTests": {
4236
"type": "boolean",
4337
"description": "When true, does not create \"spec.ts\" test files for the new service.",

tests/legacy-cli/e2e/tests/commands/new/new-style.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {expectFileToExist} from '../../../utils/fs';
55

66
export default function() {
77
return Promise.resolve()
8-
.then(() => ng('config', 'defaults.styleExt', 'scss', '--global'))
8+
.then(() => ng('config', 'defaults.style', 'scss', '--global'))
99
.then(() => createProject('style-project'))
1010
.then(() => expectFileToExist('src/app/app.component.scss'))
1111

0 commit comments

Comments
 (0)