



















@@ -236,7 +236,7 @@ async function expectPathAccessState(pathToCheck: string, expected: "exists" | "
236236await expect(accessExpectation).resolves.toBeUndefined();
237237return;
238238}
239-await expect(accessExpectation).rejects.toThrow();
239+await expect(accessExpectation).rejects.toMatchObject({ code: "ENOENT" });
240240}
241241242242describe("resolveUninstallChannelConfigKeys", () => {
@@ -895,7 +895,7 @@ describe("uninstallPlugin", () => {
895895expectSuccessfulUninstallActions(result, {
896896directory: true,
897897});
898-await expect(fs.access(pluginDir)).rejects.toThrow();
898+await expect(fs.access(pluginDir)).rejects.toMatchObject({ code: "ENOENT" });
899899} finally {
900900await fs.rm(pluginDir, { recursive: true, force: true });
901901}
@@ -923,7 +923,7 @@ describe("uninstallPlugin", () => {
923923924924const applied = await applyPluginUninstallDirectoryRemoval(plan.directoryRemoval);
925925expect(applied).toEqual({ directoryRemoved: true, warnings: [] });
926-await expect(fs.access(pluginDir)).rejects.toThrow();
926+await expect(fs.access(pluginDir)).rejects.toMatchObject({ code: "ENOENT" });
927927});
928928929929it("uninstalls npm-managed packages through npm before deleting the package directory", async () => {
@@ -1004,7 +1004,7 @@ describe("uninstallPlugin", () => {
10041004}),
10051005}),
10061006);
1007-await expect(fs.access(pluginDir)).rejects.toThrow();
1007+await expect(fs.access(pluginDir)).rejects.toMatchObject({ code: "ENOENT" });
10081008});
1009100910101010it("repairs remaining npm plugin openclaw peer links after npm uninstall prunes them", async () => {
@@ -1068,8 +1068,10 @@ describe("uninstallPlugin", () => {
10681068});
1069106910701070expect(applied).toEqual({ directoryRemoved: true, warnings: [] });
1071-await expect(fs.access(removedPluginDir)).rejects.toThrow();
1072-await expect(fs.access(path.join(npmRoot, "node_modules", "openclaw"))).rejects.toThrow();
1071+await expect(fs.access(removedPluginDir)).rejects.toMatchObject({ code: "ENOENT" });
1072+await expect(fs.access(path.join(npmRoot, "node_modules", "openclaw"))).rejects.toMatchObject({
1073+code: "ENOENT",
1074+});
10731075await expect(fs.lstat(peerLink).then((stat) => stat.isSymbolicLink())).resolves.toBe(true);
10741076});
10751077@@ -1218,7 +1220,7 @@ describe("uninstallPlugin", () => {
12181220expect(successfulResult.warnings).toEqual([
12191221"Failed to prune npm dependencies for plugin package demo-plugin: registry unavailable",
12201222]);
1221-await expect(fs.access(pluginDir)).rejects.toThrow();
1223+await expect(fs.access(pluginDir)).rejects.toMatchObject({ code: "ENOENT" });
12221224});
1223122512241226it.each([
@@ -1366,7 +1368,7 @@ describe("uninstallPlugin", () => {
13661368expectSuccessfulUninstallActions(result, {
13671369directory: true,
13681370});
1369-await expect(fs.access(managedDir)).rejects.toThrow();
1371+await expect(fs.access(managedDir)).rejects.toMatchObject({ code: "ENOENT" });
13701372});
1371137313721374it("deletes tracked installs from a recorded managed extensions root", async () => {
@@ -1386,7 +1388,7 @@ describe("uninstallPlugin", () => {
13861388expectSuccessfulUninstallActions(result, {
13871389directory: true,
13881390});
1389-await expect(fs.access(installPath)).rejects.toThrow();
1391+await expect(fs.access(installPath)).rejects.toMatchObject({ code: "ENOENT" });
13901392});
1391139313921394it("deletes managed ClawHub install directories", async () => {
@@ -1429,7 +1431,7 @@ describe("uninstallPlugin", () => {
14291431expectSuccessfulUninstallActions(result, {
14301432directory: true,
14311433});
1432-await expect(fs.access(installPath)).rejects.toThrow();
1434+await expect(fs.access(installPath)).rejects.toMatchObject({ code: "ENOENT" });
14331435});
1434143614351437it("deletes managed git install repos outside the extensions directory", async () => {
@@ -1455,8 +1457,8 @@ describe("uninstallPlugin", () => {
14551457expectSuccessfulUninstallActions(result, {
14561458directory: true,
14571459});
1458-await expect(fs.access(installPath)).rejects.toThrow();
1459-await expect(fs.access(installParent)).rejects.toThrow();
1460+await expect(fs.access(installPath)).rejects.toMatchObject({ code: "ENOENT" });
1461+await expect(fs.access(installParent)).rejects.toMatchObject({ code: "ENOENT" });
14601462});
1461146314621464it("keeps non-empty managed git install parents after deleting the repo", async () => {
@@ -1483,7 +1485,7 @@ describe("uninstallPlugin", () => {
14831485expectSuccessfulUninstallActions(result, {
14841486directory: true,
14851487});
1486-await expect(fs.access(installPath)).rejects.toThrow();
1488+await expect(fs.access(installPath)).rejects.toMatchObject({ code: "ENOENT" });
14871489await expect(fs.access(path.join(installParent, "keep.txt"))).resolves.toBeUndefined();
14881490});
14891491此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。