Merge pull request #102 from micromatch/ISSUE-93_incorrect_extglob_ex… · micromatch/picomatch@9f241ef

@@ -58,15 +58,34 @@ describe('extglobs', () => {

5858

it('should support stars in negation extglobs', () => {

5959

assert(!isMatch('/file.d.ts', '/!(*.d).ts'));

6060

assert(isMatch('/file.ts', '/!(*.d).ts'));

61+

assert(isMatch('/file.something.ts', '/!(*.d).ts'));

6162

assert(isMatch('/file.d.something.ts', '/!(*.d).ts'));

6263

assert(isMatch('/file.dhello.ts', '/!(*.d).ts'));

63646465

assert(!isMatch('/file.d.ts', '**/!(*.d).ts'));

6566

assert(isMatch('/file.ts', '**/!(*.d).ts'));

67+

assert(isMatch('/file.something.ts', '**/!(*.d).ts'));

6668

assert(isMatch('/file.d.something.ts', '**/!(*.d).ts'));

6769

assert(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+7089

it('should support negation extglobs in patterns with slashes', () => {

7190

assert(!isMatch('foo/abc', 'foo/!(abc)'));

7291

assert(isMatch('foo/bar', 'foo/!(abc)'));