fix(ci): route extension test helpers through public sdk seams

This commit is contained in:
Vincent Koc
2026-04-04 00:03:24 +09:00
parent ad8870ae28
commit 6366010884
27 changed files with 46 additions and 31 deletions

View File

@@ -4,8 +4,13 @@ export {
type CliRuntimeCapture,
} from "../../src/cli/test-runtime-capture.js";
export { isLiveTestEnabled } from "../../src/agents/live-test-helpers.js";
export { type OpenClawConfig } from "openclaw/plugin-sdk/browser-support";
export {
createTempHomeEnv,
type FetchMock,
type OpenClawConfig,
type TempHomeEnv,
withEnv,
withEnvAsync,
withFetchPreconnect,
} from "openclaw/plugin-sdk/browser-support";
export { expectGeneratedTokenPersistedToGatewayAuth } from "../../src/test-utils/auth-token-assertions.js";
export { withEnv, withEnvAsync } from "../../test/helpers/plugins/env.ts";
export { withFetchPreconnect, type FetchMock } from "../../test/helpers/plugins/fetch-mock.ts";
export { createTempHomeEnv, type TempHomeEnv } from "../../test/helpers/plugins/temp-home.ts";

View File

@@ -1,5 +1,5 @@
import { withFetchPreconnect } from "openclaw/plugin-sdk/testing";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { withFetchPreconnect } from "../../../test/helpers/plugins/fetch-mock.js";
import { fetchDiscord } from "./api.js";
import { jsonResponse } from "./test-http-helpers.js";

View File

@@ -1,5 +1,5 @@
import { countLines, hasBalancedFences } from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { countLines, hasBalancedFences } from "../../../test/helpers/plugins/chunk.js";
import { chunkDiscordText, chunkDiscordTextWithMode } from "./chunk.js";
describe("chunkDiscordText", () => {

View File

@@ -1,5 +1,5 @@
import { withFetchPreconnect } from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { withFetchPreconnect } from "../../../test/helpers/plugins/fetch-mock.js";
import { resolveDiscordChannelAllowlist } from "./resolve-channels.js";
import { jsonResponse, urlToString } from "./test-http-helpers.js";

View File

@@ -1,5 +1,5 @@
import { withFetchPreconnect } from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { withFetchPreconnect } from "../../../test/helpers/plugins/fetch-mock.js";
import { resolveDiscordUserAllowlist } from "./resolve-users.js";
import { jsonResponse, urlToString } from "./test-http-helpers.js";

View File

@@ -1,6 +1,6 @@
import * as ssrf from "openclaw/plugin-sdk/infra-runtime";
import { withFetchPreconnect } from "openclaw/plugin-sdk/testing";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { withFetchPreconnect } from "../../test/helpers/plugins/fetch-mock.js";
import { createRequestCaptureJsonFetch } from "../../test/helpers/plugins/media-understanding.js";
import { describeGeminiVideo } from "./media-understanding-provider.js";

View File

@@ -1,6 +1,6 @@
import { withEnv } from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../../src/config/config.js";
import { withEnv } from "../../test/helpers/plugins/env.js";
import { __testing, createGeminiWebSearchProvider } from "./src/gemini-web-search-provider.js";
describe("google web search provider", () => {

View File

@@ -14,8 +14,8 @@ import {
resolveEnvApiKey,
} from "openclaw/plugin-sdk/provider-auth-runtime";
import { resolveAgentModelPrimaryValue } from "openclaw/plugin-sdk/provider-onboard";
import { captureEnv } from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { captureEnv } from "../../test/helpers/plugins/env.js";
import {
applyKilocodeProviderConfig,
applyKilocodeConfig,

View File

@@ -1,5 +1,5 @@
import { withEnv } from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { withEnv } from "../../../test/helpers/plugins/env.js";
import { __testing } from "./kimi-web-search-provider.js";
const kimiApiKeyEnv = ["KIMI_API", "KEY"].join("_");

View File

@@ -1,5 +1,5 @@
import { withFetchPreconnect } from "openclaw/plugin-sdk/testing";
import { describe, expect, it, vi } from "vitest";
import { withFetchPreconnect } from "../../../test/helpers/plugins/fetch-mock.js";
import { buildTeamsFileInfoCard } from "./graph-chat.js";
import { resolveGraphChatId, uploadToOneDrive, uploadToSharePoint } from "./graph-upload.js";

View File

@@ -1,5 +1,5 @@
import { withEnv } from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { withEnv } from "../../../test/helpers/plugins/env.js";
import { __testing } from "./perplexity-web-search-provider.js";
const openRouterApiKeyEnv = ["OPENROUTER_API", "KEY"].join("_");

View File

@@ -2,12 +2,9 @@ import * as ssrf from "openclaw/plugin-sdk/infra-runtime";
import * as mediaFetch from "openclaw/plugin-sdk/media-runtime";
import type { SavedMedia } from "openclaw/plugin-sdk/media-runtime";
import * as mediaStore from "openclaw/plugin-sdk/media-runtime";
import { type FetchMock, withFetchPreconnect } from "openclaw/plugin-sdk/testing";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { mockPinnedHostnameResolution } from "../../../../src/test-helpers/ssrf.js";
import {
type FetchMock,
withFetchPreconnect,
} from "../../../../test/helpers/plugins/fetch-mock.js";
import {
fetchWithSlackAuth,
resolveSlackAttachmentContent,

View File

@@ -2,8 +2,8 @@ import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { withEnv } from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { withEnv } from "../../../test/helpers/plugins/env.js";
import { inspectTelegramAccount } from "./account-inspect.js";
describe("inspectTelegramAccount SecretRef resolution", () => {

View File

@@ -1,7 +1,7 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import * as runtimeEnvModule from "openclaw/plugin-sdk/runtime-env";
import { withEnv } from "openclaw/plugin-sdk/testing";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { withEnv } from "../../../test/helpers/plugins/env.js";
import {
listTelegramAccountIds,
resolveTelegramMediaRuntimeOptions,

View File

@@ -1,6 +1,6 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { captureEnv } from "openclaw/plugin-sdk/testing";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { captureEnv } from "../../../test/helpers/plugins/env.js";
import {
handleTelegramAction,
readTelegramButtons,

View File

@@ -1,7 +1,7 @@
import type { GetReplyOptions, MsgContext } from "openclaw/plugin-sdk/reply-runtime";
import { withEnvAsync } from "openclaw/plugin-sdk/testing";
import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { escapeRegExp, formatEnvelopeTimestamp } from "../../../test/helpers/envelope-timestamp.js";
import { withEnvAsync } from "../../../test/helpers/plugins/env.js";
const harness = await import("./bot.create-telegram-bot.test-harness.js");
const EYES_EMOJI = "\u{1F440}";
const {

View File

@@ -1,5 +1,5 @@
import { withFetchPreconnect } from "openclaw/plugin-sdk/testing";
import { afterEach, beforeAll, beforeEach, type Mock, describe, expect, it, vi } from "vitest";
import { withFetchPreconnect } from "../../../test/helpers/plugins/fetch-mock.js";
const resolveTelegramFetch = vi.hoisted(() => vi.fn());
const makeProxyFetch = vi.hoisted(() => vi.fn());

View File

@@ -3,9 +3,9 @@ import os from "node:os";
import path from "node:path";
import { getSessionBindingService } from "openclaw/plugin-sdk/conversation-runtime";
import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
import { loadBundledPluginTestApiSync } from "openclaw/plugin-sdk/testing";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { importFreshModule } from "../../../test/helpers/import-fresh.js";
import { loadBundledPluginTestApiSync } from "../../../test/helpers/plugins/bundled-plugin-public-surface.js";
import {
__testing,
createTelegramThreadBindingManager,

View File

@@ -1,8 +1,8 @@
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { captureEnv } from "openclaw/plugin-sdk/testing";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { captureEnv } from "../../../test/helpers/plugins/env.js";
import { hasAnyWhatsAppAuth, listWhatsAppAuthDirs } from "./accounts.js";
describe("hasAnyWhatsAppAuth", () => {

View File

@@ -3,9 +3,9 @@ import crypto from "node:crypto";
import fs from "node:fs/promises";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { setLoggerOverride } from "openclaw/plugin-sdk/runtime-env";
import { withEnvAsync } from "openclaw/plugin-sdk/testing";
import { beforeAll, describe, expect, it, vi } from "vitest";
import { escapeRegExp, formatEnvelopeTimestamp } from "../../../test/helpers/envelope-timestamp.js";
import { withEnvAsync } from "../../../test/helpers/plugins/env.js";
import {
createWebInboundDeliverySpies,
createMockWebListener,

View File

@@ -4,10 +4,10 @@ import path from "node:path";
import { optimizeImageToPng } from "openclaw/plugin-sdk/media-runtime";
import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
import { captureEnv } from "openclaw/plugin-sdk/testing";
import sharp from "sharp";
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { mockPinnedHostnameResolution } from "../../../src/test-helpers/ssrf.js";
import { captureEnv } from "../../../test/helpers/plugins/env.js";
import { sendVoiceMessageDiscord } from "../../discord/src/send.js";
import {
LocalMediaAccessError,

View File

@@ -1,5 +1,5 @@
import { withFetchPreconnect } from "openclaw/plugin-sdk/testing";
import { afterEach, describe, expect, it, vi } from "vitest";
import { withFetchPreconnect } from "../../test/helpers/plugins/fetch-mock.js";
import { createCodeExecutionTool } from "./code-execution.js";
function installCodeExecutionFetch(payload?: Record<string, unknown>) {

View File

@@ -1,8 +1,8 @@
import { NON_ENV_SECRETREF_MARKER } from "openclaw/plugin-sdk/provider-auth-runtime";
import { createNonExitingRuntime } from "openclaw/plugin-sdk/runtime-env";
import { withEnv } from "openclaw/plugin-sdk/testing";
import { describe, expect, it, vi } from "vitest";
import { capturePluginRegistration } from "../../src/plugins/captured-registration.js";
import { withEnv } from "../../test/helpers/plugins/env.js";
import { createWizardPrompter } from "../../test/helpers/wizard-prompter.js";
import xaiPlugin from "./index.js";
import { resolveXaiCatalogEntry } from "./model-definitions.js";

View File

@@ -1,5 +1,5 @@
import { withFetchPreconnect } from "openclaw/plugin-sdk/testing";
import { afterEach, describe, expect, it, vi } from "vitest";
import { withFetchPreconnect } from "../../test/helpers/plugins/fetch-mock.js";
import { createXSearchTool } from "./x-search.js";
function installXSearchFetch(payload?: Record<string, unknown>) {

View File

@@ -1,8 +1,8 @@
import { mkdtemp, rm } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { withEnvAsync } from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { withEnvAsync } from "../../../test/helpers/plugins/env.js";
import { createPluginSetupWizardStatus } from "../../../test/helpers/plugins/setup-wizard.js";
import "./zalo-js.test-mocks.js";
import { zalouserSetupPlugin } from "./channel.setup.js";

View File

@@ -88,5 +88,9 @@ export { generateSecureToken } from "../infra/secure-random.js";
export { resolvePreferredOpenClawTmpDir } from "../infra/tmp-openclaw-dir.js";
export { rawDataToString } from "../infra/ws.js";
export { runExec } from "../process/exec.js";
export { captureEnv, withEnv, withEnvAsync } from "../test-utils/env.js";
export { withFetchPreconnect } from "../test-utils/fetch-mock.js";
export type { FetchMock } from "../test-utils/fetch-mock.js";
export { createTempHomeEnv } from "../test-utils/temp-home.js";
export type { TempHomeEnv } from "../test-utils/temp-home.js";
export type { MockFn } from "../test-utils/vitest-mock-fn.js";

View File

@@ -55,3 +55,12 @@ export { createWindowsCmdShimFixture } from "../test-helpers/windows-cmd-shim.js
export { installCommonResolveTargetErrorCases } from "../test-helpers/resolve-target-error-cases.js";
export { sanitizeTerminalText } from "../terminal/safe-text.js";
export { withStateDirEnv } from "../test-helpers/state-dir-env.js";
export { countLines, hasBalancedFences } from "../test-utils/chunk-test-helpers.js";
export {
loadBundledPluginPublicSurfaceSync,
loadBundledPluginTestApiSync,
resolveRelativeBundledPluginPublicModuleId,
} from "../test-utils/bundled-plugin-public-surface.js";
export { captureEnv, withEnv, withEnvAsync } from "../test-utils/env.js";
export { withFetchPreconnect, type FetchMock } from "../test-utils/fetch-mock.js";
export { createTempHomeEnv, type TempHomeEnv } from "../test-utils/temp-home.js";