# thlorenz/proxyquire

🔮 Proxies nodejs require in order to allow overriding dependencies during testing.

Repository: https://github.com/thlorenz/proxyquire
Canonical: https://ross.abutalabs.com/products/proxyquire
Language: JavaScript
License: MIT
License Family: permissive
Last push: 2025-08-13T00:46:53+00:00

## Health v2 (maintenance only)
Score: 39/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 36, release rhythm 8, longevity 100
- inputs: {"age_days": 5174, "days_push": 386, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2745, forks 102 (observed 2026-08-28T04:07:16.683965+00:00)

## What it is
A Node.js library that proxies the require function so dependencies can be overridden with stubs or mocks during testing without modifying the code under test. It is mocking-framework agnostic and lets non-overridden methods behave like the original.

## Use cases
- stub node modules in unit tests
- override dependencies without changing production code
- mock require calls in javascript tests
- inject test doubles into nodejs modules
- partially mock a module while keeping other methods real
- prevent call-thru to original dependencies during tests

## When to choose
- you test CommonJS Node.js code that uses require and want unobtrusive dependency stubbing
- you want to use your existing mocking/stubbing library with require overrides
- you need to stub only some methods of a dependency and leave the rest intact

## When to avoid
- you write ES modules with import statements instead of CommonJS require
- you use a bundler-based test setup (browser/client code) rather than Node.js
- you prefer modern test runners with built-in module mocking

## Facets
- artifact type: library
- maturity: maintenance
- function: mocking, testing
- domain: testing, developer-tools, backend
- platform: -
- tags: dependency-injection, stubbing, require-proxy, unit-testing, mock-framework-agnostic, nodejs, javascript

## Member repositories
- thlorenz/proxyquire (main) score 39

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:16.683965+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T08:19:04.945237+00:00, confidence not recorded.
  - readme: https://github.com/thlorenz/proxyquire (fetched 2026-08-28T04:07:16.683965+00:00, sha 3589e5d9d3e4)
  - registry_npm: https://registry.npmjs.org/proxyquire (fetched 2026-08-29T09:57:23.635115+00:00, sha d7f25669a1e7)
- Data as of 2026-08-30T08:39:29.467469+00:00.
