Skip to content

fix(test): read source-level fixtures with line endings normalised - #109

Merged
alpha5611331 merged 1 commit into
mainfrom
fix/source-test-line-endings
Aug 26, 2026
Merged

fix(test): read source-level fixtures with line endings normalised#109
alpha5611331 merged 1 commit into
mainfrom
fix/source-test-line-endings

Conversation

@alpha5611331

Copy link
Copy Markdown
Member

Found immediately after #108 merged: pnpm test:main fails 12 checks on a fresh Windows checkout of main, and passes in CI.

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. 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.

readSource in test/helpers.mjs normalises 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 in language-switch.test.mjs pins 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 .gitattributes normalising 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.

`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>
@gitar-bot

gitar-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

@alpha5611331
alpha5611331 merged commit d2be935 into main Aug 26, 2026
2 checks passed
@mchl7852 mchl7852 self-assigned this Aug 26, 2026
@alpha5611331
alpha5611331 deleted the fix/source-test-line-endings branch August 26, 2026 21:59
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