
















@@ -35,6 +35,8 @@ plugins.
35353636**Environment/network test import:** `openclaw/plugin-sdk/test-env`
373738+**Generic fixture import:** `openclaw/plugin-sdk/test-fixtures`
39+3840The testing subpath exports a narrow set of helpers for plugin authors:
39414042```typescript
@@ -50,45 +52,53 @@ import { describePluginRegistrationContract } from "openclaw/plugin-sdk/plugin-t
5052import { registerSingleProviderPlugin } from "openclaw/plugin-sdk/plugin-test-runtime";
5153import { describeOpenAIProviderRuntimeContract } from "openclaw/plugin-sdk/provider-test-contracts";
5254import { withEnv, withFetchPreconnect } from "openclaw/plugin-sdk/test-env";
55+import { createCliRuntimeCapture, typedCases } from "openclaw/plugin-sdk/test-fixtures";
5356```
54575558### Available exports
565957-| Export | Purpose |
58-| -------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
59-| `createTestPluginApi` | Build a minimal plugin API mock for direct registration unit tests. Import from `plugin-sdk/plugin-test-api` |
60-| `expectChannelInboundContextContract` | Assert channel inbound context shape. Import from `plugin-sdk/channel-contract-testing` |
61-| `installChannelOutboundPayloadContractSuite` | Install channel outbound payload contract cases. Import from `plugin-sdk/channel-contract-testing` |
62-| `createStartAccountContext` | Build channel account lifecycle contexts. Import from `plugin-sdk/channel-test-helpers` |
63-| `describePluginRegistrationContract` | Install plugin registration contract checks. Import from `plugin-sdk/plugin-test-contracts` |
64-| `registerSingleProviderPlugin` | Register one provider plugin in loader smoke tests. Import from `plugin-sdk/plugin-test-runtime` |
65-| `registerProviderPlugin` | Capture all provider kinds from one plugin. Import from `plugin-sdk/plugin-test-runtime` |
66-| `registerProviderPlugins` | Capture provider registrations across multiple plugins. Import from `plugin-sdk/plugin-test-runtime` |
67-| `requireRegisteredProvider` | Assert that a provider collection contains an id. Import from `plugin-sdk/plugin-test-runtime` |
68-| `createRuntimeEnv` | Build a mocked CLI/plugin runtime environment. Import from `plugin-sdk/plugin-test-runtime` |
69-| `createPluginSetupWizardStatus` | Build setup status helpers for channel plugins. Import from `plugin-sdk/plugin-test-runtime` |
70-| `describeOpenAIProviderRuntimeContract` | Install provider-family runtime contract checks. Import from `plugin-sdk/provider-test-contracts` |
71-| `installCommonResolveTargetErrorCases` | Shared test cases for target resolution error handling |
72-| `shouldAckReaction` | Check whether a channel should add an ack reaction |
73-| `removeAckReactionAfterReply` | Remove ack reaction after reply delivery |
74-| `createTestRegistry` | Build a channel plugin registry fixture |
75-| `createEmptyPluginRegistry` | Build an empty plugin registry fixture |
76-| `setActivePluginRegistry` | Install a registry fixture for plugin runtime tests |
77-| `createRequestCaptureJsonFetch` | Capture JSON fetch requests in media helper tests. Import from `plugin-sdk/test-env` |
78-| `withFetchPreconnect` | Run fetch tests with preconnect hooks installed. Import from `plugin-sdk/test-env` |
79-| `withEnv` / `withEnvAsync` | Temporarily patch environment variables. Import from `plugin-sdk/test-env` |
80-| `createTempHomeEnv` / `withTempDir` | Create isolated filesystem test fixtures. Import from `plugin-sdk/test-env` |
81-| `createMockServerResponse` | Create a minimal HTTP server response mock. Import from `plugin-sdk/test-env` |
82-| `runProviderCatalog` | Execute a provider catalog hook with test dependencies |
83-| `resolveProviderWizardOptions` | Resolve provider setup wizard choices in contract tests |
84-| `resolveProviderModelPickerEntries` | Resolve provider model-picker entries in contract tests |
85-| `buildProviderPluginMethodChoice` | Build provider wizard choice ids for assertions |
86-| `setProviderWizardProvidersResolverForTest` | Inject provider wizard providers for isolated tests |
87-| `createProviderUsageFetch` | Build provider usage fetch fixtures |
88-| `useFrozenTime` / `useRealTime` | Freeze and restore timers for time-sensitive tests. Import from `plugin-sdk/test-env` |
89-| `createTestWizardPrompter` | Build a mocked setup wizard prompter |
90-| `createRuntimeTaskFlow` | Create isolated runtime task-flow state |
91-| `typedCases` | Preserve literal types for table-driven tests |
60+| Export | Purpose |
61+| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
62+| `createTestPluginApi` | Build a minimal plugin API mock for direct registration unit tests. Import from `plugin-sdk/plugin-test-api` |
63+| `expectChannelInboundContextContract` | Assert channel inbound context shape. Import from `plugin-sdk/channel-contract-testing` |
64+| `installChannelOutboundPayloadContractSuite` | Install channel outbound payload contract cases. Import from `plugin-sdk/channel-contract-testing` |
65+| `createStartAccountContext` | Build channel account lifecycle contexts. Import from `plugin-sdk/channel-test-helpers` |
66+| `describePluginRegistrationContract` | Install plugin registration contract checks. Import from `plugin-sdk/plugin-test-contracts` |
67+| `registerSingleProviderPlugin` | Register one provider plugin in loader smoke tests. Import from `plugin-sdk/plugin-test-runtime` |
68+| `registerProviderPlugin` | Capture all provider kinds from one plugin. Import from `plugin-sdk/plugin-test-runtime` |
69+| `registerProviderPlugins` | Capture provider registrations across multiple plugins. Import from `plugin-sdk/plugin-test-runtime` |
70+| `requireRegisteredProvider` | Assert that a provider collection contains an id. Import from `plugin-sdk/plugin-test-runtime` |
71+| `createRuntimeEnv` | Build a mocked CLI/plugin runtime environment. Import from `plugin-sdk/plugin-test-runtime` |
72+| `createPluginSetupWizardStatus` | Build setup status helpers for channel plugins. Import from `plugin-sdk/plugin-test-runtime` |
73+| `describeOpenAIProviderRuntimeContract` | Install provider-family runtime contract checks. Import from `plugin-sdk/provider-test-contracts` |
74+| `installCommonResolveTargetErrorCases` | Shared test cases for target resolution error handling |
75+| `shouldAckReaction` | Check whether a channel should add an ack reaction |
76+| `removeAckReactionAfterReply` | Remove ack reaction after reply delivery |
77+| `createTestRegistry` | Build a channel plugin registry fixture |
78+| `createEmptyPluginRegistry` | Build an empty plugin registry fixture |
79+| `setActivePluginRegistry` | Install a registry fixture for plugin runtime tests |
80+| `createRequestCaptureJsonFetch` | Capture JSON fetch requests in media helper tests. Import from `plugin-sdk/test-env` |
81+| `withFetchPreconnect` | Run fetch tests with preconnect hooks installed. Import from `plugin-sdk/test-env` |
82+| `withEnv` / `withEnvAsync` | Temporarily patch environment variables. Import from `plugin-sdk/test-env` |
83+| `createTempHomeEnv` / `withTempDir` | Create isolated filesystem test fixtures. Import from `plugin-sdk/test-env` |
84+| `createMockServerResponse` | Create a minimal HTTP server response mock. Import from `plugin-sdk/test-env` |
85+| `createCliRuntimeCapture` | Capture CLI runtime output in tests. Import from `plugin-sdk/test-fixtures` |
86+| `createSandboxTestContext` | Build sandbox test contexts. Import from `plugin-sdk/test-fixtures` |
87+| `writeSkill` | Write skill fixtures. Import from `plugin-sdk/test-fixtures` |
88+| `makeAgentAssistantMessage` | Build agent transcript message fixtures. Import from `plugin-sdk/test-fixtures` |
89+| `peekSystemEvents` / `resetSystemEventsForTest` | Inspect and reset system event fixtures. Import from `plugin-sdk/test-fixtures` |
90+| `sanitizeTerminalText` | Sanitize terminal output for assertions. Import from `plugin-sdk/test-fixtures` |
91+| `countLines` / `hasBalancedFences` | Assert chunking output shape. Import from `plugin-sdk/test-fixtures` |
92+| `runProviderCatalog` | Execute a provider catalog hook with test dependencies |
93+| `resolveProviderWizardOptions` | Resolve provider setup wizard choices in contract tests |
94+| `resolveProviderModelPickerEntries` | Resolve provider model-picker entries in contract tests |
95+| `buildProviderPluginMethodChoice` | Build provider wizard choice ids for assertions |
96+| `setProviderWizardProvidersResolverForTest` | Inject provider wizard providers for isolated tests |
97+| `createProviderUsageFetch` | Build provider usage fetch fixtures |
98+| `useFrozenTime` / `useRealTime` | Freeze and restore timers for time-sensitive tests. Import from `plugin-sdk/test-env` |
99+| `createTestWizardPrompter` | Build a mocked setup wizard prompter |
100+| `createRuntimeTaskFlow` | Create isolated runtime task-flow state |
101+| `typedCases` | Preserve literal types for table-driven tests. Import from `plugin-sdk/test-fixtures` |
9210293103Bundled-plugin contract suites also use SDK testing subpaths for test-only
94104registry, manifest, public-artifact, and runtime fixture helpers. Core-only
@@ -97,7 +107,8 @@ Keep new extension tests on `openclaw/plugin-sdk/testing` or a narrower
97107documented SDK subpath such as `plugin-sdk/plugin-test-api` or
98108`plugin-sdk/channel-contract-testing`, `plugin-sdk/channel-test-helpers`,
99109`plugin-sdk/plugin-test-contracts`, `plugin-sdk/plugin-test-runtime`,
100-`plugin-sdk/provider-test-contracts`, or `plugin-sdk/test-env` rather than
110+`plugin-sdk/provider-test-contracts`, `plugin-sdk/test-env`, or
111+`plugin-sdk/test-fixtures` rather than
101112importing repo `src/**` files or repo `test/helpers/plugins/*` bridges directly.
102113103114### Types
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。