You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 24, 2021. It is now read-only.
Describe the bug
When running the test in jest (with either env=jsdom or env=node setting) the TextDecoder or TextEncoder is not a constructor error makes it impossible to write unit tests using this module
error: TypeError: TextDecoder is not a constructor
TypeError: TextDecoder is not a constructor
> 1 | import CID from 'cids'
| ^
2 | import { getCodec, rmPrefix } from 'multicodec'
3 | import { decode, toB58String } from 'multihashes'
4 |
at Object.<anonymous> (node_modules/multibase/src/util.js:6:21)
at Object.<anonymous> (node_modules/multibase/src/base.js:4:24)
at Object.<anonymous> (node_modules/multibase/src/constants.js:5:14)
at Object.<anonymous> (node_modules/multibase/src/index.js:9:19)
at Object.<anonymous> (node_modules/multihashes/src/index.js:10:19)
at Object.<anonymous> (node_modules/cids/src/index.js:3:12)
at Object.<anonymous> (src/utils/contenthashToUri.ts:1:1)
at Object.<anonymous> (src/utils/contenthashToUri.test.ts:1:1)
Expected behavior TextDecoder from the environment (specifically, global for node and window for jsdom jest setting) is successfully loaded
Screenshots
Desktop (please complete the following information):