test: tighten managed npm repair command assertion

This commit is contained in:
Shakker
2026-05-11 02:35:53 +01:00
parent 5181f021d6
commit c27bae449f

View File

@@ -389,24 +389,21 @@ describe("managed npm root", () => {
const runCommand = vi.fn().mockResolvedValue(successfulSpawn);
await expect(repairManagedNpmRootOpenClawPeer({ npmRoot, runCommand })).resolves.toBe(true);
expect(runCommand).toHaveBeenCalledWith(
[
"npm",
"uninstall",
"--loglevel=error",
"--legacy-peer-deps",
"--ignore-scripts",
"--no-audit",
"--no-fund",
"openclaw",
],
expect.objectContaining({
cwd: npmRoot,
env: expect.objectContaining({
npm_config_legacy_peer_deps: "true",
}),
}),
);
expect(runCommand).toHaveBeenCalledTimes(1);
const [repairArgs, repairOptions] = runCommand.mock.calls[0];
expect(repairArgs).toEqual([
"npm",
"uninstall",
"--loglevel=error",
"--legacy-peer-deps",
"--ignore-scripts",
"--no-audit",
"--no-fund",
"openclaw",
]);
expect(repairOptions?.cwd).toBe(npmRoot);
expect(repairOptions?.timeoutMs).toBe(300_000);
expect(repairOptions?.env?.npm_config_legacy_peer_deps).toBe("true");
const manifest = JSON.parse(await fs.readFile(path.join(npmRoot, "package.json"), "utf8")) as {
dependencies?: Record<string, string>;