eslint-plugin-jest 26.4.1 → 26.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -32,13 +32,6 @@ var _default = (0, _utils.createRule)({
|
|
|
32
32
|
let suiteDepth = 0;
|
|
33
33
|
let testDepth = 0;
|
|
34
34
|
return {
|
|
35
|
-
'CallExpression[callee.name=/^(it|test)$/][arguments.length<2]'(node) {
|
|
36
|
-
context.report({
|
|
37
|
-
messageId: 'missingFunction',
|
|
38
|
-
node
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
|
-
|
|
42
35
|
CallExpression(node) {
|
|
43
36
|
const jestFnCall = (0, _utils.parseJestFnCall)(node, context.getScope());
|
|
44
37
|
|
|
@@ -52,6 +45,13 @@ var _default = (0, _utils.createRule)({
|
|
|
52
45
|
|
|
53
46
|
if (jestFnCall.type === 'test') {
|
|
54
47
|
testDepth++;
|
|
48
|
+
|
|
49
|
+
if (node.arguments.length < 2) {
|
|
50
|
+
context.report({
|
|
51
|
+
messageId: 'missingFunction',
|
|
52
|
+
node
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
if ( // the only jest functions that are with "x" are "xdescribe", "xtest", and "xit"
|
package/lib/rules/no-if.js
CHANGED
|
@@ -9,7 +9,7 @@ var _utils = require("@typescript-eslint/utils");
|
|
|
9
9
|
|
|
10
10
|
var _utils2 = require("./utils");
|
|
11
11
|
|
|
12
|
-
const testCaseNames = new Set([...Object.keys(_utils2.TestCaseName), 'it.only', 'it.
|
|
12
|
+
const testCaseNames = new Set([...Object.keys(_utils2.TestCaseName), 'it.only', 'it.only', 'it.skip', 'it.skip', 'test.only', 'test.only', 'test.skip', 'test.skip', 'fit.concurrent']);
|
|
13
13
|
|
|
14
14
|
const isTestFunctionExpression = node => node.parent !== undefined && node.parent.type === _utils.AST_NODE_TYPES.CallExpression && testCaseNames.has((0, _utils2.getNodeName)(node.parent.callee));
|
|
15
15
|
|
|
@@ -64,8 +64,7 @@ const determineJestFnType = name => {
|
|
|
64
64
|
return 'unknown';
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
const ValidJestFnCallChains = ['afterAll', 'afterEach', 'beforeAll', 'beforeEach', 'describe', 'describe.each', 'describe.only', 'describe.only.each', 'describe.skip', 'describe.skip.each', 'fdescribe', 'fdescribe.each', 'xdescribe', 'xdescribe.each', 'it', 'it.concurrent', 'it.concurrent.each', 'it.concurrent.only.each', 'it.concurrent.skip.each', 'it.each', 'it.failing', 'it.only', 'it.only.each', 'it.only.failing', 'it.skip', 'it.skip.each', 'it.skip.failing', 'it.todo', 'fit', 'fit.each', 'fit.failing', 'xit', 'xit.each', 'xit.failing', 'test', 'test.concurrent', 'test.concurrent.each', 'test.concurrent.only.each', 'test.concurrent.skip.each', 'test.each', 'test.failing', 'test.only', 'test.only.each', 'test.only.failing', 'test.skip', 'test.skip.each', 'test.skip.failing', 'test.todo', 'xtest', 'xtest.each', 'xtest.failing'
|
|
68
|
-
'test.concurrent.skip', 'test.concurrent.only', 'it.concurrent.skip', 'it.concurrent.only'];
|
|
67
|
+
const ValidJestFnCallChains = ['afterAll', 'afterEach', 'beforeAll', 'beforeEach', 'describe', 'describe.each', 'describe.only', 'describe.only.each', 'describe.skip', 'describe.skip.each', 'fdescribe', 'fdescribe.each', 'xdescribe', 'xdescribe.each', 'it', 'it.concurrent', 'it.concurrent.each', 'it.concurrent.only.each', 'it.concurrent.skip.each', 'it.each', 'it.failing', 'it.only', 'it.only.each', 'it.only.failing', 'it.skip', 'it.skip.each', 'it.skip.failing', 'it.todo', 'fit', 'fit.each', 'fit.failing', 'xit', 'xit.each', 'xit.failing', 'test', 'test.concurrent', 'test.concurrent.each', 'test.concurrent.only.each', 'test.concurrent.skip.each', 'test.each', 'test.failing', 'test.only', 'test.only.each', 'test.only.failing', 'test.skip', 'test.skip.each', 'test.skip.failing', 'test.todo', 'xtest', 'xtest.each', 'xtest.failing'];
|
|
69
68
|
|
|
70
69
|
const parseJestFnCall = (node, scope) => {
|
|
71
70
|
var _node$parent, _node$parent2, _resolved$original;
|