# vitest-indexeddb

> Add a shim for IndexdDB when testing with Vitest.

Latest version **0.0.2** (published 2026-01-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install vitest-indexeddb
pnpm add vitest-indexeddb
yarn add vitest-indexeddb
bun add vitest-indexeddb
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2026-01-21 |
| First published | 2023-06-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Enoch Chau |
| Maintainers | ec965 |
| Keywords | vitest, vite, indexeddb |

## Links

- npm: https://www.npmjs.com/package/vitest-indexeddb
- Repository: https://github.com/ec965/vitest-indexeddb
- Homepage: https://github.com/ec965/vitest-mongodb#readme
- Issues: https://github.com/ec965/vitest-indexeddb/issues
- npm.io page: https://npm.io/package/vitest-indexeddb

## Dependencies (1)

- [fake-indexeddb](https://npm.io/package/fake-indexeddb.md) ^6.2.5

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2026-01-21
- 0.0.1 — 2025-12-10
- 0.0.0 — 2023-06-21

## README

# vitest-indexeddb

Add a shim for indexeddb when testing with Vitest.

## Installation

```
yarn add -D vitest-indexeddb
npm i -D vitest-indexeddb
pnpm i -D vitest-indexeddb
```

## Usage

An example project can be found at [/example](../example) for reference.

1. Create a setup file

```typescript
// ./setup/idbSetup.ts

import { setup } from "vitest-indexeddb";

setup();
```

2. Include that setup file in your Vitest config.

```typescript
// ./vite.config.ts

import { defineConfig } from "vitest/config";

export default defineConfig({
  test: {
    environment: "jsdom",
    setupFiles: ["./setup/idbSetup.ts"],
  },
});
```

3. Run tests

---
_Source: https://npm.io/package/vitest-indexeddb · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
