fix: running a folder shouldn't also run folders that share prefix#614
Conversation
There was a problem hiding this comment.
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
src/utils.ts:216
- [nitpick] Consider renaming the variable 'path' to avoid potential confusion with the imported 'path' module, which may improve code clarity.
const path = location.split(':')[0];
| return; | ||
| // Locations are regular expressions. | ||
| locations = locations.map(escapeRegex); | ||
| locations = locations.map(preventRegexLookalike).map(escapeRegex); |
There was a problem hiding this comment.
Since we call escapeRegex - perhaps we don't need preventRegexLookalike here at all?
There was a problem hiding this comment.
escapeRegex doesn't do anything to forward slashes. I can merge the preventRegexLookalike logic into escapeRegex if you'd prefer that.
There was a problem hiding this comment.
Yep, that would be great. Just escape the forward slashes together with other characters.
There was a problem hiding this comment.
Escaping the forward slashes wasn't enough, but removing the leading one did the trick: 42995e8
I also made sure that the exec log preserves the trailing slash for directory. path.relative likes to remove that.
Closes microsoft/playwright#34813. When running the
foofolder, we were sendingfooover the wire instead offoo/. That meant that thefoobar/folder also gets executed, which isn't expected.The fix is to include the trailing slash in the locations we send to Playwright. Because Playwright interprets
/root/project/dir/as a regular expression, I made it omit the leading slash for absolute directories. That has the same effect, because Playwright's location checker isn't strict.