Socket
Socket
Sign inDemoInstall

eslint-plugin-testing-library

Package Overview
Dependencies
Maintainers
2
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-testing-library - npm Package Compare versions

Comparing version 3.9.1 to 3.9.2

2

package.json
{
"name": "eslint-plugin-testing-library",
"version": "3.9.1",
"version": "3.9.2",
"description": "ESLint rules for Testing Library",

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

@@ -37,2 +37,3 @@ "use strict";

type: 'string',
enum: utils_1.PRESENCE_MATCHERS,
},

@@ -73,8 +74,18 @@ customQueryNames: {

else if (assertion) {
var expectation = node.parent.parent.parent;
if (expectation.type === 'MemberExpression' &&
expectation.property.type === 'Identifier' &&
expectation.property.name !== assertion) {
var expectCallNode = node_utils_1.findClosestCallNode(node, 'expect');
var expectStatement = expectCallNode.parent;
var property = expectStatement.property;
var matcher = property.name;
var isNegatedMatcher = false;
if (matcher === 'not' &&
node_utils_1.isMemberExpression(expectStatement.parent) &&
node_utils_1.isIdentifier(expectStatement.parent.property)) {
isNegatedMatcher = true;
matcher = expectStatement.parent.property.name;
}
var shouldEnforceAssertion = (!isNegatedMatcher && utils_1.PRESENCE_MATCHERS.includes(matcher)) ||
(isNegatedMatcher && utils_1.ABSENCE_MATCHERS.includes(matcher));
if (shouldEnforceAssertion && matcher !== assertion) {
context.report({
node: expectation.property,
node: property,
messageId: 'preferExplicitAssertAssertion',

@@ -81,0 +92,0 @@ data: {

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

var QUERIES_REGEXP = new RegExp("^(get|query)(All)?(" + utils_1.ALL_QUERIES_METHODS.join('|') + ")$");
var PRESENCE_MATCHERS = ['toBeInTheDocument', 'toBeTruthy', 'toBeDefined'];
var ABSENCE_MATCHERS = ['toBeNull', 'toBeFalsy'];
function isThrowingQuery(node) {

@@ -50,7 +48,7 @@ return node.name.startsWith('get');

var validMatchers = isThrowingQuery(node)
? PRESENCE_MATCHERS
: ABSENCE_MATCHERS;
? utils_1.PRESENCE_MATCHERS
: utils_1.ABSENCE_MATCHERS;
var invalidMatchers = isThrowingQuery(node)
? ABSENCE_MATCHERS
: PRESENCE_MATCHERS;
? utils_1.ABSENCE_MATCHERS
: utils_1.PRESENCE_MATCHERS;
var messageId = isThrowingQuery(node)

@@ -57,0 +55,0 @@ ? 'absenceQuery'

@@ -10,3 +10,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.LIBRARY_MODULES = exports.TESTING_FRAMEWORK_SETUP_HOOKS = exports.ASYNC_UTILS = exports.ALL_QUERIES_COMBINATIONS = exports.ASYNC_QUERIES_COMBINATIONS = exports.SYNC_QUERIES_COMBINATIONS = exports.ALL_QUERIES_METHODS = exports.ALL_QUERIES_VARIANTS = exports.ASYNC_QUERIES_VARIANTS = exports.SYNC_QUERIES_VARIANTS = exports.getDocsUrl = void 0;
exports.ABSENCE_MATCHERS = exports.PRESENCE_MATCHERS = exports.LIBRARY_MODULES = exports.TESTING_FRAMEWORK_SETUP_HOOKS = exports.ASYNC_UTILS = exports.ALL_QUERIES_COMBINATIONS = exports.ASYNC_QUERIES_COMBINATIONS = exports.SYNC_QUERIES_COMBINATIONS = exports.ALL_QUERIES_METHODS = exports.ALL_QUERIES_VARIANTS = exports.ASYNC_QUERIES_VARIANTS = exports.SYNC_QUERIES_VARIANTS = exports.getDocsUrl = void 0;
var combineQueries = function (variants, methods) {

@@ -68,1 +68,5 @@ var combinedQueries = [];

exports.TESTING_FRAMEWORK_SETUP_HOOKS = TESTING_FRAMEWORK_SETUP_HOOKS;
var PRESENCE_MATCHERS = ['toBeInTheDocument', 'toBeTruthy', 'toBeDefined'];
exports.PRESENCE_MATCHERS = PRESENCE_MATCHERS;
var ABSENCE_MATCHERS = ['toBeNull', 'toBeFalsy'];
exports.ABSENCE_MATCHERS = ABSENCE_MATCHERS;
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