@decaf-ts/utils
Version:
module management utils for decaf-ts
38 lines (37 loc) • 1.85 kB
text/typescript
import { PerformanceScenario, PerformanceRunner, PhaseResult } from "../utils/performanceRunner.d.mts";
export type JestPerformanceScenario<TContext = Record<string, unknown>> = PerformanceScenario<TContext>;
export declare class JestPerformanceRunner<TContext = Record<string, unknown>> extends PerformanceRunner<TContext> {
protected scenario: JestPerformanceScenario<TContext>;
private readonly reporter;
constructor(scenario: JestPerformanceScenario<TContext>);
/** Disable the base-class text-table canvas; we render a proper bar chart instead. */
protected shouldRenderCanvas(): boolean;
/** Logs per-phase table to the jest-html-reporters attachment. */
private reportPhaseToReporter;
/**
* After all phases finish: console-log the combined summary (base class),
* then report the summary table and a bar chart with the reporter.
*/
protected logSummary(results: PhaseResult<TContext>[]): Promise<void>;
private buildTableDef;
/**
* Builds a Chart.js config: grouped bar columns (Wall/Avg/Min/Max ms)
* with a red line overlay for failure counts on a secondary right axis.
*/
private buildPhaseChart;
/**
* Registers Jest describe/it blocks for the scenario.
* Creates one `it` per phase — its never fail, errors are only recorded
* in aggregated results. Logs a per-phase console table and reports it
* via TestReporter after each `it`; reports combined table + bar chart
* in `afterAll`.
*
* @param hooks Optional lifecycle hooks:
* - `beforeAll`: runs after `scenario.initialize` but before any `it`.
* Use this to populate shared mutable state (e.g. metadata objects)
* that phase configs reference.
*/
describeSuite(hooks?: {
beforeAll?: () => Promise<void> | void;
}): void;
}