fix(no-skipped-test): detect testInfo annotations and split allowConditional - #490
Open
unlikelyzero wants to merge 2 commits into
Open
fix(no-skipped-test): detect testInfo annotations and split allowConditional#490unlikelyzero wants to merge 2 commits into
unlikelyzero wants to merge 2 commits into
Conversation
…onal `testInfo.skip()` and `testInfo.fixme()` were never reported, since the rule only looked at chains rooted at the `test` identifier. Resolve the second parameter of a test, hook, or step callback and treat annotations called on it the same as the standalone `test.skip()` form. `allowConditional` now also accepts an object so `skip` and `fixme` can be configured separately, which lets a project rely on conditional skips while still forbidding every use of `.fixme()`. A boolean keeps working and applies to both annotations.
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.
Addresses the two follow-ups raised in #446 after
disallowFixmeshipped in v2.10.0.testInfo.skip()/testInfo.fixme()were not detectedThe rule only inspected call chains rooted at the
testidentifier, so the equally validtestInfoform slipped through:The rule now resolves the second parameter of a test, hook, or step callback and treats annotations called on it exactly like the standalone
test.skip()form — same report location, sameallowConditionalhandling, same remove-the-statement suggestion. Annotations on the first callback parameter (the fixtures object) and on identifiers that aren't a test callback'stestInfoare left alone.Conditional skip without conditional fixme
allowConditionalnow accepts an object as well as a boolean:{ "playwright/no-skipped-test": [ "error", { "allowConditional": { "fixme": false, "skip": true }, "disallowFixme": true } ] }This is the configuration the issue asked for: conditional
test.skip()stays available for tests that only run under a given configuration, while.fixme()is rejected everywhere — including conditionally — because it marks the test as failed rather than skipped.A boolean keeps its current meaning and applies to both annotations, so
{ "allowConditional": true }is equivalent to{ "allowConditional": { "fixme": true, "skip": true } }. No existing configuration changes behavior.Docs updated, and tests cover the new
testInfodetection (including hooks, computed accessors, and the valid non-test cases) plus bothallowConditionalshapes.