🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more
Socket
Book a DemoInstallSign in
Socket

@happy-dom/global-registrator

Package Overview
Dependencies
Maintainers
1
Versions
545
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@happy-dom/global-registrator

Use Happy DOM globally in a Node.js environment for testing.

Source
npmnpm
Version
20.0.8
Version published
Weekly downloads
161K
-18.39%
Maintainers
1
Weekly downloads
 
Created
Source

Happy DOM Logo

This package makes it possible to register Happy DOM and makes it easy to setup your own test environment.

Installation

npm install @happy-dom/global-registrator --save-dev

Documentation

You will find the documentation in the Happy DOM Wiki under Global Registrator.

Usage

Register

import { GlobalRegistrator } from '@happy-dom/global-registrator';

GlobalRegistrator.register({ url: 'http://localhost:3000', width: 1920, height: 1080 });

document.body.innerHTML = `<button>My button</button>`;

const button = document.querySelector('button');

// Outputs: "My button"
console.log(button.innerText);

Unregister

import { GlobalRegistrator } from '@happy-dom/global-registrator';

GlobalRegistrator.register();

await GlobalRegistrator.unregister();

// Outputs: "undefined"
console.log(global.document);

Happy DOM

Documentation | Getting Started | Setup as Test Environment | GitHub

Keywords

jsdom

FAQs

Package last updated on 21 Oct 2025

Did you know?

Socket

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.

Install

Related posts