chore: Fix types in tests 36/N.

This commit is contained in:
cpojer
2026-02-17 15:46:48 +09:00
parent 2a4ca7671e
commit 7b31e8fc59
14 changed files with 86 additions and 42 deletions

View File

@@ -423,7 +423,14 @@ describe("installPluginFromDir", () => {
const { runCommandWithTimeout } = await import("../process/exec.js");
const run = vi.mocked(runCommandWithTimeout);
run.mockResolvedValue({ code: 0, stdout: "", stderr: "" });
run.mockResolvedValue({
code: 0,
stdout: "",
stderr: "",
signal: null,
killed: false,
termination: "exit",
});
const { installPluginFromDir } = await import("./install.js");
const res = await installPluginFromDir({
@@ -468,9 +475,16 @@ describe("installPluginFromNpmSpec", () => {
const packedName = "voice-call-0.0.1.tgz";
run.mockImplementation(async (argv, opts) => {
if (argv[0] === "npm" && argv[1] === "pack") {
packTmpDir = String(opts?.cwd ?? "");
packTmpDir = String(typeof opts === "number" ? "" : (opts.cwd ?? ""));
await packToArchive({ pkgDir, outDir: packTmpDir, outName: packedName });
return { code: 0, stdout: `${packedName}\n`, stderr: "", signal: null, killed: false };
return {
code: 0,
stdout: `${packedName}\n`,
stderr: "",
signal: null,
killed: false,
termination: "exit",
};
}
throw new Error(`unexpected command: ${argv.join(" ")}`);
});
@@ -493,7 +507,8 @@ describe("installPluginFromNpmSpec", () => {
}
const [argv, options] = packCall;
expect(argv).toEqual(["npm", "pack", "@openclaw/voice-call@0.0.1", "--ignore-scripts"]);
expect(options?.env).toMatchObject({ NPM_CONFIG_IGNORE_SCRIPTS: "true" });
const commandOptions = typeof options === "number" ? undefined : options;
expect(commandOptions?.env).toMatchObject({ NPM_CONFIG_IGNORE_SCRIPTS: "true" });
expect(packTmpDir).not.toBe("");
expect(fs.existsSync(packTmpDir)).toBe(false);