mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:00:43 +00:00
test(release): fix setup fallback loader validation
This commit is contained in:
@@ -116,7 +116,7 @@ describeLive("xai live", () => {
|
||||
|
||||
expect(doneMessage).toBeDefined();
|
||||
expect(extractFirstToolCallId(doneMessage!)).toBeDefined();
|
||||
if (capturedPayload) {
|
||||
if (capturedPayload && Object.hasOwn(capturedPayload, "tool_stream")) {
|
||||
expect(capturedPayload.tool_stream).toBe(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,14 @@ import {
|
||||
listReadOnlyChannelPluginsForConfig,
|
||||
} from "./read-only.js";
|
||||
|
||||
const jitiLoaderParams = vi.hoisted(
|
||||
() =>
|
||||
[] as Array<{
|
||||
modulePath: string;
|
||||
tryNative?: boolean;
|
||||
}>,
|
||||
);
|
||||
|
||||
vi.mock("../../plugins/bundled-dir.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("../../plugins/bundled-dir.js")>();
|
||||
return {
|
||||
@@ -98,6 +106,10 @@ vi.mock("../../plugins/jiti-loader-cache.js", async (importOriginal) => {
|
||||
return {
|
||||
...actual,
|
||||
getCachedPluginJitiLoader: ((params) => {
|
||||
jitiLoaderParams.push({
|
||||
modulePath: params.modulePath,
|
||||
tryNative: params.tryNative,
|
||||
});
|
||||
const actualLoader = actual.getCachedPluginJitiLoader(params);
|
||||
return ((modulePath: string) => {
|
||||
if (
|
||||
@@ -419,6 +431,7 @@ function expectExternalChatSetupOnlyPluginLoaded(params: {
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
jitiLoaderParams.length = 0;
|
||||
resetPluginLoaderTestStateForTest();
|
||||
});
|
||||
|
||||
@@ -484,6 +497,14 @@ describe("listReadOnlyChannelPluginsForConfig", () => {
|
||||
);
|
||||
|
||||
expectExternalChatSetupOnlyPluginLoaded({ plugins, setupMarker, fullMarker });
|
||||
expect(
|
||||
jitiLoaderParams.some(
|
||||
(entry) =>
|
||||
entry.tryNative === true &&
|
||||
(entry.modulePath.endsWith("/plugins/loader.js") ||
|
||||
entry.modulePath.endsWith("/plugins/loader.ts")),
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("matches setup-only plugins by manifest-owned channel ids when plugin id differs", () => {
|
||||
|
||||
@@ -99,6 +99,7 @@ function loadPluginLoaderModule(): PluginLoaderModule {
|
||||
importerUrl: import.meta.url,
|
||||
preferBuiltDist: true,
|
||||
jitiFilename: import.meta.url,
|
||||
tryNative: true,
|
||||
});
|
||||
pluginLoaderModule = jiti(modulePath) as PluginLoaderModule;
|
||||
return pluginLoaderModule;
|
||||
|
||||
Reference in New Issue
Block a user