


























@@ -62,6 +62,16 @@ function collectMatching<T>(items: readonly T[], predicate: (item: T) => boolean
6262return matches;
6363}
646465+async function expectMissingPath(pathToCheck: string) {
66+let thrown: unknown;
67+try {
68+await fs.lstat(pathToCheck);
69+} catch (error) {
70+thrown = error;
71+}
72+expect((thrown as NodeJS.ErrnoException | undefined)?.code).toBe("ENOENT");
73+}
74+6575async function createTempWorkspaceDir() {
6676const workspaceDir = path.join(tempRoot, `workspace-${++workspaceCaseIndex}`);
6777await fs.mkdir(workspaceDir, { recursive: true });
@@ -228,9 +238,7 @@ describe("loadWorkspaceSkillEntries", () => {
228238});
229239230240expect(blockedEntries.map((entry) => entry.skill.name)).not.toContain("browser-automation");
231-await expect(
232-fs.lstat(path.join(workspaceDir, ".plugin-skills", "browser-automation")),
233-).rejects.toMatchObject({ code: "ENOENT" });
241+await expectMissingPath(path.join(workspaceDir, ".plugin-skills", "browser-automation"));
234242});
235243236244it("loads frontmatter edge cases in one workspace", async () => {
@@ -467,10 +475,8 @@ describe("loadWorkspaceSkillEntries", () => {
467475filePath: path.join(skillDir, "SKILL.md"),
468476});
469477470-expect(frontmatter).toMatchObject({
471-name: "root-allowed",
472-description: "Readable from filesystem root",
473-});
478+expect(frontmatter?.name).toBe("root-allowed");
479+expect(frontmatter?.description).toBe("Readable from filesystem root");
474480},
475481);
476482@@ -504,7 +510,8 @@ describe("loadWorkspaceSkillEntries", () => {
504510});
505511506512const names = loadTestWorkspaceSkillEntries(workspaceDir).map((entry) => entry.skill.name);
507-expect(names).toEqual(expect.arrayContaining(["direct-skill", "grouped-skill"]));
513+expect(names).toContain("direct-skill");
514+expect(names).toContain("grouped-skill");
508515});
509516510517it("does not count invalid grouped candidates against the loaded skill cap", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。