Cypress is reporting no specs found, but the spec definitely exists
See original GitHub issueCurrent behavior
When I run the following command, cypress states the spec can’t be found.
npx cypress run -C ../sc-automation/config/cypress.uat.json --spec "../sc-automation/cypress/integration/apis/partner-leads/external-single-partner-lead.spec.ts"
Cypress eventually shows the following
Can't run because no spec files were found.
We searched for specs matching this glob pattern:
> /Users/<user>/Documents/clients/abc.com/sc-automation/cypress/integration/apis/partner-leads/external-single-partner-lead.spec.ts
Desired behavior
I would expect cypress to run the defined spec as it surely exists
~/Documents/clients/abc.com/sc-automation/cypress/integration/tickets master*
❯ pwd
/Users/<user>/Documents/clients/abc.com/sc-automation/cypress/integration/tickets
See here, I am in the directory, and listing files show the spec in question
~/Documents/clients/abc.com/sc-automation/cypress/integration/apis/partner-leads master*
❯ ls -la
total 40
drwxr-xr-x 4 user staff 128 Mar 20 12:56 .
drwxr-xr-x 6 user staff 192 Dec 20 17:14 ..
-rw-r--r-- 1 user staff 15476 Mar 20 12:56 external-single-partner-lead.spec.ts
Test code to reproduce
n/a
Cypress Version
9.5
Other
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:22 (1 by maintainers)
Top Results From Across the Web
Error Messages | Cypress Documentation
No tests found. This message means that Cypress was unable to find tests in the specified file. You'll likely get this message if...
Read more >webdriverio/webdriverio - Gitter
My ide complain about browser not existing in config scope, running the test does No specs found to run, exiting with failure ,...
Read more >Cypress Cucumber processor: Cannot Run Step Definition .js ...
From your error I can tell is that the Feature file is not able to find your step definitions. Change the name of...
Read more >End-To-End Testing with Cypress - Learn With Jason
One of the things I love about Cypress but everything is in Javascript mode. ... GLEB: And if you run it now it...
Read more >Cypress - End to End Testing Framework
Cypress tests are written in JavaScript but let that not scare you, in case you are unfamiliar with JavaScript, majority of the time...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you want to run a specific folder under the integration folder, we need to change the default behavior of cypress in the cypres.config.json file.
By default the cypress does support the execution of the test if the project structure is be like:
now if we want to run the newly created folder under the integration folder then alter the property into the cypres.config.json file.
Now cypress will accept all newly created folders under which there will be different specs files.
To run the whole new folder from terminal give command:
node_modules/.bin/cypress run --spec cypress/integration/newFolder/* --headed
I managed to resolve this issue by specifying both:
specPattern
+spec
. BeingspecPattern
more general andspec
more specific.cypress run --e2e --config baseUrl='http://localhost:3000',specPattern='cypress/integration/**/**.cy.ts' --browser electron --headless --spec=cypress/integration/group1/**.cy.ts
Hope it helps others.