Skip to content

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

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
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

confirmed-bugIssues and PRs for confirmed bugs.fsIssues and PRs related to file-system APIs and the fs module.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions