The Easiest Way to Run Integration Tests with Docker and Testcontainers

Поделиться
HTML-код
  • Опубликовано: 25 янв 2025

Комментарии • 24

  • @flolu
    @flolu  2 года назад

    ⭐ Make sure to star the GitHub repository: github.com/flolu/node-integration-testing

  • @juststudying1019
    @juststudying1019 7 месяцев назад +1

    amazing straight to the point.

  • @ricardocastanho4717
    @ricardocastanho4717 2 года назад +1

    This video should have more views. This is a great content!

  • @napoleonicmusic
    @napoleonicmusic Год назад +1

    Thanks! I was having a hard time finding good implementations for this.

    • @flolu
      @flolu  Год назад

      Glad I could help!

  • @asrn1739
    @asrn1739 Год назад +1

    Thank you definitely helpful

    • @flolu
      @flolu  Год назад

      Glad it was helpful!

  • @xBlisxs
    @xBlisxs 2 года назад

    This is very neat approach. Not sure if it's better than starting container and running test inside, but still noteworthy 👍

  • @mauriciodalgalarrondo3809
    @mauriciodalgalarrondo3809 2 года назад

    Thanks for your content! It gave me a new approach to integration tests. One of the tradeoffs of putting everything inside test containers is that you cannot mock some dependencies. Maybe you want to test with your database integration but without email integration with the SMTP server. So I prefer to only use the containers for the database or for any dockerizable external dependency that you want to integrate into your testings.

    • @flolu
      @flolu  2 года назад

      Thanks! And yes, that's completely fine, too. But I can't see why I wouldn't be able to mock an email integration?

    • @prionkor
      @prionkor Год назад

      If you want only mysql container you can do so and expose the port and just use the node app by setting env variable. That should work too. In that case you need to change your code by adding host port as well. For example: .withExposedPorts({container: 3306, host: 3306, }), if you get port conflict then change host port to something else.

  • @TheFJS98
    @TheFJS98 7 месяцев назад

    Thanks for the video! I am trying to setup a bun environment, do you know if there is a problem about it? It says that undefined symbol: node_module_register...

  • @rajeshnarayanappa2438
    @rajeshnarayanappa2438 2 года назад

    Wonderful explained. Thanks for video

    • @flolu
      @flolu  2 года назад

      I'm glad that I was able to help!

  • @ykhatat
    @ykhatat Год назад

    why didn't you use your docker-compos to setup the container?

    • @flolu
      @flolu  Год назад

      Depending on your needs you can definitely just use docker-compose. But you have far greater flexibility by using Testcontainers.

    • @joebowbeer
      @joebowbeer 4 месяца назад

      In NodeJS testcontainers see DockerComposeEnvironment for sharing compose files with testcontainers

  • @markokraljevic1590
    @markokraljevic1590 2 года назад

    what is the advantage of using testcontainers package instead of just running tests inside app container with docker-compose run?

    • @flolu
      @flolu  2 года назад +1

      You don't need to use it, but it can be useful in complex testing environments. You can watch this great video for more information: ruclips.net/video/9fzn0j1jbiQ/видео.html

  • @in-housecoding4360
    @in-housecoding4360 3 года назад

    Hi florian, can you please make similar video using Jest also covering some unit tests as well

    • @flolu
      @flolu  3 года назад +1

      Hi there. I think there are already plenty of good resources about unit testing out there.
      And using Jest shouldn't make a big difference either. You can take a look at an npm module called "ts-jest" for running Jest with TypeScript.

  • @rauIkat
    @rauIkat 2 года назад

    It was a really helpful video, thanks a lot!

    • @flolu
      @flolu  2 года назад

      Great to hear that, thanks for the comment!