Merge pull request #102 from micromatch/ISSUE-93_incorrect_extglob_ex… · micromatch/picomatch@9f241ef
@@ -58,15 +58,34 @@ describe('extglobs', () => {
5858it('should support stars in negation extglobs', () => {
5959assert(!isMatch('/file.d.ts', '/!(*.d).ts'));
6060assert(isMatch('/file.ts', '/!(*.d).ts'));
61+assert(isMatch('/file.something.ts', '/!(*.d).ts'));
6162assert(isMatch('/file.d.something.ts', '/!(*.d).ts'));
6263assert(isMatch('/file.dhello.ts', '/!(*.d).ts'));
63646465assert(!isMatch('/file.d.ts', '**/!(*.d).ts'));
6566assert(isMatch('/file.ts', '**/!(*.d).ts'));
67+assert(isMatch('/file.something.ts', '**/!(*.d).ts'));
6668assert(isMatch('/file.d.something.ts', '**/!(*.d).ts'));
6769assert(isMatch('/file.dhello.ts', '**/!(*.d).ts'));
6870});
697172+// See https://github.com/micromatch/picomatch/issues/93
73+it('should support stars in negation extglobs with expression after closing parenthesis', () => {
74+// Nested expression after closing parenthesis
75+assert(!isMatch('/file.d.ts', '/!(*.d).{ts,tsx}'));
76+assert(isMatch('/file.ts', '/!(*.d).{ts,tsx}'));
77+assert(isMatch('/file.something.ts', '/!(*.d).{ts,tsx}'));
78+assert(isMatch('/file.d.something.ts', '/!(*.d).{ts,tsx}'));
79+assert(isMatch('/file.dhello.ts', '/!(*.d).{ts,tsx}'));
80+81+// Extglob after closing parenthesis
82+assert(!isMatch('/file.d.ts', '/!(*.d).@(ts)'));
83+assert(isMatch('/file.ts', '/!(*.d).@(ts)'));
84+assert(isMatch('/file.something.ts', '/!(*.d).@(ts)'));
85+assert(isMatch('/file.d.something.ts', '/!(*.d).@(ts)'));
86+assert(isMatch('/file.dhello.ts', '/!(*.d).@(ts)'));
87+});
88+7089it('should support negation extglobs in patterns with slashes', () => {
7190assert(!isMatch('foo/abc', 'foo/!(abc)'));
7291assert(isMatch('foo/bar', 'foo/!(abc)'));