Socket
Socket
Sign inDemoInstall

identity-obj-proxy

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

identity-obj-proxy

an identity object using ES6 proxies


Version published
Weekly downloads
3.4M
decreased by-42.22%
Maintainers
1
Weekly downloads
 
Created

What is identity-obj-proxy?

The identity-obj-proxy package is primarily used for mocking module exports in JavaScript tests. It's especially useful when working with CSS Modules in a Jest testing environment, as it allows you to proxy the imported CSS Modules with an identity object that returns the module's name for any property access. This way, tests can be run without having to worry about the actual CSS and focus on the JavaScript logic.

What are identity-obj-proxy's main functionalities?

Mocking CSS Modules in Jest

This code snippet demonstrates how to mock a CSS module import using identity-obj-proxy in a Jest test. It replaces the actual styles with an object that has the same keys as the class names defined in the CSS file, but with values equal to the keys themselves.

jest.mock('styles.module.css', () => require('identity-obj-proxy'));

Other packages similar to identity-obj-proxy

Keywords

FAQs

Package last updated on 03 Aug 2016

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc