/// import { TestType, Test } from './test'; import { Result, Outcome } from './result'; import { Logger } from './logger'; import { Runtime } from './runtime'; import { RunOptions } from './options'; import { EventEmitter } from 'events'; interface Tests { [key: string]: T; } /** * A suite represents one ply requests file (.ply.yaml), one ply case file (.ply.ts), * or one flow file (.ply.flow); * * Suites cannot be nested. * * TODO: separate RequestSuite and CaseSuite (like FlowSuite) * instead of conditional logic in this class. */ export declare class Suite { readonly name: string; readonly type: TestType; readonly path: string; readonly runtime: Runtime; readonly logger: Logger; readonly start: number; readonly end: number; readonly className?: string | undefined; readonly outFile?: string | undefined; readonly tests: Tests; emitter?: EventEmitter; skip: boolean; callingFlowPath?: string; /** * @param name suite name * @param type request|case|flow * @param path relative path from tests location (forward slashes) * @param runtime info * @param logger * @param start zero-based start line * @param end zero-based end line * @param className? className for decorated suites * @param outFile? outputFile for decorated suites (absolute) */ constructor(name: string, type: TestType, path: string, runtime: Runtime, logger: Logger, start: number, end: number, className?: string | undefined, outFile?: string | undefined); add(test: T): void; get(name: string): T | undefined; all(): T[]; size(): number; [Symbol.iterator](): Generator; get log(): Logger; /** * Run one test, write actual result, and verify vs expected. * @param values runtime values for substitution * @returns result indicating outcome */ run(name: string, values: object, runOptions?: RunOptions): Promise; /** * Run specified tests, write actual results, and verify vs expected. * @param values runtime values for substitution * @returns result array indicating outcomes */ run(names: string[], values: object, runOptions?: RunOptions): Promise; /** * Run all tests, write actual results, and verify vs expected. * @param values runtime values for substitution * @returns result array indicating outcomes * TODO: support runOptions.values for requests and cases */ run(values: object, runOptions?: RunOptions): Promise; /** * Tests within a suite are always run sequentially. * @param tests */ runTests(tests: T[], values: object, runOptions?: RunOptions): Promise; emitSuiteStarted(): void; emitTest(test: T): void; emitSuiteFinished(): void; private declaredStartsWith; /** * Translates request/response bodies to objects and * adds to array. Also adds to values object for downstream access. * @param results * @param result */ private addResult; private getExpectedResponseHeaders; private handleResultRunOptions; logOutcome(test: Test, outcome: Outcome, label?: string): void; /** * Use stack trace to find calling case info (if any) for request. */ private getCallingCaseInfo; /** * Always contains \n newlines. Includes trailing newline. */ private buildResultYaml; } export {};