Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@90poe/jest-performant-warnings-stats-reporter

Package Overview
Dependencies
Maintainers
32
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@90poe/jest-performant-warnings-stats-reporter

A flexible jest reporter that provides ability to show statistics of warnings and group them

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
32
Weekly downloads
 
Created
Source

@90poe/jest-performant-warnings-stats-reporter

This is a custom jest reporter that recursively collects all warnings while tests run and notifying user afterwards improving performance.

Motivation

We had problems with:

  1. Slow tests run on CI even with silent mode
  2. When running tests locally noise in the terminal slows tests enormously

List of superpowers

  • more performant than default one (check benchmark)
  • can provide statistics on warnings for every test suite (see example)
  • can show slowest tests (see example)

Installation

yarn add @90poe/jest-performant-warnings-stats-reporter --dev

or

npm install @90poe/jest-performant-warnings-stats-reporter --save-dev

Usage

In your jest config add the following entry:

{
  reporters: [
        [
            '@90poe/jest-performant-warnings-stats-reporter',
            {
                showSlowest: false,
                maxSlowTests: 5,
                warnOnSlowerThan: 1000,
                showWarningSummary: false,
                warningsConfig: [
                    {
                        name: 'act(...) warnings',
                        regex: /act(...)/im,
                    },
                    {
                        name: 'React Key Issues',
                        regex: /Encountered two children with the same key/im,
                    },
                    // ...
                ],
            },
        ],
    ],
}

Configuration

@90poe/jest-performant-warnings-stats-reporter configuration is based on Jest, available options are shown below.

OptionDescriptiontypeDefault value
showSlowesttrue / false flag whether to show slowest tests or notbooleanfalse
maxSlowTestsquantity of slowest tests to show, dependant on showSlowest flagnumber5
warnOnSlowerThana limit in milliseconds, used to identify slow testsnumber400
showWarningSummarytrue / false flag whether to show detailed information on warningsbooleanfalse
warningsConfigan array of objects with name and regexp props, where name is title for a warning and regexp is regular expression used to match the console warning. Dependant on showWarningSummary flagArray<{ name: string, regexp: RegExp }>[]

Sample of output for different configurations

showSlowest: true

Sample of output if showSlowest=true

showWarningSummary: false

Sample of output if showWarningSummary=false

showWarningSummary: true

Sample of output if showWarningSummary=true

Benchmarks

Using hyperfine for running 130 test suites in real world project, we can see advantage in performance comparing with:

  • default reporter (up to 20% improvement possible, varies by the number of warnings that exist)
  • default reporter with silent mode on (up to 5% improvement)

default jest reporter

Sample of benchmark for default jest reporter

default jest reporter with silent mode on

Sample of benchmark for default jest reporter with silent mode on

@90poe/jest-performant-warnings-stats-reporter

Sample of benchmark for @90poe/jest-performant-warnings-stats-reporter

Contribution

Document

Code of conduct

Document

Licence

MIT

Keywords

FAQs

Package last updated on 15 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc