jakearchibald / idb

IndexedDB, but with promises
https://www.npmjs.com/package/idb
ISC License
6.4k stars 360 forks source link

Jest testing for my library using idb #117

Closed aneer-anwar closed 5 years ago

aneer-anwar commented 5 years ago

Jest uses JSDOM to fake dom elements but unfortunately, Indexeddb support is only in their timeline and not implemented. One workaround is to include 'fake-indexeddb' module . but 'idb' module looks for window .indexeddb. Is there any way to test 'idb' using jest?

jakearchibald commented 5 years ago

This library is a wrapper around IDB. It's 100% dependent on an IDB implementation. You could run your tests in something like Puppeteer.

aneer-anwar commented 5 years ago

ok thank you

aneer-anwar commented 5 years ago

FYI. I could do the browser testing using Karma + jasmine + rollup. If anyone is interested I can share the code.