Skip to content

Commit

Permalink
Fixed #548 - folder fully excluded if trying to exclude one file.
Browse files Browse the repository at this point in the history
  • Loading branch information
beatfactor committed Jul 15, 2015
1 parent a55de2b commit df3794a
Show file tree
Hide file tree
Showing 2 changed files with 450 additions and 441 deletions.
11 changes: 9 additions & 2 deletions lib/runner/walk.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ function isFolderExcluded(resource, opts) {
if (item.indexOf(resource) === -1) {
return false;
}
return fs.statSync(item).isDirectory();

try {
return fs.statSync(item).isDirectory();
} catch (err) {
return false;
}
});
}
return false;
Expand Down Expand Up @@ -52,7 +57,7 @@ function walk(dir, done, opts) {
var isExcluded = isFolderExcluded(resource, opts); // prevent loading of files from an excluded folder
var isSkipped = opts.skipgroup && opts.skipgroup.indexOf(dirName) > -1;

if (isExcluded && isSkipped) {
if (isExcluded || isSkipped) {
pending = pending-1;
} else {
walk(resource, function(err, res) {
Expand All @@ -78,6 +83,8 @@ function walk(dir, done, opts) {

module.exports = {
readPaths : function (paths, cb, opts) {
Matchers.exclude = [];
Matchers.filter = [];
var extensionPattern = /\.js$/;
if (paths.length === 1 && extensionPattern.test(paths[0])) {
paths[0] = paths[0].replace(extensionPattern, '');
Expand Down
Loading

0 comments on commit df3794a

Please sign in to comment.