Socket
Socket
Sign inDemoInstall

eslint-plugin-jest

Package Overview
Dependencies
Maintainers
10
Versions
325
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-jest - npm Package Compare versions

Comparing version 24.1.0 to 24.1.1

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [24.1.1](https://github.com/jest-community/eslint-plugin-jest/compare/v24.1.0...v24.1.1) (2020-11-12)
### Bug Fixes
* improve support for it.each involving tagged template literals ([#701](https://github.com/jest-community/eslint-plugin-jest/issues/701)) ([2341814](https://github.com/jest-community/eslint-plugin-jest/commit/2341814060b38c55728c0b456d7b432f1e0e1a11))
# [24.1.0](https://github.com/jest-community/eslint-plugin-jest/compare/v24.0.2...v24.1.0) (2020-10-05)

@@ -2,0 +9,0 @@

2

docs/rules/valid-title.md

@@ -46,3 +46,3 @@ # Enforce valid titles (`valid-title`)

Titles for test blocks should always be a string literal or expression.
Titles for test blocks should always be a string.

@@ -49,0 +49,0 @@ This is also applied to `describe` blocks by default, but can be turned off via

@@ -63,2 +63,4 @@ "use strict";

const funcNode = node.callee.type === _experimentalUtils.AST_NODE_TYPES.TaggedTemplateExpression ? node.callee.tag : node.callee;
if ((0, _utils.isTestCase)(node) && describeNestingLevel === 0 && !nodeName.includes(testKeyword)) {

@@ -73,3 +75,3 @@ const oppositeTestKeyword = getOppositeTestKeyword(testKeyword);

},
fix: buildFixer(node.callee, nodeName, testKeyword)
fix: buildFixer(funcNode, nodeName, testKeyword)
});

@@ -87,3 +89,3 @@ }

},
fix: buildFixer(node.callee, nodeName, testKeywordWithinDescribe)
fix: buildFixer(funcNode, nodeName, testKeywordWithinDescribe)
});

@@ -90,0 +92,0 @@ }

@@ -53,4 +53,6 @@ "use strict";

CallExpression(node) {
const functionName = (0, _utils.getNodeName)(node.callee);
const functionName = (0, _utils.getNodeName)(node.callee); // prevent duplicate warnings for it.each()()
if (node.callee.type === 'CallExpression') return;
switch (functionName) {

@@ -68,2 +70,6 @@ case 'describe.skip':

case 'test.concurrent.skip':
case 'it.skip.each':
case 'test.skip.each':
case 'xit.each':
case 'xtest.each':
context.report({

@@ -70,0 +76,0 @@ messageId: 'skippedTest',

@@ -8,2 +8,4 @@ "use strict";

var _experimentalUtils = require("@typescript-eslint/experimental-utils");
var _utils = require("./utils");

@@ -35,2 +37,3 @@

if (!preferredNodeName) return;
const funcNode = node.callee.type === _experimentalUtils.AST_NODE_TYPES.TaggedTemplateExpression ? node.callee.tag : node.callee;
context.report({

@@ -44,3 +47,3 @@ messageId: 'usePreferredName',

fix(fixer) {
return [fixer.replaceText(node.callee, preferredNodeName)];
return [fixer.replaceText(funcNode, preferredNodeName)];
}

@@ -60,9 +63,10 @@

const firstChar = nodeName.charAt(0);
const suffix = nodeName.endsWith('.each') ? '.each' : '';
if (firstChar === 'f') {
return `${nodeName.slice(1)}.only`;
return `${nodeName.slice(1).replace('.each', '')}.only${suffix}`;
}
if (firstChar === 'x') {
return `${nodeName.slice(1)}.skip`;
return `${nodeName.slice(1).replace('.each', '')}.skip${suffix}`;
}

@@ -69,0 +73,0 @@

@@ -366,2 +366,5 @@ "use strict";

switch (node.type) {
case _experimentalUtils.AST_NODE_TYPES.TaggedTemplateExpression:
return getNodeName(node.tag);
case _experimentalUtils.AST_NODE_TYPES.MemberExpression:

@@ -396,3 +399,5 @@ return joinNames(getNodeName(node.object), getNodeName(node.property));

const isTestCase = node => node.callee.type === _experimentalUtils.AST_NODE_TYPES.Identifier && TestCaseName.hasOwnProperty(node.callee.name) || node.callee.type === _experimentalUtils.AST_NODE_TYPES.MemberExpression && node.callee.property.type === _experimentalUtils.AST_NODE_TYPES.Identifier && TestCaseProperty.hasOwnProperty(node.callee.property.name) && (node.callee.object.type === _experimentalUtils.AST_NODE_TYPES.Identifier && TestCaseName.hasOwnProperty(node.callee.object.name) || node.callee.object.type === _experimentalUtils.AST_NODE_TYPES.MemberExpression && node.callee.object.object.type === _experimentalUtils.AST_NODE_TYPES.Identifier && TestCaseName.hasOwnProperty(node.callee.object.object.name));
const isTestCase = node => node.callee.type === _experimentalUtils.AST_NODE_TYPES.Identifier && TestCaseName.hasOwnProperty(node.callee.name) || // e.g. it.each``()
node.callee.type === _experimentalUtils.AST_NODE_TYPES.TaggedTemplateExpression && node.callee.tag.type === _experimentalUtils.AST_NODE_TYPES.MemberExpression && isSupportedAccessor(node.callee.tag.property, TestCaseProperty.each) || // e.g. it.concurrent.{skip,only}
node.callee.type === _experimentalUtils.AST_NODE_TYPES.MemberExpression && node.callee.property.type === _experimentalUtils.AST_NODE_TYPES.Identifier && TestCaseProperty.hasOwnProperty(node.callee.property.name) && (node.callee.object.type === _experimentalUtils.AST_NODE_TYPES.Identifier && TestCaseName.hasOwnProperty(node.callee.object.name) || node.callee.object.type === _experimentalUtils.AST_NODE_TYPES.MemberExpression && node.callee.object.object.type === _experimentalUtils.AST_NODE_TYPES.Identifier && TestCaseName.hasOwnProperty(node.callee.object.object.name));

@@ -399,0 +404,0 @@ exports.isTestCase = isTestCase;

{
"name": "eslint-plugin-jest",
"version": "24.1.0",
"version": "24.1.1",
"description": "Eslint rules for Jest",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc