Skip to content

Commit

Permalink
Merge pull request #3989 from dominicbarnes/ignored-files-should-not-…
Browse files Browse the repository at this point in the history
…stat

Ignored files should not throw errors during CLI
  • Loading branch information
nzakas committed Oct 2, 2015
2 parents fa830ea + 564051d commit 45863c1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/cli-engine.js
Expand Up @@ -556,9 +556,12 @@ CLIEngine.prototype = {
*/
function executeOnFile(filename) {
var shouldIgnore = ignoredPaths.contains(filename);
filename = fs.realpathSync(filename);
if (shouldIgnore) {
return;
}

if (processed[filename] || shouldIgnore) {
filename = fs.realpathSync(filename);
if (processed[filename]) {
return;
}

Expand Down
21 changes: 21 additions & 0 deletions tests/lib/cli-engine.js
Expand Up @@ -712,6 +712,27 @@ describe("CLIEngine", function() {
assert.equal(report.results[0].messages.length, 0);
});

it("should not fail if an ignored file cannot be resolved", function() {

var fakeFS = leche.fake(fs),
LocalCLIEngine = proxyquire("../../lib/cli-engine", {
fs: fakeFS
});

fakeFS.realpathSync = function() {
throw new Error("this error should not happen");
};

engine = new LocalCLIEngine({
ignorePattern: "tests"
});

assert.doesNotThrow(function() {
engine.executeOnFiles(["tests/fixtures/single-quoted.js"]);
});

});

describe("Fix Mode", function() {

it("should return fixed text on multiple files when in fix mode", function() {
Expand Down

0 comments on commit 45863c1

Please sign in to comment.