keyz/identity-obj-proxy

An identity object using ES6 proxies. Useful for mocking webpack imports like CSS Modules.

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 1 hour ago
Added to GitGenius on July 29th, 2026
Created on December 24th, 2015
Open Issues & Pull Requests: 10 (+0)
GitHub issues: Enabled
Number of forks: 19
Total Stargazers: 507 (+0)
Total Subscribers: 2 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 0.0 hours
Mean response time: 48.9 days
90th percentile: 97.8 days
Tracked items: 2

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 1
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 3,012 days
Stale 30+ days: 1
Stale 90+ days: 1

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

No label distribution available yet.

Most active issues this week

Sign in to see which issues are moving.

Detailed Description

identity-obj-proxy is a lightweight JavaScript utility that creates an identity object using ES6 proxies, designed primarily for mocking webpack imports in testing environments. The core functionality allows developers to mock CSS Modules and other webpack imports by returning property lookups as-is, making it particularly useful for snapshot testing in React components and other frontend applications.

The repository addresses a specific testing challenge: when testing components that import CSS Modules, developers need a way to mock those imports so that className lookups return predictable values for snapshot testing. Rather than returning undefined or throwing errors, identity-obj-proxy uses ES6 proxies to intercept property access and return the property name itself. This means that accessing styles.myClass returns the string "myClass", enabling accurate snapshot generation that reflects the actual class names used in components.

The primary use case involves Jest testing configuration, where developers can configure Jest to use identity-obj-proxy as a mock for CSS Module imports. This approach allows React components and other frontend code to access imported styles without errors during testing, while maintaining readable and meaningful snapshots. The repository includes references to related resources like jest-css-modules-example and Jest's webpack documentation to help users understand the integration process.

From a technical perspective, the implementation leverages ES6 proxy functionality, which requires Node.js v6 or later without any special flags. For older Node versions, specifically v4 and v5, users need to run Node with the node --harmony_proxies flag to enable proxy support. This version requirement reflects the repository's reliance on modern JavaScript features.

The project is classified across multiple relevant domains including ES6 proxy implementation, identity object patterns, mocking utilities, webpack import handling, CSS Modules support, and frontend development testing tools. These classifications accurately reflect the repository's position as a specialized testing utility within the JavaScript ecosystem.

The repository includes build status, npm version, and test coverage badges in its README, demonstrating commitment to code quality and transparency. The documentation includes a practical example showing how snapshot testing works with mocked CSS Modules, making the value proposition immediately clear to potential users. The tl;dr section and real-world example approach in the README indicates an effort to make the utility accessible to developers who may be unfamiliar with proxy-based mocking patterns.