Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.

ph-fritsche/repro-jest-jsdom-indexeddb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reproduction of a bug(?) in idb + fake-indexeddb + jsdom

  1. Install
yarn install
  1. 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.

Result

image

Issue

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.

Workaround

https://github.com/ph-fritsche/repro-jest-jsdom-indexeddb/blob/master/fix.js#L1

yarn test:fix

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published