Giter Site home page Giter Site logo

wlsf82 / cy-eslint-example Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 0.0 56 KB

Sample project to demonstrate the rules of eslint-plugin-cypress.

Home Page: https://www.youtube.com/live/3WEQ23HfzQU?feature=share

License: MIT License

JavaScript 47.77% HTML 52.23%
cypress cypress-io eslint talking-about-testing testing web-testing eslint-plugin-cypress

cy-eslint-example's Introduction

cy-eslint-example

ESLint

Sample project to demonstrate the rules of eslint-plugin-cypress.


Pre-requirements

To clone and run this project, you will need:

  • git (I've used version 2.34.1 while writing this doc)
  • Node.js (I've used version v18.13.0 while writing this doc)
  • npm (I've used version 8.19.3 while writing this doc)

Note: When installing Node.js, npm is automatically installed too.

Installation

To install the dev dependencies, run npm install (or npm i for short.)

Running the static code analysis

To run the EcmaScript static code analysis, run npm run lint.

Below is an example of some linting issues.

   7:5   error    Do not assign the return value of a Cypress command                                                                                                                  cypress/no-assigning-return-values
   7:11  error    'heading' is assigned a value but never used                                                                                                                         no-unused-vars
   7:21  warning  use data-* attribute selectors instead of classes or tag names                                                                                                       cypress/require-data-selectors
  11:5   error    Do not wait for arbitrary time periods                                                                                                                               cypress/no-unnecessary-waiting
  14:3   error    Avoid using async functions with Cypress tests                                                                                                                       cypress/no-async-tests
  15:11  error    'heading' is assigned a value but never used                                                                                                                         no-unused-vars
  15:27  warning  use data-* attribute selectors instead of classes or tag names                                                                                                       cypress/require-data-selectors
  19:5   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
  19:5   warning  use data-* attribute selectors instead of classes or tag names                                                                                                       cypress/require-data-selectors
  25:5   warning  use data-* attribute selectors instead of classes or tag names                                                                                                       cypress/require-data-selectors
  26:5   error    Do not use force on click and type calls                                                                                                                             cypress/no-force
  26:5   warning  use data-* attribute selectors instead of classes or tag names                                                                                                       cypress/require-data-selectors
  30:5   error    Make an assertion on the page state before taking a screenshot                                                                                                       cypress/assertion-before-screenshot
  34:5   warning  use data-* attribute selectors instead of classes or tag names                                                                                                       cypress/require-data-selectors
  38:5   error    Do not use cy.pause command                                                                                                                                          cypress/no-pause

✖ 15 problems (9 errors, 6 warnings)

Support this project

To support this project, leave a ⭐.


Made with ❤️ by Walmyr.

cy-eslint-example's People

Contributors

wlsf82 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.