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: [] }); }); });