






















@@ -1,33 +1,43 @@
11import { afterEach, describe, expect, it, vi } from "vitest";
223-const loadPluginManifestRegistryMock = vi.hoisted(() => vi.fn());
3+const loadPluginRegistrySnapshotMock = vi.hoisted(() => vi.fn());
445-vi.mock("./manifest-registry.js", () => ({
6-loadPluginManifestRegistry: loadPluginManifestRegistryMock,
5+vi.mock("./plugin-registry.js", () => ({
6+loadPluginRegistrySnapshot: loadPluginRegistrySnapshotMock,
77}));
8899afterEach(() => {
10-loadPluginManifestRegistryMock.mockReset();
10+loadPluginRegistrySnapshotMock.mockReset();
1111});
12121313describe("setup-registry runtime fallback", () => {
14-it("uses bundled manifest cliBackends when the setup-registry runtime is unavailable", async () => {
15-loadPluginManifestRegistryMock.mockReturnValue({
14+it("uses bundled registry cliBackends when the setup-registry runtime is unavailable", async () => {
15+loadPluginRegistrySnapshotMock.mockReturnValue({
1616diagnostics: [],
1717plugins: [
1818{
19-id: "openai",
19+pluginId: "openai",
2020origin: "bundled",
21-cliBackends: ["legacy-openai-cli"],
22-setup: {
23-cliBackends: ["Codex-CLI"],
24-requiresRuntime: true,
21+enabled: true,
22+contributions: {
23+cliBackends: ["Codex-CLI", "legacy-openai-cli"],
2524},
2625},
2726{
28-id: "local",
27+pluginId: "disabled",
28+origin: "bundled",
29+enabled: false,
30+contributions: {
31+cliBackends: ["disabled-cli"],
32+},
33+},
34+{
35+pluginId: "local",
2936origin: "workspace",
30-cliBackends: ["local-cli"],
37+enabled: true,
38+contributions: {
39+cliBackends: ["local-cli"],
40+},
3141},
3242],
3343});
@@ -42,21 +52,21 @@ describe("setup-registry runtime fallback", () => {
4252backend: { id: "Codex-CLI" },
4353});
4454expect(resolvePluginSetupCliBackendRuntime({ backend: "local-cli" })).toBeUndefined();
45-expect(loadPluginManifestRegistryMock).toHaveBeenCalledTimes(1);
46-expect(loadPluginManifestRegistryMock).toHaveBeenCalledWith({ cache: true });
55+expect(resolvePluginSetupCliBackendRuntime({ backend: "disabled-cli" })).toBeUndefined();
56+expect(loadPluginRegistrySnapshotMock).toHaveBeenCalledTimes(1);
57+expect(loadPluginRegistrySnapshotMock).toHaveBeenCalledWith({ cache: true });
4758});
48594960it("preserves fail-closed setup lookup when the runtime module explicitly declines to resolve", async () => {
50-loadPluginManifestRegistryMock.mockReturnValue({
61+loadPluginRegistrySnapshotMock.mockReturnValue({
5162diagnostics: [],
5263plugins: [
5364{
54-id: "openai",
65+pluginId: "openai",
5566origin: "bundled",
56-cliBackends: ["legacy-openai-cli"],
57-setup: {
58-cliBackends: ["Codex-CLI"],
59-requiresRuntime: true,
67+enabled: true,
68+contributions: {
69+cliBackends: ["Codex-CLI", "legacy-openai-cli"],
6070},
6171},
6272],
@@ -70,6 +80,6 @@ describe("setup-registry runtime fallback", () => {
7080});
71817282expect(resolvePluginSetupCliBackendRuntime({ backend: "codex-cli" })).toBeUndefined();
73-expect(loadPluginManifestRegistryMock).not.toHaveBeenCalled();
83+expect(loadPluginRegistrySnapshotMock).not.toHaveBeenCalled();
7484});
7585});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。