-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use minimatchFilter instead of minimatch.filter
- Loading branch information
1 parent
a8dac53
commit 0722118
Showing
3 changed files
with
31 additions
and
16 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 |
---|---|---|
@@ -1,18 +1,33 @@ | ||
import { minimatch } from './minimatch'; | ||
import { minimatch, minimatchFilter } from './minimatch'; | ||
|
||
describe('util/minimatch', () => { | ||
it('caches minimatch', () => { | ||
expect(minimatch('foo')).toBe(minimatch('foo')); | ||
expect(minimatch('foo', { dot: true })).toBe( | ||
minimatch('foo', { dot: true }), | ||
); | ||
describe('minimatch', () => { | ||
it('caches minimatch', () => { | ||
expect(minimatch('foo')).toBe(minimatch('foo')); | ||
expect(minimatch('foo', { dot: true })).toBe( | ||
minimatch('foo', { dot: true }), | ||
); | ||
}); | ||
|
||
it('does not cache minimatch', () => { | ||
expect(minimatch('foo', undefined, false)).not.toBe( | ||
minimatch('foo', undefined, false), | ||
); | ||
expect(minimatch('foo')).not.toBe(minimatch('foo', undefined, false)); | ||
expect(minimatch('foo', { dot: true })).not.toBe(minimatch('foo')); | ||
}); | ||
}); | ||
|
||
it('does not cache minimatch', () => { | ||
expect(minimatch('foo', undefined, false)).not.toBe( | ||
minimatch('foo', undefined, false), | ||
); | ||
expect(minimatch('foo')).not.toBe(minimatch('foo', undefined, false)); | ||
expect(minimatch('foo', { dot: true })).not.toBe(minimatch('foo')); | ||
describe('minimatchFilter', () => { | ||
it('should return a function', () => { | ||
expect(minimatchFilter('*.js')).toBeFunction(); | ||
expect(minimatchFilter('*.js', undefined, false)).toBeFunction(); | ||
}); | ||
|
||
it('should correctly match filenames', () => { | ||
const filterFunc = minimatchFilter('*.js'); | ||
expect(filterFunc('test.js')).toBe(true); | ||
expect(filterFunc('test.txt')).toBe(false); | ||
}); | ||
}); | ||
}); |
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