The documentation for --grep states this regarding the string that is used for matching:
"The regular expression will be tested against the string that consists of the test file name, test.describe titles if any, test title and all test tags, separated by spaces, e.g. my-test.spec.ts my-suite my-test @smoke."
In reality, from my own testing, it appears that the string used to match against also includes the project name.
For example, this fails to match:
--grep "^mytestfile.spec.ts\smy\stest$"
Whereas, this does match:
--grep "^chromium\smytestfile.spec.ts\smy\stest$"
This makes a difference if you are trying to match on the whole string in order to avoid potential sub-string matches.
Page(s)
https://playwright.dev/docs/test-cli#reference
Description
The documentation for
--grep
states this regarding the string that is used for matching: "The regular expression will be tested against the string that consists of the test file name,test.describe
titles if any, test title and all test tags, separated by spaces, e.g.my-test.spec.ts my-suite my-test @smoke
."In reality, from my own testing, it appears that the string used to match against also includes the project name.
For example, this fails to match:
Whereas, this does match:
This makes a difference if you are trying to match on the whole string in order to avoid potential sub-string matches.