Skip to content

Commit 1e6b8ff

Browse files
committed
test(setup): restore the @Clack module mock in a finally (no cross-file leak)
1 parent 535cdf6 commit 1e6b8ff

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

test/core-setup.test.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -519,16 +519,18 @@ describe("defaultAskProjectSpec single-repo Enter-through flow", () => {
519519
},
520520
}));
521521

522-
const { defaultAskProjectSpec } = await import("../src/core/setup.ts");
523-
const { entry, spec } = await defaultAskProjectSpec({ key: "NP", tracker: "plane" });
524-
525-
expect(spec).toEqual({ identifier: "NP", name: "My App" });
526-
expect(entry.name).toBe("My App");
527-
expect(entry.root).toBe("/root/new");
528-
expect(entry.default_repo).toBe("NP");
529-
expect(entry.repos).toEqual({ NP: "/root/new" });
530-
expect(entry.module_repo_map).toEqual({});
531-
532-
mock.restore();
522+
try {
523+
const { defaultAskProjectSpec } = await import("../src/core/setup.ts");
524+
const { entry, spec } = await defaultAskProjectSpec({ key: "NP", tracker: "plane" });
525+
526+
expect(spec).toEqual({ identifier: "NP", name: "My App" });
527+
expect(entry.name).toBe("My App");
528+
expect(entry.root).toBe("/root/new");
529+
expect(entry.default_repo).toBe("NP");
530+
expect(entry.repos).toEqual({ NP: "/root/new" });
531+
expect(entry.module_repo_map).toEqual({});
532+
} finally {
533+
mock.restore();
534+
}
533535
});
534536
});

0 commit comments

Comments
 (0)