mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
perf(test): remove extra module resets in cli and message suites
This commit is contained in:
@@ -91,7 +91,6 @@ describe("browser extension install", () => {
|
||||
const dir = path.join(tmp, "browser", "chrome-extension");
|
||||
writeManifest(dir);
|
||||
|
||||
vi.resetModules();
|
||||
const { Command } = await import("commander");
|
||||
const { registerBrowserExtensionCommands } = await import("./browser-cli-extension.js");
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { movePathToTrash } from "../browser/trash.js";
|
||||
import { STATE_DIR } from "../config/paths.js";
|
||||
import { resolveStateDir } from "../config/paths.js";
|
||||
import { danger, info } from "../globals.js";
|
||||
import { copyToClipboard } from "../infra/clipboard.js";
|
||||
import { defaultRuntime } from "../runtime.js";
|
||||
@@ -32,7 +32,7 @@ export function resolveBundledExtensionRootDir(
|
||||
}
|
||||
|
||||
function installedExtensionRootDir() {
|
||||
return path.join(STATE_DIR, "browser", "chrome-extension");
|
||||
return path.join(resolveStateDir(), "browser", "chrome-extension");
|
||||
}
|
||||
|
||||
function hasManifest(dir: string) {
|
||||
@@ -48,7 +48,7 @@ export async function installChromeExtension(opts?: {
|
||||
throw new Error("Bundled Chrome extension is missing. Reinstall OpenClaw and try again.");
|
||||
}
|
||||
|
||||
const stateDir = opts?.stateDir ?? STATE_DIR;
|
||||
const stateDir = opts?.stateDir ?? resolveStateDir();
|
||||
const dest = path.join(stateDir, "browser", "chrome-extension");
|
||||
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ async function writeConfigFile(home: string, config: Record<string, unknown>): P
|
||||
describe("config cli", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
vi.resetModules();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
@@ -61,7 +61,6 @@ beforeEach(async () => {
|
||||
process.env.TELEGRAM_BOT_TOKEN = "";
|
||||
process.env.DISCORD_BOT_TOKEN = "";
|
||||
testConfig = {};
|
||||
vi.resetModules();
|
||||
await setRegistry(createTestRegistry([]));
|
||||
callGatewayMock.mockReset();
|
||||
webAuthExists.mockReset().mockResolvedValue(false);
|
||||
|
||||
Reference in New Issue
Block a user