Skip to content

fsPromises.glob doesn't call exclude with dirent when called withFileTypes: true #53821

Closed
@targos

Description

@targos

Version

22.4.0

Platform

Darwin Targos-MBP.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:14:38 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020 arm64

Subsystem

fs

What steps will reproduce the bug?

mkdir -p a/b
node -e "Array.fromAsync(require('fs/promises').glob('a/**', { withFileTypes: true, exclude: console.log }))"

How often does it reproduce? Is there a required condition?

Always reproduces when withFileTypes is true.

What is the expected behavior? Why is that the expected behavior?

It should log a Dirent for the b directory.

What do you see instead?

It only prints "b"

Additional information

fs.globSync is not affected:

$ node -e "require('fs').globSync('a/**', { withFileTypes: true, exclude: console.log })"       
Dirent {
  name: 'b',
  parentPath: '/tmp/a',
  path: '/tmp/a',
  [Symbol(type)]: 2
}

Metadata

Metadata

Assignees

Labels

confirmed-bugIssues with confirmed bugs.fsIssues and PRs related to the fs subsystem / file system.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions