question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cypress is reporting no specs found, but the spec definitely exists

See original GitHub issue

Current 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:open
  • Created a year ago
  • Reactions:2
  • Comments:22 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
hamzafarooq333commented, Jul 4, 2022

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:

  • cypress/integration/examples/abc.js

now if we want to run the newly created folder under the integration folder then alter the property into the cypres.config.json file.

  • specPattern: ‘cypress/integration/**/*.js’

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

4reactions
jquintozamoracommented, Oct 15, 2022

I managed to resolve this issue by specifying both: specPattern + spec. Being specPattern more general and spec 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found