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

Conversation

gkorakas-eli
Copy link
Contributor

@gkorakas-eli gkorakas-eli commented Aug 30, 2023

On version v2.14.0 it seems there is a change in the unsafe-to-chain-command rule that causes the following issue:

#140

This is probably a quick fix on this without changing the Regex used by additional methods. The test covers the case where there is a command that is not considered an action for Cypress.

@cypress-app-bot
Copy link

…fe-to-chain-command-that-is-not-action

# Conflicts:
#	tests/lib/rules/unsafe-to-chain-command.js
@imaliouris
Copy link

any update on this?

@dqiubread
Copy link

Any update on when this will be merged and a new release cut?

@MikeMcC399 MikeMcC399 added the bug label Apr 17, 2024
@MikeMcC399
Copy link
Collaborator

@gkorakas-eli

Are you interesting in reviving this PR? It seems that it is still relevant.

@MikeMcC399
Copy link
Collaborator

@gkorakas-eli

@gkorakas-eli
Copy link
Contributor Author

gkorakas-eli commented May 2, 2024

@gkorakas-eli

@MikeMcC399
You can add the following rule to valid rules in tests/lib/rules/unsafe-to-chain-command.js and this is not going to work. The command is marked as unsafe to chain.

{ code: 'cy.submitBtn().click();', parserOptions, },

…ommand-that-is-not-action' into fix/issue-with-unsafe-to-chain-command-that-is-not-action
@MikeMcC399
Copy link
Collaborator

@gkorakas-eli

Thank you for explaining and adding the extra test!

I found the reference in #140 (comment) to the custom command submitBtn which I overlooked when I was trying to understand the history. Sorry for that.

@MikeMcC399
Copy link
Collaborator

@gkorakas-eli

Please add the text

- closes #140

to your original post so that this PR (#141) and the issue (#140) are automatically linked by GitHub.

Copy link
Collaborator

@MikeMcC399 MikeMcC399 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested against
https://github.com/cypress-io/cypress-example-kitchensink
using

npm install https://github.com/gkorakas-eli/eslint-plugin-cypress#fix/issue-with-unsafe-to-chain-command-that-is-not-action

and additional test-spec

/// <reference types="cypress" />

context('eslinting', () => {
  it('custom command', () => {
    cy.submitBtn().click()
  })
})
eslint-plugin-cypress result PR
2.13.4 no failure
2.14.0 (1)(2) #137
2.15.1 (2) #144
PR #141 no failure #141

(1) failure: cy.focused().should('have.id', 'name')
(2) failure: cy.submitBtn().click()

@jennifer-shehane jennifer-shehane merged commit dc22026 into cypress-io:master May 3, 2024
6 checks passed
@cypress-app-bot
Copy link

🎉 This PR is included in version 3.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gkorakas-eli gkorakas-eli deleted the fix/issue-with-unsafe-to-chain-command-that-is-not-action branch May 12, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cy.focused().type("text") shows cypress/unsafe-to-chain-command error
8 participants