diff --git a/addon/ng2/blueprints/component/index.js b/addon/ng2/blueprints/component/index.js index 7f8758026328..51c1b030fc1e 100644 --- a/addon/ng2/blueprints/component/index.js +++ b/addon/ng2/blueprints/component/index.js @@ -14,7 +14,8 @@ module.exports = { { name: 'route', type: Boolean, default: false }, { name: 'inline-template', type: Boolean, default: false, aliases: ['it'] }, { name: 'inline-style', type: Boolean, default: false, aliases: ['is'] }, - { name: 'prefix', type: Boolean, default: true } + { name: 'prefix', type: Boolean, default: true }, + { name: 'nospec', type: Boolean, default: false } ], normalizeEntityName: function (entityName) { @@ -49,6 +50,7 @@ module.exports = { return { dynamicPath: this.dynamicPath.dir.replace(this.dynamicPath.appRoot, ''), flat: options.flat, + nospec: options.nospec, inlineTemplate: options.inlineTemplate, inlineStyle: options.inlineStyle, route: options.route, @@ -74,6 +76,9 @@ module.exports = { if (this.options && this.options.inlineStyle) { fileList = fileList.filter(p => p.indexOf('.__styleext__') < 0); } + if (this.options && this.options.nospec) { + fileList = fileList.filter(p => p.indexOf('__name__.component.spec.ts') < 0); + } return fileList; }, diff --git a/tests/acceptance/generate-component.spec.js b/tests/acceptance/generate-component.spec.js index f25005165cbe..3c8ccc87eac1 100644 --- a/tests/acceptance/generate-component.spec.js +++ b/tests/acceptance/generate-component.spec.js @@ -178,4 +178,11 @@ describe('Acceptance: ng generate component', function () { expect(existsSync(testPath)).to.equal(false); }); }); + + it('ng generate component my-comp --nospec', function() { + return ng(['generate', 'component', 'my-comp', '--nospec']).then(() => { + var testPath = path.join(root, 'tmp', 'foo', 'src', 'app', 'my-comp', 'my-comp.component.spec.ts'); + expect(existsSync(testPath)).to.equal(false); + }); + }) });