cypresse2e-testingfile-watcher

How to run tests related to changed files in Cypress


I'm using cypress to set E2E tests.

But I'm facing some troubles, because every time I implement a new feature or refactor some code, I need to run all my tests to see if my modifications doesn't broke something in my application.

In Jest we have the flag --findRelatedTests that run only related tests files modified.

I wonder if there's a way to do the same in Cypress.


Solution

  • Are you looking for the plugin cypress-watch-and-reload?

    // cypress.json
    
    {
      "cypress-watch-and-reload": {
        "watch": ["page/*", "src/*.js"]  // watch source and page-object (helper) files
      }
    }
    

    YouTube - Re-run Cypress Tests When Application Files Change