mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 13:10:27 +00:00
test: stabilize ci test isolation
This commit is contained in:
@@ -5,11 +5,14 @@ import { logAuthProfileFailureStateChange } from "./state-observation.js";
|
||||
afterEach(() => {
|
||||
setLoggerOverride(null);
|
||||
resetLogger();
|
||||
vi.unstubAllEnvs();
|
||||
});
|
||||
|
||||
describe("logAuthProfileFailureStateChange", () => {
|
||||
it("sanitizes consoleMessage fields before logging", () => {
|
||||
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
|
||||
vi.stubEnv("FORCE_COLOR", "0");
|
||||
vi.stubEnv("NO_COLOR", "1");
|
||||
setLoggerOverride({ level: "silent", consoleLevel: "warn" });
|
||||
|
||||
logAuthProfileFailureStateChange({
|
||||
|
||||
@@ -12,6 +12,7 @@ import { loadOpenClawPlugins } from "../plugins/loader.js";
|
||||
import { guardSessionManager } from "./session-tool-result-guard-wrapper.js";
|
||||
|
||||
const EMPTY_PLUGIN_SCHEMA = { type: "object", additionalProperties: false, properties: {} };
|
||||
const originalBundledPluginsDir = process.env.OPENCLAW_BUNDLED_PLUGINS_DIR;
|
||||
|
||||
function writeTempPlugin(params: { dir: string; id: string; body: string }): string {
|
||||
const pluginDir = path.join(params.dir, params.id);
|
||||
@@ -60,6 +61,11 @@ function getPersistedToolResult(sm: ReturnType<typeof SessionManager.inMemory>)
|
||||
|
||||
afterEach(() => {
|
||||
resetGlobalHookRunner();
|
||||
if (originalBundledPluginsDir === undefined) {
|
||||
delete process.env.OPENCLAW_BUNDLED_PLUGINS_DIR;
|
||||
} else {
|
||||
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = originalBundledPluginsDir;
|
||||
}
|
||||
});
|
||||
|
||||
describe("tool_result_persist hook", () => {
|
||||
|
||||
Reference in New Issue
Block a user