UNPKG

786 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 MemberExpression: visitIf([
12 ava.isInTestFile,
13 ava.isInTestNode,
14 ])(node => {
15 if (node.property.name === 'skip') {
16 const root = util.getRootNode(node);
17 if (root.object.name === 't' && util.assertionMethods.has(root.property.name)) {
18 context.report({
19 node,
20 message: 'No assertions should be skipped.',
21 });
22 }
23 }
24 }),
25 });
26};
27
28module.exports = {
29 create,
30 meta: {
31 type: 'suggestion',
32 docs: {
33 description: 'Ensure no assertions are skipped.',
34 url: util.getDocsUrl(__filename),
35 },
36 schema: [],
37 },
38};