问题
I am trying to run some specific tests within a directory, using cypress the command that I try to execute is:
node_modules\.bin\cypress run --spec 'cypress\integration\tests\default.spec.js'
I have also tried with:
node_modules\.bin\cypress run --spec 'cypress\integration\tests\*.spec.js'
Or:
node_modules\.bin\cypress run --spec 'cypress\integration\tests\**'
The directory and the files exist, I tried to keep the absolute path to those files but it does not work either. Try changing the configuration of the integration directory in the cypress.json, at the end I have this file:
cypress.json
{
"baseUrl": "http://localhost/",
"chromeWebSecurity": false,
"integrationFolder": "./cypress/integration/",
"testFiles": "**.spec.js"
}
This is the message's error: Can't run because no spec files were found.
We searched for any files matching this glob pattern:
'cypress\integration\tests\default.spec.js'
回答1:
I know it's late but I just came across this issue.
I solved it by using (=) --spec=cypress/integration/[path]
, it can't detect if I'm using quotes, --spec 'cypress/integration/[path]'
.
来源:https://stackoverflow.com/questions/53324050/why-is-it-wrong-for-me-to-run-the-tests-of-a-specific-directory-with-cypress