https://github.com/simonberner/testcontainers-nodejs-example
An example project showing how to use Testcontainers in Node.js for Integration- & Browser-Tests
https://github.com/simonberner/testcontainers-nodejs-example
cloud-native-testing docker-container docker-image integration-testing postgres-container testcontainers
Last synced: 10 months ago
JSON representation
An example project showing how to use Testcontainers in Node.js for Integration- & Browser-Tests
- Host: GitHub
- URL: https://github.com/simonberner/testcontainers-nodejs-example
- Owner: simonberner
- License: mit
- Created: 2024-08-26T15:06:35.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-10T14:53:45.000Z (about 1 year ago)
- Last Synced: 2025-04-10T16:04:20.376Z (about 1 year ago)
- Topics: cloud-native-testing, docker-container, docker-image, integration-testing, postgres-container, testcontainers
- Language: JavaScript
- Homepage: https://testcontainers.com/
- Size: 522 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Testcontainers Node.js Example
[](https://github.com/simonberner/testcontainers-nodejs-example/actions/workflows/ci.yml)
[](https://github.com/simonberner/testcontainers-nodejs-example/blob/main/LICENSE)
🚧 Running playwright browser tests in a [testcontainer](https://github.com/javierlopezdeancos/testcontainers-node-playwright) is still [work in progress](https://github.com/simonberner/testcontainers-nodejs-example/blob/main/tests/playwright/web.spec.js)! 🚧
(If you know how this works, please open a PR, thanks!)
## About
- [Getting Started](https://testcontainers.com/getting-started/)
- [Getting Started with Node.js](https://testcontainers.com/guides/getting-started-with-testcontainers-for-nodejs/)
## Containers
For running containers, we have the following options:
- Use Docker Desktop to run the containers locally
- Use [Testcontainers Desktop App](https://testcontainers.com/desktop/) to run containers locally (embedded runtime) or in the Testcontainers cloud (300min for free)
- Use [GitHub Actions to run a Testcontainer](https://www.atomicjar.com/2023/06/running-testcontainers-tests-using-github-actions/)
## Testcontainers Cloud
- [Your Account Dashboard](https://app.testcontainers.cloud)
## GitHub Actions
This project contains a [GitHub Action](https://github.com/simonberner/testcontainers-nodejs-example/actions) which runs the Jest-Tests (Integration-Tests) in a Testcontainer when pushing/merging to main.
## Resources
- [Enable reusable containers](https://testcontainers.com/guides/simple-local-development-with-testcontainers-desktop/#_enable_reusable_containers_to_speed_up_the_development)
### Playwright
It is recommended to use Docker image version that matches Playwright version. If the Playwright version in your Docker image does not match the version in your project/tests, Playwright will be unable to locate browser executables.
- [Playwright module for Testcontainers](https://github.com/javierlopezdeancos/testcontainers-node-playwright)
- [Playwright Docker](https://playwright.dev/docs/docker)
- [Playwright Docker Image Tags](https://playwright.dev/docs/docker#image-tags)
- [Playwright official docker Images](https://mcr.microsoft.com/en-us/product/playwright/about)
- [Docker image to run Playwright with Node.js](https://hub.docker.com/r/microsoft/playwright)
### Postgres
- [Postgres Docker Images](https://hub.docker.com/_/postgres)
## Credits
- The project is based on [this guide](https://testcontainers.com/guides/getting-started-with-testcontainers-for-nodejs/)
- [Page Objects vs. Functional Helpers](https://dev.to/muratkeremozcan/page-objects-vs-functional-helpers-2akj)