Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module API: is unable to pick a specific test from within the integration folder #14532

borecz opened this issue Jan 13, 2021 · 4 comments · Fixed by #14810
type: unexpected behavior User expected result, but got another


Copy link

borecz commented Jan 13, 2021

Cypress 6.2.1

Simple setup:{ spec: 'gtm/osp/', configFile: 'cypress/config/configFiles/cypress-mobile.json' })

or{ configFile: 'cypress/config/configFiles/cypress-mobile.json' })

When I use it correctly finds all the spec files (screenshot)


looking for this specific spec



Copy link

borecz commented Jan 28, 2021

any updates on this?

Copy link

The way --spec CLI parameter and{ spec: ... }) value work is different from what you select in the Cypress Desktop GUI search box.

  • inside the search box we already use the Cypress integration folder setting and ignore test files pattern to show just the specs. Thus we do not show the typical "cypress/integration" folder
  • when using --spec CLI parameter you typically are in the terminal at the root of the project. For example let's say we are in the folder ~/git/cypress-test-tiny and want to run a spec. The specs are in the folder cypress/integration/ui folder. Our files:
$ ls -R cypress/integration


So you are typing the command, and it makes sense to use the shell's path to the spec file - this way I can type the spec filename quickly


Even if you are outside the Cypress folder, you can use the relative path from the current path this way. For example, if I am in ~/git folder and my project is in ~/git/cypress-test-tiny

$ ./cypress-test-tiny/node_modules/.bin/cypress run \
  --project ~/git/cypress-test-tiny \
  --spec ./cypress-test-tiny/cypress/integration/ui/spec.js 

The same thing happens with{ spec: ... }) option. You need to use the relative path from the current folder. Some code editors even help you by showing the relative path popups, for example like my VSCode here


Finally, I will keep this ticket open:

  • I want to clarify this in our documentation
  • it would be super helpful to show the current folder in the error message to make the error understandable and remove the confusion

Copy link

cypress-bot bot commented Jan 29, 2021

The code for this is done in cypress-io/cypress#14810, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

Copy link

cypress-bot bot commented Feb 1, 2021

Released in 6.4.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v6.4.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Feb 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
type: unexpected behavior User expected result, but got another
None yet

Successfully merging a pull request may close this issue.

2 participants