Skip to content

Commit 8314042

Browse files
committed
harden: cover loadUserConfig invalid .ts paths at load
1 parent c09173e commit 8314042

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/config.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,4 +247,20 @@ describe("loadUserConfig", () => {
247247
);
248248
await expect(loadUserConfig(dir)).rejects.toThrow(/include/);
249249
});
250+
251+
it("invalid explicit .ts config throws at load", async () => {
252+
const p = join(dir, "bad.ts");
253+
writeFileSync(p, "export default { include: [1, 2] };\n");
254+
await expect(loadUserConfig(dir, p)).rejects.toThrow(/include/);
255+
});
256+
257+
it("invalid state-dir config.ts throws at load", async () => {
258+
const stateDir = join(dir, ".codemap");
259+
mkdirSync(stateDir, { recursive: true });
260+
writeFileSync(
261+
join(stateDir, "config.ts"),
262+
"export default { extra: 1 };\n",
263+
);
264+
await expect(loadUserConfig(dir)).rejects.toThrow(/extra/);
265+
});
250266
});

0 commit comments

Comments
 (0)