






















@@ -1,4 +1,4 @@
1-import { afterEach, describe, expect, it } from "vitest";
1+import { afterAll, describe, expect, it } from "vitest";
22import {
33applyPluginAutoEnable,
44detectPluginAutoEnableCandidates,
@@ -11,7 +11,9 @@ import {
1111} from "./plugin-auto-enable.test-helpers.js";
1212import { validateConfigObject } from "./validation.js";
131314-afterEach(() => {
14+const env = makeIsolatedEnv();
15+16+afterAll(() => {
1517resetPluginAutoEnableTestState();
1618});
1719@@ -21,7 +23,7 @@ describe("applyPluginAutoEnable core", () => {
2123config: {
2224channels: { slack: { botToken: "x" } },
2325},
24-env: makeIsolatedEnv(),
26+ env,
2527});
26282729expect(candidates).toEqual([
@@ -46,7 +48,7 @@ describe("applyPluginAutoEnable core", () => {
4648it("treats an undefined config as empty", () => {
4749const result = applyPluginAutoEnable({
4850config: undefined,
49-env: makeIsolatedEnv(),
51+ env,
5052});
51535254expect(result.config).toEqual({});
@@ -60,7 +62,7 @@ describe("applyPluginAutoEnable core", () => {
6062channels: { slack: { botToken: "x" } },
6163plugins: { allow: ["telegram"] },
6264},
63-env: makeIsolatedEnv(),
65+ env,
6466});
65676668expect(result.config.channels?.slack?.enabled).toBe(true);
@@ -77,7 +79,7 @@ describe("applyPluginAutoEnable core", () => {
7779config: {
7880channels: { slack: { botToken: "x" } },
7981},
80-env: makeIsolatedEnv(),
82+ env,
8183});
82848385expect(result.config.channels?.slack?.enabled).toBe(true);
@@ -89,7 +91,7 @@ describe("applyPluginAutoEnable core", () => {
8991config: {
9092channels: { slack: { botToken: "x" } },
9193},
92-env: makeIsolatedEnv(),
94+ env,
9395});
94969597expect(Object.getPrototypeOf(result.autoEnabledReasons)).toBeNull();
@@ -105,7 +107,7 @@ describe("applyPluginAutoEnable core", () => {
105107allow: ["telegram"],
106108},
107109},
108-env: makeIsolatedEnv(),
110+ env,
109111});
110112111113expect(result.config.plugins?.allow).toEqual(["telegram", "browser"]);
@@ -123,7 +125,7 @@ describe("applyPluginAutoEnable core", () => {
123125allow: ["telegram"],
124126},
125127},
126-env: makeIsolatedEnv(),
128+ env,
127129});
128130129131expect(result.config.plugins?.allow).toEqual(["telegram", "browser"]);
@@ -138,7 +140,7 @@ describe("applyPluginAutoEnable core", () => {
138140allow: ["telegram"],
139141},
140142},
141-env: makeIsolatedEnv(),
143+ env,
142144});
143145144146expect(result.config.plugins?.allow).toEqual(["telegram"]);
@@ -160,7 +162,7 @@ describe("applyPluginAutoEnable core", () => {
160162allow: ["telegram"],
161163},
162164},
163-env: makeIsolatedEnv(),
165+ env,
164166manifestRegistry: makeRegistry([
165167{
166168id: "evil-plugin",
@@ -191,7 +193,7 @@ describe("applyPluginAutoEnable core", () => {
191193},
192194},
193195},
194-env: makeIsolatedEnv(),
196+ env,
195197});
196198197199expect(result.config.plugins?.entries?.firecrawl?.enabled).toBe(true);
@@ -208,7 +210,7 @@ describe("applyPluginAutoEnable core", () => {
208210},
209211},
210212},
211-env: makeIsolatedEnv(),
213+ env,
212214manifestRegistry: makeRegistry([{ id: "codex", channels: [], providers: ["codex"] }]),
213215});
214216@@ -229,7 +231,7 @@ describe("applyPluginAutoEnable core", () => {
229231},
230232},
231233},
232-env: makeIsolatedEnv(),
234+ env,
233235manifestRegistry: makeRegistry([
234236{
235237id: "codex",
@@ -281,7 +283,7 @@ describe("applyPluginAutoEnable core", () => {
281283list: [{ id: "pi" }],
282284},
283285},
284-env: makeIsolatedEnv(),
286+ env,
285287});
286288287289expect(result.config).toEqual({
@@ -309,7 +311,7 @@ describe("applyPluginAutoEnable core", () => {
309311},
310312},
311313},
312-env: makeIsolatedEnv(),
314+ env,
313315});
314316315317expect(result.config.plugins?.entries?.modelByChannel).toBeUndefined();
@@ -326,7 +328,7 @@ describe("applyPluginAutoEnable core", () => {
326328},
327329},
328330},
329-env: makeIsolatedEnv(),
331+ env,
330332});
331333332334expect(result.config.channels?.whatsapp?.enabled).toBe(true);
@@ -345,7 +347,7 @@ describe("applyPluginAutoEnable core", () => {
345347allow: ["telegram"],
346348},
347349},
348-env: makeIsolatedEnv(),
350+ env,
349351});
350352351353expect(result.config.channels?.whatsapp?.enabled).toBe(true);
@@ -367,7 +369,7 @@ describe("applyPluginAutoEnable core", () => {
367369},
368370},
369371},
370-env: makeIsolatedEnv(),
372+ env,
371373});
372374373375expect(result.config.plugins?.allow).toEqual(["glueclaw", "discord"]);
@@ -388,7 +390,7 @@ describe("applyPluginAutoEnable core", () => {
388390},
389391},
390392},
391-env: makeIsolatedEnv(),
393+ env,
392394});
393395394396expect(result.config.plugins?.allow).toEqual(["glueclaw"]);
@@ -407,12 +409,12 @@ describe("applyPluginAutoEnable core", () => {
407409allow: ["telegram"],
408410},
409411},
410-env: makeIsolatedEnv(),
412+ env,
411413});
412414413415const second = applyPluginAutoEnable({
414416config: first.config,
415-env: makeIsolatedEnv(),
417+ env,
416418});
417419418420expect(first.changes).toHaveLength(1);
@@ -426,7 +428,7 @@ describe("applyPluginAutoEnable core", () => {
426428channels: { slack: { botToken: "x" } },
427429plugins: { entries: { slack: { enabled: false } } },
428430},
429-env: makeIsolatedEnv(),
431+ env,
430432});
431433432434expect(result.config.plugins?.entries?.slack?.enabled).toBe(false);
@@ -438,7 +440,7 @@ describe("applyPluginAutoEnable core", () => {
438440config: {
439441channels: { slack: { botToken: "x", enabled: false } },
440442},
441-env: makeIsolatedEnv(),
443+ env,
442444});
443445444446expect(result.config.channels?.slack?.enabled).toBe(false);
@@ -451,7 +453,7 @@ describe("applyPluginAutoEnable core", () => {
451453config: {
452454channels: { matrix: { enabled: false } },
453455},
454-env: makeIsolatedEnv(),
456+ env,
455457manifestRegistry: makeRegistry([{ id: "matrix", channels: ["matrix"] }]),
456458});
457459@@ -478,7 +480,7 @@ describe("applyPluginAutoEnable core", () => {
478480config: {
479481channels: { apn: { someKey: "value" } },
480482},
481-env: makeIsolatedEnv(),
483+ env,
482484manifestRegistry: makeRegistry([{ id: "apn-channel", channels: ["apn"] }]),
483485});
484486@@ -492,7 +494,7 @@ describe("applyPluginAutoEnable core", () => {
492494channels: { slack: { botToken: "x" } },
493495plugins: { enabled: false },
494496},
495-env: makeIsolatedEnv(),
497+ env,
496498});
497499498500expect(result.config.plugins?.entries?.slack?.enabled).toBeUndefined();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。