fix(test): read source-level fixtures with line endings normalised - #109
Merged
Conversation
`test/language-switch.test.mjs` anchors two `methodBody` lookups on a literal newline, and nothing normalised the file it read. `core.autocrlf` is true with no `.gitattributes`, so those files arrive CRLF on a Windows checkout and LF on the Ubuntu runner: twelve checks passed in CI and failed for anyone who pulled. Green CI plus a suite that looks broken to whoever just merged is the worst direction for this to fail in, and it is the direction it failed in - it surfaced on `main` immediately after the merge, not on the branch, because the branch's working tree still held the files as they were written. `readSource` normalises on read, and every source-level test goes through it rather than each matcher learning about `\r`: the matchers are written against the source as it reads on screen and that is the useful thing about them. A check pins it, and fails without the normalisation. The alternative is a `.gitattributes` that normalises the whole tree, which is a bigger and noisier change than the problem. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Found immediately after #108 merged:
pnpm test:mainfails 12 checks on a fresh Windows checkout ofmain, and passes in CI.test/language-switch.test.mjsanchors twomethodBodylookups on a literal newline, and nothing normalised the file it read.core.autocrlfis true with no.gitattributes, so those files arrive CRLF on a Windows checkout and LF on the Ubuntu runner. Green CI plus a suite that looks broken to whoever just pulled is the worst direction for this to fail in, and it is the direction it failed in - it did not show up on the branch, because that working tree still held the files as they were written.readSourceintest/helpers.mjsnormalises on read, and the four source-level tests go through it rather than each matcher learning about\r: the matchers are written against the source as it reads on screen, and that is the useful thing about them. A check inlanguage-switch.test.mjspins the assumption its anchors depend on, and fails without the normalisation (verified by removing it - 13 failures).Test-only; no production code touched.
The alternative fix is a
.gitattributesnormalising the whole tree. That is a bigger and noisier change than the problem, but it is the one that would stop this recurring for anything else - happy to do that instead if you would rather.