Skip to content

Comments

fix: glob now falls back to real filesystem for unmocked paths (#158)#197

Open
atoomic wants to merge 1 commit intocpanel:masterfrom
atoomic:koan.atoomic/fix-issue-158
Open

fix: glob now falls back to real filesystem for unmocked paths (#158)#197
atoomic wants to merge 1 commit intocpanel:masterfrom
atoomic:koan.atoomic/fix-issue-158

Conversation

@atoomic
Copy link
Contributor

@atoomic atoomic commented Feb 20, 2026

The __glob override only searched %files_being_mocked via Text::Glob, never falling back to CORE::glob for real filesystem results. This caused glob() to return empty results for real files on disk when Test::MockFile was loaded (even in nostrict mode with nothing mocked).

Now __glob merges real CORE::glob results with mocked file matches, skipping any paths that are actively mocked (mock takes precedence). Results are sorted to maintain glob's alphabetical order contract.

Closes #158

…l#158)

The __glob override only searched %files_being_mocked via Text::Glob,
never falling back to CORE::glob for real filesystem results. This
caused glob() to return empty results for real files on disk when
Test::MockFile was loaded (even in nostrict mode with nothing mocked).

Now __glob merges real CORE::glob results with mocked file matches,
skipping any paths that are actively mocked (mock takes precedence).
Results are sorted to maintain glob's alphabetical order contract.

Closes cpanel#158

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Test::MockFile corrupts glob

2 participants