How to use the dockest/dist/test-helper.getHostAddress function in dockest

To help you get started, we’ve selected a few dockest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github erikengervall / dockest / packages / examples / aws-codebuild / src / integration-test / hello-world.spec.ts View on Github external
import http from 'http'
import fetch from 'node-fetch'
import { getHostAddress, getServiceAddress } from 'dockest/dist/test-helper'

const TARGET_HOST = getServiceAddress('aws_codebuild_website', 9000)

// hostname is either our docker container hostname or if not run inside a docker container the docker host
const HOSTNAME = getHostAddress()
const PORT = 8080

let server: http.Server

afterEach(async () => {
  if (server) {
    await new Promise((resolve, reject) => {
      server.close(err => {
        if (err) {
          reject(err)
          return
        }
        resolve()
      })
    })
  }

dockest

Dockest is an integration testing tool aimed at alleviating the process of evaluating unit tests whilst running multi-container Docker applications.

MIT
Latest version published 6 months ago

Package Health Score

67 / 100
Full package analysis