Skip to content

Commit 60ef497

Browse files
committed
fix: normalize all patterns for Windows glob compatibility
Always normalize path separators in patterns before processing, not just for directories. This ensures glob patterns like "C:\temp\*.md" work correctly on Windows by converting them to "C:/temp/*.md" which the glob library handles properly. Fixes failing Windows tests in CI.
1 parent e3be3a1 commit 60ef497

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/commands/validate.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,17 +311,19 @@ export async function validateCommand(
311311

312312
// Convert directories to glob patterns
313313
finalPatterns = finalPatterns.map((pattern) => {
314+
// Always normalize paths for cross-platform compatibility
315+
const normalizedPattern = pattern.replace(/\\/g, '/');
316+
314317
try {
315318
const stat = statSync(pattern);
316319
if (stat.isDirectory()) {
317320
// Use posix-style paths for glob patterns to ensure cross-platform compatibility
318-
const normalizedPattern = pattern.replace(/\\/g, '/');
319321
return posix.join(normalizedPattern, '**/*.md');
320322
}
321-
return pattern;
323+
return normalizedPattern;
322324
} catch {
323-
// If stat fails, treat as a file pattern
324-
return pattern;
325+
// If stat fails, treat as a file pattern (could be a glob)
326+
return normalizedPattern;
325327
}
326328
});
327329

0 commit comments

Comments
 (0)