Skip to content

Commit

Permalink
Failing test for firebase#8131
Browse files Browse the repository at this point in the history
  • Loading branch information
rhodgkins committed Jan 23, 2025
1 parent e145360 commit 0bf91cc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/fsAsync.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,39 @@ import * as fsAsync from "./fsAsync";
// <basedir>
// .hidden
// visible
// ignored/
// not-included
// subdir/
// subfile
// nesteddir/
// nestedfile
// node_modules/
// nestednodemodules
// ignored
// included
// node_modules
// subfile
describe("fsAsync", () => {
let baseDir = "";
const files = [
".hidden",
"visible",
"ignored/not-included",
"subdir/subfile",
"subdir/nesteddir/nestedfile",
"subdir/node_modules/nestednodemodules",
"subdir/ignored/included",
"node_modules/subfile",
];

before(() => {
baseDir = path.join(os.tmpdir(), crypto.randomBytes(10).toString("hex"));
fs.mkdirSync(baseDir);
fs.mkdirSync(path.join(baseDir, "ignored"));
fs.mkdirSync(path.join(baseDir, "subdir"));
fs.mkdirSync(path.join(baseDir, "subdir", "nesteddir"));
fs.mkdirSync(path.join(baseDir, "subdir", "node_modules"));
fs.mkdirSync(path.join(baseDir, "subdir", "ignored"));
fs.mkdirSync(path.join(baseDir, "node_modules"));
for (const file of files) {
fs.writeFileSync(path.join(baseDir, file), file);
Expand Down Expand Up @@ -72,12 +80,13 @@ describe("fsAsync", () => {
it("supports blob rules", async () => {
const results = await fsAsync.readdirRecursive({
path: baseDir,
ignore: ["**/node_modules/**"],
ignore: ["**/node_modules/**", "ignored/*"],
});

const gotFileNames = results.map((r) => r.name).sort();
const expectFiles = files
.filter((file) => !file.includes("node_modules"))
.filter((file) => !file.includes("not-included"))
.map((file) => path.join(baseDir, file))
.sort();
return expect(gotFileNames).to.deep.equal(expectFiles);
Expand Down

0 comments on commit 0bf91cc

Please sign in to comment.