Cypress: Support having tests in separate folders

Created on 10 Jul 2018  Â·  8Comments  Â·  Source: cypress-io/cypress

Current behavior:

Tests must all exist in the same folder.

Desired behavior:

I like to store tests in the folder of the component they are testing.

When running this command
cypress run --browser chrome --spec app/components/**/*.cyp.js

I get the error:

Can't run because no spec files were found.
We searched for any files matching this glob pattern:
app/components/**/*.cyp.js

Versions

Cypress v3.0.1

Most helpful comment

@jamie-kupka-acl can you try adding integrationFolder: './' to your cypress.json ?

All 8 comments

@jamie-kupka-acl I believe you might just need quotes around your glob pattern, shown here https://docs.cypress.io/guides/guides/command-line.html#Run-tests-specifying-a-glob-of-where-to-look-for-test-files

Thanks @Bkucera but still get the same error when add quotes.

If I put the tests in cypress/integration folder and run cypress run --browser chrome --spec cypress/**/*.cyp.js, it works. But putting it in another folder it does not. Note in my cypress.json all I have set is the baseUrl

@jamie-kupka-acl can you try adding integrationFolder: './' to your cypress.json ?

Ok that does work, thanks.

@jamie-kupka-acl can you try adding integrationFolder: './' to your cypress.json ?

This seems to make my cypress GUI load forever and longer.

Is there any way to add multiple folders to the 'integrationFolder' option?

@sebastianjung The glob can match whatever folder structure you want. Try playing around on https://globster.xyz/ and find what works for the folders you want.

Jennifer,
What I add "integrationFolder": "{other-folder/cypress,cypress}/integration", in my config file, when the ide loads, all I get is an error stating "No Files Found In" "root{other-folder\cypress,cypress}\integration"

Am I doing something wrong. It doesn't seem to parse the glob in that field?

You can use combination of integration folder and test files config options to get this. Integration folder is a strict string but test files allows you to use mini match

Sent from my iPhone

On Oct 3, 2020, at 20:52, Aaron Steele notifications@github.com wrote:


Jennifer,
What I add "integrationFolder": "{other-folder/cypress,cypress}/integration", in my config file, when the ide loads, all I get is an error stating "No Files Found In" "root{other-folder\cypress,cypress}\integration"

Am I doing something wrong. It doesn't seem to parse the glob in that field?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Was this page helpful?
0 / 5 - 0 ratings