Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issue with unsafe to chain command that is not an action #141

2 changes: 1 addition & 1 deletion lib/rules/unsafe-to-chain-command.js
Expand Up @@ -129,7 +129,7 @@ const isRootCypress = (node) => {
*/
const isActionUnsafeToChain = (node, additionalMethods = []) => {
const unsafeActionsRegex = new RegExp([
...unsafeToChainActions,
...unsafeToChainActions.map((action) => `^${action}$`),
gkorakas-eli marked this conversation as resolved.
Show resolved Hide resolved
...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
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