UNPKG

@rivetkit/core

Version:

57 lines (54 loc) 1.92 kB
import { a3 as Transport, T as Registry, D as DriverConfig } from '../connection-CaBl-i8R.js'; import 'zod'; import 'hono'; import 'ws'; import '../common/log.js'; import '../utils.js'; import '../utils-CT0cv4jd.js'; import 'hono/utils/http-status'; import 'nanoevents'; import '../common-CXCe7s6i.js'; import 'zod/v4'; import 'hono/streaming'; import 'hono/ws'; interface SkipTests { schedule?: boolean; } interface DriverTestConfig { /** Deploys an registry and returns the connection endpoint. */ start(projectDir: string): Promise<DriverDeployOutput>; /** * If we're testing with an external system, we should use real timers * instead of Vitest's mocked timers. **/ useRealTimers?: boolean; /** Cloudflare Workers has some bugs with cleanup. */ HACK_skipCleanupNet?: boolean; skip?: SkipTests; transport?: Transport; clientType: ClientType; cleanup?: () => Promise<void>; } /** * The type of client to run the test with. * * The logic for HTTP vs inline is very different, so this helps validate all behavior matches. **/ type ClientType = "http" | "inline"; interface DriverDeployOutput { endpoint: string; /** Cleans up the test. */ cleanup(): Promise<void>; } /** Runs all Vitest tests against the provided drivers. */ declare function runDriverTests(driverTestConfigPartial: Omit<DriverTestConfig, "clientType" | "transport">): void; /** * Helper function to adapt the drivers to the Node.js runtime for tests. * * This is helpful for drivers that run in-process as opposed to drivers that rely on external tools. */ declare function createTestRuntime(registryPath: string, driverFactory: (registry: Registry<any>) => Promise<{ driver: DriverConfig; cleanup?: () => Promise<void>; }>): Promise<DriverDeployOutput>; export { type DriverDeployOutput, type DriverTestConfig, type SkipTests, createTestRuntime, runDriverTests };