pgmock
Dev tools
test database
SHOW HN2024
How HN took it
9 positive, 22 neutral or asking, 1 mixed, 12 critical, out of 44 comments about the project. Thread score -0.08.
Idea: 7 for, 7 againstPerformance: 0 for, 3 againstExecution: 1 for, 1 againstPrivacy: 0 for, 1 against
The thread, comment by comment
Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.
positive neutral or mixed critical about another commenter or something else the maker
What HN said
What people liked
Fast startup makes tests much quicker
From 3 comments
These kinds of in-process/in-memory versions of dependencies take the startup time of those test from minutes/seconds to milliseconds, allowing you to run your tests vastly…
lelandbatey on HNNah, by having in-memory versions of your dependencies, in-memory versions which fulfill the same interfaces as those used in your E2E tests (or the majority of your E2E tests)…
lelandbatey on HNThis is amazing! I've been looking for an in-memory postgres mock for integration tests for ages!
fullstackchris on HN
Runs in process with no cleanup needed
From 1 comment
The fact that this can run in-process is a big deal, as it means you don't have to worry about cleanup. As soon as you have external processes that your tests depend on, your…
hamandcheese on HN
Objections
Not true E2E since it is not real Postgres
From 2 comments
It is, however, humanly possible, to run a real Postgres instance in a Docker container. You may use for example Testcontainers. So, I would not resort to an inferior Postgres…
sverhagen on HNThe whole purpose of End to End testing is that your testing the system in a real state. It's an emulation of your live environment. Because of that you can do interesting things…
zer00eyz on HN
Slow because it runs under emulation
From 2 comments
> by emulating the Postgres server in an x86 emulator > because performance is not usually a concern in tests I hate to be a downer, especially because it sounds like a lot of…
danpalmer on HNYeah, that should be possible! Though, for audio processing, the performance will probably be terrible (because it's all emulated).
n2d4 on HN
Uses a lot of memory compared to alternatives
From 1 comment
For prisma/nodejs devs who just want postgres-in-a-can for local dev you are better off using the recently released serverizing of pglite, pglite-server:…
theage on HN
Requests
Support for pgvector extension
From 1 comment
If it could support the pgvector extension it would be a super fast vector database with all the power of Pg - the relational aspect brings the ability to add and query using…
nborwankar on HN
Support for ORMs like Prisma, Sequelize, Drizzle
From 2 comments
support for orms like sequelize, prisma, drizzle for testing?
vivzkestrel on HNThis might be a stupid question, but do you know how this might be used with a Prisma client?
herpdyderp on HN
Multi-connection mode and pg_notify support
From 1 comment
This looks really cool, awesome work! Correct on PGlite only being single user at the moment, and that certainly is a problem for using it for integration tests in some…
samwillis on HN
Questions
Why not run Postgres in Docker or on a RAM disk
From 3 comments
Why not just run Postgres with it's files on a ramdisk? Update: this can apparently run in a browser/Node environment so can be created/updated/destroyed by the tests. I guess…
rsyring on HNI used to run all kinds of (custom) fake in-memory servers in my tests. Nowadays I just run the real thing using Testcontainers (https://testcontainers.com)
rickette on HN> by emulating the Postgres server in an x86 emulator > because performance is not usually a concern in tests I hate to be a downer, especially because it sounds like a lot of…
danpalmer on HN
Which Postgres version it is based on
From 1 comment
Cool! Which pg version is this based on?
andrelaszlo on HN
Whether the binary blobs in src/binaries are needed
From 1 comment
Why is there a set of binary blobs in the `src/binaries` directory? I don't want to use projects that have that if there isn't a good reason for it.
henning on HN
Alternatives named
PGlite
From 2 comments
This looks really cool, awesome work! Correct on PGlite only being single user at the moment, and that certainly is a problem for using it for integration tests in some…
samwillis on HNFor prisma/nodejs devs who just want postgres-in-a-can for local dev you are better off using the recently released serverizing of pglite, pglite-server:…
theage on HN
pg-mem
From 1 comment
I've used pgmem https://github.com/oguimbal/pg-mem for the last couple of years for the same thing.
geuis on HN
Testcontainers
From 2 comments
I used to run all kinds of (custom) fake in-memory servers in my tests. Nowadays I just run the real thing using Testcontainers (https://testcontainers.com)
rickette on HNI don't get it either. I feel like this is so much unnecessary code, an emulator, a network stack... Why not use something like https://testcontainers.com/? Is a container engine…
orphea on HN
Template databases with CREATE DATABASE FROM TEMPLATE
From 2 comments
You can bring "real postgres" test startup times back to milliseconds with CREATE DATABASE ... FROM TEMPLATE. Every test gets a fresh database (without having to run migration…
stickfigure on HNOK, that goal makes sense, thanks for explaining. For what it's worth I'm pretty sure you can do this with postgres, tmpfs, and template databases — see my project, pgtestdb [0].…
peter_l_downs on HN