mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-25 13:03:06 +00:00
test: avoid env module reset
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { withEnv } from "../test-utils/env.js";
|
||||
import { isTruthyEnvValue, logAcceptedEnvOption, normalizeEnv, normalizeZaiEnv } from "./env.js";
|
||||
|
||||
const loggerMocks = vi.hoisted(() => ({
|
||||
info: vi.fn(),
|
||||
@@ -11,19 +12,6 @@ vi.mock("../logging/subsystem.js", () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
type EnvModule = typeof import("./env.js");
|
||||
|
||||
let isTruthyEnvValue: EnvModule["isTruthyEnvValue"];
|
||||
let logAcceptedEnvOption: EnvModule["logAcceptedEnvOption"];
|
||||
let normalizeEnv: EnvModule["normalizeEnv"];
|
||||
let normalizeZaiEnv: EnvModule["normalizeZaiEnv"];
|
||||
|
||||
beforeAll(async () => {
|
||||
vi.resetModules();
|
||||
({ isTruthyEnvValue, logAcceptedEnvOption, normalizeEnv, normalizeZaiEnv } =
|
||||
await import("./env.js"));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
loggerMocks.info.mockClear();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user