tinyglobby icon indicating copy to clipboard operation
tinyglobby copied to clipboard

Globbing ../**/*.js with cwd ./foo gives no results

Open zachleat opened this issue 6 months ago • 2 comments

Follow up to #117

I believe cwd is filtered out of results, rather than being a valid target for the results.

test('relative self (wildcard)', () => {
  const files = globSync(['../**/*.txt'], { cwd: path.join(cwd, 'a') });
  // Returns [ '../b/a.txt', '../b/b.txt' ]

  // I believe it should return:
  assert.deepEqual(files.sort(), [ '../a/a.txt', '../a/b.txt', '../b/a.txt', '../b/b.txt' ]);
});

Related: https://github.com/11ty/eleventy/issues/3854

zachleat avatar Jun 10 '25 17:06 zachleat

i figured out about the existence of this issue last month when fixing #117 and how hard it might be to fix, and figured out it might be really hard to do with the current code structure. thankfully there's a somewhat big refactor i'm looking into making that in theory should solve this issue and greatly decrease the number of workarounds. meanwhile you might benefit from the cwd option to prevent it from using ../** as a pattern.

SuperchupuDev avatar Jun 11 '25 15:06 SuperchupuDev

fwiw I did patch around this in Eleventy so for me that lowers the implied severity!

https://github.com/11ty/eleventy/issues/3854

zachleat avatar Jun 16 '25 19:06 zachleat