Files
openclaw/test/scripts/build-external-plugin-local-dist.test.ts
Vincent Koc 2b06180bb5 fix(package): restore npm package size headroom (#129782)
* fix(package): externalize diffs build outputs

* chore: remove release-owned changelog entry

* fix(build): generate selected plugin assets before Docker staging

---------

Co-authored-by: Dallin Romney <dallinromney@gmail.com>
2026-08-26 12:40:27 +08:00

55 lines
1.7 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(63);
expect(packageDirs).toEqual(
expect.arrayContaining([
"extensions/diffs",
"extensions/diffs-language-pack",
"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: [] });
});
});