Bug
I have two subfolders in my integration folder:
cypress/integration/APP/
cypress/integration/API/
When I run
cypress run --spec cypress/integration/APP/*/
ALL tests run, but I expected that only tests in the APP subfolder would run.
Is this a bug or intended behaviour? Doesn't the --spec flag support globs?
Just run tests in cypress/integration/APP/ subfolder
The --spec feature would be really useful if I could run all tests in different subfolders so I could manually distribute tests across machines.
cypress run --spec cypress/integration/SUBFOLDER/**/*
cypress 3.0.1 on Mac OS 10.13.4
You should see new output we added in 3.0 that specifies Specs and Searched
Specs being the specs that will be run
Searched being what Cypress used to search for the specs

What is printed in these fields in the console output?
You can run different subfolders by passing multiple globs to the spec argument like:
cypress run --spec cypress/integration/APP/**/*,cypress/integration/API/**/*
I just ran mine for a subfolder and it did work for me. Double check your glob with a glob tester.
If it's still not working, let me know what terminal you are using.
$ ./node_modules/.bin/cypress run --spec cypress/integration/examples/**/*
====================================================================================================
(Run Starting)
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Cypress: 3.0.0 β
β Browser: Electron 59 (headless) β
β Specs: 19 found (examples/actions.spec.js, examples/aliasing.spec.js, examples/assertionβ¦ β
β Searched: cypress/integration/examples/**/* β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Thanks for your helpful response.
I further investigated this issue. I'm using the original Mac OS Terminal.
cypress run --spec cypress/integration/API/*/
Output:
β Cypress: 3.0.1
β Browser: Electron 59 (headless)
β Specs: 199 found (_reset-to-fixtures.spec.js, API/crm/task-crm-test-end.spec.js, API/docβ¦
(1 of 199)
BUT when adding a trailing comma to the glob only tests in API folder run, so it works as expected:
cypress run --spec cypress/integration/API/*/,
Output:
β Cypress: 3.0.1
β Browser: Electron 59 (headless)
β Specs: 125 found (API/crm/task-crm-test-end.spec.js, API/documents/acl_GET_all.spec.js, β¦
β Searched: cypress/integration/API/*/,
(1 of 125)
Tested with locally installed cypress (npm i cypress) and globally installed cypress (npm i cypress -g) - both show the same behaviour.
So adding a trailing comma to the glob works for me and is ok for me as workaround.
Just want to chime in to say I had the same issue and adding the trailing comma got it working for me. (Thanks @maximilianschmid)
"scripts": {
"cypress:open": "cypress open",
"cypress:run": "cypress run --spec cypress/integration/test/**/*,"
},
@silversteez @maximilianschmid try adding single quotes around the spec glob or use an equals sign...
cypress run --spec 'cypress/integration/test/**/*'
cypress run --spec=cypress/integration/test/**/*
@brian-mann Yup, both of those work for me, as well. Thanks.
@brian-mann both solutions work form me as well. thx.
Checkout your documentation to reflect this solutions:
https://docs.cypress.io/guides/guides/command-line.html#Run-tests-specifying-a-glob-of-where-to-look-for-test-files
We updated the documentation last week and I'm going to close this issue.
Most helpful comment
@silversteez @maximilianschmid try adding single quotes around the spec glob or use an equals sign...