swissarmykirpan / testcontainers-node

TestContainers is a NodeJS library that supports tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Testcontainers

Testcontainers is a NodeJS library that supports tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.

Build Status

Install

npm i -D testcontainers

Usage

Run your app with the DEBUG=testcontainers env variable set to see debug output.

Example

const redis = require("async-redis");
const { GenericContainer } = require("testcontainers");

(async () => {
  const container = await new GenericContainer("redis")
    .withExposedPorts(6379)
    .start();

  const redisClient = redis.createClient(container.getMappedPort(6379));
  await redisClient.quit();

  await container.stop();
})();

About

TestContainers is a NodeJS library that supports tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.


Languages

Language:TypeScript 99.7%Language:JavaScript 0.3%