DEV Community

loading...
Cover image for Set up Cypress in your React Project

Set up Cypress in your React Project

Pere Sola
Account Manager @Stripe during the day. Full stack software developer after-hours. @LambdaSchool graduate
Updated on ・1 min read
  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.

Discussion (0)