apache / apache/pouchdb

PouchDB Adapter Memory is broken on Jest 27.x due to removal of setImmediate

Open
#8,383 15 comments 2 reactions 0 assignees View on GitHub
stale
Dominant language
JavaScript
Stars
17.6k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

### Issue
PouchDB Adapter Memory is causing Jest tests to fail after upgrading to Jest 27.x. Jest removed setImmediate and clearImmediate from JSDOM in [27.0.0](https://github.com/facebook/jest/blob/main/CHANGELOG.md#2700) with [this PR](https://github.com/facebook/jest/pull/11222). PouchDB Adapter Memory still relies on a very old version of `memdown` (1.4.1) that uses setImmediate. The [latest version](https://github.com/Level/memdown/tree/v6.1.1) of memdown (6.1.1) does not seem to rely on setImmediate and after forcing PouchDB Adapter Memory to use memdown@6.1.1 by editing the node module's package.json my tests go back to passing

This is similar to [issue 8096](https://github.com/pouchdb/pouchdb/issues/8096)

### Info
- Environment: (JSDOM/Jest@17.x)
- Platform: (Windows)
- Adapter: (Memory)

### Reproduce
1. Install Jest 27.x.
2. Create a test suite and import PouchDB Adapter Memory

Expected Result:
The tests should run

Actual Result:
The test suite will not even run and gives a `ReferenceError: setImmediate is not defined`.

![image](https://user-images.githubusercontent.com/2885351/137931103-edabb94a-efb2-4ae0-b316-42135fc215e0.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.