Skip to content

fix(no-standalone-expect): report expect after member test calls like test.skip - #993

Open
RagedPanda wants to merge 1 commit into
vitest-dev:mainfrom
RagedPanda:fix/no-standalone-expect-member-test
Open

RagedPanda wants to merge 1 commit into
vitest-dev:mainfrom
RagedPanda:fix/no-standalone-expect-member-test

Conversation

@RagedPanda

Copy link
Copy Markdown
Contributor

Fixes #992

no-standalone-expect stopped reporting a standalone expect once it followed a member-form test call such as test.skip(...), test.concurrent(...) or it.only(...).

The rule pushes a test entry for any test call, but CallExpression:exit only popped it when the callee was not a MemberExpression. So test.skip(...) left test on the stack, and every later expect in the file looked like it was inside a test.

The fix records which call pushed each test entry 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([...])(...) and it.skip inside a describe, each followed by a standalone expect. Four of them fail without the fix (test.each already 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

no-standalone-expect: standalone expect is not reported after a member-form test call such as test.concurrent(...)

1 participant