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
Add a ment  | 

3 Answers 3

Reset to default 6

By 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