Repository navigation
When using glob can't exclude all directs #56260
Description
Activity
- addedfsIssues and PRs related to file-system APIs and the fs module.Issues and PRs related to file-system APIs and the fs module.
on Dec 15, 2024 I expect the exclude function to receive all the output directs
I would not expect that. That is an internal implementation detail. If you're globbing for
src/**, there's no reason for theexcludefunction to receive thesrcdirectory itself (although I suppose it could--again, it's an internal implementation detail).I expect the exclude function to receive all the output directs
I would not expect that. That is an internal implementation detail. If you're globbing for
src/**, there's no reason for theexcludefunction to receive thesrcdirectory itself (although I suppose it could--again, it's an internal implementation detail).Hey 👋
This is an unexpected behavior. It shouldn't work this way.
How is that
src/**selects thesrcfolder and shows it in the output but it isn't available in theexclude?This is just a bug. I don't know what this implementation details is, but it is a bug.
So, can we open this back?
@nodejs/fs Is the behavior here a bug?
DirentFromStatsdoesn't appear to be documented so I'm not sure what to make of it. To me, the key question is this:How is it that
src/**selects thesrcfolder and shows it in the output but it isn't available in theexclude?...or maybe returning
srcmakes perfect sense as**matches nothing. But in that case, it should be passed toexcludefor processing....I'm not familiar with the globbing code, but I attempted a fix in #57420.
- added a commit that references this issue
on Mar 13, 2025 - added a commit that references this issue
on Mar 16, 2025 - added a commit that references this issue
on Mar 18, 2025 - added 2 commits that reference this issue
on Apr 16, 2025 - added 2 commits that reference this issue
on May 1, 2025
Version
v23.4.0
Platform
Subsystem
No response
What steps will reproduce the bug?
Create a folder and open it in your code editor (we use this as current working directory).
Make/create the files/folders shown below:
Run the code below:
How often does it reproduce? Is there a required condition?
.
What is the expected behavior? Why is that the expected behavior?
I expect the
excludefunction to receive all the output directs, so that they can be excluded. (See "Additional information" part).Even with just returning
trueinexcludefunction, you can't excludeDirentFromStatsfrom the result.What do you see instead?
The first direct from output is missing in exclude. (See "Additional information" part).
Additional information
Exclude:
Output: