-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Friendly note on unexpected side-effects of 2.1.5->2.1.6 transition #21
Comments
Jest [doesn't support package exports](jestjs/jest#9771), nor does it support `browser` overrides out of the box (though it [can be configured](https://jestjs.io/docs/configuration#resolver-string)). This means it parses the stubbed files introduced in mikeal#13 as javascript, so let's just require and export the file that the stub is stubbing. This has the added bonus of also supporting old nodes that don't understand package exports. Fixes achingbrain/uint8arrays#21
Ah, that's annoying, sorry about that. I've just opened mikeal/ipjs#14 which when building In the mean time please use your custom resolver or pin |
Jest [doesn't support package exports](jestjs/jest#9771), nor does it support `browser` overrides out of the box (though it [can be configured](https://jestjs.io/docs/configuration#resolver-string)). This means it parses the stubbed files introduced in #13 as javascript, so let's just require and export the file that the stub is stubbing. This has the added bonus of also supporting old nodes that don't understand package exports. Fixes achingbrain/uint8arrays#21
This should be fixed in Please let me know if this still causes you problems. |
Closing this as it should be fixed, please re-open if you continue to see problems. |
Thanks @achingbrain |
Jest [doesn't support package exports](jestjs/jest#9771), nor does it support `browser` overrides out of the box (though it [can be configured](https://jestjs.io/docs/configuration#resolver-string)). This means it parses the stubbed files introduced in mikeal#13 as javascript, so let's just require and export the file that the stub is stubbing. This has the added bonus of also supporting old nodes that don't understand package exports. Fixes achingbrain/uint8arrays#21
@achingbrain It seems the issue is being reproduced for now. I had the error "Cannot read property 'base16' of undefined" and fixed it only via resolver as was suggested above -> |
Using marvellous
uint8arrays
library extensively. The recent change depends onmultiformats
module instead of previousmultibase
. Apparently,multiformats
uses conditional exports in itspackage.json
, and vanilla Jest can not handle those.So, if some people start complaining on their tests failing with cryptic errors, like
Cannot read property 'base16' of undefined
, please know, this is due to Jest unable to loadmultiformats
properly.A solution I have for the downstream users is to use custom resolver for Jest (jest-resolver-enhanced), like in the following fragment of
package.json
:Any other resolver capable of handling conditional exports is just as fine, but every one I know of, are unusable right now due to old age. Checked them all, IMO.
The text was updated successfully, but these errors were encountered: