mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-27 00:17:29 +00:00
refactor(core): dedupe shared config and runtime helpers
This commit is contained in:
16
src/test-utils/exec-assertions.ts
Normal file
16
src/test-utils/exec-assertions.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { expect } from "vitest";
|
||||
|
||||
export function expectSingleNpmInstallIgnoreScriptsCall(params: {
|
||||
calls: Array<[unknown, { cwd?: string } | undefined]>;
|
||||
expectedCwd: string;
|
||||
}) {
|
||||
const npmCalls = params.calls.filter((call) => Array.isArray(call[0]) && call[0][0] === "npm");
|
||||
expect(npmCalls.length).toBe(1);
|
||||
const first = npmCalls[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(params.expectedCwd);
|
||||
}
|
||||
Reference in New Issue
Block a user