Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recursive option not work when withFileTypes is set to true (fs.readdirSync) #49299

Closed
Hanaasagi opened this issue Aug 23, 2023 · 1 comment
Closed

Comments

@Hanaasagi
Copy link

Version

v20.5.1

Platform

Linux misaka 6.4.11-arch2-1 #1 SMP PREEMPT_DYNAMIC Sat, 19 Aug 2023 15:38:34 +0000 x86_64 GNU/Linux

Subsystem

ArchLinux

What steps will reproduce the bug?

My current directory structure is as follows:

>>​ tree .
.
├── CMakeLists.txt
├── index.cjs
├── main.cc
├── mocks
│   ├── mock-collector.hh
│   ├── mock-engine.hh
│   └── mock-reporter.hh
├── second-source.c
├── test.hh
├── tests-collector.cc
├── tests-configuration.cc
├── tests-elf.cc
├── tests-filter.cc
├── tests-merge-parser.cc
├── test-source.c
├── tests-reporter.cc
├── tests-system-mode.cc
├── tests-utils.cc
├── tests-writer.cc
└── trompeloeil

3 directories, 18 files

Run following code

const fs = require("fs");

fs.readdirSync(".", { recursive: true, withFileTypes: true }).forEach(
  (file) => {
    console.log(file);
  },
);

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

Every time.

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

List all the files.

What do you see instead?

Dirent { name: 'CMakeLists.txt', path: '.', [Symbol(type)]: 1 }
Dirent { name: 'index.cjs', path: '.', [Symbol(type)]: 1 }

Only two of them are listed, and then it stopped.

Additional information

withFileTypes is false, it will work.

const fs = require("fs");

fs.readdirSync(".", { recursive: true, withFileTypes: false }).forEach(
  (file) => {
    console.log(file);
  },
);
@MoLow
Copy link
Member

MoLow commented Aug 23, 2023

this duplicates #48858

@MoLow MoLow closed this as not planned Won't fix, can't repro, duplicate, stale Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants