ProjectEvergreen/greenwood
refactor usages of glob-promise with native NodeJS `fs.glob`
Open
#1,551 opened on Aug 16, 2025
choredocumentationgood first issue
Repository metrics
- Stars
- (132 stars)
- PR merge metrics
- (PR metrics pending)
Description
Task
In many of our test cases, we use the package glob-promise to easily read in a bunch of files, e.g.
it("should contain one javascript file in the output directory", async function () {
expect(await glob.promise(path.join(this.context.publicDir, "*.js"))).to.have.lengthOf(1);
});
However, after we merged #1543 , we will have access to the fs.glob API from NodeJS, so would be nice to swap over to that. Then we could re-write the usage as follows:
it("should contain one javascript file in the output directory", async function () {
const files = await Array.fromAsync(fs.promises.glob(
"*.js",
{ cwd: new URL(".", import.meta.url)},
));
expect(files.length).to.equal(1);
});
With that, we could also delete the glob and glob-promise dependency from the root monorepo's package.json.
We should also update the CONTRIBUTING.md sample, if applicable.
🗒️ Note to self: after doing this, we should also refactor all the tests to not need to import from
node:url, but that can be its own issue