pollyjs
Polly.JS is a Netflix-backed JavaScript library that records, replays, and stubs HTTP interactions for testing. It works in both Node.js and browsers, automatically capturing real API responses and replaying them in tests for speed and determinism.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | Netflix/pollyjs |
| Owner | Netflix |
| Primary language | JavaScript |
| License | Apache-2.0 — OSI-approved |
| Stars | 10.3k |
| Forks | 354 |
| Open issues | 58 |
| Latest release | Unknown |
| Last updated | 2025-05-31 |
| Source | https://github.com/Netflix/pollyjs |
What pollyjs is
Framework-agnostic HTTP mocking library that intercepts requests via multiple adapters (XHR, Fetch) and persists interactions as HAR files. Supports request/response interception, pass-through routing, and time manipulation for test scenarios.
Get the pollyjs source
Clone the repository and explore it locally.
git clone https://github.com/Netflix/pollyjs.gitcd pollyjs# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Requires explicit adapter registration (XHR, Fetch, etc.) and persister selection before instantiation; declarative setup reduces accidental misconfiguration.
- HAR file format stores full request/response bodies; large test suites may accumulate significant disk space if recordings are not pruned.
- Recording mode captures real credentials/tokens in HAR files by default; sanitization strategy must be defined in team workflows to prevent secrets in version control.
- Mocha and QUnit have first-class helpers; integration with other test frameworks (Jest, Playwright, etc.) requires custom configuration or adapter development.
- No release versioning noted since project creation; last push was 2025-05-31, suggesting ongoing maintenance but requiring verification of breaking changes before upgrade.
When to avoid it — and what to weigh
- Real-Time Protocol Requirements — Polly records/replays HTTP only; WebSocket, gRPC, or real-time streaming interactions are not supported.
- Legacy IE or Unsupported Browsers — Adapter coverage depends on the browser environment; no data provided on minimum version requirements or legacy browser support.
- GraphQL as Primary API Layer — While Polly can intercept GraphQL over HTTP, the HAR format may not capture GraphQL semantics optimally compared to GraphQL-specific mocking tools.
- Binary Protocol Mocking — Polly is designed for HTTP request/response pairs; binary or non-HTTP protocols require custom adapters not documented in the README.
License & commercial use
Apache License 2.0: permissive OSI-approved license allowing commercial use, modification, and distribution with trademark and patent protections for Apache Software Foundation.
Apache 2.0 permits commercial use in proprietary test suites and CI/CD pipelines. No proprietary license restrictions noted. However, verify compliance with your legal team for bundled distribution or SaaS offerings, particularly regarding patent clauses and liability disclaimers.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Moderate |
| DEV.co fit | Good |
| Assessment confidence | High |
HAR files store plaintext request/response bodies, including headers and POST data; sensitive credentials, tokens, or PII must be explicitly filtered before committing to version control. No documented sanitization hooks or secrets detection in the README. Team must enforce pre-commit filtering policies. Replay-only mode reduces risk compared to live API calls but does not eliminate data exposure if HAR files are leaked.
Alternatives to consider
Pretender
Lightweight XHR/Fetch stubbing library (mentioned as prior art); preferred if persistence and Node adapters are not required.
MSW (Mock Service Worker)
Modern API mocking at the network level with strong TypeScript support and Playwright integration; better for headless browser testing.
Nock
Node.js-specific HTTP mocking library; simpler for backend testing but lacks browser support and recording/replay GUI.
Build on pollyjs with DEV.co software developers
Consider Polly.JS if your team needs deterministic HTTP mocking with recording capabilities across Node and browser environments. Verify security practices for HAR file sanitization and confirm adapter support for your test framework before adoption.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
pollyjs FAQ
Can Polly record and replay HTTPS and redirect responses?
What happens if a test requests a URL not in the recording?
Is there a browser GUI for managing recordings?
How do I use Polly with Jest or Playwright?
Custom software development services
Need help beyond evaluating pollyjs? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and open-source testing integrations — and maintain them long-term.
Evaluate Polly.JS for Your Test Suite
Consider Polly.JS if your team needs deterministic HTTP mocking with recording capabilities across Node and browser environments. Verify security practices for HAR file sanitization and confirm adapter support for your test framework before adoption.