UNPKG

@aws-cdk/integ-runner

Version:

CDK Integration Testing Tool

99 lines (98 loc) 2.78 kB
import type { DeployOptions, ICdk, ListOptions, SynthFastOptions, SynthOptions, WatchEvents } from '@aws-cdk/cdk-cli-wrapper'; import type { DestroyOptions } from '@aws-cdk/cloud-assembly-schema/lib/integ-tests'; export interface ToolkitLibEngineOptions { /** * The directory to run the cdk commands from */ readonly workingDirectory: string; /** * Additional environment variables to set * in the execution environment that will be running * the cdk app * * @default - no additional env vars */ readonly env?: { [name: string]: string; }; /** * Show the output from running the CDK CLI * * @default false */ readonly showOutput?: boolean; /** * The region the CDK app should synthesize itself for */ readonly region: string; } /** * A runner engine powered directly by the toolkit-lib */ export declare class ToolkitLibRunnerEngine implements ICdk { private readonly toolkit; private readonly options; private readonly showOutput; private readonly ioHost; constructor(options: ToolkitLibEngineOptions); /** * Synthesizes the CDK app through the Toolkit */ synth(options: SynthOptions): Promise<void>; /** * Synthesizes the CDK app quickly, by bypassing the Toolkit and just invoking the app command */ synthFast(options: SynthFastOptions): Promise<void>; /** * Lists the stacks in the CDK app */ list(options: ListOptions): Promise<string[]>; /** * Deploys the CDK app */ deploy(options: DeployOptions): Promise<void>; /** * Watches the CDK app for changes and deploys them automatically */ watch(options: DeployOptions, events?: WatchEvents): Promise<void>; /** * Destroys the CDK app */ destroy(options: DestroyOptions): Promise<void>; /** * Creates a Cloud Assembly Source from the provided options. */ private cx; /** * Creates a StackSelector from the provided options. */ private stackSelector; /** * Creates a DeploymentMethod from the provided options. */ private deploymentMethod; /** * Check that the regions for the stacks in the CloudAssembly match the regions requested on the engine * * This prevents misconfiguration of the integ test app. People tend to put: * * ```ts * new Stack(app, 'Stack', { * env: { * region: 'some-region-that-suits-me', * } * }); * ``` * * Into their integ tests, instead of: * * ```ts * { * region: process.env.CDK_DEFAULT_REGION, * } * ``` * * This catches that misconfiguration. */ private validateRegion; }