Skip to content

fix: resolve prettier config from a file path instead of the cwd directory - #492

Merged
danadajian merged 2 commits into
ExpediaGroup:mainfrom
o-martin:fix-prettier-config-resolution-path
Aug 3, 2026
Merged

fix: resolve prettier config from a file path instead of the cwd directory#492
danadajian merged 2 commits into
ExpediaGroup:mainfrom
o-martin:fix-prettier-config-resolution-path

Conversation

@o-martin

@o-martin o-martin commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

resolveConfig() expects a file path, not a directory: it starts its search in that file's parent directory and walks up. Passing process.cwd() starts the search one level above the project root, so a project's own .prettierrc.json is never found and codegen() silently falls back to Prettier's defaults, reformatting generated files on every Cypress launch.

This passes the cypress/commands/index.ts path instead, so the search starts inside the project and correctly picks up the project's config.

Added a test asserting resolveConfig is called with the resolved file path, not process.cwd().

…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
danadajian enabled auto-merge (squash) August 3, 2026 13:46
@danadajian
danadajian merged commit 894ea16 into ExpediaGroup:main Aug 3, 2026
4 checks passed
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 2.5.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants