Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jest-containers-setup

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-containers-setup

*Run Docker containers for jest tests with an async setup function*

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
27
increased by800%
Maintainers
1
Weekly downloads
 
Created
Source

jest-containers-setup

Run Docker containers for jest tests with an async setup function

Description

This is a very simple wrapper around jest-testcontainers that allows you to specify a simple async function in the setup property of the container config.

Something a little like this
const pg = require('pg')

module.exports = {
    postgres: {
        image: 'postgres',
        tag: 'alpine',
        ports: [5432],
        env: {
            POSTGRES_PASSWORD: "coolpassword",
            POSTGRES_USER: "admin",
        },
        wait: {
            type: 'ports',
            timeout: 30000
        },
        async setup() {
            const client = new pg.Client({
                user: 'admin',
                password: 'coolpassword',
                database: 'admin',
                host: process.env.__TESTCONTAINERS_POSTGRES_IP__,
                port: +process.env.__TESTCONTAINERS_POSTGRES_PORT_5432__
            })
            await client.connect();
            await client.query(`
                create table test_table(
                  id serial not null,
                  name varchar not null
                );
            `)
            await client.end();
        }
    }
}

FAQs

Package last updated on 01 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc