@salesforce/apex-node
Version:
Salesforce JS library for Apex
60 lines (59 loc) • 2.49 kB
TypeScript
import { TestResult, ApexTestResultData } from '../tests/types';
export type OutputFormat = 'markdown' | 'text';
export type TestSortOrder = 'runtime' | 'coverage' | 'severity';
export interface MarkdownTextReporterOptions {
/**
* Output format: 'markdown' or 'text'
*/
format?: OutputFormat;
/**
* Sort order for tests: 'runtime', 'coverage', or 'severity'
*/
sortOrder?: TestSortOrder;
/**
* Performance threshold in milliseconds. Tests exceeding this will be flagged as poorly performing.
*/
performanceThresholdMs?: number;
/**
* Coverage threshold as a percentage. Tests below this will be flagged as poorly covered.
*/
coverageThresholdPercent?: number;
/**
* Whether to include code coverage information in the report
*/
codeCoverage?: boolean;
/**
* Timestamp for the test run. If not provided, current time will be used.
*/
timestamp?: Date;
}
/** Escapes markdown special characters */
export declare const escapeMarkdown: (text: string) => string;
/** Formats duration in milliseconds to a human-readable string */
export declare const formatDuration: (ms: number) => string;
/** Checks if a test is poorly performing (takes too long) */
export declare const isPoorlyPerforming: (runTime: number | undefined, thresholdMs: number) => boolean;
/** Checks if a test has poor coverage */
export declare const hasPoorCoverage: (coverage: string | number | undefined, thresholdPercent: number) => boolean;
/** Extracts numeric coverage percentage from coverage value */
export declare const getCoveragePercentage: (coverage?: string | number) => number | null;
/** Extracts test name information from a test */
export declare const getTestNameInfo: (test: ApexTestResultData) => {
className: string;
namespacePrefix: string;
fullClassName: string;
methodName: string;
testName: string;
};
/** Formats timestamp to a string */
export declare const formatTimestamp: (timestamp: Date) => string;
/** Extracts summary information from test result */
export declare const getSummaryInfo: (summary: TestResult["summary"]) => {
passed: number;
failed: number;
skipped: number;
total: number;
duration: number;
};
/** Calculates a severity score for sorting (higher = worse) */
export declare const getSeverityScore: (test: ApexTestResultData, codeCoverage: boolean, performanceThresholdMs: number, coverageThresholdPercent: number) => number;