Skip to content

fatton139/jest-compact-reporter

 
 

Repository files navigation

Jest Compact Reporter

Fork of Sunfit's jest-summary-reporter. Rewritten in TypeScript with a few additional options.

Motivation

The default Jest reporter output is sometimes too fancy, especially in environments which doesn't support things such as colours etc. This can make the output difficult to read.

This custom reporter will print a more compact form of the information showing only the failed tests by default.

Additional options are available to customise the output. See options.

Examples

Default

default-output

No colours

default-output

Show passing tests

With single test

default-output

With multiple tests

default-output

No diffs

default-output

Mixed tests

default-output

Installation

With NPM

npm i -D jest-compact-reporter

With Yarn

yarn add jest-compact-reporter -D

Usage

CLI

jest <...args> --reporters jest-compact-reporter

Jest Config

No options

// jest.config.js or jest.config.ts
{
  "reporters": ["jest-compact-reporter"]
}

With options

// jest.config.js or jest.config.ts
{
  "reporters": [
      ["jest-compact-reporter", { diffs: true, colours: true, showPassingTests: false }]
    ]
}

Options

diffs

Defaults to true. If enabled prints Jest's default error explanations for each failing test.

colours

Defaults to true. If enabled adds colours to the output for improved readability. Disable when an environment doesn't support colours.

showPassingTests

Defaults to false. If enabled shows test names of passing tests as well rather than just the suite.

Contributing

Requirements

  • Node 12+
  • Jest 20+
  • NPM 6 or Yarn

Developing

  1. Run npm install or yarn install
  2. Run npm build-and-test to test changes to the reporter. Note the default jest.config.ts has already been setup to use the development reporter.

License

Unlicense Licence

See LICENCE.md

About

Custom reporter for Jest that prints only the summary of the test results.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%