Version
v23.4.0
Platform
Microsoft Windows NT 10.0.22631.0 x64
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:
src
src\a
src\a\b
src\a\c
src\index.ts
src\zip.ts
-
Run the code below:
console.log(
fs.globSync("src/**", {
withFileTypes: true,
cwd: process.cwd(),
exclude: (dirent) => {
console.log(dirent)
},
}),
)
How often does it reproduce? Is there a required condition?
.
What is the expected behavior? Why is that the expected behavior?
I expect the exclude function to receive all the output directs, so that they can be excluded. (See "Additional information" part).
Even with just returning true in exclude function, you can't exclude DirentFromStats from the result.
What do you see instead?
The first direct from output is missing in exclude. (See "Additional information" part).
Additional information
Exclude:
Dirent {
name: 'a',
parentPath: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src',
path: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src',
[Symbol(type)]: 2
}
Dirent {
name: 'index.ts',
parentPath: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src',
path: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src',
[Symbol(type)]: 1
}
Dirent {
name: 'zip.ts',
parentPath: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src',
path: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src',
[Symbol(type)]: 1
}
Dirent {
name: 'b',
parentPath: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src\\a',
path: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src\\a',
[Symbol(type)]: 2
}
Dirent {
name: 'c',
parentPath: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src\\a',
path: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src\\a',
[Symbol(type)]: 2
}
Output:
[
DirentFromStats {
name: 'src',
parentPath: 'C:\\Users\\Babak\\Documents\\Code\\tosk',
path: 'C:\\Users\\Babak\\Documents\\Code\\tosk',
[Symbol(type)]: null,
[Symbol(stats)]: Stats {
dev: 1247631908,
mode: 16822,
nlink: 1,
uid: 0,
gid: 0,
rdev: 0,
blksize: 4096,
ino: 1970324837878618,
size: 0,
blocks: 0,
atimeMs: 1734234059936.9617,
mtimeMs: 1734231659493.8164,
ctimeMs: 1734231659493.8164,
birthtimeMs: 1734197097735.2148
}
},
Dirent {
name: 'index.ts',
parentPath: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src',
path: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src',
[Symbol(type)]: 1
},
Dirent {
name: 'zip.ts',
parentPath: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src',
path: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src',
[Symbol(type)]: 1
},
Dirent {
name: 'a',
parentPath: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src',
path: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src',
[Symbol(type)]: 2
},
Dirent {
name: 'c',
parentPath: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src\\a',
path: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src\\a',
[Symbol(type)]: 2
},
Dirent {
name: 'b',
parentPath: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src\\a',
path: 'C:\\Users\\Babak\\Documents\\Code\\tosk\\src\\a',
[Symbol(type)]: 2
}
]
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: