Files
openclaw/test/scripts/build-external-plugin-local-dist.test.ts
T
Peter Steinberger eeffa53b20 improve(plugins): compile externalized plugins in source builds (#124639)
* build(plugins): compile externalized plugins into local dist

* test(plugins): assert native external plugin loading

* chore(plugins): keep source runner asset scan unchanged

* refactor(plugins): isolate external local dist builds

* test(plugins): codify external artifact precedence

* test(plugins): preserve contract path boundary
2026-08-16 08:21:17 -07:00

49 lines
1.6 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
buildExternalPluginLocalDist,
listExternalPluginLocalDistPackageDirs,
} from "../../scripts/build-external-plugin-local-dist.mts";
import {
collectRootPackageExcludedExtensionDirs,
DOCKER_SELECTED_PLUGIN_BUILD_IDS_ENV,
} from "../../scripts/lib/bundled-plugin-build-entries.mjs";
describe("external plugin local dist build", () => {
it("selects every externalized first-party plugin behind a package exclusion", () => {
const packageDirs = listExternalPluginLocalDistPackageDirs();
const excludedPluginIds = collectRootPackageExcludedExtensionDirs();
expect(packageDirs).toHaveLength(61);
expect(packageDirs).toEqual(
expect.arrayContaining(["extensions/slack", "extensions/sms", "extensions/mxc"]),
);
expect(packageDirs).not.toContain("extensions/whatsapp");
expect(
packageDirs.every((packageDir) => excludedPluginIds.has(packageDir.split("/").at(-1) ?? "")),
).toBe(true);
});
it("leaves Docker-selected external plugin compilation on the unified build path", () => {
expect(
listExternalPluginLocalDistPackageDirs({
env: {
...process.env,
[DOCKER_SELECTED_PLUGIN_BUILD_IDS_ENV]: "slack",
},
}),
).toEqual([]);
});
it("performs no writes when Docker owns the selected build", async () => {
await expect(
buildExternalPluginLocalDist({
env: {
...process.env,
[DOCKER_SELECTED_PLUGIN_BUILD_IDS_ENV]: "slack",
},
logLevel: "silent",
}),
).resolves.toMatchObject({ pluginDirs: [] });
});
});