DEV Community

Cover image for Set up Cypress in your React Project
Pere Sola
Pere Sola

Posted on • Updated on

Set up Cypress in your React Project

  1. npm install -D cypress => install Cypress as dev dependency
  2. You can create a script in package.json to open cypress:
"scripts": {
     "cy:open": "cypress open"
}
Enter fullscreen mode Exit fullscreen mode
  1. npm run cy:open => starts the cypress test runner
  2. You can create a script in package.json to run Cypress tests in the terminal (so you can, for instance, run it in continuous integration):
"scripts": {
     "cy:run": "cypress run --spec \"cypress/integration/app/**/*\""
}
Enter fullscreen mode Exit fullscreen mode

^ you will have to create a app folder inside cypress/integration, a good place to keep your tests.

Top comments (0)