test(channels): align module loader jiti fixture

This commit is contained in:
Vincent Koc
2026-04-29 23:46:39 -07:00
parent 43ca7399e5
commit d18fdecd53

View File

@@ -93,7 +93,7 @@ describe("channel plugin module loader helpers", () => {
expect(createJiti).not.toHaveBeenCalled();
});
it("uses the runtime-supported Jiti boundary for Windows dist loads", async () => {
it("creates the runtime-supported Jiti boundary for Windows dist loads", async () => {
const createJiti = vi.fn(() => vi.fn(() => ({ ok: true })));
vi.doMock("jiti", () => ({
createJiti,
@@ -108,15 +108,15 @@ describe("channel plugin module loader helpers", () => {
const rootDir = createTempDir();
const modulePath = path.join(rootDir, "dist", "extensions", "demo", "index.js");
fs.mkdirSync(path.dirname(modulePath), { recursive: true });
fs.writeFileSync(modulePath, "export {};\n", "utf8");
fs.writeFileSync(modulePath, "export const ok = true;\n", "utf8");
expect(
loaderModule.loadChannelPluginModule({
modulePath,
rootDir,
shouldTryNativeRequire: () => false,
}),
).toEqual({ ok: true });
const loaded = loaderModule.loadChannelPluginModule({
modulePath,
rootDir,
shouldTryNativeRequire: () => false,
});
expect(loaded).toMatchObject({ ok: true });
expect(createJiti).toHaveBeenCalledWith(
expect.any(String),
expect.objectContaining({