This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Internal: `Checker` - return correct arguments for excluded files

Fixes #1816
Closes gh-1817
  • Loading branch information...
markelog authored and hzoo committed Sep 28, 2015
1 parent 4132219 commit f12830a469959f3543c51bfc632fe37292ea6d09
Showing with 34 additions and 2 deletions.
  1. +5 −1 lib/checker.js
  2. +29 −1 test/specs/checker.js
View
@@ -183,7 +183,11 @@ Checker.prototype._processPath = function(path, fileHandler) {
}
return fileHandler(path).then(function(errors) {
return [errors];
if (errors) {
return [errors];
}
return [];
});
}, this);
}, this);
View
@@ -1,7 +1,9 @@
var fs = require('fs');
var assert = require('assert');
var sinon = require('sinon');
var Checker = require('../../lib/checker');
var fs = require('fs');
describe('checker', function() {
var checker;
@@ -34,6 +36,19 @@ describe('checker', function() {
assert(errors.length === 3);
});
});
it('should return empty array for excluded dir', function() {
checker = new Checker();
checker.registerDefaultRules();
checker.configure({
disallowKeywords: ['with'],
excludeFiles: ['./test/**']
});
return checker.checkDirectory('./test/data/checker').then(function(errors) {
assert(Array.isArray(errors));
assert.equal(errors.length, 0);
});
});
});
describe('checkPath', function() {
@@ -72,6 +87,19 @@ describe('checker', function() {
assert(true);
});
});
it('should return empty array for excluded files', function() {
checker = new Checker();
checker.registerDefaultRules();
checker.configure({
disallowKeywords: ['with'],
excludeFiles: ['./test/**']
});
return checker.checkPath('./test/data/checker/file.js').then(function(errors) {
assert(Array.isArray(errors));
assert.equal(errors.length, 0);
});
});
});
describe('checkStdin', function() {

0 comments on commit f12830a

Please sign in to comment.