oxc-project/oxc · error
Unexpected argument(s) in describe callback
Error message
Unexpected argument(s) in describe callback
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 ('Unexpected argument(s) in describe callback') fires when the describe callback declares parameters. Jest never passes anything to a describe callback, so parameters such as `done` indicate a mistaken copy from a test callback.
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
- Delete the callback parameters: `describe('feature', () => { ... })`.
- If you need an async done-style flow, it belongs in a `test((done) => {...})` callback, not describe.
- Move setup/teardown into beforeEach/afterEach hooks instead of parameterizing describe.
Example fix
// before
describe('db', (done) => {
test('connects', () => { /* ... */ });
});
// after
describe('db', () => {
test('connects', (done) => {
connect().then(() => done());
});
}); Defensive patterns
Strategy: validation
Validate before calling
// rg -nU "describe\([^)]*,\s*\([^)]*\)\s*=>" tests/ -t ts -t js
Prevention
- Describe callbacks take zero parameters - done/a/b belong in test callbacks
- Review converted tests for leftover parameters
When it happens
Trigger: `describe('feature', (done) => { ... })` or `describe('feature', (a, b) => { ... })` - the callback's parameter list is non-empty, verified when the rule walks the function's params.
Common situations: Promoting a test into a describe without stripping its `done` parameter; converting callback-style tests to describes; IDE auto-import creating unexpected signatures.
Related errors
- 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
- Describe requires name and callback arguments
- Second argument must be a function
AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20).
Data as JSON: /api/errors/b6a00f790e9700e6.
Report an issue: GitHub.