With Cypress, how to see which files will run without actually running them?

Viewed 32

I'm tinkering with my config file to improve my specPattern and excludeSpecPattern. I think it does what I want but I'd like to check without running my entire test suite to check. I'm calling cypress run on the command line with different --spec flags for different suites. Is there some way to show all of the files (and ideally a count of tests) that will run without actually running them?

When I start a run, it shows the number of specs found by my patterns, but the list is truncated. I looked through the Commands docs but didn't see a relevant option.

3 Answers

if you are using cypress 10+ and run cypress in open mode in project settings you can see number of Matched test wits specPattern, if you change a save config file it will automatically refresh the application with new config and number of tests.

To enable a "dry run" mode, try adding this temporarily to the top of /cypress/support/e2e.js

beforeEach(function() {    // use function to gain access to Mocha context (this)
  this.skip()
})

Take a look at find-cypress-specs

Find Cypress spec files using the config settings

npx find-cypress-specs 
# prints all spec files separated by a comma
cypress/e2e/spec.js,cypress/e2e/featureA/user.js
Related