test: stabilize hooks loader log assertion on Windows

This commit is contained in:
Peter Steinberger 2026-03-13 02:16:42 +00:00
parent 4fb3b88e57
commit 296a106f49
1 changed files with 6 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi }
import type { OpenClawConfig } from "../config/config.js";
import { setLoggerOverride } from "../logging/logger.js";
import { loggingState } from "../logging/state.js";
import { stripAnsi } from "../terminal/ansi.js";
import { captureEnv } from "../test-utils/env.js";
import {
clearInternalHooks,
@ -361,9 +362,11 @@ describe("loader", () => {
await expectNoCommandHookRegistration(cfg);
const messages = (error as ReturnType<typeof vi.fn>).mock.calls
.map((call) => String(call[0] ?? ""))
.join("\n");
const messages = stripAnsi(
(error as ReturnType<typeof vi.fn>).mock.calls
.map((call) => String(call[0] ?? ""))
.join("\n"),
);
expect(messages).toContain("forged-log");
expect(messages).not.toContain("\u001b[31m");
expect(messages).not.toContain("\nforged-log");