v0l / snort

Feature packed nostr web UI, Mirror of https://git.v0l.io/Kieran/snort
https://snort.social
MIT License
321 stars 125 forks source link

`nostr` package: get tests passing in the browser #490

Closed sistemd closed 1 year ago

sistemd commented 1 year ago

I can now truly call it an isomorphic library: it does in fact work in the browser as well as node. Will implement NIP-07 next.

cloudflare-workers-and-pages[bot] commented 1 year ago

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5f29ae0
Status: ✅  Deploy successful!
Preview URL: https://1861e914.snort-social.pages.dev
Branch Preview URL: https://nostr-package-browser-tests.snort-social.pages.dev

View logs

v0l commented 1 year ago

Module not found: Error: Can't resolve '@snort/nostr' in '/opt/buildhome/repo/packages/app/src'

sistemd commented 1 year ago

So after dealing with more nonsense from a broken ecosystem, the tests now pass but only on node versions larger than 16.

The root cause is that the uuid package is trying to use crypto.getRandomValues in tests. I don't know why it doesn't use node's crypto module instead. I don't want to know; it's part of the legacy code, and I don't think that trying to fix this is worth the time.