UNPKG

774 BJavaScriptView Raw
1'use strict';
2
3const {visitIf} = require('enhance-visitors');
4const util = require('../util');
5const createAvaRule = require('../create-ava-rule');
6
7const create = context => {
8 const ava = createAvaRule();
9
10 return ava.merge({
11 CallExpression: visitIf([
12 ava.isInTestFile,
13 ava.isTestNode,
14 ])(node => {
15 if (ava.hasTestModifier('todo') && node.arguments.some(argument => util.isFunctionExpression(argument))) {
16 context.report({
17 node,
18 message: '`test.todo()` should not be passed an implementation function.',
19 });
20 }
21 }),
22 });
23};
24
25module.exports = {
26 create,
27 meta: {
28 type: 'suggestion',
29 docs: {
30 description: 'Ensure `test.todo()` is not given an implementation function.',
31 url: util.getDocsUrl(__filename),
32 },
33 schema: [],
34 },
35};