JoshuaWise / integer

Native 64-bit integers with overflow protection.
MIT License
19 stars 9 forks source link

Use regular properties when exporting constants to play nicely with Jest #3

Closed jlongster closed 6 years ago

jlongster commented 6 years ago

I'm trying to use better-sqlite3 with jest. better-sqlite3 depends on this module and apparently there's a problem running it via jest. I already found https://github.com/JoshuaWise/better-sqlite3/issues/45 which gives some insight.

I completely understand not wanting to remove functionality for Jest, and I wouldn't recommend removing Integer. However, with these small changes I was able to get it work. I think it's a good compromise and, while it may not be quite as sound as defining static property, being compatible with the current JS ecosystem is going to help better-sqlite3 be used a lot more.

Sidenote: I love love love better-sqlite3. Thank you so much. I was able to remove so much complexity in my app by using simple synchronous APIs, and I've never understood why node-sqlite3 is asynchronous because sqlite3 itself is not async. It only ever runs one query at a time. Why in the world would we be using async bindings to it? Your library is exactly what I've been looking for and it's so, so much better.

JoshuaWise commented 6 years ago

I'm happy to have better-sqlite3 support jest if this is all it takes. Thanks for the contribution!

jlongster commented 6 years ago

Nice response time, awesome work!