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

@moxy/jest-config-enzyme

v6.1.0

Published

MOXY's Jest configuration enhancer for Enzyme

Downloads

32

Readme

jest-config-enzyme

NPM version Downloads Dependency status Dev Dependency status

MOXY's Jest configuration enhancer for web projects that use Enzyme framework.

Installation

$ npm install --save-dev jest @moxy/jest-config-base @moxy/jest-config-enzyme

This package should be used in conjunction with @moxy/jest-config-base. There are two enhancers available:

withEnzymeWeb

An enhancer for web projects tested with Enzyme.

What's included?

  • Automatic adapter setup: Setups the enzyme adapter automatically based on the desired one.
  • Wrapper snapshotting: Ability to snapshot Enzyme wrappers by using enzyme-to-json.
  • Extended matchers: Make assertions easier and clearer by using jest-enzyme matchers.

Usage

To use this enhancer, use the compose function that comes with @moxy/jest-config-base. Keep in mind, the first item should always be the base configuration!

'use strict';

const { compose, baseConfig } = require('@moxy/jest-config-base');
const { withEnzymeWeb } = require('@moxy/jest-config-enzyme');

module.exports = compose(
    baseConfig(),
    withEnzymeWeb('enzyme-adapter-react-16'),
);

⚠️ Note that you must install the Enzyme adapter yourself. In the example above, you would have to install enzyme-adapter-react-16:

⚠️ Make sure withEnzymeWeb is composed only after withWeb from @moxy/jest-config-web.

$ npm install --save-dev enzyme-adapter-react-16

withEnzymeReactNative

An enhancer for React Native projects tested with Enzyme.

What's included?

  • Automatic adapter setup: Setups the enzyme adapter automatically based on the desired one.
  • Wrapper snapshotting: Ability to snapshot Enzyme wrappers by using enzyme-to-json.
  • Ignore certain warnings and errors: Ignore warnings and errors produced by React due to the fact that we are using JSDOM in React Native, as prescribed by Enzyme.
  • Extended matchers: Make assertions easier and clearer by using jest-enzyme matchers. Only React Native-compatible matchers are installed:
    • toBeDisabled()
    • toBeEmptyRender()
    • toExist()
    • toContainMatchingElement()
    • toContainMatchingElements()
    • toContainExactlyOneMatchingElement()
    • toContainReact()
    • toHaveDisplayName()
    • toHaveProp()
    • toHaveRef()
    • toHaveState()
    • toIncludeText()
    • toMatchElement()
    • toMatchSelector()

Usage

To use this enhancer, use the compose function that comes with @moxy/jest-config-base. Keep in mind, the first item should always be the base configuration!

'use strict';

const { compose, baseConfig } = require('@moxy/jest-config-base');
const { withEnzymeReactNative } = require('@moxy/jest-config-enzyme');

module.exports = compose(
    baseConfig(),
    withEnzymeReactNative('enzyme-adapter-react-16', options),
);

⚠️ Note that you must install the Enzyme adapter yourself. In the example above, you would have to install enzyme-adapter-react-16:

⚠️ Make sure withEnzymeReactNative is composed only after withReactNative from @moxy/jest-config-react-native.

options

ignoreExtraMessagePatterns

Type: Array
Default: []

An array of regexp pattern strings that are matched against errors or warnings emitted by React and filtered out. There are several messages which already ignored by default. This option allows to exclude additional messages if necessary.

$ npm install --save-dev enzyme-adapter-react-16