javascriptautomationframeworkscypressbuild-automation

No files found in cypress test runner


This weird thing happen where I got a ' No files found in cypress test runner' error message all of a sudden. enter image description here

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? enter image description here

I also tried running it in headless mode but I got the same error message. enter image description here

Thank you. @Nanker Phelge please any thoughts as how to fix this issue. Thanks


Solution

  • 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 common 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.