fakeIndexedDB
fakeIndexedDB copied to clipboard
Add observation for Dexie users
When using Dexie.js, it caches the global indexedDB variable, so resetting the db state won't work as expected. An easy fix is to manually handle each constructor call to explicitly use a new instance of fakeIndexedDB or add a getter to override the value in your test setup like this:
Object.defineProperty(Dexie.dependencies, "indexedDB", {
get: () => indexedDB,
})
So far I've tracked this back to 3.0.3
which is the version we're currently using.