eslint-plugin-cypress
Advanced tools
Comparing version 2.7.0 to 2.8.0
@@ -24,4 +24,8 @@ /** | ||
CallExpression (node) { | ||
if (isCallingCyWait(node) && isNumberArgument(node)) { | ||
context.report({ node, messageId: 'unexpected' }) | ||
if (isCallingCyWait(node)) { | ||
const scope = context.getScope() | ||
if (isIdentifierNumberConstArgument(node, scope) || isNumberArgument(node)) { | ||
context.report({ node, messageId: 'unexpected' }) | ||
} | ||
} | ||
@@ -46,1 +50,12 @@ }, | ||
} | ||
function isIdentifierNumberConstArgument (node, scope) { | ||
if (node.arguments[0].type !== 'Identifier') { | ||
return false | ||
} | ||
const resolvedIdentifier = scope.resolve(node.arguments[0]).resolved | ||
const IdentifierValue = resolvedIdentifier.defs[0].node.init.value | ||
return typeof IdentifierValue === 'number' | ||
} |
{ | ||
"name": "eslint-plugin-cypress", | ||
"version": "2.7.0", | ||
"version": "2.8.0", | ||
"description": "An ESLint plugin for projects using Cypress", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -21,2 +21,4 @@ 'use strict' | ||
{ code: 'cy.tick(500)', parserOptions }, | ||
{ code: 'const someRequest="@someRequest"; cy.wait(someRequest)', parserOptions, errors }, | ||
], | ||
@@ -28,3 +30,4 @@ | ||
{ code: 'cy.wait(5000)', parserOptions, errors }, | ||
{ code: 'const someNumber=500; cy.wait(someNumber)', parserOptions, errors }, | ||
], | ||
}) |
@@ -11,3 +11,3 @@ 'use strict' | ||
ruleTester.run('no-dynamic-id-classes', rule, { | ||
ruleTester.run('require-data-selectors', rule, { | ||
valid: [ | ||
@@ -14,0 +14,0 @@ { code: 'cy.get(\'[data-cy=submit]\').click()', parserOptions }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22052
407