Skip to content

fix(linter): avoid consistent-test-it describe leakage#22632

Closed
ipanasenko wants to merge 4 commits into
oxc-project:mainfrom
ipanasenko:illiap/fix-consistent-test-it-describe
Closed

fix(linter): avoid consistent-test-it describe leakage#22632
ipanasenko wants to merge 4 commits into
oxc-project:mainfrom
ipanasenko:illiap/fix-consistent-test-it-describe

Conversation

@ipanasenko

@ipanasenko ipanasenko commented May 20, 2026

Copy link
Copy Markdown

Fixes #22633

Summary

  • track actual describe call ancestors for consistent-test-it instead of leaking state after any describe call
  • add jest and vitest regression coverage for top-level test calls after describe

Comment thread crates/oxc_linter/src/rules/jest/consistent_test_it.rs Outdated
Comment thread crates/oxc_linter/src/rules/vitest/consistent_test_it.rs Outdated
Signed-off-by: Illia Panasenko <hottdogg2008@gmail.com>
Signed-off-by: Illia Panasenko <hottdogg2008@gmail.com>
@ipanasenko ipanasenko marked this pull request as ready for review May 20, 2026 21:37
@ipanasenko ipanasenko requested a review from camc314 as a code owner May 20, 2026 21:37
@camc314 camc314 added the A-linter Area - Linter label May 21, 2026
@camc314 camc314 self-assigned this May 21, 2026
@codspeed-hq

codspeed-hq Bot commented May 21, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 5 untouched benchmarks
⏩ 55 skipped benchmarks1


Comparing ipanasenko:illiap/fix-consistent-test-it-describe (0850193) with main (1846218)

Open in CodSpeed

Footnotes

  1. 55 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Comment on lines +131 to +147
let describe_call_ids = possible_jest_nodes
.iter()
.filter_map(|possible_jest_node| {
let node = possible_jest_node.node;
let AstKind::CallExpression(call_expr) = node.kind() else {
return None;
};
let Some(ParsedJestFnCallNew::GeneralJest(jest_fn_call)) =
parse_jest_fn_call(call_expr, possible_jest_node, ctx)
else {
return None;
};

matches!(jest_fn_call.kind, JestFnKind::General(JestGeneralFnKind::Describe))
.then_some(node.id())
})
.collect::<FxHashSet<_>>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm i'm a little worried about the perf overhead of this check.

I'll look at this more tomorow

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know zero Rust, this was written by gpt-5.5, just fyi

@graphite-app graphite-app Bot closed this in 33ec6b4 May 28, 2026
@ipanasenko ipanasenko deleted the illiap/fix-consistent-test-it-describe branch May 28, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter: consistent-test-it considers sibling describe as parent

2 participants