top | item 44200001

(no title)

benpacker | 8 months ago

I have this setup and integrated for Node/Bun -

This is an example of a unit test of an API route on a fully isolated WASM backed Postgres - very few lines of code, and all your API unit tests can run fully in parallel without any shared state: https://github.com/ben-pr-p/bprp-react-router-starter/blob/m...

This is all of the code needed to use Postgres in prod and PGLite in test/dev: https://github.com/ben-pr-p/bprp-react-router-starter/blob/m...

discuss

order

peterldowns|8 months ago

Thanks for sharing this, I'm not a Node/Bun dev but it's quite understandable. One question: does each test/database need to wait for migrations to run, or are you somehow using template databases to run them once and then quickly clone a new database for each test?

wey-gu|8 months ago

wow thanks! Should I use bun instead of node now?

benpacker|8 months ago

It’s the same - just saying it works in both.

I like it because I can do full stack development, including the database, with a single system level dependency (Bun).