eslint-plugin-jest 24.3.4 → 24.3.5
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.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [24.3.5](https://github.com/jest-community/eslint-plugin-jest/compare/v24.3.4...v24.3.5) (2021-04-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **valid-describe:** support using `each` with modifiers ([#820](https://github.com/jest-community/eslint-plugin-jest/issues/820)) ([cbdbcef](https://github.com/jest-community/eslint-plugin-jest/commit/cbdbcef47984eb01509493bd5b2423f518a2663d))
|
|
7
|
+
|
|
1
8
|
## [24.3.4](https://github.com/jest-community/eslint-plugin-jest/compare/v24.3.3...v24.3.4) (2021-04-05)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -12,7 +12,7 @@ whenever you are using the exclusivity feature.
|
|
|
12
12
|
## Rule Details
|
|
13
13
|
|
|
14
14
|
This rule looks for every `describe.only`, `it.only`, `test.only`, `fdescribe`,
|
|
15
|
-
|
|
15
|
+
and `fit` occurrences within the source code. Of course there are some
|
|
16
16
|
edge-cases which can’t be detected by this rule e.g.:
|
|
17
17
|
|
|
18
18
|
```js
|
|
@@ -31,13 +31,9 @@ test.only('foo', () => {});
|
|
|
31
31
|
test['only']('bar', () => {});
|
|
32
32
|
fdescribe('foo', () => {});
|
|
33
33
|
fit('foo', () => {});
|
|
34
|
-
ftest('bar', () => {});
|
|
35
34
|
fit.each`
|
|
36
35
|
table
|
|
37
36
|
`();
|
|
38
|
-
ftest.each`
|
|
39
|
-
table
|
|
40
|
-
`();
|
|
41
37
|
```
|
|
42
38
|
|
|
43
39
|
These patterns would not be considered warnings:
|
package/lib/rules/utils.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getNodeName = getNodeName;
|
|
7
|
-
exports.scopeHasLocalReference = exports.getJestFunctionArguments = exports.isEachCall = exports.
|
|
7
|
+
exports.scopeHasLocalReference = exports.getJestFunctionArguments = exports.isEachCall = exports.isDescribeCall = exports.isTestCaseCall = exports.getTestCallExpressionsFromDeclaredVariables = exports.isHook = exports.isFunction = exports.TestCaseProperty = exports.DescribeProperty = exports.HookName = exports.TestCaseName = exports.DescribeAlias = exports.parseExpectCall = exports.isParsedEqualityMatcherCall = exports.EqualityMatcher = exports.ModifierName = exports.isExpectMember = exports.isExpectCall = exports.getAccessorValue = exports.isSupportedAccessor = exports.hasOnlyOneArgument = exports.getStringValue = exports.isStringNode = exports.followTypeAssertionChain = exports.createRule = void 0;
|
|
8
8
|
|
|
9
9
|
var _path = require("path");
|
|
10
10
|
|
|
@@ -470,10 +470,6 @@ const isDescribeCall = node => {
|
|
|
470
470
|
|
|
471
471
|
return false;
|
|
472
472
|
};
|
|
473
|
-
|
|
474
|
-
exports.isDescribeCall = isDescribeCall;
|
|
475
|
-
|
|
476
|
-
const isDescribe = node => node.callee.type === _experimentalUtils.AST_NODE_TYPES.Identifier && DescribeAlias.hasOwnProperty(node.callee.name) || node.callee.type === _experimentalUtils.AST_NODE_TYPES.MemberExpression && node.callee.object.type === _experimentalUtils.AST_NODE_TYPES.Identifier && DescribeAlias.hasOwnProperty(node.callee.object.name) && node.callee.property.type === _experimentalUtils.AST_NODE_TYPES.Identifier && DescribeProperty.hasOwnProperty(node.callee.property.name) || node.callee.type === _experimentalUtils.AST_NODE_TYPES.TaggedTemplateExpression && node.callee.tag.type === _experimentalUtils.AST_NODE_TYPES.MemberExpression && node.callee.tag.object.type === _experimentalUtils.AST_NODE_TYPES.Identifier && DescribeAlias.hasOwnProperty(node.callee.tag.object.name);
|
|
477
473
|
/**
|
|
478
474
|
* Checks if the given node` is a call to `<describe|test|it>.each(...)()`.
|
|
479
475
|
* If `true`, the code must look like `<method>.each(...)()`.
|
|
@@ -484,7 +480,7 @@ const isDescribe = node => node.callee.type === _experimentalUtils.AST_NODE_TYPE
|
|
|
484
480
|
*/
|
|
485
481
|
|
|
486
482
|
|
|
487
|
-
exports.
|
|
483
|
+
exports.isDescribeCall = isDescribeCall;
|
|
488
484
|
|
|
489
485
|
const isEachCall = node => {
|
|
490
486
|
var _node$parent3;
|
|
@@ -41,7 +41,7 @@ var _default = (0, _utils.createRule)({
|
|
|
41
41
|
create(context) {
|
|
42
42
|
return {
|
|
43
43
|
CallExpression(node) {
|
|
44
|
-
if (!(0, _utils.
|
|
44
|
+
if (!(0, _utils.isDescribeCall)(node) || node.callee.type === _experimentalUtils.AST_NODE_TYPES.TaggedTemplateExpression) {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
|