Skip to content

fix: add .gitattributes to enforce LF line endings for Windows CI#67

Merged
Simon-He95 merged 2 commits into
mainfrom
copilot/fix-ci-test-windows
Mar 26, 2026
Merged

fix: add .gitattributes to enforce LF line endings for Windows CI#67
Simon-He95 merged 2 commits into
mainfrom
copilot/fix-ci-test-windows

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 26, 2026

Tests fail on windows-latest due to CRLF line endings. Git checks out text files with \r\n on Windows, which breaks snapshot comparisons and CRLF-sensitive regex patterns in the transform functions.

  • Add .gitattributes with * text=auto eol=lf to normalize line endings across all platforms

No source or test changes required — the line ending normalization at the git layer is sufficient.

Original prompt

This section details on the original issue you should resolve

<issue_title>ci: test failed in windows</issue_title>
<issue_description>Image</issue_description>

<agent_instructions>fix ci test in windows</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 26, 2026

Deploy Preview for to-unocss failed. Why did it fail? →

Name Link
🔨 Latest commit d9a9def
🔍 Latest deploy log https://app.netlify.com/projects/to-unocss/deploys/69c4ce2b4b3abc0008e68cb0

On Windows, git checks out text files with CRLF line endings by default.
This caused test failures because:
- Snapshot files had CRLF but transform output had LF
- Transform functions produced different output due to \r in input
- CRLF-sensitive regex patterns failed to match properly

Adding `* text=auto eol=lf` ensures all text files use LF line endings
on all platforms, matching the behavior on Linux and macOS.

Co-authored-by: Simon-He95 <57086651+Simon-He95@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Simon-He95/transformToUnoCSS/sessions/c29a2371-a2b9-4fc0-bd70-45db2ad8d953
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Mar 26, 2026

Deploying transformtounocss with  Cloudflare Pages  Cloudflare Pages

Latest commit: d9a9def
Status: ✅  Deploy successful!
Preview URL: https://33d4874c.transformtounocss.pages.dev
Branch Preview URL: https://copilot-fix-ci-test-windows.transformtounocss.pages.dev

View logs

Copilot AI changed the title [WIP] Fix CI test issue in Windows fix: add .gitattributes to enforce LF line endings for Windows CI Mar 26, 2026
Copilot AI requested a review from Simon-He95 March 26, 2026 06:12
@Simon-He95 Simon-He95 marked this pull request as ready for review March 26, 2026 06:42
@Simon-He95 Simon-He95 merged commit 6b08a87 into main Mar 26, 2026
2 of 6 checks passed
@Simon-He95
Copy link
Copy Markdown
Owner

@copilot 修复有问题,继续修复,下面是失败的原因,我猜测可能是windows上一些文件路径的问题

Run nr test

transform-to-unocss@0.1.24-beta.3 test D:\a\transformToUnoCSS\transformToUnoCSS
vitest

RUN v3.2.4 D:/a/transformToUnoCSS/transformToUnoCSS

✓ test/sass-mixed-decls.test.ts (5 tests) 519ms
✓ sassCompiler deprecation warnings fix > should compile SCSS with mixed declarations without warnings 445ms
stdout | test/complex-scss-for-loop.test.ts > Complex SCSS for-loop and variable syntax > should handle SCSS @for loops with variables correctly
Testing complex SCSS with @for loops and variables...
[DEBUG] transformCode started: {"filepath":"complex-scss-test.vue","isJsx":true,"codeLength":3103}
[DEBUG] transformCode detected type: vue, original type: undefined, filepath: complex-scss-test.vue
[DEBUG] transformCode: Processing as Vue file

stdout | test/complex-scss-for-loop.test.ts > Complex SCSS for-loop and variable syntax > should handle SCSS @for loops with variables correctly
[DEBUG] transformVue started: {
"filepath": "complex-scss-test.vue",
"isJsx": true,
"codeLength": 3103
}
[DEBUG] After inline style transformation
[DEBUG] transformMedia: No @media queries found

stdout | test/complex-scss-for-loop.test.ts > Complex SCSS for-loop and variable syntax > should handle SCSS @for loops with variables correctly
[DEBUG] Processing styles: {
"stylesCount": 1
}
[transform-to-unocss] Compiling SCSS file: complex-scss-test.vue

stdout | test/complex-scss-for-loop.test.ts > Complex SCSS for-loop and variable syntax > should handle SCSS @for loops with variables correctly
[DEBUG] CSS compiled successfully: {
"styleIndex": 0,
"originalStyleLength": 2221,
"compiledCssLength": 4612,
"scoped": true
}

stdout | test/complex-scss-for-loop.test.ts > Complex SCSS for-loop and variable syntax > should handle SCSS @for loops with variables correctly
[DEBUG] importCss started: {
"filepath": "complex-scss-test.vue",
"styleLength": 4612,
"hasImports": false
}

  • color: $brand-color;
  • }
  • </style>

❯ test/transformAstro.test.ts:57:20
55| })
56|
57| expect(result).toContain('text-red')
| ^
58| expect(result).not.toContain('$brand-color')
59|

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

Test Files 1 failed | 14 passed (15)
Tests 1 failed | 63 passed (64)
Start at 06:43:33
Duration 6.63s (transform 546ms, setup 0ms, collect 6.36s, tests 6.84s, environment 4ms, prepare 2.21s)

Error: AssertionError: expected '---\nexport const prerender = true;\n…' to contain 'text-red'

  • Expected
  • Received
  • text-red

  • export const prerender = true;

  • hi

  • <style>
  • @use "@/styles/tokens" as *;
  • .title {
  • color: $brand-color;
  • }
  • </style>

❯ test/transformAstro.test.ts:57:20

 ELIFECYCLE  Test failed. See above for more details.
Error: Process completed with exit code 1.

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.

ci: test failed in windows

2 participants