Repository navigation
[probes.browser] Make testspec matching less sensitive to testDir path. - #1085
Merged
Merged
Conversation
Contributor
Author
|
Since it caused so much pain (and all AI chatbots kept saying playwright doesn't resolve symlinks (partially true), though grok was more helpful), I dug further and found the root cause: It is the isFile() that fails on symlinks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In some cases testDir may have symlinks to the test spec. This happens for example for k8s config maps. If you mount a config map, say at /cfg, containing a test spec say test.spec.ts, its path on the filesystem will look like the following:
In such cases, playwright will evaluate file path as
/cfg/..data/test.spec.ts(note ..data itself will be a symlink so final path will be even longer). In that case, if we specify test spec as^/cfg/test.spec.ts$it will not match anything.To workaround this problem, let's leave out testDir from the test spec regex. We'll use `^.*/test.spec.ts$ instead.
For posterity:
Playwright code for file matching:
https://github.com/microsoft/playwright/blob/eb5e3b37402bad85e6c2b976e1a596cca0e4f47c/packages/playwright/src/util.ts#L96
for collecting file:
https://github.com/microsoft/playwright/blob/eb5e3b37402bad85e6c2b976e1a596cca0e4f47c/packages/playwright/src/runner/projectUtils.ts#L169