






















@@ -49,12 +49,12 @@ describe("runPluginPayloadSmokeCheck", () => {
4949records: { brave: { source: "npm", installPath: dir } },
5050env: {},
5151});
52-expect(result.failures).toEqual([
52+expect(result.failures).toStrictEqual([
5353{
5454pluginId: "brave",
5555installPath: dir,
5656reason: "missing-package-dir",
57-detail: expect.stringContaining(dir),
57+detail: `Install dir is missing: ${dir}`,
5858},
5959]);
6060});
@@ -66,12 +66,12 @@ describe("runPluginPayloadSmokeCheck", () => {
6666records: { brave: { source: "npm", installPath: dir } },
6767env: {},
6868});
69-expect(result.failures).toEqual([
69+expect(result.failures).toStrictEqual([
7070{
7171pluginId: "brave",
7272installPath: dir,
7373reason: "missing-package-json",
74-detail: expect.stringContaining("package.json"),
74+detail: `package.json is missing under ${dir}`,
7575},
7676]);
7777});
@@ -83,12 +83,14 @@ describe("runPluginPayloadSmokeCheck", () => {
8383records: { brave: { source: "npm", installPath: dir } },
8484env: {},
8585});
86-expect(result.failures).toHaveLength(1);
87-expect(result.failures[0]).toMatchObject({
88-pluginId: "brave",
89-reason: "missing-main-entry",
90-});
91-expect(result.failures[0]?.detail).toContain("dist/index.js");
86+expect(result.failures).toStrictEqual([
87+{
88+pluginId: "brave",
89+installPath: dir,
90+reason: "missing-main-entry",
91+detail: `Plugin main entry "dist/index.js" not found at ${path.join(dir, "dist/index.js")}`,
92+},
93+]);
9294});
93959496it("accepts a manifest with no main field (OpenClaw plugins commonly use `exports` or `openclaw.extensions`)", async () => {
@@ -153,12 +155,15 @@ describe("runPluginPayloadSmokeCheck", () => {
153155records: { brave: { source: "npm", installPath: dir } },
154156env: {},
155157});
156-expect(result.failures).toHaveLength(1);
157-expect(result.failures[0]).toMatchObject({
158-pluginId: "brave",
159-reason: "missing-extension-entry",
160-});
161-expect(result.failures[0]?.detail).toContain("./dist/index.js");
158+expect(result.failures).toStrictEqual([
159+{
160+pluginId: "brave",
161+installPath: dir,
162+reason: "missing-extension-entry",
163+detail:
164+"Plugin extension entry validation failed: extension entry not found: ./dist/index.js",
165+},
166+]);
162167});
163168164169it("reports a failure when `main` resolves to a directory rather than a file", async () => {
@@ -174,8 +179,14 @@ describe("runPluginPayloadSmokeCheck", () => {
174179records: { x: { source: "npm", installPath: dir } },
175180env: {},
176181});
177-expect(result.failures).toHaveLength(1);
178-expect(result.failures[0]).toMatchObject({ pluginId: "x", reason: "missing-main-entry" });
182+expect(result.failures).toStrictEqual([
183+{
184+pluginId: "x",
185+installPath: dir,
186+reason: "missing-main-entry",
187+detail: `Plugin main entry "lib" not found at ${path.join(dir, "lib")}`,
188+},
189+]);
179190});
180191181192it("reports a failure when `main` is a symlink whose target is missing", async () => {
@@ -195,11 +206,14 @@ describe("runPluginPayloadSmokeCheck", () => {
195206records: { x: { source: "npm", installPath: dir } },
196207env: {},
197208});
198-expect(result.failures).toHaveLength(1);
199-expect(result.failures[0]).toMatchObject({
200-pluginId: "x",
201-reason: "missing-main-entry",
202-});
209+expect(result.failures).toStrictEqual([
210+{
211+pluginId: "x",
212+installPath: dir,
213+reason: "missing-main-entry",
214+detail: `Plugin main entry "dist/entry.js" not found at ${path.join(dir, "dist", "entry.js")}`,
215+},
216+]);
203217});
204218205219it("reports a failure when package.json cannot be parsed", async () => {
@@ -210,11 +224,15 @@ describe("runPluginPayloadSmokeCheck", () => {
210224records: { broken: { source: "npm", installPath: dir } },
211225env: {},
212226});
213-expect(result.failures).toHaveLength(1);
214-expect(result.failures[0]).toMatchObject({
215-pluginId: "broken",
216-reason: "invalid-package-json",
217-});
227+expect(result.failures).toStrictEqual([
228+{
229+pluginId: "broken",
230+installPath: dir,
231+reason: "invalid-package-json",
232+detail:
233+"Could not parse package.json: Unexpected token 'o', \"not-json\" is not valid JSON",
234+},
235+]);
218236});
219237220238it("reports a failure when an install record is missing installPath", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。