Enhance the forbidOnly mode message to guide the user towards the configuration option#23146
Conversation
…figuration option The message now explains what a focused item is (by using the `only` keyword which is more likely to trigger the realization in the user than the general name) as well as why the mode is configured (in the default configuration this is set to whether `CI=1` is set). Signed-off-by: Tomáš Hübelbauer <tomas@hubelbauer.net>
|
A couple of tests failed due to the change! |
|
@pavelfeldman Yeah I will adjust them, but I am curious if you have a better suggestion for the message copy as well as whether there is a way to distinguish whether the project is in TypeScript or JavaScript first. Do you have any input there? |
I'd recommend something like Or you can even make it more specific, see below.
In the |
This should detect whether it is coming from the CLI or the config file. Signed-off-by: Tomáš Hübelbauer <tomas@hubelbauer.net>
|
@dgozman Is there any way to tell if the project was I have not updated the tests yet, will do so once I clone Playwright and figure out how to run the tests locally. |
|
Something weird is going on with the tests. I am following
When I change either of the tests to
I return to What am I doing wrong? |
Nope. But you can check |
|
Sorry, I misunderstood your suggestion at first! Now I get what you mean and how to get the right path. |
We should fix this! Send us a PR if you'd like 😄
Right, that's test runner tests. You can run them with npm run ttest -- --grep "should report forbid-only error to reporter"
Yeah, that's not going to work. We are using complicated setup to run test runner tests, so |
I would! Will do.
Perfect, thanks, will also add to the PR! One last thing: I will also add a note about needing to run |
This should be all!
|
Alright, this should be good to go. The tests are passing locally and we even tests the config file existing in one and not existing in the other and the error message reflecting that now. Thanks for engaging on this PR and all the useful tips! |
|
@microsoft-github-policy-service agree |
|
Need to fix this: I need to use platform-specific path separators to make this pass on Windows. Coming up next. |
The path separator issue was tanking the tests on GitHub.
…expression I forgot to assign the POSIX branch expression to `configFilePath`.
I misunderstood the Windows test failure before.
It was the title path failing the test actually not the confi file path. Duh.
|
I am getting random test failures that seem unrelated and IDK how to fix them 😞 |
We have another test that tests the CLI flag path.
This wasn't there before and Dmitry suggested we adjust the test instead.
Using this we should be able to make them work on both Unix and Windows.
|
There are again some failing tests on the CI but I do not think they relate to my changes. |
dgozman
left a comment
There was a problem hiding this comment.
Thank you for the PR! Looks great, merging in.
|
Thank you!!! |
Hi, I am putting this PR out as a feeler to see if there's interested in improving this error message, but the copy is by no means final and I am open to improvement suggestions.
My intention here is to:
Explain what a "focused item" is - that we're talking about a test and it being focused is most likely down it using
onlyAre there other types of "items"? Are there other ways to make them focused other than
only?Explain why we're even in focused mode and how to control it
The default scaffolded Playwright config file includes a forbidMode expression driven by whether
CI=1is set.I ran into this when trying to reproduce a CI issue locally so I had it set and unknowingly entered focus only mode.
I wasn't aware this mode was a thing because I was using the default configuration from
npm initand did not familiarize myself with all the options in it.Is there a way to tell if we're in a TypeScript or JavaScript project in this function? I would use that to display the configuration file name with the right extension.