{"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":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/jest-jasmine2/src/jasmine/Env.ts","lineNumber":410,"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":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/jestjs/jest/blob/f49721c78e195558b40913977c9230f5b7f559d8/packages/jest-jasmine2/src/jasmine/Env.ts#L392-L428","documentation":"A describe() callback must declare zero parameters. Env.ts:409-411 throws when specDefinitions.length > 0 (the function's declared arity), because Jasmine does not pass any argument to the describe body and a parameter suggests the author expects injection that never happens — a likely bug.","triggerScenarios":"Writing `describe('name', (done) => {...})` or `describe('name', function(ctx){...})`. Function .length is the number of declared params before defaults; >0 triggers the throw at line 410.","commonSituations":"Confusing describe with it (which can take a done callback); refactoring an async test into a suite but leaving the done parameter; using an arrow that declares an unused param.","solutions":["Remove the parameter from the describe callback: describe('name', () => {...}).","If you need async behavior, put it inside an it/beforeAll with a done argument or use async functions there — describe bodies must be synchronous and parameterless."],"exampleFix":"// before — describe callback declares a param\ndescribe('api', (done) => { it('works', () => {}); });\n\n// after — parameterless describe\ndescribe('api', () => {\n  beforeAll((done) => { setup(done); });\n  it('works', () => {});\n});","handlingStrategy":"validation","validationCode":"function assertDescribeArity(fn: Function) {\n  if (fn.length > 0) throw new Error('describe callback must take no arguments');\n}","typeGuard":"function isZeroArityFn(fn: Function): boolean { return fn.length === 0; }","tryCatchPattern":null,"preventionTips":["Write describe callbacks as parameterless arrows: describe('x', () => {...}).","Reserve done/async params for it/before*/after*, never describe."],"tags":["jasmine2","describe","api-misuse","arity","test-structure"],"analyzedSha":"f49721c78e195558b40913977c9230f5b7f559d8","analyzedAt":"2026-08-03T20:16:28.571Z","schemaVersion":2}