0.0.0 • Published 11 months ago

vitest-indexeddb v0.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

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.

  1. Create a setup file
// ./setup/idbSetup.ts

import { setup } from "vitest-indexeddb";

setup();
  1. 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"],
  },
});
  1. Run tests
0.0.0

11 months ago