Version
v18.16.0
Platform
Microsoft Windows NT 10.0.22621.0 x64
Subsystem
node:fs/promises
What steps will reproduce the bug?
- Make a directory
mkdir foo
- Make a directory symlink
mklink /D "bar" "foo" - bar is now a symlink to foo.
const fs = require("fs/promises")
for await (const dirent of await fs.opendir('./')) {
console.log(dirent.name, dirent.isDirectory(), dirent.isSymbolicLink())
}
How often does it reproduce? Is there a required condition?
Always, on Windows
What is the expected behavior? Why is that the expected behavior?
I'd expect the output to be
bar false true
foo true false
Because bar is not a directory, but is a symlink. Therefore, I'd expect bar false true.
It could be argued that bar is actually a directory, so I might also expect bar true true.
For foo, because it is a directory, and not a symlink, I'd expect foo true false.
I'd also expect the same outputs on Linux and Windows.
What do you see instead?
bar true false
foo true false
The outputs says that bar is a directory and not a symlink.
Proof the symlink is created correctly:

Additional information
Doesn't reproduce on Ubuntu Linux 22.04 (x86_64 GNU/Linux), or any other Linux system I test it on.
mkdir foo
ln -s ./foo bar
The script outputs
foo true false
bar false true
Which is the expected result.
Version
v18.16.0
Platform
Microsoft Windows NT 10.0.22621.0 x64
Subsystem
node:fs/promises
What steps will reproduce the bug?
mkdir foomklink /D "bar" "foo"- bar is now a symlink to foo.How often does it reproduce? Is there a required condition?
Always, on Windows
What is the expected behavior? Why is that the expected behavior?
I'd expect the output to be
Because
baris not a directory, but is a symlink. Therefore, I'd expectbar false true.It could be argued that
baris actually a directory, so I might also expectbar true true.For
foo, because it is a directory, and not a symlink, I'd expectfoo true false.I'd also expect the same outputs on Linux and Windows.
What do you see instead?
The outputs says that

baris a directory and not a symlink.Proof the symlink is created correctly:
Additional information
Doesn't reproduce on Ubuntu Linux 22.04 (x86_64 GNU/Linux), or any other Linux system I test it on.
mkdir fooln -s ./foo barThe script outputs
Which is the expected result.