Skip to content

test(linter): make chained Tester::expect_fix calls add fix cases - #29308

Open
ashokram-si wants to merge 5 commits into
oxc-project:mainfrom
ashokram-si:fix/tester-expect-fix-29155
Open

ashokram-si wants to merge 5 commits into
oxc-project:mainfrom
ashokram-si:fix/tester-expect-fix-29155

Conversation

@ashokram-si

@ashokram-si ashokram-si commented Nov 11, 2026 •

Copy link
Copy Markdown

Fixes #29155

Tester::expect_fix replaced the stored fix cases, so a test that chains several .expect_fix(...) calls only ran the last list. Four tests chain it:

expect_fix now adds to the cases already given (the issue's first option), so these tests keep their grouping and every list runs. All of them pass. The doc comment says a second call adds. intentionally_allow_no_fix_tests had the same replace-not-add bug (called after expect_fix, it dropped the cases), so it now keeps them too.

Tests: no new test. The four rule tests above are the regression tests, in the linter's existing harness (AGENTS.md asks for that rather than standalone tests). The earlier version's mod tests in tester.rs is gone. Checked by hand: with a wrong expectation in interactive-supports-focus's first list (fix_tabbable), the rule's test fails on this branch and passes with main's tester.rs, where that list never runs.

At 7cdf892 (current main merged): cargo test -p oxc_linter --lib: 1339 passed. cargo fmt --check and cargo clippy -p oxc_linter --all-targets -- -D warnings are clean.

No Example or playground link: this changes the linter's test harness (Tester::expect_fix), not what a rule reports or fixes.

AI disclosure: written with Claude Code (model: Claude Opus 5.5, claude-opus-5-5; the reasoning effort level was not recorded); I reviewed the change and ran the tests.

…of replacing them

Chained `.expect_fix(...)` calls kept only the last list, so the fix cases of the
earlier calls never ran: jest and vitest `prefer-expect-assertions` (five and three
lists), `jsx-a11y/interactive-supports-focus` (`fix_tabbable`) and
`typescript/consistent-type-definitions` (`fix`). They all pass now that every
call's cases run.

Fixes oxc-project#29155
@ashokram-si
ashokram-si requested a review from camc314 as a code owner November 11, 2026 18:24
ashokram-si and others added 4 commits November 11, 2026 23:54
AGENTS.md now asks for cases in a crate's existing test harness rather
than new standalone unit tests. The rule tests that chain `expect_fix`
(jest and vitest prefer-expect-assertions, jsx-a11y
interactive-supports-focus, typescript consistent-type-definitions)
already cover the change: with it, a wrong case in an earlier list fails
the rule's test; without it, that list never runs.
It replaced the stored fix cases with an empty list, so calling it after
`expect_fix` dropped them, the same bug `expect_fix` had.

This branch has not been deployed

No deployments
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.

linter: chained Tester::expect_fix calls overwrite earlier fix cases

1 participant