-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
120 additions
and
23 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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
const origCwd = process.cwd(); | ||
afterAll(() => { | ||
process.chdir(origCwd); // not sure it's needed | ||
process.chdir(origCwd); | ||
}); |
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,29 @@ | ||
const glob = require('../'); | ||
|
||
beforeAll(() => { | ||
process.chdir(__dirname + '/fixtures'); | ||
}); | ||
|
||
|
||
// [cwd, options, expected] | ||
const cases = [ | ||
[ 'a', { pattern:['abcdef/*', 'z'], mark: true}, [ | ||
"abcdef/g/", | ||
"z/", | ||
] | ||
] | ||
]; | ||
|
||
cases.forEach(c => { | ||
const cwd = c[0]; | ||
const options = c[1]; | ||
const expected = c[2].sort(); | ||
test(cwd + ' ' + JSON.stringify(options), done => { | ||
glob(cwd, options, (er, res) => { | ||
expect(er).toBeFalsy(); | ||
res.sort(); | ||
expect(res).toEqual(expected); | ||
done(); | ||
}) | ||
}) | ||
}) |
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,49 @@ | ||
const glob = require('../'); | ||
|
||
beforeAll(() => { | ||
process.chdir(__dirname + '/fixtures'); | ||
}); | ||
|
||
|
||
// [cwd, options, expected] | ||
const cases = [ | ||
[ 'a', { pattern:'**/*', mark: true, skip: ['*/g', 'cb'] }, [ | ||
"abcdef/", | ||
"abcfed/", | ||
"b/", | ||
"b/c/", | ||
"b/c/d", | ||
"bc/", | ||
"bc/e/", | ||
"bc/e/f", | ||
"c/", | ||
"c/d/", | ||
"c/d/c/", | ||
"c/d/c/b", | ||
"symlink/", | ||
"symlink/a/", | ||
"symlink/a/b/", | ||
"symlink/a/b/c", | ||
"x/", | ||
"z/", | ||
] | ||
], | ||
[ 'a/c', { mark: true, skip: '**/c' }, [ | ||
'd/', | ||
] | ||
] | ||
]; | ||
|
||
cases.forEach(c => { | ||
const cwd = c[0]; | ||
const options = c[1]; | ||
const expected = c[2].sort(); | ||
test(cwd + ' ' + JSON.stringify(options), done => { | ||
glob(cwd, options, (er, res) => { | ||
expect(er).toBeFalsy(); | ||
res.sort(); | ||
expect(res).toEqual(expected); | ||
done(); | ||
}) | ||
}) | ||
}) |