UNPKG

942 BJavaScriptView Raw
1'use strict';
2
3const {visitIf} = require('enhance-visitors');
4const createAvaRule = require('../create-ava-rule');
5const util = require('../util');
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 const propertyNode = util.getTestModifier(node, 'skip');
16 if (propertyNode) {
17 context.report({
18 node: propertyNode,
19 message: 'No tests should be skipped.',
20 suggest: [{
21 desc: 'Remove the `.skip`',
22 fix: fixer => fixer.replaceTextRange.apply(null, util.removeTestModifier({
23 modifier: 'skip',
24 node,
25 context,
26 })),
27 }],
28 });
29 }
30 }),
31 });
32};
33
34module.exports = {
35 create,
36 meta: {
37 type: 'suggestion',
38 docs: {
39 description: 'Ensure no tests are skipped.',
40 url: util.getDocsUrl(__filename),
41 },
42 fixable: 'code',
43 hasSuggestions: true,
44 schema: [],
45 },
46};