A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nodejs/node/commit/b377b93a3f below:

correctly pass dirent to exclude `withFileTypes` · nodejs/node@b377b93 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+16

-4

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+16

-4

lines changed Original file line number Diff line number Diff line change

@@ -542,7 +542,7 @@ class Glob {

542 542

const fromSymlink = pattern.symlinks.has(index);

543 543 544 544

if (current === lazyMinimatch().GLOBSTAR) {

545 -

if (entry.name[0] === '.' || (this.#exclude && this.#exclude(entry.name))) {

545 +

if (entry.name[0] === '.' || (this.#exclude && this.#exclude(this.#withFileTypes ? entry : entry.name))) {

546 546

continue;

547 547

}

548 548

if (!fromSymlink && entry.isDirectory()) {

Original file line number Diff line number Diff line change

@@ -342,7 +342,11 @@ describe('glob - withFileTypes', function() {

342 342

const promisified = promisify(glob);

343 343

for (const [pattern, expected] of Object.entries(patterns)) {

344 344

test(pattern, async () => {

345 -

const actual = await promisified(pattern, { cwd: fixtureDir, withFileTypes: true });

345 +

const actual = await promisified(pattern, {

346 +

cwd: fixtureDir,

347 +

withFileTypes: true,

348 +

exclude: (dirent) => assert.ok(dirent instanceof Dirent),

349 +

});

346 350

assertDirents(actual);

347 351

const normalized = expected.filter(Boolean).map((item) => basename(item)).sort();

348 352

assert.deepStrictEqual(actual.map((dirent) => dirent.name).sort(), normalized.sort());

@@ -353,7 +357,11 @@ describe('glob - withFileTypes', function() {

353 357

describe('globSync - withFileTypes', function() {

354 358

for (const [pattern, expected] of Object.entries(patterns)) {

355 359

test(pattern, () => {

356 -

const actual = globSync(pattern, { cwd: fixtureDir, withFileTypes: true });

360 +

const actual = globSync(pattern, {

361 +

cwd: fixtureDir,

362 +

withFileTypes: true,

363 +

exclude: (dirent) => assert.ok(dirent instanceof Dirent),

364 +

});

357 365

assertDirents(actual);

358 366

const normalized = expected.filter(Boolean).map((item) => basename(item)).sort();

359 367

assert.deepStrictEqual(actual.map((dirent) => dirent.name).sort(), normalized.sort());

@@ -365,7 +373,11 @@ describe('fsPromises glob - withFileTypes', function() {

365 373

for (const [pattern, expected] of Object.entries(patterns)) {

366 374

test(pattern, async () => {

367 375

const actual = [];

368 -

for await (const item of asyncGlob(pattern, { cwd: fixtureDir, withFileTypes: true })) actual.push(item);

376 +

for await (const item of asyncGlob(pattern, {

377 +

cwd: fixtureDir,

378 +

withFileTypes: true,

379 +

exclude: (dirent) => assert.ok(dirent instanceof Dirent),

380 +

})) actual.push(item);

369 381

assertDirents(actual);

370 382

const normalized = expected.filter(Boolean).map((item) => basename(item)).sort();

371 383

assert.deepStrictEqual(actual.map((dirent) => dirent.name).sort(), normalized.sort());

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4