diff --git a/script-base.js b/script-base.js index de4ff1c3f..8ed8abe3b 100644 --- a/script-base.js +++ b/script-base.js @@ -75,6 +75,13 @@ var Generator = module.exports = function Generator() { this.scriptSuffix = '.ts'; } + // add the option to generate javascript files even if we already have coffeescript or typescript or both. + this.env.options.javascript = this.options.javascript; + if (this.env.options.javascript) { + sourceRoot = '/templates/javascript'; + this.scriptSuffix = '.js'; + } + this.sourceRoot(path.join(__dirname, sourceRoot)); }; diff --git a/test/app.js b/test/app.js index 1c2e32f8a..540b20a68 100644 --- a/test/app.js +++ b/test/app.js @@ -80,6 +80,22 @@ describe('angular:app', function () { }); }); + describe('--javascript', function () { + beforeEach(function (done) { + this.angular.withOptions({ + javascript: true + }).on('end', done); + }); + + it('generates JavaScript files', function () { + assert.file([].concat(getDefaultFilesForAppPath('app'), [ + 'app/scripts/app.js', + 'app/scripts/controllers/main.js', + 'test/spec/controllers/main.js' + ])); + }); + }); + describe('--typescript', function () { beforeEach(function (done) { this.angular.withOptions({