pgtest-container
TypeScript icon, indicating that this package has built-in type declarations

1.0.12 • Public • Published

pgtest-container

This is a small repo just to create PostgreSQL container for unittest or integration test for nodejs projects.

Installation

npm install pgtest-container

Usage

import { Pool } from 'pg';

import { PostgresContainer } from 'pgtest-container';

async function main() {
  const container = await PostgresContainer.start('15', { sslmode: 'disable' });

  console.log(container);

  const pool = new Pool({ connectionString: container.connectionUri });

  const r = await pool.query('SELECT NOW()');

  console.log(r.rows);

  await pool.end();

  await container.shutdown();
}

main();

Readme

Keywords

none

Package Sidebar

Install

npm i pgtest-container

Weekly Downloads

11

Version

1.0.12

License

ISC

Unpacked Size

33.8 kB

Total Files

24

Last publish

Collaborators

  • buildpeak