UNPKG

@sprucelabs/jest-json-reporter

Version:

Stream Jest results to stdout in JSON for ingestion by parent processes.

34 lines (33 loc) 1.44 kB
import { AggregatedResult, TestContext, Reporter, Test, TestResult } from '@jest/reporters'; export declare type Milliseconds = number; export declare type TestStatus = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled' | 'focused'; declare interface CallSite { column: number; line: number; } export declare interface AssertionResult { ancestorTitles: string[]; duration?: Milliseconds | null; failureDetails: unknown[]; failureMessages: string[]; fullName: string; invocations?: number; location?: CallSite | null; numPassingAsserts: number; status: TestStatus; title: string; } export declare const START_DIVIDER = "***************************START_JSON_DIVIDER***************************"; export declare const END_DIVIDER = "***************************END_JSON_DIVIDER***************************"; export default class JsonReporter implements Reporter { onTestFileResult(test: Test, testResult: TestResult, aggregatedResult: AggregatedResult): void; onRunStart(results: AggregatedResult): void; onRunComplete(contexts: Set<TestContext>, results: AggregatedResult): void; onTestCaseResult(test: Test, testCaseResult: AssertionResult): void; onTestFileStart(test: Test): void; getLastError(): undefined; onTestResult(test: Test, testResult: TestResult): void; private render; onTestStart(test: Test): void; } export * from './cycle';