oxc-project/oxc · error
Describe requires name and callback arguments
Error message
Describe requires name and callback arguments
What it means
Diagnostic from the oxlint `jest/valid-describe-callback` rule (source: crates/oxc_linter/src/rules/shared/jest_vitest/valid_describe_callback.rs:18). This variant ('Describe requires name and callback arguments') fires when a `describe()` call has fewer than two arguments - missing the title or the callback. Jest would misbehave or error at runtime, so this rule catches the mistake at lint time.
Source
Thrown at crates/oxc_linter/src/rules/shared/jest_vitest/valid_describe_callback.rs:18
use oxc_ast::{
AstKind,
ast::{Argument, Expression, FunctionBody, Statement},
};
use oxc_diagnostics::OxcDiagnostic;
use oxc_span::{GetSpan, Span};
use crate::{
context::LintContext,
utils::{JestFnKind, JestGeneralFnKind, PossibleJestNode, parse_general_jest_fn_call},
};
fn valid_describe_callback_diagnostic(
x1: &'static str,
x2: &'static str,
span3: Span,
) -> OxcDiagnostic {
OxcDiagnostic::warn(x1).with_help(x2).with_label(span3)
}
#[derive(Clone, Copy)]
pub struct ValidDescribeCallbackOptions {
allow_async_describe_callback: bool,
allow_describe_options_argument: bool,
}
impl ValidDescribeCallbackOptions {
pub const JEST: Self =
Self { allow_async_describe_callback: false, allow_describe_options_argument: false };
pub const VITEST: Self =
Self { allow_async_describe_callback: true, allow_describe_options_argument: true };
}
pub fn run<'a>(
possible_jest_node: &PossibleJestNode<'a, '_>,View on GitHub (pinned to e1e7af627c)
Solutions
- Give describe both arguments: a string title and a function callback, e.g. `describe('feature', () => { /* tests */ })`.
- Delete the fragment if it is leftover scaffolding.
- If a custom wrapper around describe is being flagged, rename it or configure the framework's globals so the rule can tell them apart.
Example fix
// before
describe('user service');
// after
describe('user service', () => {
test('loads a user', () => { /* ... */ });
}); Defensive patterns
Strategy: validation
Validate before calling
// rg -nU "describe\(\'[^\']*\'\)" tests/ # describe with no callback // rg -n "describe\(\(\)" tests/
Prevention
- Use editor snippets so describe always emits title + empty callback together
- Run oxlint in the editor to catch malformed describes as you type
When it happens
Trigger: `describe('title')`, `describe(() => {})`, or `describe()` - any describe call where either the name argument or the callback argument is absent (the source checks argument count before types).
Common situations: Incomplete scaffolding left in a spec file; merge artifacts that drop a callback; auto-generated tests from scripts that emit malformed describes; typos during refactors.
Related errors
- Second argument must be a function
- Enforces a maximum depth to nested describe calls.
- Describe block title is used multiple times in the same desc
- Require test cases and hooks to be inside a `describe` block
- No async describe callback
AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20).
Data as JSON: /api/errors/2fb1662892bda3ca.
Report an issue: GitHub.