Skip to content

Commit dc22026

Browse files
Merge pull request #141 from gkorakas-eli/fix/issue-with-unsafe-to-chain-command-that-is-not-action
fix: issue with unsafe to chain command that is not an action
2 parents 87f35e0 + 3f22c8e commit dc22026

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/rules/unsafe-to-chain-command.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const unsafeToChainActions = [
1919
'check',
2020
'dblclick',
2121
'each',
22-
'focus$',
22+
'focus',
2323
'rightclick',
2424
'screenshot',
2525
'scrollIntoView',
@@ -130,7 +130,7 @@ const isRootCypress = (node) => {
130130
*/
131131
const isActionUnsafeToChain = (node, additionalMethods = []) => {
132132
const unsafeActionsRegex = new RegExp([
133-
...unsafeToChainActions,
133+
...unsafeToChainActions.map((action) => `^${action}$`),
134134
...additionalMethods.map((method) => method instanceof RegExp ? method.source : method),
135135
].join('|'))
136136

tests/lib/rules/unsafe-to-chain-command.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ ruleTester.run('action-ends-chain', rule, {
1818
code: 'cy.focused().should("be.visible");',
1919
parserOptions,
2020
},
21+
{
22+
code: 'cy.submitBtn().click();',
23+
parserOptions,
24+
},
2125
],
2226

2327
invalid: [

0 commit comments

Comments
 (0)