docs: add mocha instructions to readme #181
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
.only
and.skip
rule needs #180Issue
Users have requested linting support to detect
.only
and.skip
constructs in Cypress test specs and have submitted issues and PRs to have these rules built in toeslint-plugin-cypress
. Adding these rules into the Cypress plugin would however duplicate the following existing working and comprehensive rules in eslint-plugin-mocha:describe.only
,it.only
,suite.only
,test.only
,context.only
andspecify.only
within the source code.describe.skip
,it.skip
,suite.skip
,test.skip
,context.skip
,specify.skip
,xdescribe
,xit
,xcontext
andxspecify
within the source code.The alternative to adding the rules to
eslint-plugin-cypress
is to install and use eslint-plugin-mocha together witheslint-plugin-cypress
.Change
A section is added to the README to describe how to use the eslint-plugin-mocha plugin together with the
eslint-plugin-cypress
plugin in order to detect.only
and.skip
usage.Verification
Verify using the working example of
eslint-plugin-cypress
andeslint-plugin-mocha
in the cypress-io/cypress-example-kitchensink repo (see .eslintrc for the ESLint 8.x config file).git clone https://github.com/cypress-io/cypress-example-kitchensink cd cypress-example-kitchensink npm ci npm install eslint@8 eslint-plugin-mocha@latest -D
Modify the file
cypress/e2e/2-advanced-examples/actions.cy.js
to add an exclusive test and a skipped test:context
tocontext.only
it
toit.skip
and execute:
confirm that linting errors are reported: