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:
Michal Dorner 2020-10-23 12:33:44 +02:00 committed by GitHub
parent 7b5334ddb5
commit b37d4e9e86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 4413 additions and 1355 deletions

View file

@ -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