perf(test): trim secrets and media setup

This commit is contained in:
Peter Steinberger
2026-07-09 19:32:03 -04:00
parent db71e497be
commit 88908d5ce6
7 changed files with 15 additions and 26 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ import {
clearConfigCache,
clearRuntimeConfigSnapshot,
} from "../config/config.js";
import { createEmptyPluginRegistry } from "../plugins/registry.js";
import { createEmptyPluginRegistry } from "../plugins/registry-empty.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
import { captureEnv, withEnvAsync } from "../test-utils/env.js";
import {
@@ -4,7 +4,7 @@ import os from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../config/config.js";
import { createEmptyPluginRegistry } from "../plugins/registry.js";
import { createEmptyPluginRegistry } from "../plugins/registry-empty.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
import { asConfig, setupSecretsRuntimeSnapshotTestHooks } from "./runtime.test-support.ts";
+9 -22
View File
@@ -71,19 +71,12 @@ let createResolverContext: typeof import("./runtime-shared.js").createResolverCo
let resolveRuntimeWebTools: typeof import("./runtime-web-tools.js").resolveRuntimeWebTools;
let restoreResolveSecretRefValuesSpy: (() => void) | undefined;
vi.mock("./runtime-web-tools-fallback.runtime.js", async () => {
const actual = await vi.importActual<typeof import("./runtime-web-tools-fallback.runtime.js")>(
"./runtime-web-tools-fallback.runtime.js",
);
return {
...actual,
runtimeWebToolsFallbackProviders: {
...actual.runtimeWebToolsFallbackProviders,
resolvePluginWebSearchProviders: resolvePluginWebSearchProvidersMock,
resolvePluginWebFetchProviders: resolvePluginWebFetchProvidersMock,
},
};
});
vi.mock("./runtime-web-tools-fallback.runtime.js", () => ({
runtimeWebToolsFallbackProviders: {
resolvePluginWebSearchProviders: resolvePluginWebSearchProvidersMock,
resolvePluginWebFetchProviders: resolvePluginWebFetchProvidersMock,
},
}));
vi.mock("../plugins/web-provider-public-artifacts.explicit.js", () => ({
resolveBundledExplicitWebSearchProvidersFromPublicArtifacts:
@@ -106,15 +99,9 @@ vi.mock("./runtime-web-tools-manifest.runtime.js", () => ({
resolveManifestContractPluginIdsByCompatibilityRuntimePathMock,
}));
vi.mock("../plugins/installed-plugin-index-records.js", async () => {
const actual = await vi.importActual<
typeof import("../plugins/installed-plugin-index-records.js")
>("../plugins/installed-plugin-index-records.js");
return {
...actual,
loadInstalledPluginIndexInstallRecordsSync: loadInstalledPluginIndexInstallRecordsSyncMock,
};
});
vi.mock("../plugins/installed-plugin-index-records.js", () => ({
loadInstalledPluginIndexInstallRecordsSync: loadInstalledPluginIndexInstallRecordsSyncMock,
}));
function asConfig(value: unknown): OpenClawConfig {
return value as OpenClawConfig;
+1 -1
View File
@@ -8,7 +8,7 @@ import type { AuthProfileStore } from "../agents/auth-profiles.js";
import { saveAuthProfileStore } from "../agents/auth-profiles/store.js";
import { clearConfigCache, clearRuntimeConfigSnapshot } from "../config/config.js";
import { resolveOAuthPath } from "../config/paths.js";
import { createEmptyPluginRegistry } from "../plugins/registry.js";
import { createEmptyPluginRegistry } from "../plugins/registry-empty.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
import { closeOpenClawAgentDatabasesForTest } from "../state/openclaw-agent-db.js";
import { clearSecretsRuntimeSnapshot } from "./runtime.js";
+1 -1
View File
@@ -2,7 +2,7 @@
import { afterEach, beforeAll, beforeEach, vi } from "vitest";
import type { AuthProfileStore } from "../agents/auth-profiles.js";
import type { OpenClawConfig } from "../config/config.js";
import { createEmptyPluginRegistry } from "../plugins/registry.js";
import { createEmptyPluginRegistry } from "../plugins/registry-empty.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
import type { PluginWebSearchProviderEntry } from "../plugins/types.js";
+1
View File
@@ -975,6 +975,7 @@ describe("scoped vitest configs", () => {
const testConfig = requireTestConfig(defaultMediaUnderstandingConfig);
expect(testConfig.dir).toBe(path.join(process.cwd(), "src"));
expect(testConfig.include).toEqual(["media-understanding/**/*.test.ts"]);
expect(normalizeConfigPaths(testConfig.setupFiles)).toEqual(["test/setup.ts"]);
});
it("keeps tooling tests in their own lane", () => {
@@ -5,6 +5,7 @@ export function createMediaUnderstandingVitestConfig(env?: Record<string, string
return createScopedVitestConfig(["src/media-understanding/**/*.test.ts"], {
dir: "src",
env,
includeOpenClawRuntimeSetup: false,
name: "media-understanding",
passWithNoTests: true,
});