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

jest-environment-node-single-context

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-environment-node-single-context

Jest environment for Node with single context

  • 29.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Single-context Node.js environment for Jest

One of Jest's key features is context isolation so tests can't have side-effects on other tests by manipulating the global context. In theory that's a good idea but in practice the current implementation messes around with global types in a way which breaks pretty much all instanceof checks in tests against standard types like Uint8Array for example.

This small project provides a single-context Node.js environment which effectively sacrifices the context isolation feature by using a single context for all tests so instanceof checks works again as expected.

See Jest issue #2549 for details.

Usage

  • Install dependency:

    npm install -D jest-environment-node-single-context
    
  • Add this property to your Jest config:

    testEnvironment: "jest-environment-node-single-context"
    

Keywords

FAQs

Package last updated on 29 Jan 2024

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