-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Last Good Version
First Bad Version
Steps to reproduce
I've tested this directly on
| export function globToRegexPattern(glob: string): string { |
This regressed in #37156.
Expected behavior
Before that PR, a pattern like foo/**/bar would match any level of path components between foo and bar, including zero. So this used to match both foo/bar and foo/x/bar.
Actual behavior
After that PR, it only matches 1 or more components between foo and bar.
Additional context
I can't really safely replace it with foo**/bar or foo/**bar because those would also match URLs like fooz/bar or foo/zbar.
Before the change, the ** globbing used to work like in .gitignore, requiring it to be preceded and/or followed by a / to get the special behavior, while the Playwright documentation didn't mention that restriction.
I don't mind the broader interpretation of just letting ** match anything, but maybe /**/ can be treated specially to match (/.*/|/)? I'd rather avoid having to do {foo/**/bar,foo/bar}.
foo/{**/,}bar might be acceptable. Except I can't do that when I'm already inside a {} group because groups can't be nested. (That could potentially be fixed by making inGroup a number instead of a boolean.)
Environment
N/A