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

feat: apply no-pause rule recursively #189

Merged

Conversation

tom9744
Copy link
Contributor

@tom9744 tom9744 commented Apr 24, 2024

Issue

The cypress/no-pause rule only applies to a parent node.

Changes

Convert the isCypressCall function into a recursive function to detect chained calls such as cy.get("...").pause();.

Closes #147

@CLAassistant
Copy link

CLAassistant commented Apr 24, 2024

CLA assistant check
All committers have signed the CLA.

@cypress-app-bot
Copy link

@tom9744 tom9744 changed the title fix: apply no-pause rule recursively #147 fix: apply no-pause rule recursively Apr 24, 2024
@MikeMcC399
Copy link
Collaborator

@tom9744

I would class your PR as a feature not a fix, since it extends the documented functionality, so the commit message would need to start with feat:, for example: feat: apply no-pause rule recursively

You would also need to sign the SLA before the Cypress.io team could consider your PR.

@tom9744 tom9744 force-pushed the user/tom9744/recursive-no-pause branch from e47aedd to eb900fc Compare April 24, 2024 14:39
@tom9744 tom9744 changed the title fix: apply no-pause rule recursively feat: apply no-pause rule recursively Apr 24, 2024
@tom9744
Copy link
Contributor Author

tom9744 commented Apr 24, 2024

@MikeMcC399 Thank you for your guidance. I was on the fence about which prefix to choose.

@MikeMcC399
Copy link
Collaborator

@tom9744

The documentation has been reworked since you submitted this PR. Could you rebase your PR? Sorry for the inconvenience!

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.

Please resolve the conflicts due to changes that have been done since this PR was submitted.

@tom9744 tom9744 force-pushed the user/tom9744/recursive-no-pause branch from eb900fc to 8696387 Compare May 3, 2024 12:47
@tom9744 tom9744 requested a review from MikeMcC399 May 3, 2024 12:48
@tom9744
Copy link
Contributor Author

tom9744 commented May 3, 2024

I rebased my PR and resolved all conflicts!

@MikeMcC399
Copy link
Collaborator

@tom9744

Many thanks for your contribution! All looks good!

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

npm install https://github.com/tom9744/eslint-plugin-cypress#user/tom9744/recursive-no-pause

and additional test-spec cypress/e2e/pause.cy.js

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

context('eslinting', () => {
  it('pausing', () => {
    cy.pause()
    cy.visit('https://example.cypress.io').pause()
  })
})

Add "cypress/no-pause": "error" to .eslintrc rules.
(The rule no-pause is not in the set of recommended rules.)

eslint-plugin-cypress result PR
2.11.3 no failure (1) -
2.12.1 (2) #85 + #86
3.0.3 (2) -
PR #189 (3) #189

(1) Note: rule cypress/no-pause not yet available in this version
(2) Only cy.pause() detected
(3) All uses of .pause() detected

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.

This is a good enhancement to the rule cypress/no-pause !

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

🎉 This PR is included in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

cypress/no-pause is not working if the command is chained
5 participants