test(plugins): avoid flaky jiti import seam in regression

This commit is contained in:
MaxxxDong 2026-03-20 18:17:04 +08:00
parent b64d176b0e
commit 46fa94f303

View File

@ -82,14 +82,16 @@ export const copiedRuntimeMarker = {
});
// Exercise the same Jiti option builder used by the production loader, but
// stick to the stable positive path that proves git-style runtimes can load
// through the scoped plugin-sdk alias (#49806).
// assert the Jiti alias seam via resolve() instead of executing the full
// import path. Linux CI workers can still hit a sync require/getter edge
// case inside Jiti when evaluating cross-root temporary TypeScript files,
// and that behavior is orthogonal to the #49806 alias regression this test
// is protecting.
const withAlias = createJiti(jitiBaseUrl, jitiOptions);
expect(withAlias(copiedChannelRuntime)).toMatchObject({
copiedRuntimeMarker: {
PAIRING_APPROVED_MESSAGE: "paired",
resolveOutboundSendDep: expect.any(Function),
},
});
expect(withAlias.resolve("openclaw/plugin-sdk/channel-runtime")).toBe(copiedChannelRuntimeShim);
expect(fs.readFileSync(copiedChannelRuntime, "utf-8")).toContain(
'from "openclaw/plugin-sdk/channel-runtime"',
);
expect(fs.readFileSync(copiedChannelRuntime, "utf-8")).toContain('from "../runtime-api.js"');
});
});