1 | 'use strict';
|
2 |
|
3 | const {visitIf} = require('enhance-visitors');
|
4 | const util = require('../util');
|
5 | const createAvaRule = require('../create-ava-rule');
|
6 |
|
7 | const 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 |
|
28 | module.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 | };
|