@aws-cdk/integ-runner
Version:
CDK Integration Testing Tool
89 lines • 2.55 kB
TypeScript
/**
* Our own execute function which doesn't use shells and strings.
*/
export declare function exec(commandLine: string[], options?: {
cwd?: string;
verbose?: boolean;
env?: any;
}): any;
type Command = Array<string | Command>;
/**
* Like exec, but any arrays encountered inside the command array are pull out and executed first, than their value is inserted again.
* This mimics execution a command with sub shell behavior.
*
* For example this input:
* ```
* ["git", "checkout", ["git", "merge-base", "HEAD"], "--," "path/to/file"]
* ```
* will run something like this:
* ```
* git checkout $(git merge-base HEAD) -- path/to/file
* ```
*
* Note that the algorithm will detect sub shells first, exec them and then
* substitute the return values in.
*/
export declare function execWithSubShell(command: Command, options?: {
cwd?: string;
verbose?: boolean;
env?: any;
}): any;
/**
* Takes the same input as `execWithSubShell` and returns a string with sub shells.
*/
export declare function renderCommand(command: Command): string;
/**
* Flatten a list of lists into a list of elements
*/
export declare function flatten<T>(xs: T[][]): T[];
/**
* Chain commands
*/
export declare function chain(commands: string[]): string;
/**
* Split command to chunks by space
*/
export declare function chunks(command: string): string[];
/**
* A class holding a set of items which are being crossed off in time
*
* If it takes too long to cross off a new item, print the list.
*/
export declare class WorkList<A> {
private readonly items;
private readonly options;
private readonly remaining;
private readonly timeout;
private timer?;
constructor(items: A[], options?: WorkListOptions<A>);
crossOff(item: A): void;
done(): void;
private stopTimer;
private scheduleTimer;
private report;
}
export interface WorkListOptions<A> {
/**
* When to reply with remaining items
*
* @default 60000
*/
readonly timeout?: number;
/**
* Function to call when timeout hits
*/
readonly onTimeout?: (x: Set<A>) => void;
}
/**
* A backport of Promiser.withResolvers
*
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
*/
export declare function promiseWithResolvers<A>(): PromiseAndResolvers<A>;
interface PromiseAndResolvers<A> {
promise: Promise<A>;
resolve: (value: A) => void;
reject: (reason: any) => void;
}
export {};
//# sourceMappingURL=utils.d.ts.map