npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

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

v1.0.0

Published

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

Downloads

8

Readme

@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.

| Option | Description | type | Default value | | :----------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :-----------------------------------------: | :-----------: | | showSlowest | true / false flag whether to show slowest tests or not | boolean | false | | maxSlowTests | quantity of slowest tests to show, dependant on showSlowest flag | number | 5 | | warnOnSlowerThan | a limit in milliseconds, used to identify slow tests | number | 400 | | showWarningSummary | true / false flag whether to show detailed information on warnings | boolean | false | | warningsConfig | an 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 flag | Array<{ name: string, regexp: RegExp }> | [] |

Sample of output for different configurations

showSlowest: true

showWarningSummary: false

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

default jest reporter with silent mode on

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

Contribution

Document

Code of conduct

Document

Licence

MIT