eslint-plugin-jest 25.0.1 → 25.0.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [25.0.2](https://github.com/jest-community/eslint-plugin-jest/compare/v25.0.1...v25.0.2) (2021-10-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **valid-expect-in-promise:** support out of order awaits ([#939](https://github.com/jest-community/eslint-plugin-jest/issues/939)) ([07d2137](https://github.com/jest-community/eslint-plugin-jest/commit/07d213719de974d6b5a1cab75e836dc39b432f87))
|
|
7
|
+
|
|
1
8
|
## [25.0.1](https://github.com/jest-community/eslint-plugin-jest/compare/v25.0.0...v25.0.1) (2021-10-10)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.preprocess = exports.postprocess = void 0;
|
|
7
7
|
|
|
8
8
|
// https://eslint.org/docs/developer-guide/working-with-plugins#processors-in-plugins
|
|
9
9
|
// https://github.com/typescript-eslint/typescript-eslint/issues/808
|
package/lib/rules/utils.js
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.getAccessorValue = exports.followTypeAssertionChain = exports.createRule = exports.TestCaseProperty = exports.TestCaseName = exports.ModifierName = exports.HookName = exports.EqualityMatcher = exports.DescribeProperty = exports.DescribeAlias = void 0;
|
|
6
7
|
exports.getNodeName = getNodeName;
|
|
7
|
-
exports.scopeHasLocalReference = exports.
|
|
8
|
+
exports.scopeHasLocalReference = exports.parseExpectCall = exports.isTestCaseCall = exports.isSupportedAccessor = exports.isStringNode = exports.isParsedEqualityMatcherCall = exports.isIdentifier = exports.isHook = exports.isFunction = exports.isExpectMember = exports.isExpectCall = exports.isDescribeCall = exports.hasOnlyOneArgument = exports.getTestCallExpressionsFromDeclaredVariables = exports.getStringValue = void 0;
|
|
8
9
|
|
|
9
10
|
var _path = require("path");
|
|
10
11
|
|
|
@@ -61,7 +62,8 @@ const isStringLiteral = (node, value) => node.type === _experimentalUtils.AST_NO
|
|
|
61
62
|
*
|
|
62
63
|
* @template V
|
|
63
64
|
*/
|
|
64
|
-
const isTemplateLiteral = (node, value) => node.type === _experimentalUtils.AST_NODE_TYPES.TemplateLiteral && node.quasis.length === 1 && (
|
|
65
|
+
const isTemplateLiteral = (node, value) => node.type === _experimentalUtils.AST_NODE_TYPES.TemplateLiteral && node.quasis.length === 1 && ( // bail out if not simple
|
|
66
|
+
value === undefined || node.quasis[0].value.raw === value);
|
|
65
67
|
|
|
66
68
|
/**
|
|
67
69
|
* Checks if the given `node` is a {@link StringNode}.
|
|
@@ -101,7 +101,7 @@ const isPromiseMethodThatUsesValue = (node, identifier) => {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
return
|
|
104
|
+
return (0, _utils.isIdentifier)(node.argument, name);
|
|
105
105
|
};
|
|
106
106
|
/**
|
|
107
107
|
* Attempts to determine if the runtime value represented by the given `identifier`
|
|
@@ -126,8 +126,8 @@ const isValueAwaitedOrReturned = (identifier, body) => {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
if (node.type === _experimentalUtils.AST_NODE_TYPES.ExpressionStatement) {
|
|
129
|
-
if (node.expression.type === _experimentalUtils.AST_NODE_TYPES.AwaitExpression) {
|
|
130
|
-
return
|
|
129
|
+
if (node.expression.type === _experimentalUtils.AST_NODE_TYPES.AwaitExpression && isPromiseMethodThatUsesValue(node.expression, identifier)) {
|
|
130
|
+
return true;
|
|
131
131
|
} // (re)assignment changes the runtime value, so if we've not found an
|
|
132
132
|
// await or return already we act as if we've reached the end of the body
|
|
133
133
|
|