diff --git a/blueprints/ember-cli-eslint/index.js b/blueprints/ember-cli-eslint/index.js index da290221..feeb6ecd 100644 --- a/blueprints/ember-cli-eslint/index.js +++ b/blueprints/ember-cli-eslint/index.js @@ -123,10 +123,10 @@ module.exports = { var files = walkSync(projectRoot, { globs: ['**/.jshintrc'], ignore: [ - 'bower_components', - 'dist', - 'node_modules', - 'tmp' + '**/bower_components', + '**/dist', + '**/node_modules', + '**/tmp' ] }); diff --git a/node-tests/blueprints/ember-cli-eslint-test.js b/node-tests/blueprints/ember-cli-eslint-test.js index d9e0ba36..37f510ab 100644 --- a/node-tests/blueprints/ember-cli-eslint-test.js +++ b/node-tests/blueprints/ember-cli-eslint-test.js @@ -2,6 +2,8 @@ var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); var setupTestHooks = blueprintHelpers.setupTestHooks; +var fs = require('fs-extra'); +var path = require('path'); var emberNew = blueprintHelpers.emberNew; var emberGenerate = blueprintHelpers.emberGenerate; @@ -69,6 +71,33 @@ describe('Acceptance: install ember-cli-eslint', function() { }); }); + it('Does not touch foreign .jshintrc files', function() { + var args = ['ember-cli-eslint', 'foo']; + var foreignJshintrcPaths = [ + path.join('.', 'bower_components', 'foreign-package', '.jshintrc'), + path.join('.', 'tmp', '.jshintrc'), + path.join('.', 'tests', 'dummy', 'app', 'node_modules', 'foreign-package', '.jshintrc'), + path.join('.', 'tests', 'dummy', 'app', 'dist', '.jshintrc') + ]; + + td.when(prompt(td.matchers.anything())).thenResolve({ deleteFiles: 'all' }); + + return emberNew() + .then(function() { + foreignJshintrcPaths.forEach(function(foreignJshintrcPath) { + fs.ensureFileSync(foreignJshintrcPath); + }); + }) + .then(function() { + return emberGenerate(args); + }) + .then(function() { + foreignJshintrcPaths.forEach(function(foreignJshintrcPath) { + expect(file(foreignJshintrcPath)).to.exist; + }); + }); + }); + it('does not remove any files if it shouldn\'t', function() { var args = ['ember-cli-eslint', 'foo'];