fix(linter): skip test.extend() in expect-expect and no-disabled-tests#21201
Closed
masseater wants to merge 3 commits intooxc-project:mainfrom
Closed
fix(linter): skip test.extend() in expect-expect and no-disabled-tests#21201masseater wants to merge 3 commits intooxc-project:mainfrom
test.extend() in expect-expect and no-disabled-tests#21201masseater wants to merge 3 commits intooxc-project:mainfrom
Conversation
…-tests` `test.extend()` is a Vitest test factory for creating fixture-based test contexts, not a test call itself. Both `expect-expect` and `no-disabled-tests` were incorrectly treating it as a test call, causing false positives. This aligns with the fix in eslint-plugin-vitest (vitest-dev/eslint-plugin-vitest#584) and follows the same pattern already used in `valid-title`. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
I think the correct approach is adding a |
JustFly1984
added a commit
to JustFly1984/oxc
that referenced
this pull request
Apr 10, 2026
…-tests` Cherry-picked from oxc-project#21201 (commit f71099d) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
camc314
added a commit
that referenced
this pull request
Apr 23, 2026
…functions (#21668) # AI Disclosure The code has been done without AI help. # Summary A [previous PR](#21201) fixed this false positive directly in the rule. This PR take another approach, add a new Fixture Kind. This PR solely solve the false positive, a follow PR, or PRs, need to addres the identifier tracking. closes #21201 Co-authored-by: Cameron <cameron.clark@hey.com>
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.
Currently being reviewed by a human.
Summary
vitest/expect-expectandvitest/no-disabled-testswhen usingtest.extend()to create fixture-based test contextstest.extend()is a test factory (creates new test functions with fixtures), not a test call itself, so it should not trigger these lint rulesvalid-titlerule and aligns with the upstream fix in eslint-plugin-vitest#584Reproduction
Before this fix,
test.extend()was incorrectly flagged as:expect-expect: "Test has no assertions"no-disabled-tests: "Test is missing function argument"Changes
expect_expect.rsAdded
extendto the early-return check alongsidetodoandskip:no_disabled_tests.rsAdded an early-return when the first member is
extend(same pattern asvalid_title.rs):Test plan
test.extend()in both Jest and Vitest contexts forexpect-expecttest.extend()in both Jest and Vitest contexts forno-disabled-testscargo test -p oxc_linter -- expect_expectpassescargo test -p oxc_linter -- no_disabled_testspassescargo clippy -p oxc_linterpasses without new warningsAI Disclosure
This PR was authored with the assistance of Claude Code (AI).
The contributor has reviewed, tested, and validated all changes.