Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/forty-zoos-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'dotenv-diff': patch
---

Case sensitive for glob pattern fix
2 changes: 1 addition & 1 deletion packages/cli/src/services/fileWalker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,6 @@ export function matchesGlobPattern(filePath: string, pattern: string): boolean {
.replace(/___DOUBLESTAR___/g, '.*')
.replace(/\?/g, '[^/]');

const re = new RegExp(`^${regexPattern}$`, 'i');
const re = new RegExp(`^${regexPattern}$`);
return re.test(normalized);
}
9 changes: 4 additions & 5 deletions packages/cli/test/unit/services/filewalker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import fs from 'fs';
import path from 'path';
import os from 'os';
import { execSync } from 'child_process';
import {
findFiles,
expandBraceSets,
Expand Down Expand Up @@ -184,9 +185,9 @@ describe('filewalker', () => {
expect(result).toBe(false);
});

it('handles case insensitive matching', () => {
it('is case sensitive for glob matching', () => {
const result = matchesGlobPattern('src/App.JS', '**/*.js');
expect(result).toBe(true);
expect(result).toBe(false);
});

it('handles patterns without separators', () => {
Expand Down Expand Up @@ -278,13 +279,12 @@ describe('filewalker', () => {

try {
// Try to create a FIFO (named pipe) - only works on Unix-like systems
const { execSync } = require('child_process');
execSync(`mkfifo "${pipePath}"`);

const result = getPatternBaseDir(tmpDir, 'testpipe');
// FIFO is neither file nor directory
expect(result).toBeNull();
} catch (err) {
} catch {
// Skip on Windows or if mkfifo not available
console.log('FIFO test skipped - not supported on this system');
expect(true).toBe(true); // Dummy assertion so test doesn't fail
Expand Down Expand Up @@ -409,7 +409,6 @@ describe('filewalker', () => {
});

it('walks extra roots for patterns outside cwd', async () => {
const parentDir = path.dirname(tmpDir);
const srcDir = path.join(tmpDir, 'src');
fs.mkdirSync(srcDir);
fs.writeFileSync(path.join(srcDir, 'app.js'), '');
Expand Down
Loading