Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
jest-environment-enzyme
Advanced tools
Runtime Environment for enzyme tests in jest
Weekly downloads
Readme
Setting up Enzyme with Jest and React is a somewhat complicated process. There are a lot of dependencies, configuring adapters, etc. This module will take lessen that setup and make it more declarative. This package will also simplify your test files by declaring React, and enzyme wrappers in the global scope. This means that all of your test files don't need to include imports for React or enzyme.
The setup can be as simple as this:
yarn add jest-environment-enzyme jest-enzyme enzyme-adapter-react-* --dev
(Where * is your app's adapter that matches your React version)
For example, if you are using react-16, it should look like:
yarn add jest-environment-enzyme jest-enzyme enzyme-adapter-react-16 --dev
// package.json
"jest": {
"setupFilesAfterEnv": ["jest-enzyme"],
"testEnvironment": "enzyme"
}
Additionally, you can specify which enzyme adapter you want to use through the testEnvironmentOptions.enzymeAdapter
.
Valid options are:
react13
react14
react15
react15.4
react16
(default)// package.json
"jest": {
"setupFilesAfterEnv": ["jest-enzyme"],
"testEnvironment": "enzyme",
"testEnvironmentOptions": {
"enzymeAdapter": "react16"
}
}
Lastly, and most importantly, this library has a hard requirement on jest-enzyme
.
FAQs
Runtime Environment for enzyme tests in jest
The npm package jest-environment-enzyme receives a total of 248,168 weekly downloads. As such, jest-environment-enzyme popularity was classified as popular.
We found that jest-environment-enzyme 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.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.