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
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, define it in "package.json" or add a property your Jest config file.
Edit your "package.json" file.
Add "--env=jest-environment-happy-dom" as an attribute to your Jest command.
{
"scripts": {
"test": "jest --env=jest-environment-happy-dom"
}
}
Save the file.
Edit your "package.json" file.
Add the following to it:
{
"jest": {
"testEnvironment": "jest-environment-happy-dom"
}
}
Save the file.
Edit your Jest config file (usually jest.config.js)
Add the following to it:
{
"testEnvironment": "jest-environment-happy-dom"
}
Save the file.
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.22 | 2019-10-07 | Fixes bug where global.Error is undefined. |
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.