Skip to content

Commit

Permalink
fix: issue with unsafe to chain command that is not an action
Browse files Browse the repository at this point in the history
  • Loading branch information
gkorakas-eli committed Aug 30, 2023
1 parent b9f7a26 commit 93824e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/unsafe-to-chain-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const isRootCypress = (node) => {
*/
const isActionUnsafeToChain = (node, additionalMethods = []) => {
const unsafeActionsRegex = new RegExp([
...unsafeToChainActions,
...unsafeToChainActions.map((action) => `^${action}$`),
...additionalMethods.map((method) => method instanceof RegExp ? method.source : method),
].join('|'))

Expand Down
4 changes: 4 additions & 0 deletions tests/lib/rules/unsafe-to-chain-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ ruleTester.run('action-ends-chain', rule, {
code: 'cy.get("new-todo").type("todo A{enter}"); cy.get("new-todo").type("todo B{enter}"); cy.get("new-todo").should("have.class", "active");',
parserOptions,
},
{
code: 'cy.submitBtn().click();',
parserOptions,
},
],

invalid: [
Expand Down

0 comments on commit 93824e4

Please sign in to comment.