Skip to content

Commit 80c9b33

Browse files
with-heartSimenB
authored andcommittedMar 13, 2018
fix(valid-describe): add check for empty arguments (#94)
Fixes #93
1 parent fb54759 commit 80c9b33

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
 

Diff for: ‎rules/__tests__/valid-describe.test.js

+10
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ ruleTester.run('valid-describe', rule, {
7171
},
7272
],
7373
},
74+
{
75+
code: 'describe()',
76+
errors: [
77+
{
78+
message: 'Describe requires name and callback arguments',
79+
line: 1,
80+
column: 1,
81+
},
82+
],
83+
},
7484
{
7585
code: 'describe("foo", async () => {})',
7686
errors: [{ message: 'No async describe callback', line: 1, column: 17 }],

Diff for: ‎rules/valid-describe.js

+7
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ module.exports = {
3737
return {
3838
CallExpression(node) {
3939
if (isDescribe(node)) {
40+
if (node.arguments.length === 0) {
41+
return context.report({
42+
message: 'Describe requires name and callback arguments',
43+
loc: node.loc,
44+
});
45+
}
46+
4047
const name = node.arguments[0];
4148
const callbackFunction = node.arguments[1];
4249
if (!isString(name)) {

0 commit comments

Comments
 (0)
Please sign in to comment.