@jest/reporters

  • Version 29.7.0
  • Published
  • 115 kB
  • 24 dependencies
  • MIT license

Install

npm i @jest/reporters
yarn add @jest/reporters
pnpm add @jest/reporters

Overview

Jest's reporters

Index

Variables

variable utils

const utils: {
formatTestPath: typeof formatTestPath;
getResultHeader: typeof getResultHeader;
getSnapshotStatus: typeof getSnapshotStatus;
getSnapshotSummary: typeof getSnapshotSummary;
getSummary: typeof getSummary;
printDisplayName: typeof printDisplayName;
relativePath: typeof relativePath;
trimAndFormatPath: typeof trimAndFormatPath;
};

    Functions

    function formatTestPath

    formatTestPath: (
    config: Config.GlobalConfig | Config.ProjectConfig,
    testPath: string
    ) => string;

      function getResultHeader

      getResultHeader: (
      result: TestResult,
      globalConfig: Config.GlobalConfig,
      projectConfig?: Config.ProjectConfig
      ) => string;

        function getSnapshotStatus

        getSnapshotStatus: (snapshot: TestResult, afterUpdate: boolean) => Array<string>;

          function getSnapshotSummary

          getSnapshotSummary: (
          snapshots: SnapshotSummary,
          globalConfig: Config.GlobalConfig,
          updateCommand: string
          ) => Array<string>;

            function getSummary

            getSummary: (
            aggregatedResults: AggregatedResult,
            options?: SummaryOptions
            ) => string;

              function printDisplayName

              printDisplayName: (config: Config.ProjectConfig) => string;

                function relativePath

                relativePath: (
                config: Config.GlobalConfig | Config.ProjectConfig,
                testPath: string
                ) => { basename: string; dirname: string };

                  function trimAndFormatPath

                  trimAndFormatPath: (
                  pad: number,
                  config: Config.ProjectConfig | Config.GlobalConfig,
                  testPath: string,
                  columns: number
                  ) => string;

                    Classes

                    class BaseReporter

                    class BaseReporter implements Reporter {}

                      method getLastError

                      getLastError: () => Error | undefined;

                        method log

                        log: (message: string) => void;

                          method onRunComplete

                          onRunComplete: (
                          _testContexts?: Set<TestContext>,
                          _aggregatedResults?: AggregatedResult
                          ) => Promise<void> | void;

                            method onRunStart

                            onRunStart: (
                            _results?: AggregatedResult,
                            _options?: ReporterOnStartOptions
                            ) => void;

                              method onTestCaseResult

                              onTestCaseResult: (_test: Test, _testCaseResult: TestCaseResult) => void;

                                method onTestResult

                                onTestResult: (
                                _test?: Test,
                                _testResult?: TestResult,
                                _results?: AggregatedResult
                                ) => void;

                                  method onTestStart

                                  onTestStart: (_test?: Test) => void;

                                    class CoverageReporter

                                    class CoverageReporter extends BaseReporter {}

                                      constructor

                                      constructor(globalConfig: Config.GlobalConfig, context: ReporterContext);

                                        property filename

                                        static readonly filename: string;

                                          method onRunComplete

                                          onRunComplete: (
                                          testContexts: Set<TestContext>,
                                          aggregatedResults: AggregatedResult
                                          ) => Promise<void>;

                                            method onTestResult

                                            onTestResult: (_test: Test, testResult: TestResult) => void;

                                              class DefaultReporter

                                              class DefaultReporter extends BaseReporter {}

                                                constructor

                                                constructor(globalConfig: Config.GlobalConfig);

                                                  property filename

                                                  static readonly filename: string;

                                                    method forceFlushBufferedOutput

                                                    forceFlushBufferedOutput: () => void;

                                                      method onRunComplete

                                                      onRunComplete: () => void;

                                                        method onRunStart

                                                        onRunStart: (
                                                        aggregatedResults: AggregatedResult,
                                                        options: ReporterOnStartOptions
                                                        ) => void;

                                                          method onTestCaseResult

                                                          onTestCaseResult: (test: Test, testCaseResult: TestCaseResult) => void;

                                                            method onTestResult

                                                            onTestResult: (
                                                            test: Test,
                                                            testResult: TestResult,
                                                            aggregatedResults: AggregatedResult
                                                            ) => void;

                                                              method onTestStart

                                                              onTestStart: (test: Test) => void;

                                                                method printTestFileFailureMessage

                                                                printTestFileFailureMessage: (
                                                                _testPath: string,
                                                                _config: Config.ProjectConfig,
                                                                result: TestResult
                                                                ) => void;

                                                                  method printTestFileHeader

                                                                  printTestFileHeader: (
                                                                  testPath: string,
                                                                  config: Config.ProjectConfig,
                                                                  result: TestResult
                                                                  ) => void;

                                                                    method testFinished

                                                                    testFinished: (
                                                                    config: Config.ProjectConfig,
                                                                    testResult: TestResult,
                                                                    aggregatedResults: AggregatedResult
                                                                    ) => void;

                                                                      class GitHubActionsReporter

                                                                      class GitHubActionsReporter extends BaseReporter {}

                                                                        constructor

                                                                        constructor(
                                                                        _globalConfig: Config.GlobalConfig,
                                                                        reporterOptions?: { silent?: boolean }
                                                                        );

                                                                          property filename

                                                                          static readonly filename: string;

                                                                            method onTestResult

                                                                            onTestResult: (
                                                                            test: Test,
                                                                            testResult: TestResult,
                                                                            aggregatedResults: AggregatedResult
                                                                            ) => void;

                                                                              class NotifyReporter

                                                                              class NotifyReporter extends BaseReporter {}

                                                                                constructor

                                                                                constructor(globalConfig: Config.GlobalConfig, context: ReporterContext);

                                                                                  property filename

                                                                                  static readonly filename: string;

                                                                                    method onRunComplete

                                                                                    onRunComplete: (
                                                                                    testContexts: Set<TestContext>,
                                                                                    result: AggregatedResult
                                                                                    ) => void;

                                                                                      class SummaryReporter

                                                                                      class SummaryReporter extends BaseReporter {}

                                                                                        constructor

                                                                                        constructor(globalConfig: Config.GlobalConfig, options?: SummaryReporterOptions);

                                                                                          property filename

                                                                                          static readonly filename: string;

                                                                                            method onRunComplete

                                                                                            onRunComplete: (
                                                                                            testContexts: Set<TestContext>,
                                                                                            aggregatedResults: AggregatedResult
                                                                                            ) => void;

                                                                                              method onRunStart

                                                                                              onRunStart: (
                                                                                              aggregatedResults: AggregatedResult,
                                                                                              options: ReporterOnStartOptions
                                                                                              ) => void;

                                                                                                class VerboseReporter

                                                                                                class VerboseReporter extends DefaultReporter {}

                                                                                                  constructor

                                                                                                  constructor(globalConfig: Config.GlobalConfig);

                                                                                                    property filename

                                                                                                    static readonly filename: string;

                                                                                                      method filterTestResults

                                                                                                      static filterTestResults: (
                                                                                                      testResults: Array<AssertionResult>
                                                                                                      ) => Array<AssertionResult>;

                                                                                                        method groupTestsBySuites

                                                                                                        static groupTestsBySuites: (testResults: Array<AssertionResult>) => Suite;

                                                                                                          method onTestResult

                                                                                                          onTestResult: (
                                                                                                          test: Test,
                                                                                                          result: TestResult,
                                                                                                          aggregatedResults: AggregatedResult
                                                                                                          ) => void;

                                                                                                            Interfaces

                                                                                                            interface Reporter

                                                                                                            interface Reporter {}

                                                                                                              property getLastError

                                                                                                              readonly getLastError?: () => Error | void;

                                                                                                                property onRunComplete

                                                                                                                readonly onRunComplete?: (
                                                                                                                testContexts: Set<TestContext>,
                                                                                                                results: AggregatedResult
                                                                                                                ) => Promise<void> | void;

                                                                                                                  property onRunStart

                                                                                                                  readonly onRunStart?: (
                                                                                                                  results: AggregatedResult,
                                                                                                                  options: ReporterOnStartOptions
                                                                                                                  ) => Promise<void> | void;

                                                                                                                    property onTestCaseResult

                                                                                                                    readonly onTestCaseResult?: (
                                                                                                                    test: Test,
                                                                                                                    testCaseResult: TestCaseResult
                                                                                                                    ) => Promise<void> | void;

                                                                                                                      property onTestCaseStart

                                                                                                                      readonly onTestCaseStart?: (
                                                                                                                      test: Test,
                                                                                                                      testCaseStartInfo: Circus.TestCaseStartInfo
                                                                                                                      ) => Promise<void> | void;
                                                                                                                      • Called before running a spec (prior to before hooks) Not called for skipped and todo specs

                                                                                                                      property onTestFileResult

                                                                                                                      readonly onTestFileResult?: (
                                                                                                                      test: Test,
                                                                                                                      testResult: TestResult,
                                                                                                                      aggregatedResult: AggregatedResult
                                                                                                                      ) => Promise<void> | void;

                                                                                                                        property onTestFileStart

                                                                                                                        readonly onTestFileStart?: (test: Test) => Promise<void> | void;

                                                                                                                          property onTestResult

                                                                                                                          readonly onTestResult?: (
                                                                                                                          test: Test,
                                                                                                                          testResult: TestResult,
                                                                                                                          aggregatedResult: AggregatedResult
                                                                                                                          ) => Promise<void> | void;

                                                                                                                            property onTestStart

                                                                                                                            readonly onTestStart?: (test: Test) => Promise<void> | void;

                                                                                                                              Type Aliases

                                                                                                                              type ReporterContext

                                                                                                                              type ReporterContext = {
                                                                                                                              firstRun: boolean;
                                                                                                                              previousSuccess: boolean;
                                                                                                                              changedFiles?: Set<string>;
                                                                                                                              sourcesRelatedToTestsInChangedFiles?: Set<string>;
                                                                                                                              startRun?: (globalConfig: Config.GlobalConfig) => unknown;
                                                                                                                              };

                                                                                                                                type ReporterOnStartOptions

                                                                                                                                type ReporterOnStartOptions = {
                                                                                                                                estimatedTime: number;
                                                                                                                                showStatus: boolean;
                                                                                                                                };

                                                                                                                                  type SummaryOptions

                                                                                                                                  type SummaryOptions = {
                                                                                                                                  currentTestCases?: Array<{
                                                                                                                                  test: Test;
                                                                                                                                  testCaseResult: TestCaseResult;
                                                                                                                                  }>;
                                                                                                                                  estimatedTime?: number;
                                                                                                                                  roundTime?: boolean;
                                                                                                                                  width?: number;
                                                                                                                                  showSeed?: boolean;
                                                                                                                                  seed?: number;
                                                                                                                                  };

                                                                                                                                    type SummaryReporterOptions

                                                                                                                                    type SummaryReporterOptions = {
                                                                                                                                    summaryThreshold?: number;
                                                                                                                                    };

                                                                                                                                      Package Files (1)

                                                                                                                                      Dependencies (24)

                                                                                                                                      Dev Dependencies (15)

                                                                                                                                      Peer Dependencies (1)

                                                                                                                                      Badge

                                                                                                                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@jest/reporters.

                                                                                                                                      • Markdown
                                                                                                                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@jest/reporters)
                                                                                                                                      • HTML
                                                                                                                                        <a href="https://www.jsdocs.io/package/@jest/reporters"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>