1import { isIgnoredPath } from '../Path'; 2 3describe(isIgnoredPath, () => { 4 it('should support file pattern', () => { 5 expect(isIgnoredPath('app.json', ['app.json'])).toBe(true); 6 expect(isIgnoredPath('app.ts', ['*.{js,ts}'])).toBe(true); 7 expect(isIgnoredPath('/dir/app.json', ['/dir/*.json'])).toBe(true); 8 }); 9 10 it('should support directory pattern', () => { 11 expect(isIgnoredPath('/app/ios/Podfile', ['**/ios/**/*'])).toBe(true); 12 }); 13 14 it('case sensitive by design', () => { 15 expect(isIgnoredPath('app.json', ['APP.JSON'])).toBe(false); 16 }); 17 18 it('should include dot files from wildcard pattern', () => { 19 expect(isIgnoredPath('.bashrc', ['*'])).toBe(true); 20 }); 21 22 it('no `matchBase` and `partial` by design', () => { 23 expect(isIgnoredPath('/dir/app.json', ['app.json'])).toBe(false); 24 }); 25 26 it('match a file inside a dir should use a globstar', () => { 27 expect(isIgnoredPath('/dir/app.ts', ['*'])).toBe(false); 28 expect(isIgnoredPath('/dir/app.ts', ['**/*'])).toBe(true); 29 }); 30 31 it('should use `!` to override default ignorePaths', () => { 32 const ignorePaths = ['**/ios/**/*', '!**/ios/Podfile', '**/android/**/*']; 33 expect(isIgnoredPath('/app/ios/Podfile', ignorePaths)).toBe(false); 34 expect(isIgnoredPath('/app/ios/Podfile.lock', ignorePaths)).toBe(true); 35 }); 36}); 37