vitest-indexeddb
v0.0.0
Published
Add a shim for IndexdDB when testing with Vitest.
Downloads
674
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 for reference.
- Create a setup file
// ./setup/idbSetup.ts
import { setup } from "vitest-indexeddb";
setup();
- Include that setup file in your Vitest config.
// ./vite.config.ts
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
environment: "jsdom",
setupFiles: ["./setup/idbSetup.ts"],
},
});
- Run tests