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

API cy.end example fails linting cypress/unsafe-to-chain-command #5753

Open
MikeMcC399 opened this issue Mar 15, 2024 · 0 comments
Open

API cy.end example fails linting cypress/unsafe-to-chain-command #5753

MikeMcC399 opened this issue Mar 15, 2024 · 0 comments

Comments

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Mar 15, 2024

Subject

API > Other Commands > end > Examples

Description

Current behavior

The following API example for cy.end() as shown on the documentation site

cy.contains('User: Cheryl')
  .click()
  .end() // yield null
  .contains('User: Charles')
  .click() // contains looks for content in document now

fails linting with the error cypress/unsafe-to-chain-command.

Desired behavior

API > Other Commands > end > Examples should provide an example of using cy.end() which passes linting using the recommended configuration as defined by the Cypress-provided cypress-io/eslint-plugin-cypress npm module. (The example should also run.)

Test code to reproduce

git clone --branch cypress-end https://github.com/MikeMcC399/cypress-test-tiny
cd cypress-test-tiny
npm ci
npm run cypress:lint

Cypress Version

13.7.0
Also reproducible on 13.15.0

Node version

v20.11.1 -> v20.17.0

Operating System

Ubuntu 22.04.4 LTS

Debug Logs

$ npm run cypress:lint

> [email protected] cypress:lint
> eslint cypress


/home/mike/github/cypress-io/cypress-test-tiny/cypress/e2e/end.cy.js
  16:7  error  It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from `cy.` in a next command line  cypress/unsafe-to-chain-command
  27:7  error  It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from `cy.` in a next command line  cypress/unsafe-to-chain-command

✖ 2 problems (2 errors, 0 warnings)

Other

eslint Version

8.57.0

eslint-plugin-cypress Version

2.15.1 3.5.0

Related issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant