diff --git a/cli/src/services/crawl.service.spec.ts b/cli/src/services/crawl.service.spec.ts index 4a30669d69..447b6edc9d 100644 --- a/cli/src/services/crawl.service.spec.ts +++ b/cli/src/services/crawl.service.spec.ts @@ -198,6 +198,58 @@ const tests: Test[] = [ [`/photos/3.jpg`]: false, }, }, + { + test: 'should support ignoring full filename', + options: { + pathsToCrawl: ['/photos'], + exclusionPatterns: ['**/image2.jpg'], + }, + files: { + '/photos/image1.jpg': true, + '/photos/image2.jpg': false, + '/photos/image3.jpg': true, + }, + }, + { + test: 'should support ignoring file extensions', + options: { + pathsToCrawl: ['/photos'], + exclusionPatterns: ['**/*.png'], + }, + files: { + '/photos/image1.jpg': true, + '/photos/image2.png': false, + '/photos/image3.jpg': true, + }, + }, + { + test: 'should support ignoring folder names', + options: { + pathsToCrawl: ['/photos'], + recursive: true, + exclusionPatterns: ['**/raw/**'], + }, + files: { + '/photos/image1.jpg': true, + '/photos/image/image1.jpg': true, + '/photos/raw/image2.dng': false, + '/photos/raw/image3.dng': false, + '/photos/notraw/image3.jpg': true, + }, + }, + { + test: 'should support ignoring absolute paths', + options: { + pathsToCrawl: ['/'], + recursive: true, + exclusionPatterns: ['/images/**'], + }, + files: { + '/photos/image1.jpg': true, + '/images/image2.jpg': false, + '/assets/image3.jpg': true, + }, + }, ]; describe(CrawlService.name, () => {