UNPKG

@arizeai/phoenix-client

Version:
47 lines 1.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SuiteSummaryReportRun = void 0; const report_artifacts_1 = require("./report-artifacts"); const reporter_format_1 = require("./reporter-format"); const runner_1 = require("./runner"); /** * Shared "print the Phoenix summary once per run" policy for the jest and * vitest reporters. The two frameworks differ only in which lifecycle methods * they call; both delegate to {@link begin} on run start and {@link finish} * on run end. */ class SuiteSummaryReportRun { constructor() { this.hasPrinted = false; this.runStartedAtMs = 0; } /** * Reset state at the start of a run so suites/artifacts from a previous * watch-mode invocation don't leak forward. */ begin() { this.hasPrinted = false; this.runStartedAtMs = Date.now(); (0, runner_1.clearAllSuites)(); (0, report_artifacts_1.clearSuiteSummaryArtifacts)(); } /** * Print the Phoenix summary once. Prefers the on-disk artifacts written by * suite workers, falling back to the in-process registry. A no-op once the * summary has already been printed for this run. */ finish() { if (this.hasPrinted) return; const artifactSuites = (0, report_artifacts_1.readSuiteSummaryArtifacts)({ sinceMs: this.runStartedAtMs, }); const suites = artifactSuites.length > 0 ? artifactSuites : (0, runner_1.getAllSuites)(); if (suites.length === 0) return; this.hasPrinted = true; (0, reporter_format_1.printSuiteSummaries)(suites); } } exports.SuiteSummaryReportRun = SuiteSummaryReportRun; //# sourceMappingURL=report-run.js.map