Reproduction of a bug(?) in idb + fake-indexeddb + jsdom
- Install
yarn install
- Run tests
yarn test
The tests use the idb
package to act upon the IndexedDB
implementation by fake-indexeddb
.
With jsdom
environment in jest@27
acting on a transaction after allowing other code to run (per await
) throws errors.
This differs from executing the same calls in a node
environment.
The two tests added in https://github.com/ph-fritsche/repro-jest-jsdom-indexeddb/commit/0bd9819d0ab4175e39e446304d9c6353cb3e3aec confirm that the problem is the order of execution with setImmediate
in jsdom
environment.
https://github.com/ph-fritsche/repro-jest-jsdom-indexeddb/blob/master/fix.js#L1
yarn test:fix