oxc-project/oxc · warning · OxcDiagnostic

Describe block title is used multiple times in the same desc

Error message

Describe block title is used multiple times in the same describe block.

What it means

The describe variant of oxlint rule `jest/no-identical-title` (shared with vitest), the describe_repeat constructor at crates/oxc_linter/src/rules/shared/jest_vitest/no_identical_title.rs:21. Two sibling describe blocks directly under the same parent must not share a title; the rule tracks titles per level in an FxHashMap and reports the repeated title.

Source

Thrown at crates/oxc_linter/src/rules/shared/jest_vitest/no_identical_title.rs:20

    AstKind,
    ast::{Argument, CallExpression},
};
use oxc_diagnostics::OxcDiagnostic;
use oxc_semantic::NodeId;
use oxc_span::Span;
use rustc_hash::FxHashMap;

use crate::{
    AstNode,
    context::LintContext,
    utils::{
        JestFnKind, JestGeneralFnKind, PossibleJestNode, collect_possible_jest_call_node,
        parse_general_jest_fn_call,
    },
};

fn describe_repeat(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Describe block title is used multiple times in the same describe block.")
        .with_help("Change the title of describe block.")
        .with_label(span)
}

fn test_repeat(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Test title is used multiple times in the same describe block.")
        .with_help("Change the title of test.")
        .with_label(span)
}

pub const DOCUMENTATION: &str = r"### What it does

This rule looks at the title of every test and test suite.
It will report when two test suites or two test cases at the same level of a test suite have the same title.

### Why is this bad?

Having identical titles for two different tests or test suites may create confusion.

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Rename the duplicate describe so each sibling has a distinct, descriptive title
  2. If the suites differ by case/data, encode the difference in the title (e.g. 'checkout - guest' vs 'checkout - logged in')
  3. If they truly duplicate each other, delete one of the suites

Example fix

// before
describe('parser', () => { /* ... */ });
describe('parser', () => { /* ... */ });

// after
describe('parser: expressions', () => { /* ... */ });
describe('parser: declarations', () => { /* ... */ });
Defensive patterns

Strategy: validation

Validate before calling

npx oxlint -c .oxlintrc.json tests/ # jest/no-identical-title reports sibling describes sharing a title

Prevention

When it happens

Trigger: Two or more describe() calls with equal string-literal titles at the same nesting level under the same parent describe (or both at top level). The second and subsequent duplicates are labeled with their span.

Common situations: Copy-pasting a suite and forgetting to rename; parameterized suites generated with identical names; test reports becoming ambiguous because two suites print the same path; refactors that moved suites under a common parent.

Related errors


AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20). Data as JSON: /api/errors/18b959eb954d38c3. Report an issue: GitHub.