Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
jest-environment-happy-dom
Advanced tools
A Jest DOM environment with support for web components.
Custom Elements (Web Components)
Shadow Root (Shadow DOM)
Mutation Observer
Tree Walker
Fetch
And much more..
npm install jest-environment-happy-dom --save-dev
Jest uses jsdom as test environment by default. In order to tell Jest to use a different environment we will either have to set a CLI attribute or add a property your Jest config file.
This guide will explain how to tell Jest to use Happy DOM by setting a CLI attribute.
Edit package.json
Add "--env=jest-environment-happy-dom" as an attribute to your Jest command.
{
...
"scripts": {
"test": "jest --env=jest-environment-happy-dom"
},
"devDependencies": {
"jest": "^24.8.0",
"jest-environment-happy-dom": "^0.0.1"
}
}
Save the file.
This guide will explain how to tell Jest to use Happy DOM by adding a property to your Jest config file.
{
...
"testEnvironment": "jest-environment-happy-dom"
}
Happy DOM supports the most common functionality of a DOM, but there are some features that are not supported yet.
If you have a need for a missing feature or if you have found a bug, please let me know, and I will do my best to fix it.
Version | Date | Description |
---|---|---|
0.0.1 | 2019-09-13 | Initial release. |
npm install
npm run compile
npm run watch
FAQs
A Jest DOM environment with support for web components.
The npm package jest-environment-happy-dom receives a total of 690 weekly downloads. As such, jest-environment-happy-dom popularity was classified as not popular.
We found that jest-environment-happy-dom 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.