Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
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 538 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.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.