diff --git a/scripts/test-live-media.ts b/scripts/test-live-media.ts index 19f13120797..b7602cd35be 100644 --- a/scripts/test-live-media.ts +++ b/scripts/test-live-media.ts @@ -30,7 +30,7 @@ export type MediaSuiteConfig = { export const MEDIA_SUITES: Record = { image: { id: "image", - testFile: "src/image-generation/runtime.live.test.ts", + testFile: "test/image-generation.runtime.live.test.ts", providerEnvVar: "OPENCLAW_LIVE_IMAGE_GENERATION_PROVIDERS", providers: ["fal", "google", "minimax", "openai", "vydra"], }, diff --git a/src/image-generation/runtime.live.test.ts b/test/image-generation.runtime.live.test.ts similarity index 88% rename from src/image-generation/runtime.live.test.ts rename to test/image-generation.runtime.live.test.ts index 5c1879c477e..5e693ceaa09 100644 --- a/src/image-generation/runtime.live.test.ts +++ b/test/image-generation.runtime.live.test.ts @@ -1,18 +1,14 @@ import { describe, expect, it } from "vitest"; -import { loadBundledProviderPlugin as loadBundledProviderPluginFromTestHelper } from "../../test/helpers/media-generation/bundled-provider-builders.js"; +import { loadBundledProviderPlugin as loadBundledProviderPluginFromTestHelper } from "./helpers/media-generation/bundled-provider-builders.js"; import { registerProviderPlugin, requireRegisteredProvider, -} from "../../test/helpers/plugins/provider-registration.js"; -import { resolveOpenClawAgentDir } from "../agents/agent-paths.js"; -import { collectProviderApiKeys } from "../agents/live-auth-keys.js"; -import { isLiveProfileKeyModeEnabled, isLiveTestEnabled } from "../agents/live-test-helpers.js"; -import { resolveApiKeyForProvider } from "../agents/model-auth.js"; -import { loadConfig, type OpenClawConfig } from "../config/config.js"; -import { isTruthyEnvValue } from "../infra/env.js"; -import { getShellEnvAppliedKeys, loadShellEnvFallback } from "../infra/shell-env.js"; -import { encodePngRgba, fillPixel } from "../media/png-encode.js"; -import { getProviderEnvVars } from "../secrets/provider-env-vars.js"; +} from "./helpers/plugins/provider-registration.js"; +import { resolveOpenClawAgentDir } from "../src/agents/agent-paths.js"; +import { collectProviderApiKeys } from "../src/agents/live-auth-keys.js"; +import { isLiveProfileKeyModeEnabled, isLiveTestEnabled } from "../src/agents/live-test-helpers.js"; +import { resolveApiKeyForProvider } from "../src/agents/model-auth.js"; +import { loadConfig, type OpenClawConfig } from "../src/config/config.js"; import { DEFAULT_LIVE_IMAGE_MODELS, parseCaseFilter, @@ -21,7 +17,11 @@ import { redactLiveApiKey, resolveConfiguredLiveImageModels, resolveLiveImageAuthStore, -} from "./live-test-helpers.js"; +} from "../src/image-generation/live-test-helpers.js"; +import { isTruthyEnvValue } from "../src/infra/env.js"; +import { getShellEnvAppliedKeys, loadShellEnvFallback } from "../src/infra/shell-env.js"; +import { encodePngRgba, fillPixel } from "../src/media/png-encode.js"; +import { getProviderEnvVars } from "../src/secrets/provider-env-vars.js"; const LIVE = isLiveTestEnabled(); const REQUIRE_PROFILE_KEYS = @@ -32,7 +32,6 @@ const caseFilter = parseCaseFilter(process.env.OPENCLAW_LIVE_IMAGE_GENERATION_CA const envModelMap = parseProviderModelMap(process.env.OPENCLAW_LIVE_IMAGE_GENERATION_MODELS); type LiveProviderCase = { - plugin: Parameters[0]["plugin"]; pluginId: string; pluginName: string; providerId: string; @@ -48,37 +47,34 @@ type LiveImageCase = { inputImages?: Array<{ buffer: Buffer; mimeType: string; fileName?: string }>; }; -function loadBundledProviderPlugin(pluginId: string): LiveProviderCase["plugin"] { +function loadBundledProviderPlugin( + pluginId: string, +): ReturnType { return loadBundledProviderPluginFromTestHelper(pluginId); } const PROVIDER_CASES: LiveProviderCase[] = [ { - plugin: loadBundledProviderPlugin("fal"), pluginId: "fal", pluginName: "fal Provider", providerId: "fal", }, { - plugin: loadBundledProviderPlugin("google"), pluginId: "google", pluginName: "Google Provider", providerId: "google", }, { - plugin: loadBundledProviderPlugin("minimax"), pluginId: "minimax", pluginName: "MiniMax Provider", providerId: "minimax", }, { - plugin: loadBundledProviderPlugin("openai"), pluginId: "openai", pluginName: "OpenAI Provider", providerId: "openai", }, { - plugin: loadBundledProviderPlugin("vydra"), pluginId: "vydra", pluginName: "Vydra Provider", providerId: "vydra", @@ -226,7 +222,7 @@ describeLive("image generation live (provider sweep)", () => { } const { imageProviders } = await registerProviderPlugin({ - plugin: providerCase.plugin, + plugin: loadBundledProviderPlugin(providerCase.pluginId), id: providerCase.pluginId, name: providerCase.pluginName, }); diff --git a/vitest.live.config.ts b/vitest.live.config.ts index f2d15d6de70..ec6c807a129 100644 --- a/vitest.live.config.ts +++ b/vitest.live.config.ts @@ -21,7 +21,7 @@ export default defineConfig({ disableConsoleIntercept: true, maxWorkers: 1, setupFiles: [...new Set([...(baseTest.setupFiles ?? []), "test/setup-openclaw-runtime.ts"])], - include: ["src/**/*.live.test.ts", BUNDLED_PLUGIN_LIVE_TEST_GLOB], + include: ["src/**/*.live.test.ts", "test/**/*.live.test.ts", BUNDLED_PLUGIN_LIVE_TEST_GLOB], exclude, }, });