Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jest-environment-happy-dom

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-environment-happy-dom

A Jest DOM environment with support for web components.

  • 0.0.32
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
703
decreased by-39.4%
Maintainers
1
Weekly downloads
 
Created
Source

Happy DOM Jest Environment

A Jest DOM environment with support for web components.

Read more about Happy DOM

DOM Features

  • Custom Elements (Web Components)

  • Shadow Root (Shadow DOM)

  • Mutation Observer

  • Tree Walker

    And much more..

How to Install

npm install jest-environment-happy-dom --save-dev

Setup

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.

CLI

  1. Edit your "package.json" file.

  2. Add "--env=jest-environment-happy-dom" as an attribute to your Jest command.

    {
        "scripts": {
            "test": "jest --env=jest-environment-happy-dom"
        }
    }
    
  3. Save the file.

In "package.json"

  1. Edit your "package.json" file.

  2. Add the following to it:

    {
        "jest": {
            "testEnvironment": "jest-environment-happy-dom"
        }
    }
    
  3. Save the file.

Configuration File

  1. Edit your Jest config file (usually jest.config.js)

  2. Add the following to it:

    {
      "testEnvironment": "jest-environment-happy-dom"
    }
    
  3. Save the file.

Known Limitations

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.

Release Notes

VersionDateDescription
0.0.222019-10-07Fixes bug where global.Error is undefined.
0.0.12019-09-13Initial release.

How to Develop

Installation

npm install

Compilation

npm run compile

Run Watcher

npm run watch

Keywords

FAQs

Package last updated on 22 Nov 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc