3 ms·
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
by benpacker 1y 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/main/app/test/listWidgets.test.ts 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/main/app/database/pg.server.ts https://github.com/ben-pr-p/bprp-react-router-starter/blob/m...
- wey-gu 1y agowow thanks! Should I use bun instead of node now?
- peterldowns 1y agoThanks 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?