Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

WorkspaceEntries.test.ts

599 lines23.0 KB

1// @effect-diagnostics nodeBuiltinImport:off
2import * as NodeServices from "@effect/platform-node/NodeServices";
3import { it, afterEach, describe, expect } from "@effect/vitest";
4import * as Effect from "effect/Effect";
5import * as FileSystem from "effect/FileSystem";
6import * as Layer from "effect/Layer";
7import * as Path from "effect/Path";
8import * as PlatformError from "effect/PlatformError";
9import { vi } from "vite-plus/test";
10​
11import * as ServerConfig from "../config.ts";
12import * as HostProcess from "@t3tools/shared/HostProcess";
13import * as VcsProcess from "../vcs/VcsProcess.ts";
14import * as WorkspaceEntries from "./WorkspaceEntries.ts";
15import * as WorkspacePaths from "./WorkspacePaths.ts";
16​
17vi.mock("node:fs/promises", async (importOriginal) => {
18 const actual = await importOriginal<typeof import("node:fs/promises")>();
19 return { ...actual, readdir: vi.fn(actual.readdir) };
20});
21​
22const layerTest = Layer.empty.pipe(
23 Layer.provideMerge(WorkspaceEntries.layer.pipe(Layer.provide(WorkspacePaths.layer))),
24 Layer.provideMerge(WorkspacePaths.layer),
25 Layer.provideMerge(VcsProcess.layer),
26 Layer.provide(
27 ServerConfig.ServerConfig.layerTest(process.cwd(), {
28 prefix: "t3-workspace-entries-test-",
29 }),
30 ),
31 Layer.provideMerge(NodeServices.layer),
32);
33​
34const makeTempDir = Effect.fn(function* (opts?: { prefix?: string; git?: boolean }) {
35 const fileSystem = yield* FileSystem.FileSystem;
36 const dir = yield* fileSystem.makeTempDirectoryScoped({
37 prefix: opts?.prefix ?? "t3code-workspace-entries-",
38 });
39 if (opts?.git) {
40 yield* git(dir, ["init"]);
41 }
42 return dir;
43});
44​
45function writeTextFile(
46 cwd: string,
47 relativePath: string,
48 contents = "",
49): Effect.Effect<void, PlatformError.PlatformError, FileSystem.FileSystem | Path.Path> {
50 return Effect.gen(function* () {
51 const fileSystem = yield* FileSystem.FileSystem;
52 const path = yield* Path.Path;
53 const absolutePath = path.join(cwd, relativePath);
54 yield* fileSystem.makeDirectory(path.dirname(absolutePath), { recursive: true });
55 yield* fileSystem.writeFileString(absolutePath, contents);
56 });
58​
59const git = (cwd: string, args: ReadonlyArray<string>, env?: NodeJS.ProcessEnv) =>
60 Effect.gen(function* () {
61 const process = yield* VcsProcess.VcsProcess;
62 const result = yield* process.run({
63 operation: "WorkspaceEntries.test.git",
64 command: "git",
65 cwd,
66 args,
67 ...(env ? { env } : {}),
68 timeoutMs: 10_000,
69 });
70 return result.stdout.trim();
71 });
72​
73const searchWorkspaceEntries = (input: {
74 cwd: string;
75 query: string;
76 limit: number;
77 kind?: "file" | "directory";
78}) =>
79 Effect.gen(function* () {
80 const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
81 return yield* workspaceEntries.search(input);
82 });
83​
84const appendSeparator = (input: string) =>
85 Effect.map(HostProcess.Platform, (platform) =>
86 input.endsWith("/") || input.endsWith("\\")
87 ? input
88 : `${input}${platform === "win32" ? "\\" : "/"}`,
89 );
90​
91it.layer(layerTest, { excludeTestServices: true })("WorkspaceEntries", (it) => {
92 afterEach(() => {
93 vi.restoreAllMocks();
94 });
95​
96 describe("list", () => {
97 it.effect("lists immediate children including ignored and empty directories", () =>
98 Effect.gen(function* () {
99 const cwd = yield* makeTempDir({ git: true });
100 const fileSystem = yield* FileSystem.FileSystem;
101 const path = yield* Path.Path;
102 yield* writeTextFile(cwd, "tracked.txt");
103 yield* git(cwd, ["add", "tracked.txt"]);
104 yield* writeTextFile(cwd, ".gitignore", "node_modules/\n.env\ntracked.txt\n");
105 yield* writeTextFile(cwd, ".env", "secret=value");
106 yield* writeTextFile(cwd, "node_modules/pkg/index.js");
107 yield* writeTextFile(cwd, "src/index.ts");
108 yield* fileSystem.makeDirectory(path.join(cwd, "empty"));
109​
110 const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
111 const root = yield* workspaceEntries.list({ cwd, directoryPath: "" });
112 expect(root.entries).toEqual(
113 expect.arrayContaining([
114 { path: ".env", kind: "file", ignored: true },
115 { path: "node_modules", kind: "directory", ignored: true },
116 { path: "src", kind: "directory" },
117 { path: "empty", kind: "directory" },
118 { path: "tracked.txt", kind: "file" },
119 ]),
120 );
121 expect(root.entries.some((entry) => entry.path.includes("/"))).toBe(false);
122 expect(root.entries.some((entry) => entry.path === ".git")).toBe(false);
123 expect(root.truncated).toBe(false);
124 expect(yield* workspaceEntries.list({ cwd, directoryPath: "node_modules/pkg" })).toEqual({
125 entries: [{ path: "node_modules/pkg/index.js", kind: "file", ignored: true }],
126 truncated: false,
127 });
128 expect(yield* workspaceEntries.list({ cwd, directoryPath: "empty" })).toEqual({
129 entries: [],
130 truncated: false,
131 });
132 }),
133 );
134​
135 it.effect("labels the children of wide folders exactly as git does for each child", () =>
136 Effect.gen(function* () {
137 // Above 1,000 children, listing first asks whether the whole folder is ignored.
138 const cwd = yield* makeTempDir({ git: true });
139 const fileSystem = yield* FileSystem.FileSystem;
140 const path = yield* Path.Path;
141 const platform = yield* HostProcess.Platform;
142 yield* writeTextFile(
143 cwd,
144 ".gitignore",
145 "node_modules/\ndist/\n\\[id\\]/\n*.map\nfoo\n!foo/\n",
146 );
147 yield* Effect.forEach(
148 [
149 "node_modules",
150 "dist",
151 "[id]",
152 "src",
153 ...(platform !== "win32" ? [":foo"] : []),
154 ].flatMap((directory) =>
155 Array.from({ length: 1001 }, (_, index) => `${directory}/pkg-${index}.js`),
156 ),
157 (relativePath) => writeTextFile(cwd, relativePath),
158 { concurrency: 32, discard: true },
159 );
160 for (const relativePath of [
161 "dist/kept.js",
162 "dist/vendored/index.js",
163 "i/page.tsx",
164 "[id]/page.tsx",
165 "src/bundle.map",
166 ]) {
167 yield* writeTextFile(cwd, relativePath);
168 }
169 yield* git(cwd, ["add", "-f", "dist/kept.js", "dist/vendored/index.js", "i/page.tsx"]);
170 if (platform !== "win32") {
171 yield* fileSystem.symlink(path.join(cwd, "src"), path.join(cwd, "node_modules/link"));
172 }
173​
174 const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
175 for (const { directoryPath, ignored, except } of [
176 { directoryPath: "node_modules", ignored: true, except: [] },
177 // A force-tracked file and a folder holding tracked files stay unignored.
178 { directoryPath: "dist", ignored: true, except: ["dist/kept.js", "dist/vendored"] },
179 // git reads `[id]/page.tsx` as a pathspec, which matches the tracked `i/page.tsx`.
180 { directoryPath: "[id]", ignored: true, except: ["[id]/page.tsx"] },
181 { directoryPath: "src", ignored: false, except: ["src/bundle.map"] },
182 ...(platform !== "win32"
183 ? [
184 // git refuses to classify paths beyond a symlink, so nothing there is labelled.
185 { directoryPath: "node_modules/link", ignored: false, except: [] },
186 // A leading `:` is pathspec magic, so git reads `:foo/pkg-0.js` as `foo/pkg-0.js`,
187 // which `!foo/` keeps unignored.
188 { directoryPath: ":foo", ignored: false, except: [] },
189 ]
190 : []),
191 ]) {
192 const { entries } = yield* workspaceEntries.list({ cwd, directoryPath });
193 expect(entries.length, directoryPath).toBeGreaterThan(1000);
194 expect(
195 entries
196 .filter((entry) => (entry.ignored === true) !== ignored)
197 .map((entry) => entry.path)
198 .toSorted(),
199 directoryPath,
200 ).toEqual(except);
201 }
202 }),
203 );
204​
205 it.effect("lists a host folder and its parent, each from its own root", () =>
206 // Folder links outside the workspace browse by passing the host folder as
207 // `cwd`; walking up passes the parent. Each stays bounded by its own root.
208 Effect.gen(function* () {
209 const parent = yield* makeTempDir();
210 const path = yield* Path.Path;
211 yield* writeTextFile(parent, "linked/notes.md");
212 yield* writeTextFile(parent, "sibling/readme.md");
213 const linked = path.join(parent, "linked");
214​
215 const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
216 expect(yield* workspaceEntries.list({ cwd: linked, directoryPath: "" })).toEqual({
217 entries: [{ path: "notes.md", kind: "file" }],
218 truncated: false,
219 });
220 const up = yield* workspaceEntries.list({ cwd: parent, directoryPath: "" });
221 expect(up.entries.map((entry) => entry.path).toSorted()).toEqual(["linked", "sibling"]);
222 const escape = yield* workspaceEntries
223 .list({ cwd: linked, directoryPath: "../sibling" })
224 .pipe(Effect.flip);
225 expect(escape._tag).toBe("WorkspaceEntriesReadDirectoryError");
226 }),
227 );
228​
229 it.effect(
230 "rejects directory traversal, git internals, and symlinks outside the workspace",
231 () =>
232 Effect.gen(function* () {
233 const cwd = yield* makeTempDir();
234 const outside = yield* makeTempDir();
235 const fileSystem = yield* FileSystem.FileSystem;
236 const path = yield* Path.Path;
237 yield* writeTextFile(cwd, ".git/HEAD");
238 const platform = yield* HostProcess.Platform;
239 if (platform !== "win32") yield* fileSystem.symlink(outside, path.join(cwd, "external"));
240 const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
241 for (const directoryPath of [
242 "../",
243 outside,
244 ".git",
245 "missing",
246 ...(platform !== "win32" ? ["external"] : []),
247 ]) {
248 const error = yield* workspaceEntries.list({ cwd, directoryPath }).pipe(Effect.flip);
249 expect(error._tag).toBe("WorkspaceEntriesReadDirectoryError");
250 }
251 }),
252 );
253​
254 it.effect("includes images and other binary files in non-git workspace indexes", () =>
255 Effect.gen(function* () {
256 const cwd = yield* makeTempDir();
257 const imagePaths = ["photo.png", "photo.jpg", "photo.jpeg"];
258 const binaryPaths = [...imagePaths, "document.pdf", "archive.zip", "data.bin"];
259 for (const filePath of binaryPaths) {
260 yield* writeTextFile(cwd, filePath, "\0binary contents\n");
261 }
262 yield* writeTextFile(cwd, "notes.txt", "plain text\n");
263​
264 const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
265 const expectedPaths = [...binaryPaths, "notes.txt"].toSorted();
266 const listed = yield* workspaceEntries.list({ cwd });
267 expect(listed.entries.map((entry) => entry.path).toSorted()).toEqual(expectedPaths);
268 expect(listed.truncated).toBe(false);
269​
270 const searched = yield* workspaceEntries.search({
271 cwd,
272 query: "",
273 limit: 100,
274 kind: "file",
275 });
276 expect(searched.entries.map((entry) => entry.path).toSorted()).toEqual(expectedPaths);
277 expect(searched.truncated).toBe(false);
278​
279 const images = yield* workspaceEntries.search({
280 cwd,
281 query: "",
282 limit: 100,
283 imageOnly: true,
284 });
285 expect(images.entries.map((entry) => entry.path).toSorted()).toEqual(imagePaths.toSorted());
286 expect(images.truncated).toBe(false);
287 }),
288 );
289 });
290​
291 describe("listIgnoredFiles", () => {
292 it.effect("lists ignored files with sizes and skips wholly ignored folders", () =>
293 Effect.gen(function* () {
294 const cwd = yield* makeTempDir({ git: true });
295 yield* writeTextFile(cwd, ".gitignore", "node_modules/\n.env*\n");
296 yield* writeTextFile(cwd, ".env", "A=1");
297 yield* writeTextFile(cwd, "apps/web/index.ts", "y");
298 yield* git(cwd, ["add", "apps/web/index.ts"]);
299 yield* writeTextFile(cwd, "apps/web/.env.local", "B=22");
300 yield* writeTextFile(cwd, "node_modules/pkg/index.js", "x");
301​
302 const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
303 expect(yield* workspaceEntries.listIgnoredFiles({ cwd })).toEqual({
304 files: [
305 { path: ".env", byteLength: 3 },
306 { path: "apps/web/.env.local", byteLength: 4 },
307 ],
308 truncated: false,
309 });
310 }),
311 );
312 });
313​
314 describe("search", () => {
315 it.effect("applies the file filter before limiting search results", () =>
316 Effect.gen(function* () {
317 const cwd = yield* makeTempDir({ prefix: "t3code-workspace-file-limit-" });
318 yield* writeTextFile(cwd, "src/index.ts");
319 yield* writeTextFile(cwd, "src/internal.ts");
320​
321 const result = yield* searchWorkspaceEntries({
322 cwd,
323 query: "src",
324 limit: 1,
325 kind: "file",
326 });
327​
328 // Native ranking can put either matching file first.
329 expect(result.entries).toHaveLength(1);
330 expect(result.entries[0]?.kind).toBe("file");
331 expect(["src/index.ts", "src/internal.ts"]).toContain(result.entries[0]?.path);
332 expect(result.truncated).toBe(true);
333 }),
334 );
335​
336 it.effect("excludes gitignored paths for git repositories", () =>
337 Effect.gen(function* () {
338 const cwd = yield* makeTempDir({ prefix: "t3code-workspace-gitignore-", git: true });
339 yield* writeTextFile(cwd, ".gitignore", ".convex/\nconvex/\nignored.txt\n");
340 yield* writeTextFile(cwd, "src/keep.ts", "export {};");
341 yield* writeTextFile(cwd, "ignored.txt", "ignore me");
342 yield* writeTextFile(cwd, ".convex/local-storage/data.json", "{}");
343 yield* writeTextFile(cwd, "convex/UOoS-l/convex_local_storage/modules/data.json", "{}");
344​
345 const result = yield* searchWorkspaceEntries({ cwd, query: "", limit: 100 });
346 const paths = result.entries.map((entry) => entry.path);
347​
348 expect(paths).toContain("src");
349 expect(paths).toContain("src/keep.ts");
350 expect(paths).not.toContain("ignored.txt");
351 expect(paths.some((entryPath) => entryPath.startsWith(".convex/"))).toBe(false);
352 expect(paths.some((entryPath) => entryPath.startsWith("convex/"))).toBe(false);
353 }),
354 );
355​
356 it.effect("excludes tracked paths that match ignore rules", () =>
357 Effect.gen(function* () {
358 const cwd = yield* makeTempDir({
359 prefix: "t3code-workspace-tracked-gitignore-",
360 git: true,
361 });
362 yield* writeTextFile(cwd, ".convex/local-storage/data.json", "{}");
363 yield* writeTextFile(cwd, "src/keep.ts", "export {};");
364 yield* git(cwd, ["add", ".convex/local-storage/data.json", "src/keep.ts"]);
365 yield* writeTextFile(cwd, ".gitignore", ".convex/\n");
366​
367 const result = yield* searchWorkspaceEntries({ cwd, query: "", limit: 100 });
368 const paths = result.entries.map((entry) => entry.path);
369​
370 expect(paths).toContain("src");
371 expect(paths).toContain("src/keep.ts");
372 expect(paths.some((entryPath) => entryPath.startsWith(".convex/"))).toBe(false);
373 }),
374 );
375 });
376​
377 describe("searchContents", () => {
378 it.effect("returns content matches with file paths, line numbers, and ranges", () =>
379 Effect.gen(function* () {
380 const cwd = yield* makeTempDir({ prefix: "t3code-workspace-content-search-" });
381 yield* writeTextFile(
382 cwd,
383 "src/shapes.ts",
384 "export const square = 4;\nexport const Square = 16;\nexport const squareSize = 8;\n",
385 );
386 yield* writeTextFile(cwd, "src/other.ts", "const circle = true;\n");
387​
388 const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
389 const result = yield* workspaceEntries.searchContents({
390 cwd,
391 query: "Square",
392 limit: 100,
393 caseSensitive: false,
394 wholeWord: true,
395 useRegex: false,
396 });
397​
398 expect(result.matches.map((match) => [match.path, match.lineNumber])).toEqual([
399 ["src/shapes.ts", 1],
400 ["src/shapes.ts", 2],
401 ]);
402 expect(result.matches[0]?.matchRanges).toEqual([{ start: 13, end: 19 }]);
403 expect(result.truncated).toBe(false);
404 }),
405 );
406​
407 it.effect("honors case sensitivity and gitignore rules", () =>
408 Effect.gen(function* () {
409 const cwd = yield* makeTempDir({ prefix: "t3code-workspace-content-ignore-", git: true });
410 yield* writeTextFile(cwd, ".gitignore", "ignored.txt\n");
411 yield* writeTextFile(cwd, "src/keep.ts", "square\nSquare\n");
412 yield* writeTextFile(cwd, "ignored.txt", "Square\n");
413​
414 const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
415 const result = yield* workspaceEntries.searchContents({
416 cwd,
417 query: "Square",
418 limit: 100,
419 caseSensitive: true,
420 wholeWord: false,
421 useRegex: false,
422 });
423​
424 expect(result.matches).toHaveLength(1);
425 expect(result.matches[0]).toMatchObject({ path: "src/keep.ts", lineNumber: 2 });
426 }),
427 );
428​
429 it.effect("finds later whole-word matches in a file after rejected raw matches", () =>
430 Effect.gen(function* () {
431 const cwd = yield* makeTempDir({ prefix: "t3code-workspace-content-late-whole-word-" });
432 yield* writeTextFile(cwd, "src/words.ts", `${"afoo\n".repeat(10)}foo\n`);
433​
434 const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
435 const result = yield* workspaceEntries.searchContents({
436 cwd,
437 query: "foo",
438 limit: 1,
439 caseSensitive: true,
440 wholeWord: true,
441 useRegex: false,
442 });
443​
444 expect(result.matches).toEqual([
445 expect.objectContaining({
446 path: "src/words.ts",
447 lineNumber: 11,
448 matchRanges: [{ start: 0, end: 3 }],
449 }),
450 ]);
451 }),
452 );
453​
454 it.effect("treats astral-plane letters as whole word characters", () =>
455 Effect.gen(function* () {
456 const cwd = yield* makeTempDir({ prefix: "t3code-workspace-content-astral-word-" });
457 yield* writeTextFile(cwd, "src/words.ts", "𐐀foo foo foo𐐀\n");
458​
459 const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
460 const result = yield* workspaceEntries.searchContents({
461 cwd,
462 query: "foo",
463 limit: 100,
464 caseSensitive: true,
465 wholeWord: true,
466 useRegex: false,
467 });
468​
469 expect(result.matches).toEqual([
470 expect.objectContaining({
471 path: "src/words.ts",
472 lineNumber: 1,
473 matchRanges: [{ start: 6, end: 9 }],
474 }),
475 ]);
476 }),
477 );
478​
479 it.effect("matches punctuation-edged whole-word queries including adjacent occurrences", () =>
480 Effect.gen(function* () {
481 const cwd = yield* makeTempDir({ prefix: "t3code-workspace-content-punctuation-" });
482 yield* writeTextFile(cwd, "src/words.ts", "-foo- -foo- -foo-\n");
483​
484 const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
485 const result = yield* workspaceEntries.searchContents({
486 cwd,
487 query: "-foo-",
488 limit: 100,
489 caseSensitive: true,
490 wholeWord: true,
491 useRegex: false,
492 });
493​
494 expect(result.matches).toHaveLength(1);
495 expect(result.matches[0]).toMatchObject({
496 path: "src/words.ts",
497 lineNumber: 1,
498 matchRanges: [
499 { start: 0, end: 5 },
500 { start: 6, end: 11 },
501 { start: 12, end: 17 },
502 ],
503 });
504 }),
505 );
506​
507 it.effect("caps matches per file so one dense file cannot fill the page", () =>
508 Effect.gen(function* () {
509 const cwd = yield* makeTempDir({ prefix: "t3code-workspace-content-per-file-cap-" });
510 yield* writeTextFile(cwd, "src/dense.ts", "needle\n".repeat(300));
511 yield* writeTextFile(cwd, "src/other.ts", "needle\n");
512​
513 const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
514 const result = yield* workspaceEntries.searchContents({
515 cwd,
516 query: "needle",
517 limit: 500,
518 caseSensitive: true,
519 wholeWord: false,
520 useRegex: false,
521 });
522​
523 const byPath = new Map<string, number>();
524 for (const match of result.matches) {
525 byPath.set(match.path, (byPath.get(match.path) ?? 0) + 1);
526 }
527 expect(byPath.get("src/dense.ts")).toBe(100);
528 expect(byPath.get("src/other.ts")).toBe(1);
529 }),
530 );
531​
532 it.effect("preserves regex escapes during case-insensitive searches", () =>
533 Effect.gen(function* () {
534 const cwd = yield* makeTempDir({ prefix: "t3code-workspace-content-regex-" });
535 yield* writeTextFile(cwd, "src/shapes.ts", "Square\nsquare\n");
536​
537 const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
538 const result = yield* workspaceEntries.searchContents({
539 cwd,
540 query: "\\SQUARE",
541 limit: 100,
542 caseSensitive: false,
543 wholeWord: false,
544 useRegex: true,
545 });
546​
547 expect(result.matches.map((match) => match.lineNumber)).toEqual([1, 2]);
548 }),
549 );
550​
551 it.effect("maps multi-byte lines to string-indexed ranges", () =>
552 Effect.gen(function* () {
553 const cwd = yield* makeTempDir({ prefix: "t3code-workspace-content-multibyte-" });
554 yield* writeTextFile(cwd, "src/notes.ts", 'const label = "héllo wörld";\n');
555​
556 const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
557 const result = yield* workspaceEntries.searchContents({
558 cwd,
559 query: "wörld",
560 limit: 100,
561 caseSensitive: true,
562 wholeWord: false,
563 useRegex: false,
564 });
565​
566 expect(result.matches).toHaveLength(1);
567 const match = result.matches[0]!;
568 const range = match.matchRanges[0]!;
569 expect(match.lineContent.slice(range.start, range.end)).toBe("wörld");
570 }),
571 );
572 });
573​
574 describe("browse", () => {
575 it.effect("shows dot directories in directory mode and hidden-prefix mode", () =>
576 Effect.gen(function* () {
577 const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
578 const path = yield* Path.Path;
579 const cwd = yield* makeTempDir({ prefix: "t3code-workspace-browse-hidden-" });
580 yield* writeTextFile(cwd, ".config/settings.json", "{}");
581 yield* writeTextFile(cwd, "config/settings.json", "{}");
582 const cwdWithSeparator = yield* appendSeparator(cwd);
583​
584 const directoryResult = yield* workspaceEntries.browse({
585 partialPath: cwdWithSeparator,
586 });
587 const hiddenPrefixResult = yield* workspaceEntries.browse({
588 partialPath: `${cwdWithSeparator}.c`,
589 });
590​
591 expect(directoryResult.entries.map((entry) => entry.name)).toEqual([".config", "config"]);
592 expect(hiddenPrefixResult).toEqual({
593 parentPath: cwd,
594 entries: [{ name: ".config", fullPath: path.join(cwd, ".config") }],
595 });
596 }),
597 );
598 });
599});