Skip to content

Commit c25804a

Browse files
committed
fix(test): disable cache in git-extended real operations tests
Add cache: false to getChangedFiles() calls in "real git operations" tests to prevent stale cached results from causing test failures on Windows. The git functions cache results by default, and on Windows the tests were getting empty cached arrays instead of fresh git status. Fixes 4 test failures on Windows Server 2025: - should work with a temporary git repository - should detect untracked files - should handle nested directories - should work with sync functions
1 parent a4005db commit c25804a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/unit/git-extended.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ describe('git extended tests', () => {
216216
await fs.writeFile(testFile, 'test content', 'utf8')
217217

218218
// File should appear as changed (untracked)
219-
const changed = await getChangedFiles({ cwd: tmpDir })
219+
const changed = await getChangedFiles({ cache: false, cwd: tmpDir })
220220
expect(changed).toContain('test.txt')
221221

222222
// Stage the file
@@ -277,7 +277,7 @@ describe('git extended tests', () => {
277277
const untracked = path.join(tmpDir, 'untracked.txt')
278278
await fs.writeFile(untracked, 'untracked', 'utf8')
279279

280-
const changed = await getChangedFiles({ cwd: tmpDir })
280+
const changed = await getChangedFiles({ cache: false, cwd: tmpDir })
281281
expect(changed).toContain('untracked.txt')
282282

283283
// Untracked files should not appear in unstaged (they're not tracked)
@@ -300,7 +300,7 @@ describe('git extended tests', () => {
300300
const nestedFile = path.join(subdir, 'nested.txt')
301301
await fs.writeFile(nestedFile, 'nested content', 'utf8')
302302

303-
const changed = await getChangedFiles({ cwd: tmpDir })
303+
const changed = await getChangedFiles({ cache: false, cwd: tmpDir })
304304
// Git may show directory or full path depending on config
305305
expect(changed.length).toBeGreaterThan(0)
306306
const hasFile = changed.some(
@@ -327,7 +327,7 @@ describe('git extended tests', () => {
327327
const testFile = path.join(tmpDir, 'sync-test.txt')
328328
await fs.writeFile(testFile, 'sync content', 'utf8')
329329

330-
const changedSync = getChangedFilesSync({ cwd: tmpDir })
330+
const changedSync = getChangedFilesSync({ cache: false, cwd: tmpDir })
331331
expect(changedSync).toContain('sync-test.txt')
332332

333333
spawnSync('git', ['add', 'sync-test.txt'], { cwd: tmpDir })

0 commit comments

Comments
 (0)