UNPKG

rwsdk

Version:

Build fast, server-driven webapps on Cloudflare with SSR, RSC, and realtime

62 lines (61 loc) 2.36 kB
import { TestResources } from "./types.mjs"; interface ExpectOptions { expect: string | RegExp; send?: string; } interface ExpectResult { stdout: string; stderr: string; code: number | null; } interface D1Database { name: string; uuid: string; [key: string]: any; } /** * A mini expect-like utility for handling interactive CLI prompts and verifying output * @param command The command to execute * @param expectations Array of {expect, send} objects for interactive responses and verification * @param options Additional options for command execution including working directory and environment * @returns Promise that resolves when the command completes */ export declare function $expect(command: string, expectations: Array<ExpectOptions>, options?: { reject?: boolean; env?: NodeJS.ProcessEnv; cwd?: string; }): Promise<ExpectResult>; /** * Ensures Cloudflare account ID is set in environment * First checks wrangler cache, then environment variables, and finally guides the user */ export declare function ensureCloudflareAccountId(cwd?: string, projectDir?: string): Promise<void>; /** * Run the release command to deploy to Cloudflare */ export declare function runRelease(cwd: string, projectDir: string, resourceUniqueKey: string): Promise<{ url: string; workerName: string; }>; /** * Runs tests against the production deployment */ export declare function runReleaseTest(artifactDir: string, resources: TestResources, browserPath?: string, headless?: boolean, bail?: boolean, skipClient?: boolean, projectDir?: string, realtime?: boolean, skipHmr?: boolean, skipStyleTests?: boolean): Promise<void>; /** * Check if a resource name includes a specific resource unique key * This is used to identify resources created during our tests */ export declare function isRelatedToTest(resourceName: string, resourceUniqueKey: string): boolean; /** * Delete the worker using wrangler */ export declare function deleteWorker(name: string, cwd: string, resourceUniqueKey: string): Promise<void>; /** * List D1 databases using wrangler */ export declare function listD1Databases(cwd?: string): Promise<Array<D1Database>>; /** * Delete a D1 database using wrangler */ export declare function deleteD1Database(name: string, cwd: string, resourceUniqueKey: string): Promise<void>; export {};