perf(test): trim module resets in config suites
This commit is contained in:
@@ -2,12 +2,11 @@ import fs from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { loadConfig, validateConfigObject } from "./config.js";
|
||||
import { withTempHome } from "./test-helpers.js";
|
||||
|
||||
describe("multi-agent agentDir validation", () => {
|
||||
it("rejects shared agents.list agentDir", async () => {
|
||||
vi.resetModules();
|
||||
const { validateConfigObject } = await import("./config.js");
|
||||
const shared = path.join(tmpdir(), "openclaw-shared-agentdir");
|
||||
const res = validateConfigObject({
|
||||
agents: {
|
||||
@@ -46,9 +45,7 @@ describe("multi-agent agentDir validation", () => {
|
||||
"utf-8",
|
||||
);
|
||||
|
||||
vi.resetModules();
|
||||
const spy = vi.spyOn(console, "error").mockImplementation(() => {});
|
||||
const { loadConfig } = await import("./config.js");
|
||||
expect(() => loadConfig()).toThrow(/duplicate agentDir/i);
|
||||
expect(spy.mock.calls.flat().join(" ")).toMatch(/Duplicate agentDir/i);
|
||||
spy.mockRestore();
|
||||
|
||||
Reference in New Issue
Block a user