Trendyol / jest-testcontainers

Jest preset for running docker containers with your tests
MIT License
122 stars 16 forks source link

add example with postgresql and migration #20

Closed Yengas closed 3 years ago

Yengas commented 3 years ago

we can create an example that showcases how to write integration tests for postgresql.

node-pg-migrate or something else, can be used to manage migrations. should support watch mode.

probablykabari commented 3 years ago

I am trying to fix in a fork but still cannot get postgres to work with this. The image seems to time out every attempt at running.In my fork, I updated testcontainers-node and modified the config to allow waiting for health checks. I am not sure what is happening or why it times out.

Yengas commented 3 years ago

Hey @RipTheJacker,

Can you please link me to your branch that does not work? We currently use this library in multiple projects for PostgreSQL integration testing. I will try to publish a working example this weekend, so you can use it as a reference.

Cheers, Yengas

Yengas commented 3 years ago

Hey @RipTheJacker,

Just published an example project showcasing how to write integration tests for PostgreSQL. It uses node-pg-migrate for the DB migration. It also has CI integration for Github + Gitlab. Tried to keep the example as simple as possible.

You can also check this commit where I add jest-testcontainers to the project.

LMK if you have any more questions or problems integrating this into your project.

Cheers, Yengas