-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: trim ignore rules before matching (#28)
Looks like the latest minimatch doesn't do this anymore.
- Loading branch information
Showing
2 changed files
with
37 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict' | ||
const walk = require('..') | ||
const { resolve } = require('path') | ||
const path = resolve(__dirname, 'fixtures') | ||
|
||
// set the ignores just for this test | ||
const c = require('./common.js') | ||
c.ignores({ | ||
'd/.ignore-spaces': [' h'], | ||
}) | ||
|
||
// the files that we expect to not see | ||
const notAllowed = [ | ||
/^d\/h\/.*/, | ||
] | ||
|
||
const t = require('tap') | ||
|
||
t.test('async', t => walk({ | ||
path, | ||
ignoreFiles: ['.ignore-spaces'], | ||
}, (er, result) => { | ||
result.forEach(r => notAllowed.forEach(na => | ||
t.notMatch(r, na, r + ' !~ ' + na))) | ||
})) | ||
|
||
t.test('sync', t => { | ||
walk.sync({ | ||
path, | ||
ignoreFiles: ['.ignore-spaces'], | ||
}).forEach(r => notAllowed.forEach(na => | ||
t.notMatch(r, na, r + ' !~ ' + na))) | ||
t.end() | ||
}) |