eslint-plugin-cypress 6.2.2 → 6.2.3
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.
|
@@ -79,13 +79,17 @@ function isIdentifierNumberConstArgument(node, scope) {
|
|
|
79
79
|
// we don't know if WAIT is a number or alias '@someRequest', so don't fail
|
|
80
80
|
if (definition.type === 'ImportBinding') return false
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
// Get the identifier's parent node to check for a default value.
|
|
83
|
+
// For `function wait (amount = 1) { ... }`, `definition.name` is the `amount` Identifier,
|
|
84
|
+
// and its parent is the AssignmentPattern `amount = 1`.
|
|
85
|
+
// This also handles destructured parameters like `function wait ({ ms = 1 }) { ... }`.
|
|
86
|
+
const nameParent = definition.name.parent
|
|
83
87
|
|
|
84
88
|
// function wait (amount) { cy.wait(amount) }
|
|
85
89
|
// we can't know the type of value, so don't fail
|
|
86
|
-
if (!
|
|
90
|
+
if (!nameParent || nameParent.type !== 'AssignmentPattern') return false
|
|
87
91
|
|
|
88
92
|
// function wait (amount = 1) { cy.wait(amount) } or
|
|
89
93
|
// function wait (amount = '@alias') { cy.wait(amount) }
|
|
90
|
-
return typeof
|
|
94
|
+
return typeof nameParent.right.value === 'number'
|
|
91
95
|
}
|