refactor(core): dedupe shared config and runtime helpers

This commit is contained in:
Peter Steinberger
2026-02-16 14:52:03 +00:00
parent 544ffbcf7b
commit 04892ee230
68 changed files with 1966 additions and 2018 deletions

View File

@@ -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,
});
});
});