Happy DOM
JavaScript implementation of a web browser's DOM without a graphical interface, used for testing and server-side rendering.
Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. It is written in TypeScript and provides DOM features such as custom elements, declarative shadow DOM, mutation observers, tree walkers and the Fetch API. The project describes its purpose as emulating enough of a browser for testing, scraping web sites and server-side rendering, and the wiki names JSDOM as an alternative to it.
Test runners use it as their DOM environment. The setup guide covers Vitest, Bun and the Node.js test runner.
Worth knowing
With Vitest, the wiki says that the timer methods of the window do not work fully by default, because Vitest does not use the timer methods of Happy DOM. The guide gives a setup-file workaround that copies those functions into the global scope.
Identity
- Status
- Active
- Maintainer
- David Ortner3
- Maintained by
- Individual3
- First release
- 20194
Rendering and deploy
- Install with
- npm7
Releases
Adoption
Sources
- 2026-11-09: links, Categories, Written in, License
github.com/capricorn86/happy-dom - 2026-11-09: links, Categories
github.com/capricorn86/happy-dom/wiki/Home - 2026-11-09: Maintainer, Maintained by, License model
github.com/capricorn86/happy-dom/blob/master/LICENSE - 2026-11-09: First release
registry.npmjs.org/happy-dom - 2026-11-09: Runtime, Minimum runtime
github.com/capricorn86/happy-dom/blob/v21.0.4/packages/happy-dom/package.json - 2026-11-09: Runtime
github.com/capricorn86/happy-dom/wiki/Setup-as-Test-Environment - 2026-11-09: Install with
github.com/capricorn86/happy-dom/wiki/Getting-started - 2026-11-09: Current major version, Last release
github.com/capricorn86/happy-dom/releases/tag/v21.0.4 - 2026-11-09: GitHub stars
api.github.com/repos/capricorn86/happy-dom - 2026-11-09: Contributors
api.github.com/repos/capricorn86/happy-dom/contributors?per_page=1 - 2026-11-09: npm downloads a week
api.npmjs.org/downloads/range/2026-11-01:2026-11-07/happy-dom - 2026-11-09: Dependent packages, Dependent repositories
packages.ecosyste.ms/api/v1/registries/npmjs.org/packages/happy-dom