Skip to content

fix(ci): normalize line endings to fix Windows CRLF test failure - #9

Merged
Yuki-zik merged 1 commit into
masterfrom
yuki-zik-fix-windows-crlf-eol
Jul 8, 2026
Merged

Yuki-zik merged 1 commit into
masterfrom
yuki-zik-fix-windows-crlf-eol

Conversation

@Yuki-zik

@Yuki-zik Yuki-zik commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Problem

master CI (run 28922137830) failed only on windows-latest; ubuntu and macOS passed. Failing test: extension applies on-demand stable ID tracking policy (test/extension.tests.js:158), expected true, actual false.

The push that triggered it (05bb7a7, a glass/alpha highlight fix) is not the culprit — it just happened to be the first master push to run CI on Windows and expose a pre-existing cross-platform test defect introduced in 9ae1b2b.

Root cause

The assertion does fs.readFileSync('src/extension.js','utf8').indexOf('...\n...forceStableIds...\n...'). The repo has no .gitattributes, so with Git's default core.autocrlf=true (true on GitHub's Windows runners), extension.js is checked out with CRLF. The \n-joined multi-line search then never matches on Windows.

Reproduced locally on Windows (CRLF working tree): LF checkout → indexOf matches; CRLF checkout → no match.

Fix

  • .gitattributes (* text=auto eol=lf + explicit LF for *.js/*.json/*.md/*.yml/*.svg, binary for images/fonts) — forces LF checkout on every platform, ending this class of Windows-only test breakage. Index blobs were already LF, so there is no content churn.
  • readSource() helper in test/extension.tests.js that strips \r\n → \n before scanning; the 12 source-scanning assertions now go through it, so existing CRLF working copies also pass without needing a re-checkout.

No runtime code changed — test/tooling only.

Verification (Windows, CRLF working tree)

  • Reproduced the failure first, then after the fix:
    • node qunit test/extension.tests.js → 15 passing / 0 fail (was 14/1)
    • npm test → 145 passing / 0 fail
    • npm run webpack → build succeeded
  • git check-attr confirms text: set, eol: lf; staged diff is only .gitattributes + test/extension.tests.js (+ governance docs).

Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com

The 'extension applies on-demand stable ID tracking policy' test failed only on windows-latest: source-scanning assertions match multi-line \n string literals, but core.autocrlf=true checks out sources as CRLF so indexOf never matches.

Add a root .gitattributes (* text=auto eol=lf) to force LF checkout on all platforms, plus a readSource() EOL-normalizing helper in test/extension.tests.js so existing CRLF working copies also pass. No runtime code changed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@Yuki-zik
Yuki-zik merged commit a38e602 into master Jul 8, 2026
6 checks passed
@Yuki-zik
Yuki-zik deleted the yuki-zik-fix-windows-crlf-eol branch July 8, 2026 06:40
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.

1 participant