0.0.0 • Published 11 months ago
vitest-indexeddb v0.0.0
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
0.0.0
11 months ago