fix: resolve prettier config from a file path instead of the cwd directory - #492
Merged
danadajian merged 2 commits intoAug 3, 2026
Merged
Conversation
…ctory resolveConfig() expects a file path and searches upward from its parent directory. Passing process.cwd() (a directory) starts the search one level above the project root, so the project's own .prettierrc.json is never found and codegen silently falls back to Prettier's defaults. Pass the cypress/commands/index.ts path instead so the search starts inside the project. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
danadajian
approved these changes
Aug 3, 2026
danadajian
enabled auto-merge (squash)
August 3, 2026 13:46
|
🎉 This PR is included in version 2.5.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolveConfig()expects a file path, not a directory: it starts its search in that file's parent directory and walks up. Passingprocess.cwd()starts the search one level above the project root, so a project's own.prettierrc.jsonis never found andcodegen()silently falls back to Prettier's defaults, reformatting generated files on every Cypress launch.This passes the
cypress/commands/index.tspath instead, so the search starts inside the project and correctly picks up the project's config.Added a test asserting
resolveConfigis called with the resolved file path, notprocess.cwd().