20e0cb7c6f634c9c9545fb614e9f857b6bbdcd5c
Test Containers
Test container solution for running third party solutions through docker.
Quick Start
We have quick start support for postgres and mongodb.
Postgres
import { PostgresTestContainer } from "@valkyr/testcontainers/postgres";
const container = await PostgresTestContainer.start("postgres:16");
await container.create("db");
await container.client("db")`SELECT 1`;
console.log(container.url("db")); // => postgres://postgres:postgres@127.0.0.1:5432/db
await container.stop();
MongoDB
import { MongoTestContainer } from "@valkyr/testcontainers/mongodb";
const container = await MongoTestContainer.start();
console.log(container.url()); // mongodb://user:pass@127.0.0.1:27017
console.log(await container.client.db("admin").command({ ping: 1 })) // { ok: 1 }
await container.stop();
Description
Languages
TypeScript
98.1%
JavaScript
1.9%