UNPKG

@decaf-ts/utils

Version:

module management utils for decaf-ts

46 lines (45 loc) 1.68 kB
import { LoggedClass } from "@decaf-ts/logging"; import { TestReporter } from "./TestReporter"; type LogStore = Record<number, string[]>; export interface ParsedLog { timestamp: number; child: string; action: string; } export interface ComparerResult { consumer: ParsedLog[]; producer: ParsedLog[]; } type Comparer = (consumerData: LogStore, producerData: LogStore) => Promise<ComparerResult>; type ConsumerHandler = (identifier: number, ...args: unknown[]) => unknown | Promise<unknown>; export declare const defaultComparer: Comparer; export interface ReportingComparerOptions { reporter?: TestReporter; testCase?: string; referencePrefix?: string; } export declare const reportingComparer: (consumerData: LogStore, producerData: LogStore, options?: ReportingComparerOptions) => Promise<ComparerResult>; export declare class ConsumerRunner extends LoggedClass { private readonly action; private readonly handler; private readonly comparerHandle; private forkedCache; private consumerResults; private producerResults; private childExitPromises; private completionTriggered; private producerCompletion; private consumerCompletion; private expectedIterations; private activeHandlers; constructor(action: string, consumerHandler: ConsumerHandler, compareHandler?: Comparer); private reset; private waitForChildExit; private store; private recordConsumer; private isProducerComplete; private isConsumerComplete; private terminateChildren; run(count: number, timeout: number | undefined, times: number, random: boolean | undefined): Promise<ComparerResult>; } export {};