- Improve performance (#169 by @jlucaso1)
-
Add support for
handleEventandcaptureto improveEventcompatibility (#162 by @nolanlawson) -
Improve handling some edge cases related transaction timing (#165, #168 by @nolanlawson)
-
More testing infrastructure improvements (#164, #166 by @nolanlawson)
-
Several small bug fixes to more correctly handle various edge cases and increase the number of passing tests from the Web Platform Tests (#147, #155, #157 by @dumbmatter; #156, #158, #159, #160 by @nolanlawson)
-
Improvements to testing infrastructure, allowing more Web Platform Tests to run (#148 by @dumbmatter; #150, #151, #152, #153, #154 by @nolanlawson)
-
Automated and updated the Web Platform Tests comparison table in the README (#161 by @nolanlawson)
- Several small bug fixes to more correctly handle various edge cases and increase the number of passing tests from the Web Platform Tests (#137, #139, #141, #142, #143, #144, #145, #146 by @nolanlawson)
- Fixed regression in v6.2.0 where overwriting the global
indexedDBvariable created byfake-indexeddb/auto(such as withindexedDB = new IDBFactory();) was no longer working (#135 by @nolanlawson)
- Fixed the
IDBDatabasevariable created by a CommonJS require offake-indexeddb/auto, which was broken in v6.2.0 (#131 by @nolanlawson)
- Add new
forceCloseDatabaseAPI to simulate the database being abnormally closed, emitting a"close"event (#126 by @nolanlawson)
-
Significantly improved performance of some operations (like 13x for inserts with many multiEntry indexes) by using a binary search tree to store data, although for most simple use cases you won't notice a difference (#128 by @nolanlawson)
-
Improved performance in non-Safari browsers by using
scheduler.postTaskrather thansetTimeout(#129 by @nolanlawson)
-
Improved handling of
BlobandFileobjects (#124 by @nolanlawson) -
Fixed
fake-indexeddb/autoimport in browsers (#127 by @nolanlawson)
- Further improved test coverage and performance of Web Platform Tests (#119 #120 #121 #122 #123 by @nolanlawson)
-
Added support for new IndexedDB features: querying keys and values at the same time with
getAllRecords, and passing a descending direction intogetAll/getAllKeys. (#112 by @nolanlawson) -
Better DOMStringList polyfill that doesn't include various inappropriate array methods. (#66 by @dumbmatter)
-
Updated the Web Platform Tests from 2019 to 2025 which improved test coverage and uncovered a few minor bugs that were fixed. (#117 by @nolanlawson)
- #110 - Fix handling of "undefined value" vs "missing value" in IDBObjectStore.add/put when that value is at the keyPath and autoIncrement is true - it should throw an error if the keyPath value is undefined, but previously it was not.
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
DOMExceptionerrors 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
setImmediateis used in some situations where people are mocking timers. -
#99 - @sjnho fixed handling of
Dateobjects to account for some edge cases, including jsdom overriding the nativeDateconstructor.
- #94 - Improved performance of
IDBObjectStore.countandIDBIndex.count.
-
#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
structuredClonepolyfill is not included anymore.
- Dropped support for Node.js 16, which allows me to get rid of the
structuredClonepolyfill, which reduces the package size by roughly 50%.
- #84 - Fix the TypeScript types in some situations.
- #79 - Added missing
requestaccessor to theFDBCursorobject. Thank you @mmacfadden for the PR!
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
importorrequireand 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 doconst indexedDB = require("fake-indexeddb");for the mainindexedDBvariable andconst 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.indexedDBis 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 likerequire("fake-indexeddb")torequire("fake-indexeddb").default. Or switch to ES modules andimportit :) -
Breaking change: Dropped support for versions of Node.js older than Node 12.
-
Breaking change: For environments with a built-in
structuredClonefunction (such as Node.js 17+), that is used rather than therealistic-structured-cloneNPM 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.
- #74 - Fixed error when adding undefined or null children in indexed objects, by @lukebrody
- #71 - Fixed an error when used with jest/jsdom introduced in version 3.1.6.
- #70 - Fixed performance regression in the previous version. Thank you @joshkel for figuring this out!
- #67 - Fixed compatibility with jsdom by replacing all uses of
setImmediatewithsetTimeout.
- #65 - Got rid of constructor.name usage, since minifying can break it.
- #54 - Fixed a bug where multiple transactions started at the same time could result in a transaction never resolving, if one of the transactions had no database operations inside it. Thank you @medmunds for both finding and fixing this bug!
- #53 - Fixed a bug introduced in v3.1.0 where
FDBObjectStore.deleteresulted in an error when given a key range. Possibly a couple other situations with key ranges produced similar errors too.
- #52 - Significant performance improvement. 5.5x faster on a real use case. Thank you @nolanlawson for this speed up!
- #45 - Fix synchronous event firing in a transaction, which led to a stack overflow when used with Dexie's waitFor function.
- #41 - Correctly roll back a record added to a store when an index constraint error occurs.
- Stopped importing core-js by default. This means that, for people using fake-indexeddb in really old environments like PhantomJS, they will now need to import core-js like
require("core-js/stable");(or something similar) before importing fake-indexeddb.
- #30 - Fixed typo in the name of the
Event.timeStampproperty.
- Added the ability to include
fake-indexeddb/autoand have it populate all the global variables. - Added support for
IDBTransaction.commit()andIDBFactory.databases(). - Fixed a couple minor edge cases to improve performance on the web platform tests from 85% to 87%.
- Fixed issue #26, where event handlers were inappropriately not being called if they added or removed other handlers to the invoking listener in their callbacks.
- Fixed issue #25 by importing core-js/shim rather than all of core-js.
- Improved structured cloning, which fixes bugs when used with strange objects like dumbmatter/realistic-structured-clone#5
- Fixed issue #20 related to iterating over cursors with non-unique keys
- Include core-js by default to make it work more easily in old environments like PhantomJS
- Minor updates to README
- Fully implements the IndexedDB 2.0 API (which technically still is a draft, but is probably not going to substantially change).
- Ported to TypeScript, which hopefully means less bugs.
- Dynamically runs the W3C web-platform-tests rather than using manually ported tests. This means it's easy to run new tests, and the tests written since the original release of fake-indexeddb turned up several minor bugs which have now been fixed. See
npm run test-w3c.