diff --git a/rules/__tests__/valid-describe.test.js b/rules/__tests__/valid-describe.test.js index 2db4a2c3d..618184afe 100644 --- a/rules/__tests__/valid-describe.test.js +++ b/rules/__tests__/valid-describe.test.js @@ -71,6 +71,16 @@ ruleTester.run('valid-describe', rule, { }, ], }, + { + code: 'describe()', + errors: [ + { + message: 'Describe requires name and callback arguments', + line: 1, + column: 1, + }, + ], + }, { code: 'describe("foo", async () => {})', errors: [{ message: 'No async describe callback', line: 1, column: 17 }], diff --git a/rules/valid-describe.js b/rules/valid-describe.js index a44412c27..3da198064 100644 --- a/rules/valid-describe.js +++ b/rules/valid-describe.js @@ -37,6 +37,13 @@ module.exports = { return { CallExpression(node) { if (isDescribe(node)) { + if (node.arguments.length === 0) { + return context.report({ + message: 'Describe requires name and callback arguments', + loc: node.loc, + }); + } + const name = node.arguments[0]; const callbackFunction = node.arguments[1]; if (!isString(name)) {