Skip to content

Keep the CLI error snapshots stable on Node.js 26 - #19926

Closed
Kjubikstronk wants to merge 1 commit into
prettier:mainfrom
Kjubikstronk:fs-error-path-node26
Closed

Kjubikstronk wants to merge 1 commit into
prettier:mainfrom
Kjubikstronk:fs-error-path-node26

Conversation

@Kjubikstronk

Copy link
Copy Markdown
Contributor

Description

config-invalid and invalid-ignore fail on Node.js 26 and pass on 14 through 22:

- [error] Unable to read '.prettierignore': EISDIR: illegal operation on a directory, read",
+ [error] Unable to read '.prettierignore': EISDIR: illegal operation on a directory, read '.prettierignore'",

Node.js 26 appends the offending path to the read error raised when reading a directory. Earlier versions stop at the syscall name, which is what the snapshots record.

This is not specific to any branch — every PR whose CI has run on the current Node 26 image hits it, including #19916 and #19908, with the same two suites and the same diff.

runCli already normalises \r before snapshotting, so the appended path is stripped in the same place. That keeps the existing snapshots valid on every supported version, rather than updating them to Node 26 and breaking 14 through 22.

The pattern is deliberately narrow. Node has always included the path for errors like ENOENT ... open '/foo'; what changed in 26 is that read includes it too. Matching every errno message would strip paths that snapshots legitimately record, so this only touches the EISDIR ... read case. No snapshot files change.

Verified by transforming the exact strings from the failing CI logs and confirming they equal the committed snapshots, and that Node ≤ 25 output passes through unchanged. Locally (Node 24) the full tests/integration suite is unaffected: 507 passed, 334 snapshots passed.

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.
  • I did not use AI to generate this PR.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

This is test-only and not user-facing, so no changelog entry or docs change. It adds no new test — the two existing suites are the coverage, and they are what currently fails on Node 26. I used AI assistance and reviewed everything before submitting.

Node.js 26 appends the offending path to the `read` error raised when reading a
directory, so `config-invalid` and `invalid-ignore` fail their snapshots there
while passing on 14 through 22. Strip the appended path in runCli, which leaves
the existing snapshots valid on every version rather than pinning them to one.
@pkg-pr-new

pkg-pr-new Bot commented Aug 27, 2026

Copy link
Copy Markdown

Open in StackBlitz

yarn add https://pkg.pr.new/@prettier/[email protected]
yarn add https://pkg.pr.new/@prettier/[email protected]
yarn add https://pkg.pr.new/@prettier/[email protected]
yarn add https://pkg.pr.new/[email protected]

commit: b2bdfb7

@netlify

netlify Bot commented Aug 27, 2026

Copy link
Copy Markdown

✅ Deploy Preview for prettier ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit b2bdfb7
🔍 Latest deploy log https://app.netlify.com/projects/prettier/deploys/6a90b94d59625b000974203f
😎 Deploy Preview https://deploy-preview-19926--prettier.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@fisker fisker mentioned this pull request Aug 28, 2026
2 of 6 tasks
@fisker

fisker commented Aug 28, 2026

Copy link
Copy Markdown
Member

Thanks for the work, I'll fix with #19927

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants