{"record":{"id":"2a2fe324c9a899fd","repo":"jestjs/jest","slug":"describe-does-not-expect-any-arguments","errorCode":null,"errorMessage":"describe does not expect any arguments","messagePattern":"describe does not expect any arguments","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/jest-jasmine2/src/jasmine/Env.ts","lineNumber":411,"sourceCode":"      };\n\n      this.describe = function (\n        description: Circus.TestNameLike,\n        specDefinitions,\n      ) {\n        const suite = suiteFactory(description);\n        if (specDefinitions === undefined) {\n          throw new Error(\n            'Missing second argument. It must be a callback function.',\n          );\n        }\n        if (typeof specDefinitions !== 'function') {\n          throw new TypeError(\n            `Invalid second argument, ${specDefinitions}. It must be a callback function.`,\n          );\n        }\n        if (specDefinitions.length > 0) {\n          throw new Error('describe does not expect any arguments');\n        }\n        if (currentDeclarationSuite.markedPending) {\n          suite.pend();\n        }\n        if (currentDeclarationSuite.markedTodo) {\n          // @ts-expect-error TODO Possible error: Suite does not have todo method\n          suite.todo();\n        }\n        addSpecsToSuite(suite, specDefinitions);\n        return suite;\n      };\n\n      this.xdescribe = function (description, specDefinitions) {\n        const suite = suiteFactory(description);\n        suite.pend();\n        addSpecsToSuite(suite, specDefinitions);\n        return suite;\n      };","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/jestjs/jest/blob/8e6d128e4a278059ecddecaa97400b04c8ae5fd9/packages/jest-jasmine2/src/jasmine/Env.ts#L393-L429","documentation":"Jasmine's describe callback must declare ZERO parameters — it is invoked synchronously with no arguments (`specDefinitions.call(suite)`). If the callback function has a declared parameter (`.length > 0`), Env.describe throws this Error at Env.ts:411, because passing a function that expects arguments indicates the user misunderstands the API (likely confusing it with a spec's done callback).","triggerScenarios":"Writing `describe('x', (done) => { ... })` or `describe('x', function(done) { ... })`. The check at Env.ts:410 reads `specDefinitions.length > 0` (function arity).","commonSituations":"Confusing describe's signature with `it(name, (done) => {...})` which DOES support a done callback for async tests; copy-paste of an async spec callback into a describe; migration from another framework where suite callbacks receive context.","solutions":["Remove the parameter from the describe callback: `describe('x', () => { ... })`.","If you need async setup, put it inside `beforeAll(async () => {...})` or use the `done` callback inside `it(...)` instead."],"exampleFix":"// before\ndescribe('my suite', (done) => {\n  // done is never called by jasmine for describe\n});\n// after\ndescribe('my suite', () => {\n  beforeAll(async () => { await setup(); });\n});","handlingStrategy":"validation","validationCode":"// Enforce zero-arity describe callbacks in a wrapper.\nfunction strictDescribe(name: string, fn: () => void) {\n  if (fn.length > 0) {\n    throw new Error(`describe('${name}') callback must take no arguments (got arity ${fn.length}).`);\n  }\n  return describe(name, fn);\n}","typeGuard":"function isZeroArityFn(fn: Function): boolean {\n  return fn.length === 0;\n}","tryCatchPattern":null,"preventionTips":["Write describe callbacks as arrow functions with no parameters: `describe('x', () => {})`.","Put async setup in beforeAll(async () => {}), not in the describe callback.","Use TypeScript types that declare the describe callback with zero params."],"tags":["describe","api-misuse","jasmine","async","validation"],"backgroundTag":null,"analyzedSha":"8e6d128e4a278059ecddecaa97400b04c8ae5fd9","analyzedAt":"2026-08-10T18:11:27.960Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}