-
-
Notifications
You must be signed in to change notification settings - Fork 482
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly exclude files from /-ending patterns
When the cwd was set, it'd change the absolute path to always be slash-free, so filtering based on `/` at the end of a pattern wasn't working. Fix #158
- Loading branch information
Showing
4 changed files
with
53 additions
and
11 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// regression test to make sure that slash-ended patterns | ||
// don't match files when using a different cwd. | ||
var glob = require('../') | ||
var test = require('tap').test | ||
var pattern = '../{*.md,test}/' | ||
var expect = [ '../test/' ] | ||
var cwd = __dirname | ||
var opt = { cwd: cwd } | ||
process.chdir(__dirname + '/..') | ||
|
||
test('slashes only match directories', function (t) { | ||
var sync = glob.sync(pattern, { cwd: cwd }) | ||
t.same(sync, expect, 'sync test') | ||
glob(pattern, { cwd: cwd }, function (er, async) { | ||
if (er) | ||
throw er | ||
t.same(async, expect, 'async test') | ||
t.end() | ||
}) | ||
}) |