eslint-plugin-jest 28.0.0-next.5 → 28.0.0-next.6
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.
|
@@ -25,10 +25,10 @@ const reportOnViolation = (context, node, {
|
|
|
25
25
|
if (allowedSnapshotsInFile) {
|
|
26
26
|
const snapshotName = (0, _utils2.getAccessorValue)(node.expression.left.property);
|
|
27
27
|
isAllowed = allowedSnapshotsInFile.some(name => {
|
|
28
|
-
if (name
|
|
29
|
-
return name
|
|
28
|
+
if (typeof name === 'string') {
|
|
29
|
+
return snapshotName === name;
|
|
30
30
|
}
|
|
31
|
-
return snapshotName
|
|
31
|
+
return name.test(snapshotName);
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
}
|
package/lib/rules/utils/misc.js
CHANGED
|
@@ -99,11 +99,11 @@ function getNodeName(node) {
|
|
|
99
99
|
const isFunction = node => node.type === _utils.AST_NODE_TYPES.FunctionExpression || node.type === _utils.AST_NODE_TYPES.ArrowFunctionExpression;
|
|
100
100
|
exports.isFunction = isFunction;
|
|
101
101
|
const getTestCallExpressionsFromDeclaredVariables = (declaredVariables, context) => {
|
|
102
|
-
return declaredVariables.
|
|
102
|
+
return declaredVariables.flatMap(({
|
|
103
103
|
references
|
|
104
|
-
}) =>
|
|
104
|
+
}) => references.map(({
|
|
105
105
|
identifier
|
|
106
|
-
}) => identifier.parent).filter(node => node?.type === _utils.AST_NODE_TYPES.CallExpression && (0, _parseJestFnCall.isTypeOfJestFnCall)(node, context, ['test'])))
|
|
106
|
+
}) => identifier.parent).filter(node => node?.type === _utils.AST_NODE_TYPES.CallExpression && (0, _parseJestFnCall.isTypeOfJestFnCall)(node, context, ['test'])));
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
/**
|