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

ci: cause skipped tests linting error #827

Merged
merged 1 commit into from Apr 22, 2024

Conversation

MikeMcC399
Copy link
Contributor

Issue

eslint-plugin-mocha is configured inconsistently in this repo regarding the rules:

Since it is undesirable to have .only or .skip in the example test specs, both should be configured to error on linting.

Change

Add mocha/no-skipped-tests error to the configuration in .eslintrc.

 "rules": {
    ...
    "mocha/no-skipped-tests": "error",
    ...
  }

Verification

Temporarily modify the file cypress/e2e/2-advanced-examples/actions.cy.js to add an exclusive test and a skipped test:

  • Change context to context.only
  • Change the first occurence of it to it.skip

and execute:

npm ci
npx eslint cypress

confirm that linting errors (no warnings) are reported:

$ npx eslint cypress

   3:9  error  Unexpected exclusive mocha test  mocha/no-exclusive-tests
  10:6  error  Unexpected skipped mocha test    mocha/no-skipped-tests

✖ 2 problems (2 errors, 0 warnings)

@cypress-app-bot
Copy link
Collaborator

@MikeMcC399 MikeMcC399 marked this pull request as ready for review April 22, 2024 10:14
Copy link
Member

@jennifer-shehane jennifer-shehane left a comment

Choose a reason for hiding this comment

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

Yah for this example app it should error in this case.

@jennifer-shehane jennifer-shehane merged commit dbd7233 into cypress-io:master Apr 22, 2024
12 checks passed
@MikeMcC399 MikeMcC399 deleted the mocha-skipped-tests branch April 23, 2024 06:50
@cypress-app-bot
Copy link
Collaborator

🎉 This PR is included in version 2.0.7 🎉

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
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants