Repository navigation
fix(no-standalone-expect): report expect after member test calls like test.skip - #993
Open
RagedPanda wants to merge 1 commit into
Open
RagedPanda wants to merge 1 commit into
RagedPanda wants to merge 1 commit into
Conversation
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.
Fixes #992
no-standalone-expectstopped reporting a standaloneexpectonce it followed a member-form test call such astest.skip(...),test.concurrent(...)orit.only(...).The rule pushes a
testentry for any test call, butCallExpression:exitonly popped it when the callee was not aMemberExpression. Sotest.skip(...)leftteston the stack, and every laterexpectin the file looked like it was inside a test.The fix records which call pushed each
testentry and pops it on that call's exit, whatever form the callee takes.Tests: added invalid cases for
test.concurrent,test.skip,it.only,test.each([...])(...)andit.skipinside adescribe, each followed by a standaloneexpect. Four of them fail without the fix (test.eachalready passed). The full suite,tsc --noEmit, eslint and prettier all pass.I used an AI assistant (Claude) to help write this change. I reviewed and tested it myself.