-
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: disallow child unignoring parent directory ignore (#116)
Closes: npm/cli#7007
- Loading branch information
1 parent
12a7c00
commit 0bb0972
Showing
2 changed files
with
33 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict' | ||
|
||
var walk = require('../lib/index.js') | ||
const { resolve } = require('path') | ||
const path = resolve(__dirname, 'fixtures') | ||
|
||
// set the ignores just for this test | ||
var c = require('./common.js') | ||
c.ignores({ | ||
'.ignore': ['*', '!/c', '!/d'], | ||
'c/.ignore': ['!*', '.ignore'], // unignore everything | ||
}) | ||
|
||
// the only files we expect to see | ||
var expected = [] | ||
|
||
const t = require('tap') | ||
|
||
t.test('sync', t => { | ||
t.same(walk.sync({ | ||
path, | ||
ignoreFiles: ['.ignore'], | ||
}), expected) | ||
t.end() | ||
}) | ||
|
||
t.test('async', t => walk({ | ||
path, | ||
ignoreFiles: ['.ignore'], | ||
}, (er, result) => t.same(result, expected))) |