File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed
packages/playwright-core/src/utils/isomorphic Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -30,22 +30,15 @@ export function globToRegexPattern(glob: string): string {
3030 continue ;
3131 }
3232 if ( c === '*' ) {
33- const beforeDeep = glob [ i - 1 ] ;
3433 let starCount = 1 ;
3534 while ( glob [ i + 1 ] === '*' ) {
3635 starCount ++ ;
3736 i ++ ;
3837 }
39- const afterDeep = glob [ i + 1 ] ;
40- const isDeep = starCount > 1 &&
41- ( beforeDeep === '/' || beforeDeep === undefined ) &&
42- ( afterDeep === '/' || afterDeep === undefined ) ;
43- if ( isDeep ) {
44- tokens . push ( '((?:[^/]*(?:\/|$))*)' ) ;
45- i ++ ;
46- } else {
38+ if ( starCount > 1 )
39+ tokens . push ( '(.*)' ) ;
40+ else
4741 tokens . push ( '([^/]*)' ) ;
48- }
4942 continue ;
5043 }
5144
Original file line number Diff line number Diff line change @@ -123,6 +123,10 @@ it('should work with glob', async () => {
123123 expect ( urlMatches ( undefined , 'https://playwright.dev/foobar' , 'https://playwright.dev/fooBAR' ) ) . toBeFalsy ( ) ;
124124 expect ( urlMatches ( undefined , 'https://playwright.dev/foobar?a=b' , 'https://playwright.dev/foobar?A=B' ) ) . toBeFalsy ( ) ;
125125
126+ expect ( urlMatches ( undefined , 'https://localhost:3000/?a=b' , '**/?a=b' ) ) . toBeTruthy ( ) ;
127+ expect ( urlMatches ( undefined , 'https://localhost:3000/?a=b' , '**?a=b' ) ) . toBeTruthy ( ) ;
128+ expect ( urlMatches ( undefined , 'https://localhost:3000/?a=b' , '**=b' ) ) . toBeTruthy ( ) ;
129+
126130 // This is not supported, we treat ? as a query separator.
127131 expect ( globToRegex ( 'http://localhost:8080/?imple/path.js' ) . test ( 'http://localhost:8080/Simple/path.js' ) ) . toBeFalsy ( ) ;
128132 expect ( urlMatches ( undefined , 'http://playwright.dev/' , 'http://playwright.?ev' ) ) . toBeFalsy ( ) ;
You can’t perform that action at this time.
0 commit comments