Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: skip dot files and ignored dirs on traverse (fixes #1077, relate…
…d to #814)
- Loading branch information
Vitaly Puzrin
committed
Jul 12, 2014
1 parent
b8f2a61
commit 5e601fb
Showing
6 changed files
with
112 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
'test.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* @fileoverview Tests for traverse. | ||
*/ | ||
|
||
//------------------------------------------------------------------------------ | ||
// Requirements | ||
//------------------------------------------------------------------------------ | ||
|
||
var assert = require("chai").assert, | ||
path = require("path"), | ||
traverse = require("../../lib/util/traverse"); | ||
|
||
|
||
//------------------------------------------------------------------------------ | ||
// Tests | ||
//------------------------------------------------------------------------------ | ||
|
||
describe("traverse", function() { | ||
|
||
it("should ignore dot files and dirs", function() { | ||
traverse( | ||
{ files: [ path.resolve(__dirname, "..", "fixtures", "traverse") ] }, | ||
function(file) { | ||
assert.notEqual(file.indexOf("."), -1); | ||
} | ||
); | ||
}); | ||
|
||
it("should ignore files by exclude option", function() { | ||
var files = []; | ||
|
||
traverse( | ||
{ | ||
files: [ path.resolve(__dirname, "..", "fixtures", "traverse") ], | ||
exclude: function() { | ||
return true; | ||
} | ||
}, | ||
function(file) { | ||
files.push(file); | ||
} | ||
); | ||
|
||
assert.equal(files.length, 0); | ||
}); | ||
|
||
it("should find normal files", function() { | ||
var files = []; | ||
|
||
traverse( | ||
{ files: [ path.resolve(__dirname, "..", "fixtures", "traverse") ] }, | ||
function(file) { | ||
files.push(file); | ||
} | ||
); | ||
|
||
assert.notEqual(files.length, 0); | ||
}); | ||
|
||
}); |