diff --git a/src/plugins/install.test.ts b/src/plugins/install.test.ts index e78993d61..c29030e07 100644 --- a/src/plugins/install.test.ts +++ b/src/plugins/install.test.ts @@ -14,18 +14,38 @@ function makeTempDir() { return dir; } -function packToArchive({ pkgDir, outDir, outName }: { pkgDir: string; outDir: string; outName: string }) { - const res = spawnSync("npm", ["pack", "--silent", "--pack-destination", outDir, pkgDir], { - encoding: "utf-8", - }); +function packToArchive({ + pkgDir, + outDir, + outName, +}: { + pkgDir: string; + outDir: string; + outName: string; +}) { + const res = spawnSync( + "npm", + ["pack", "--silent", "--pack-destination", outDir, pkgDir], + { + encoding: "utf-8", + }, + ); expect(res.status).toBe(0); if (res.status !== 0) { - throw new Error(`npm pack failed: ${res.stderr || res.stdout || ""}`); + throw new Error( + `npm pack failed: ${res.stderr || res.stdout || ""}`, + ); } - const packed = (res.stdout || "").trim().split(/\r?\n/).filter(Boolean).at(-1); + const packed = (res.stdout || "") + .trim() + .split(/\r?\n/) + .filter(Boolean) + .at(-1); if (!packed) { - throw new Error(`npm pack did not output a filename: ${res.stdout || ""}`); + throw new Error( + `npm pack did not output a filename: ${res.stdout || ""}`, + ); } const src = path.join(outDir, packed); @@ -82,7 +102,11 @@ describe("installPluginFromArchive", () => { "utf-8", ); - const archivePath = packToArchive({ pkgDir, outDir: workDir, outName: "plugin.tgz" }); + const archivePath = packToArchive({ + pkgDir, + outDir: workDir, + outName: "plugin.tgz", + }); const result = await withStateDir(stateDir, async () => { const { installPluginFromArchive } = await import("./install.js"); @@ -122,7 +146,11 @@ describe("installPluginFromArchive", () => { "utf-8", ); - const archivePath = packToArchive({ pkgDir, outDir: workDir, outName: "plugin.tgz" }); + const archivePath = packToArchive({ + pkgDir, + outDir: workDir, + outName: "plugin.tgz", + }); const { first, second } = await withStateDir(stateDir, async () => { const { installPluginFromArchive } = await import("./install.js"); @@ -148,7 +176,11 @@ describe("installPluginFromArchive", () => { "utf-8", ); - const archivePath = packToArchive({ pkgDir, outDir: workDir, outName: "bad.tgz" }); + const archivePath = packToArchive({ + pkgDir, + outDir: workDir, + outName: "bad.tgz", + }); const result = await withStateDir(stateDir, async () => { const { installPluginFromArchive } = await import("./install.js");