From 341f4ec95496ffad8043ec3fd35e9e1ea5bd03f3 Mon Sep 17 00:00:00 2001 From: Ruslan Grabovoy Date: Sun, 18 Sep 2016 14:33:04 +0300 Subject: [PATCH] Add test for exlusion of foreign jshintrc from search --- .../blueprints/ember-cli-eslint-test.js | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) 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'];