Skip to content

Commit a9e262d

Browse files
✅ Test nested file with dest dir
1 parent e712746 commit a9e262d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

index.spec.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe("eject-dependencies", () => {
4141
expect(result.updatedDependencies.has("no-dependencies.js")).toBeFalsy();
4242
});
4343

44-
it("updates with dest dir", async () => {
44+
it("updates with destination dir", async () => {
4545
await writeFile("./dest-dir.ts", `import { readFile } from "fs-extra"`);
4646
await eject({ destDir: "path/to/ejected" });
4747
const destDirFile = await readFile("./dest-dir.ts", "utf8");
@@ -59,8 +59,16 @@ describe("eject-dependencies", () => {
5959
await writeFile("./n/e/s/t/e/d.ts", `import { readFile } from "fs-extra"`);
6060
await eject({ codeFiles: ["n/e/s/**/*.ts"] });
6161
const destDirFile = await readFile("./n/e/s/t/e/d.ts", "utf8");
62+
expect(destDirFile.includes(`from "../../../../../`)).toBeTruthy();
63+
});
64+
65+
it("updates nested file with destination dir", async () => {
66+
await ensureDir("./n/e/s/t/e");
67+
await writeFile("./n/e/s/t/e/dest.ts", `import fg from "fast-glob"`);
68+
await eject({ destDir: "path/to/", codeFiles: ["n/e/s/t/e/dest.ts"] });
69+
const destDirFile = await readFile("./n/e/s/t/e/dest.ts", "utf8");
6270
console.log(destDirFile);
63-
expect(destDirFile.includes(`from "../../../`)).toBeTruthy();
71+
expect(destDirFile.includes(`from "../`)).toBeTruthy();
6472
});
6573

6674
it("updates with dependencies filter", async () => {
@@ -77,7 +85,6 @@ describe("eject-dependencies", () => {
7785
}
7886
});
7987
const filterFile = await readFile("./filter.ts", "utf8");
80-
console.log(filterFile);
8188
expect(
8289
filterFile.includes(`import { readFile } from "./ejected/fs-extra"`)
8390
).toBeTruthy();
@@ -89,7 +96,7 @@ describe("eject-dependencies", () => {
8996
await writeFile("./index.spec.ts", originalIndexSpecTS);
9097
await ensureDir("./ejected");
9198
await remove("./ejected");
92-
await remove("./path/to/ejected");
99+
await remove("./path/to");
93100
await remove("./no-dependencies.js");
94101
await remove("./dest-dir.ts");
95102
await remove("./n");

0 commit comments

Comments
 (0)