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

jest-enlightener

v0.1.1

Published

A util to convert mounted tests to shallow render where possible

Downloads

4

Readme

Jest Enlightener

Jest Enlightener works to make your test suite faster, 'lighter', by finding the tests that don't need to be as complex as they are, and modifying them.

Currently, Jest Enlightener is designed to optimize enzyme testing by finding places where you are calling 'mount', and replacing them where possible with 'shallow'. Shallow rendering components can be vastly more efficient when you were mounting components with many children, and this can speed up your test runs.

What it does

Pass in your jest options to the Enlightener using '--c' or '-config', accepting the same options as jest. The enlightener will parse all files and then rewrite any instances of mount to shallow, attempt to run tests again, and revert ones that failed, while leaving ones that still passed.

How to use

Global Install

npm install --global jest-enlightener

or

yarn add global jest-enlightener

From here you can run the global command to update your tests.

Project Install

npm install jest-enlightener

or

yarn add jest-enlightener

In your package.json add a script "enlighten": "jest-enlightener"

If you plan to make this check regular, you should install it locally, otherwise you should install it globally and run it as desired.

Command Line args

-config (--c)

Provide a jest config, either as a string or as a path. See the jest documentation for more information on what can be passed here.

-testRegex (--t)

A string representing a regex expression, passed to jest like so. This option allows you to easily pass in what files you want tested without passing in a full config.

testCommand

Command to be implemented to allow mocha tests to be enlightened as well, replacing the running of jest with a custom function.

resultsParser

Command to be implemented to allow mocha tests to be enlightened as well, parsing of the test results with a custom output. They will need to return an array of tests that need to be reverted.

Will this take forever to do?

How long this takes will depend on your test suite, however should not be too troublesome (10 000 calls to shallow take about 4 seconds, and we only run shallows in updating the project). What is more, we only run files that we change, so much of your test-suite may be skipped if it doesn't need updating.