Skip to content

Commit 95c8969

Browse files
committed
fix(test): Make TC-400 respect document EOL setting for cross-platform compatibility
Windows uses CRLF while Unix uses LF. The test was hardcoding LF expectation, causing it to fail on Windows in GitHub Actions. Fix: Read document.eol property (set by VSCode based on files.eol preference) and build expected output accordingly, matching ImportManager's behavior. This respects user's files.eol setting preference: - 'auto' (default): Detects from file content - '\n': Force LF - '\r\n': Force CRLF
1 parent 31af37d commit 95c8969

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"Bash(done)",
2929
"Bash(git stash:*)",
3030
"SlashCommand(/git-quick)",
31-
"Read(///**)"
31+
"Read(///**)",
32+
"Bash(gh run view 18709470348 --log)"
3233
],
3334
"deny": [],
3435
"ask": []

src/test/import-manager.blank-lines.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as assert from 'assert';
2-
import { Uri } from 'vscode';
2+
import { EndOfLine, Uri } from 'vscode';
33

44
import { ImportsConfig } from '../configuration';
55
import { ImportManager } from '../imports/import-manager';
@@ -645,10 +645,14 @@ suite('Blank Lines - Edge Cases', () => {
645645

646646
test('TC-400: File with only imports (no code after)', async () => {
647647
const input = `import { A } from './a';`;
648-
const expected = `import { A } from './a';\n`;
649648

650649
const doc = await createTempDocument(input);
651650
try {
651+
// Build expected based on document's actual EOL setting
652+
// VSCode detects EOL from file content or uses files.eol preference
653+
const eol = doc.eol === EndOfLine.CRLF ? '\r\n' : '\n';
654+
const expected = `import { A } from './a';${eol}`;
655+
652656
const manager = new ImportManager(doc, config);
653657
const edits = manager.organizeImports();
654658
const result = await applyEditsToDocument(doc, edits);

0 commit comments

Comments
 (0)