mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:10:44 +00:00
test(channels): align module loader jiti fixture
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user