mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 09:42:44 +00:00
refactor(core): dedupe shared config and runtime helpers
This commit is contained in:
@@ -3,6 +3,7 @@ import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { expectSingleNpmInstallIgnoreScriptsCall } from "../test-utils/exec-assertions.js";
|
||||
import { isAddressInUseError } from "./gmail-watcher.js";
|
||||
|
||||
const fixtureRoot = path.join(os.tmpdir(), `openclaw-hook-install-${randomUUID()}`);
|
||||
@@ -195,16 +196,10 @@ describe("installHooksFromPath", () => {
|
||||
if (!res.ok) {
|
||||
return;
|
||||
}
|
||||
|
||||
const calls = run.mock.calls.filter((c) => Array.isArray(c[0]) && c[0][0] === "npm");
|
||||
expect(calls.length).toBe(1);
|
||||
const first = calls[0];
|
||||
if (!first) {
|
||||
throw new Error("expected npm install call");
|
||||
}
|
||||
const [argv, opts] = first;
|
||||
expect(argv).toEqual(["npm", "install", "--omit=dev", "--silent", "--ignore-scripts"]);
|
||||
expect(opts?.cwd).toBe(res.targetDir);
|
||||
expectSingleNpmInstallIgnoreScriptsCall({
|
||||
calls: run.mock.calls as Array<[unknown, { cwd?: string } | undefined]>,
|
||||
expectedCwd: res.targetDir,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user