admin管理员组文章数量:1336200
This weird thing happen where I got a ' No files found in cypress test runner' error message all of a sudden.
However the files are in the folder, I have moved it to a new folder and tried running it but I still got the error message. Please any thoughts or idea as to why this happened?
I also tried running it in headless mode but I got the same error message.
Thank you. @Nanker Phelge please any thoughts as how to fix this issue. Thanks
This weird thing happen where I got a ' No files found in cypress test runner' error message all of a sudden.
However the files are in the folder, I have moved it to a new folder and tried running it but I still got the error message. Please any thoughts or idea as to why this happened?
I also tried running it in headless mode but I got the same error message.
Thank you. @Nanker Phelge please any thoughts as how to fix this issue. Thanks
Share Improve this question asked Feb 21, 2021 at 3:44 PeaceTPeaceT 631 silver badge7 bronze badges 1-
What is the config in
cypress.json
? – user15239601 Commented Feb 21, 2021 at 4:39
3 Answers
Reset to default 6By default, if you have not configured anything different, Cypress looks in all subfolders of the integration folder.
Please see Configuration
Folders / Files
Option | Default |
---|---|
testFiles | **/*.* |
where **
is part of a glob pattern that means 'look in all the sub folders - for all file types'.
If you have something else configured, that might be causing it, but if there is no entry then cypress.json
is not the cause.
Else, if you have *.spec.js
or */*.js
these will exclude your files (because there's no .spec.js
extension and a single *
will exclude subfolders.
Speaking of excluding, if there is an ignoreTestFiles
configuration entry (in cypress.json
), that may be causing the problem.
I would also like to point out the PageObjects
folder may be considered as tests and cause you more errors.
A mon pattern is to name all files that have tests with the .spec.js
extension e.g GTProject1.spec.js
.
In the cypress.json
file, set
testFiles: "**/*.spec.js"
which means look in the /cypress/integration
folder and any sub-folders for files with the extension .spec.js
. It will ignore you PageObject files which just have the .js
extension.
Then you can rearrange the folders later and still see all the tests.
You can execute tests like this -
npx cypress run --spec=cypress/integration/GTProjects/*
Or, you can add all your tests as an array under testFiles
in your cypress.json
file, and in that case you can directly use npx cypress run
.
"testFiles": [
"GTProjects/GTProject1.js",
"GTProjects/GTProject2.js",
"GTProjects/GTProject3.js",
"GTProjects/GTProject4.js",
"GTProjects/GTProject5.js",
"GTProjects/GTProject6.js",
"GTProjects/GTProject7.js",
"GTProjects/GTProject8.js",
"GTProjects/GTProject9.js"
]
Or, You can provide integrationFolder
path in your cypress.json
and in that case, also you can execute the tests using npx cypress run
"integrationFolder": "cypress/integration/GTProjects"
I also faced the same issue, but after renaming the test file from "testfilename.js" to "testfilename.cy.js", then the tool recognized the test file.
本文标签: javascriptNo files found in cypress test runnerStack Overflow
版权声明:本文标题:javascript - No files found in cypress test runner - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742373768a2462751.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论