Skip to main content
Home

Built and signed on GitHub Actions

Test container solution for running third party solutions through docker.

This package works with Deno
This package works with Deno
JSR Score
76%
Published
4 months ago (2.0.2)
class PostgresTestContainer

Provides a simplified utility layer for starting, operating, and shutting down a postgres docker container.

Will automatically pull the requested docker image before starting the container.

Constructors

new
PostgresTestContainer(
container: Container,
)

Properties

readonly
exec: this.container.exec

Execute a command in the Postgres container.

readonly
host: string

PostgreSQL container host.

readonly
password: string

PostgreSQL password applied to the container.

readonly
port: number

PostgreSQL container port.

readonly
username: string

PostgreSQL username applied to the container.

Methods

Get postgres client instance for the current container.

create(name: string): Promise<void>

Create a new database with the given name.

stop(): Promise<void>

Stop and remove the Postgres container.

Return the connection URL for the Postgres container in the format: postgres://${user}:${pass}@${host}:${port}/${database}.

Make sure to start the container before accessing this method or it will throw an error.

Static Methods

Start a new Postgres container.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@valkyr/testcontainers

Import symbol

import { PostgresTestContainer } from "@valkyr/testcontainers/postgres";
or

Import directly with a jsr specifier

import { PostgresTestContainer } from "jsr:@valkyr/testcontainers/postgres";