fix(ci): normalize line endings to fix Windows CRLF test failure - #9
Merged
Merged
Conversation
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>
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.
Problem
masterCI (run 28922137830) failed only onwindows-latest;ubuntuandmacOSpassed. 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 firstmasterpush to run CI on Windows and expose a pre-existing cross-platform test defect introduced in9ae1b2b.Root cause
The assertion does
fs.readFileSync('src/extension.js','utf8').indexOf('...\n...forceStableIds...\n...'). The repo has no.gitattributes, so with Git's defaultcore.autocrlf=true(true on GitHub's Windows runners),extension.jsis checked out with CRLF. The\n-joined multi-line search then never matches on Windows.Reproduced locally on Windows (CRLF working tree): LF checkout →
indexOfmatches; CRLF checkout → no match.Fix
.gitattributes(* text=auto eol=lf+ explicit LF for*.js/*.json/*.md/*.yml/*.svg,binaryfor 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 intest/extension.tests.jsthat strips\r\n→\nbefore 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)
node qunit test/extension.tests.js→ 15 passing / 0 fail (was 14/1)npm test→ 145 passing / 0 failnpm run webpack→ build succeededgit check-attrconfirmstext: 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