mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-28 17:21:52 +00:00
perf(test): reduce vitest logging overhead and media fixture cost
This commit is contained in:
@@ -67,7 +67,7 @@ describe("logger helpers", () => {
|
|||||||
|
|
||||||
it("uses daily rolling default log file and prunes old ones", () => {
|
it("uses daily rolling default log file and prunes old ones", () => {
|
||||||
resetLogger();
|
resetLogger();
|
||||||
setLoggerOverride({}); // force defaults regardless of user config
|
setLoggerOverride({ level: "info" }); // force default file path with enabled file logging
|
||||||
const today = localDateString(new Date());
|
const today = localDateString(new Date());
|
||||||
const todayPath = path.join(DEFAULT_LOG_DIR, `openclaw-${today}.log`);
|
const todayPath = path.join(DEFAULT_LOG_DIR, `openclaw-${today}.log`);
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ function normalizeConsoleLevel(level?: string): LogLevel {
|
|||||||
if (isVerbose()) {
|
if (isVerbose()) {
|
||||||
return "debug";
|
return "debug";
|
||||||
}
|
}
|
||||||
|
if (!level && process.env.VITEST === "true" && process.env.OPENCLAW_TEST_CONSOLE !== "1") {
|
||||||
|
return "silent";
|
||||||
|
}
|
||||||
return normalizeLogLevel(level, "info");
|
return normalizeLogLevel(level, "info");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,9 @@ function resolveSettings(): ResolvedSettings {
|
|||||||
cfg = undefined;
|
cfg = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const level = normalizeLogLevel(cfg?.level, "info");
|
const defaultLevel =
|
||||||
|
process.env.VITEST === "true" && process.env.OPENCLAW_TEST_FILE_LOG !== "1" ? "silent" : "info";
|
||||||
|
const level = normalizeLogLevel(cfg?.level, defaultLevel);
|
||||||
const file = cfg?.file ?? defaultRollingPathForToday();
|
const file = cfg?.file ?? defaultRollingPathForToday();
|
||||||
return { level, file };
|
return { level, file };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,8 +146,8 @@ describe("web auto-reply", () => {
|
|||||||
|
|
||||||
const smallPng = await sharp({
|
const smallPng = await sharp({
|
||||||
create: {
|
create: {
|
||||||
width: 200,
|
width: 64,
|
||||||
height: 200,
|
height: 64,
|
||||||
channels: 3,
|
channels: 3,
|
||||||
background: { r: 0, g: 255, b: 0 },
|
background: { r: 0, g: 255, b: 0 },
|
||||||
},
|
},
|
||||||
@@ -251,8 +251,8 @@ describe("web auto-reply", () => {
|
|||||||
|
|
||||||
const bigPng = await sharp({
|
const bigPng = await sharp({
|
||||||
create: {
|
create: {
|
||||||
width: 3200,
|
width: 2000,
|
||||||
height: 3200,
|
height: 2000,
|
||||||
channels: 3,
|
channels: 3,
|
||||||
background: { r: 255, g: 0, b: 0 },
|
background: { r: 255, g: 0, b: 0 },
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user