Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
enzyme-react-16-adapter-setup
Advanced tools
Readme
Easy way to setup enzyme for React 16 in Jest.
# Using yarn
yarn add --dev enzyme react-test-renderer enzyme-adapter-react-16 enzyme-react-16-adapter-setup
# Or using npm
npm install --dev enzyme react-test-renderer enzyme-adapter-react-16 enzyme-react-16-adapter-setup
The idea of this package is to make a file in order to set up enzyme.
The easyest way is to use jest's setupFiles
. Make sure your package.json
includes the following:
{
// ...
"jest": {
// ...
"setupFiles": [
"raf/polyfill",
"enzyme-react-16-adapter-setup"
]
}
}
Note: The example also adds requestAnimationFrame polyfill, if you are testing with jsdom, probabably you'll need it. In order to install it just do the following:
# Using yarn
yarn add --dev raf
# Or using npm
npm install --dev raf
If you are using Create React App, you won't be able to use jest's setupFiles
. You'll need to create the file src/setupTests.js
with the following content:
// src/setupTests.js
import 'raf/polyfill';
import 'enzyme-react-16-adapter-setup';
Note: You'll also have to add a requestAnimationFrame polyfill as jsdom doesn't provide one:
# Using yarn
yarn add --dev raf
# Or using npm
npm install --dev raf
FAQs
Easy way to setup enzyme for React 16 in Jest.
The npm package enzyme-react-16-adapter-setup receives a total of 555 weekly downloads. As such, enzyme-react-16-adapter-setup popularity was classified as not popular.
We found that enzyme-react-16-adapter-setup demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.