mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-29 16:48:39 +00:00
chore: Fix types in tests 36/N.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user