feat: Add support for multiple patterns when using file status

This adds support for using multiple patterns when checking for file status (added, modified, deleted) and as a result also allows you to use YAML anchors.
This commit is contained in:
Billy Vong 2020-11-06 17:39:25 -08:00
parent 804ec66d7a
commit 5282566eab
3 changed files with 20 additions and 1 deletions

View file

@ -165,6 +165,20 @@ describe('matching specific change status', () => {
const match = filter.match(files)
expect(match.addOrModify).toEqual(files)
})
test.only('matches when using an anchor', () => {
const yaml = `
shared: &shared
- common/**/*
- config/**/*
src:
- modified: *shared
`
let filter = new Filter(yaml)
const files = modified(['config/file.js', 'common/anotherFile.js'])
const match = filter.match(files)
expect(match.src).toEqual(files)
})
})
function modified(paths: string[]): File[] {