cypress spec file not found after folder restructure
Fixes Cypress spec file not found errors after a folder restructure for QA engineers and agents. Use when Cypress reports no specs after you moved files around. Not for specs excluded by config or for a broken Cypress install.
TL;DR
Cypress 10 and later find specs through the specPattern in cypress.config, not through the old folder conventions. After a restructure, update specPattern to the new location and double check you are editing the e2e block, not a leftover legacy key. Then list the matched files with a dry run before assuming it worked.
The query
cypress spec file not found after folder restructureUse this when
- Cypress says it found 0 spec files after you moved directories
- You renamed the cypress folder or nested specs deeper
- The config still references the old integrationFolder key
Not for
- Specs skipped by excludeSpecPattern (that is intentional filtering)
- A Cypress binary that will not launch at all
- Test discovery in other runners
Steps
- Read the current specPattern. Open cypress.config and find the specPattern under the e2e block. Write down exactly what glob it uses.
Expected output: the literal glob string from the config file.
- Compare the glob to the new folder layout. Check whether the moved spec files actually match the pattern, watching for renamed directories.
Expected output: a note showing which specs fall outside the glob.
- Update specPattern to the new location. Use a glob that covers the new structure, and remove any legacy keys like integrationFolder or testFiles.
Expected output: the config edited with the corrected glob and no legacy keys.
- Verify with a file listing. Run Cypress with a spec listing or use the config to print matched files, and confirm your moved specs appear.
Expected output: the moved spec files present in the matched list.
- Run one moved spec end to end. A found file can still fail on a stale import path after a move.
Expected output: the moved spec green, with imports resolving to the new locations.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_lTMX058oede5NGZmjgpY8w
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.