whatisgithub

What is happy-dom?

lukeed/happy-dom — explained in plain English

Analysis updated 2026-07-04 · repo last pushed 2026-02-08

1Audience · developerComplexity · 2/5MaintainedSetup · easy

In one sentence

A lightweight tool that fakes a web browser environment in JavaScript so testing frameworks can run web app tests quickly without launching a real browser.

Mindmap

mindmap
  root((repo))
    What it does
      Simulates browser in JS
      No visual window
      Faster than real browser
    Capabilities
      Custom web components
      Fetch API
      Mutation observers
    Use cases
      Automated web testing
      Jest and Vitest support
      React Vue Angular Svelte
    Audience
      Developers
      Testing focused
    Tech stack
      JavaScript
      TypeScript
      Bun runtime
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Run automated tests for React or Vue apps without launching a real browser.

USE CASE 2

Speed up your Jest or Vitest test suite by swapping in a lighter browser simulation.

USE CASE 3

Verify that buttons click and forms submit correctly in continuous integration pipelines.

USE CASE 4

Test web components and Fetch API calls in a headless JavaScript environment.

What is it built with?

JavaScriptTypeScriptBun

How does it compare?

lukeed/happy-dom195516184-a11y/esp32-mcp-parenting-robota-bissell/unleash-lite
Stars111
LanguagePython
Last pushed2026-02-08
MaintenanceMaintained
Setup difficultyeasymoderatehard
Complexity2/53/54/5
Audiencedevelopergeneralresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Install via npm and add a single environment line to your Jest or Vitest config file.

No license information was provided in the explanation, so usage terms are unknown.

So what is it?

Happy DOM gives JavaScript code a pretend web browser to run in, but without any actual visual window. It simulates the parts of a browser that websites rely on behind the scenes, so code that expects to interact with a web page can run even when there is nothing to look at. Normally, a web browser handles tasks like reading the HTML structure of a page, tracking changes to that structure, and managing network requests. This tool rebuilds those same capabilities purely in JavaScript. It supports things like custom web components, the Fetch API for loading data, and mutation observers for watching when the page changes. The tool works behind the scenes so that other programs can use it as a foundation without needing a full browser installed. This is primarily useful for testing web applications. Imagine you built a website using React, Vue, Angular, or Svelte, and you want an automated system to verify that buttons click and forms submit correctly. You cannot easily do that without a browser, but firing up a real browser for every test is slow and resource-heavy. By simulating the browser environment, this tool lets your testing frameworks like Jest or Vitest run those checks quickly in the background. It also works with newer JavaScript runtimes like Bun. The main tradeoff here is speed and simplicity versus visual reality. Because it skips the heavy graphical rendering and visual layout that a real browser does, it is much faster and lighter. However, that means it cannot tell you how something will actually look on a screen. The README does not go into detail on performance benchmarks, but the project is clearly built to streamline automated testing for developers who want fast feedback without the overhead of launching a full browser.

Copy-paste prompts

Prompt 1
How do I configure Happy DOM as the test environment in my Vitest config file for a React project?
Prompt 2
Set up Happy DOM with Jest so my existing DOM-based tests run without a real browser, and show me the jest.config.js changes needed.
Prompt 3
Create a simple test suite using Happy DOM that verifies a button click updates text content on a page, runnable with Vitest.
Prompt 4
Show me how to switch my current jsdom-based Jest tests to Happy DOM and explain what differences I should watch for.

Frequently asked questions

What is happy-dom?

A lightweight tool that fakes a web browser environment in JavaScript so testing frameworks can run web app tests quickly without launching a real browser.

Is happy-dom actively maintained?

Maintained — commit in last 6 months (last push 2026-02-08).

What license does happy-dom use?

No license information was provided in the explanation, so usage terms are unknown.

How hard is happy-dom to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is happy-dom for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.