On this page
Overview
fake-indexeddb is a pure JavaScript in-memory implementation of the IndexedDB API for running IndexedDB-dependent code in Node.js tests. It can install IndexedDB globals through fake-indexeddb/auto or expose individual objects for explicit dependency injection.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Bring IndexedDB APIs into Node.js tests
It provides core objects such as indexedDB and IDBKeyRange in memory, allowing application data-access code to exercise database creation, object stores, indexes, cursors, and related IndexedDB flows outside a browser.
Sources: [2]
Choose global setup or explicit imports
The shortest setup imports fake-indexeddb/auto to register IndexedDB globals. Tests that avoid global mutation can instead import objects such as indexedDB and IDBKeyRange and pass them explicitly to wrappers such as Dexie.
Sources: [2]
Best fit
Fits unit and integration tests for IndexedDB-backed frontends
It is useful when IndexedDB-dependent application code needs to run under Node.js or Jest. The README also documents integration patterns for Dexie and similar IndexedDB wrappers.
Sources: [2]
Before adoption
Do not treat the in-memory implementation as full browser fidelity
Data is not persisted to disk and the implementation is not a browser engine. Features that depend on browser-specific behavior, persistence, quotas, or multi-tab coordination should still be validated in real browsers.
Sources: [2]
Check structuredClone support in jsdom environments
Since v5, fake-indexeddb no longer bundles a structuredClone polyfill. Older runtimes or some jsdom setups may require one of the workarounds documented in the README.
Sources: [2]
Official sources
- [1]dumbmatter/fakeIndexedDB repository(2026-09-30)
- [2]fake-indexeddb README(2026-09-30)
- [3]fake-indexeddb Apache-2.0 license(2026-09-30)
Supplemental curator note
It can make data-layer tests fast and deterministic under Node.js, but it is not a substitute for browser tests that depend on persistence, quotas, or browser-specific behavior.
Try it in 3 steps
- 1
Add fake-indexeddb as a development dependency
Install fake-indexeddb into the Node.js test environment using the command documented in the README.
npm install --save-dev fake-indexeddb - 2
Register IndexedDB APIs for the test environment
Import the automatic setup in the test or shared setup file to expose globals such as indexedDB.
import "fake-indexeddb/auto"; - 3
Open a test database
Use the same IndexedDB API as the application to exercise object stores and reads/writes. The in-memory data is not persisted to disk.
const request = indexedDB.open("test", 1);
Growth
Growth trends · Last 30 days
695 Stars
Trend data is still being collected.
Development activity
Last 90 days · weekly
- Commits (last 30 days)
- 0
- Open PRs
- 0
Development activity is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
GitHub Topics
- indexeddb
- ponyfill
- shim
- polyfill
- Stars
- 695
- Forks
- 79
- Watchers
- 8
- Open issues
- 7
- Contributors
- 16
- Owner type
- User
- Primary language
- JavaScript
- License
- Apache-2.0
- Repository last updated
- May 13, 2026
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- pnpm36,704 Stars
2 shared tag(s) · 1 shared category(s)
share dependency files through a content-addressable store and manage monorepos
Rust - Dexie.js14,615 Stars
2 shared tag(s) · 1 shared category(s)
manage browser data through a Promise-based IndexedDB API with typed tables
TypeScript - Auth.js28,374 Stars
2 shared tag(s)
Compose OAuth/OIDC, passwordless, WebAuthn, and stateless or database-backed sessions from packages built around standard Web APIs
TypeScript - Bruno47,283 Stars
1 shared tag(s) · 2 shared category(s) · Same language
manage API collections as local Bru files in Git and run them from desktop, CLI, or CI
JavaScript - CodeceptJS4,242 Stars
1 shared tag(s) · 2 shared category(s) · Same language
unify Playwright and other E2E engines behind user-perspective
JavaScriptIsteps - Vitest17,174 Stars
1 shared tag(s) · 2 shared category(s)
reuse Vite transforms and configuration across Node, DOM, and Browser Mode tests
TypeScript
Report incorrect information
Tell us if any listing information is incorrect or outdated.