Skip to content

Releases: dumbmatter/fakeIndexedDB

v6.0.0

20 May 21:38
Compare
Choose a tag to compare

I made this a new major version because it includes a few changes that could in theory break something in some weird situations. But I think the vast majority of users (possibly all users?) won't have any issue upgrading.

  • #48 - Switched to using DOMException errors rather than normal errors, since that's what the IndexedDB spec says to use, and Node.js now has a built-in DOMException in all supported versions.

  • #93 - @bryan-codaio made the latest tweak to event scheduling, this time improving how setImmediate is used in some situations where people are mocking timers.

  • #99 - @sjnho fixed handling of Date objects to account for some edge cases, including jsdom overriding the native Date constructor.

v5.0.2

30 Dec 15:16
Compare
Choose a tag to compare
  • #94 - Improved performance of IDBObjectStore.count and IDBIndex.count.

v5.0.1

25 Oct 23:30
Compare
Choose a tag to compare
  • #89 - Fixed bug where ArrayBuffer views were not being correctly handled when used as keys.

  • #88 - Added explanation to README.md about how to use fake-indexeddb v5+ with jsdom, since a structuredClone polyfill is not included anymore.

v5.0.0

13 Oct 19:11
Compare
Choose a tag to compare
  • Dropped support for Node.js 16, which allows me to get rid of the structuredClone polyfill, which reduces the package size by roughly 50%.

v4.0.2

14 Jul 15:57
Compare
Choose a tag to compare
  • #84 - Fix the TypeScript types in some situations.

v4.0.1

29 Nov 18:44
Compare
Choose a tag to compare
  • #79 - Added missing request accessor to the FDBCursor object. Thank you @mmacfadden for the PR!

v4.0.0

02 Jul 18:50
Compare
Choose a tag to compare

TLDR: Most users can upgrade without doing any extra work, but you might need to change require("fake-indexeddb") to require("fake-indexeddb").default. All other ways of importing fake-indexeddb (such as with import, or requiring sub-modules like require("fake-indexeddb/auto") or require("fake-indexeddb/lib/FDBKeyRange")) should continue working like normal.

Details:

  • #23 - TypeScript support! As of version 4, fake-indexeddb includes TypeScript types. As you can see in types.d.ts, it's just using TypeScript's built-in IndexedDB types, rather than generating types from the fake-indexeddb code base. The reason I did this is for compatibility with your application code that may already be using TypeScript's IndexedDB types, so if I used something different for fake-indexeddb, it could lead to spurious type errors. In theory this could lead to other errors if there are differences between Typescript's IndexedDB types and fake-indexeddb's API, but currently I'm not aware of any difference.

  • Added support for ES modules in addition to CommonJS modules. That means you can import or require and it should just work.

  • Breaking change: The easiest way to use this module is still to import/require "fake-indexeddb/auto". If instead you want to import an individual variable rather than populate the global scope with all of them, previously you would do const indexedDB = require("fake-indexeddb"); for the main indexedDB variable and const IDBKeyRange = require("fake-indexeddb/lib/FDBKeyRange"); for any of the other IndexedDB variables. In this release, I made everything a named export of the main package, so you can do:

    import { indexedDB, IDBKeyRange } from "fake-indexeddb";

    or

    const { indexedDB, IDBKeyRange } = require("fake-indexeddb");

    For backwards compatibility, the require("fake-indexeddb/lib/FDBKeyRange") syntax still is supported, but the new exports of the main module are a breaking change. indexedDB is still the default export, but in CommonJS you can't have both default and named exports, so the default export is really just an property named "default". This may requrie changing requires of the root module like require("fake-indexeddb") to require("fake-indexeddb").default. Or switch to ES modules and import it :)

  • Breaking change: Dropped support for versions of Node.js older than Node 12.

  • Breaking change: For environments with a built-in structuredClone function (such as Node.js 17+), that is used rather than the realistic-structured-clone NPM module. There are some differences between the two implementations of the structured cloning algorithm, but probably nothing noticable, and probably all is in the direction of better spec compliance such as this or this. There is also a minor performance increase with the built-in function - the test suite of fake-indexeddb runs about 5% faster.

v3.1.8

08 Jun 21:32
Compare
Choose a tag to compare
  • #74 - Fixed error when adding undefined or null children in indexed objects, by @lukebrody

v3.1.7

19 Oct 23:48
Compare
Choose a tag to compare
  • #71 - Fixed an error when used with jest/jsdom introduced in version 3.1.6.

v3.1.6

19 Oct 22:16
Compare
Choose a tag to compare
  • #70 - Fixed performance regression in the previous version. Thank you @joshkel for figuring this out!