import { type ErrorObject } from 'serialize-error'; import { BaseReporter } from './base.js'; import type { TestEndNode, RunnerListNode } from '../types.js'; /** * The structured output representing the test suite discovery mode (--list). */ export interface JSONReporterListResult { /** * Indicates whether the test discovery was successfully completed. */ success: boolean; /** * The hierarchical list of suites, groups, and tests available in the project. */ list: RunnerListNode; } /** * The structured output representing the results of a test execution run. */ export interface JSONReporterExecutionResult { /** * Indicates whether all executed tests passed successfully. */ success: boolean; /** * Aggregated test execution metrics. */ summary: { /** Total number of tests executed. */ total: number; /** Number of passed tests. */ passed: number; /** Number of failed tests. */ failed: number; /** Number of skipped tests. */ skipped: number; /** Total duration of the test run in milliseconds. */ durationMs: number; }; /** * Detailed list of encountered failures across all tests. */ failures: { /** The relative path to the file where the failure occurred. */ file: string; /** The expanded title of the failed test. */ title: string; /** The serialized error objects describing the failure. */ errors: { phase: string; error: ErrorObject; }[]; }[]; } /** * Represents the overall output shape for the JSON reporter. */ export type JSONReporterResult = JSONReporterListResult | JSONReporterExecutionResult; export declare class JSONReporter extends BaseReporter { #private; isProgrammatic: boolean; result?: JSONReporterResult; protected onTestEnd(payload: TestEndNode): void; protected onRunnerList(payload: RunnerListNode): void; protected end(): Promise; }