UNPKG

@arizeai/phoenix-client

Version:
83 lines 3.84 kB
import type { TestResult } from "./state"; import type { AcceptanceResult } from "./types"; /** * The serializable summary of one suite that the reporter renders. This is the * payload written to and read from the artifact files in `report-artifacts.ts`, * so it holds only plain data — no clients, tracers, or live state. */ export interface SuiteSummary { /** Suite name (also the dataset / experiment name in Phoenix). */ name: string; /** True when the suite did not sync to Phoenix (dry run, disabled, or error). */ trackingDisabled?: boolean; /** Human-readable reason tracking was disabled, when known. */ trackingDisabledReason?: string; /** Setup failure that disabled tracking, reduced to its message for printing. */ setupError?: { message: string; }; /** Number of best-effort uploads (runs + annotations) that failed. */ uploadFailureCount?: number; /** Per-test outcomes shown in the summary. */ results: TestResult[]; /** Aggregate acceptance results shown in the summary. */ acceptanceResults?: AcceptanceResult[]; /** Phoenix UI links (dataset / experiment) printed at the end of the block. */ links: Array<{ label: string; url: string; }>; } /** * Options that control how the reporter renders. Resolved once per run from the * environment and the output stream (see {@link resolveRenderOptions}) and then * threaded through every formatting function so jest and vitest behave * identically without either reporter class needing options of its own. */ export interface RenderOptions { /** Show every test row plus the legacy per-test `output:` detail block. */ verbose: boolean; /** Emit ANSI color escapes. */ color: boolean; /** Max test rows shown per suite in compact mode (failures are never hidden). */ maxRows: number; /** Terminal width budget used to size tables. */ maxWidth: number; } /** * Resolve {@link RenderOptions} from the environment and output stream. * * Verbosity: `PHOENIX_TEST_REPORTER=verbose` (or the `PHOENIX_TEST_VERBOSE=1` * alias) restores the full per-test dump; the default is the compact view. * `PHOENIX_TEST_REPORTER_MAX_ROWS` caps the per-suite rows (default 10). * * Color follows the common ecosystem rules: off when `NO_COLOR` is set, in CI, * on a non-TTY, or a "dumb" terminal; `PHOENIX_TEST_COLOR` / `FORCE_COLOR` * force it on or off. */ export declare function resolveRenderOptions(env?: NodeJS.ProcessEnv, stream?: { isTTY?: boolean; columns?: number; }): RenderOptions; /** * Render a single suite. A clean suite collapses to one line; a suite with * failures or misses expands into a per-row diagnosis (scores, rationale, * output, and the Phoenix ids needed to pull the trace). Pass a verbose * {@link RenderOptions} to restore the full per-test dump. */ export declare function formatSuiteSummary(suite: SuiteSummary, o?: RenderOptions): string; /** * Render the run header (totals + tracking note) and, for multi-suite runs, an * aligned overview table: one row per suite with its pass count, primary metric, * acceptance verdict, mean latency, and a miss/fail note. This is the index; * only suites with problems are expanded into a detail block below it. */ export declare function formatScoreboard(suites: readonly SuiteSummary[], o?: RenderOptions): string; /** * Print the run summary: the overview header (and, for multi-suite runs, the * index table), then an expanded detail block for every suite that failed or * had misses. Clean suites are fully described by their overview row. A * single-suite run always prints its block; verbose prints every block. */ export declare function printSuiteSummaries(suites: readonly SuiteSummary[]): void; //# sourceMappingURL=reporter-format.d.ts.map