mirror of
https://github.com/dorny/paths-filter.git
synced 2026-07-27 22:13:03 +02:00
Use micromatch instead of minimatch (#46)
* Use micromatch instead of minimatch micromatch claims to support full Bash 4.3 spec and it actually passes all the tests. For example this fixes processing of '!(**/*.tsx|**/*.less)' pattern - needed by #45 * Update CHANGELOG.md
This commit is contained in:
@@ -98,6 +98,25 @@ describe('matching tests', () => {
|
||||
expect(match.dot).toEqual(files)
|
||||
})
|
||||
|
||||
test('matches all except tsx and less files (negate a group with or-ed parts)', () => {
|
||||
const yaml = `
|
||||
backend:
|
||||
- '!(**/*.tsx|**/*.less)'
|
||||
`
|
||||
const filter = new Filter(yaml)
|
||||
const tsxFiles = modified(['src/ui.tsx'])
|
||||
const lessFiles = modified(['src/ui.less'])
|
||||
const pyFiles = modified(['src/server.py'])
|
||||
|
||||
const tsxMatch = filter.match(tsxFiles)
|
||||
const lessMatch = filter.match(lessFiles)
|
||||
const pyMatch = filter.match(pyFiles)
|
||||
|
||||
expect(tsxMatch.backend).toEqual([])
|
||||
expect(lessMatch.backend).toEqual([])
|
||||
expect(pyMatch.backend).toEqual(pyFiles)
|
||||
})
|
||||
|
||||
test('matches path based on rules included using YAML anchor', () => {
|
||||
const yaml = `
|
||||
shared: &shared
|
||||
|
||||
Reference in New Issue
Block a user