oxc-project/oxc · error · OxcDiagnostic
Title description can not have the same content as a importe
Error message
Title description can not have the same content as a imported function name.
What it means
Emitted by the vitest/prefer-describe-function-title rule when a `describe` title string exactly matches the name of an imported function. It fires because the title likely interpolates or shadows the identifier incorrectly — either the function itself should be passed as the title or the string should differ, otherwise the test name is misleading.
Source
Thrown at crates/oxc_linter/src/rules/vitest/prefer_describe_function_title.rs:16
use oxc_ast::{
AstKind,
ast::{Argument, Expression},
};
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;
use crate::{
context::LintContext,
rule::Rule,
utils::{JestFnKind, JestGeneralFnKind, PossibleJestNode, parse_general_jest_fn_call},
};
fn prefer_describe_function_title_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Title description can not have the same content as a imported function name.")
.with_help("Pass the function as a description title argument or modify the description title to not match any imported function name.")
.with_label(span)
}
#[derive(Debug, Default, Clone)]
pub struct PreferDescribeFunctionTitle;
declare_oxc_lint!(
/// ### What it does
///
/// When testing a specific function, this rule aims to enforce passing a named function to `describe()`
/// instead of an equivalent hardcoded string.
///
/// ### Why is this bad?
///
/// For tests that are related to a specific function, if the function being tested is renamed,
/// the describe title will no longer match and can cause confusion in the future. Using the function
/// directly ensures consistency even if the function is renamed.View on GitHub (pinned to e1e7af627c)
Solutions
- Pass the imported function directly as the title argument, e.g. `describe(myFn, () => {...})`
- Rename the title string so it does not duplicate an imported function name
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/oxc_linter/src/rules/vitest/prefer_describe_function_title.rs:16 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20).
Data as JSON: /api/errors/d1b603919a9899f5.
Report an issue: GitHub.