JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 41
  • Score
    100M100P100Q69041F
  • License MIT

Mocking module for dockerode

Package Exports

  • dockerode-mock

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dockerode-mock) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Dockerode Mock

Mocking module for Dockerode.

Usage

First install the package.

npm install --save-dev dockerode-mock

Next use a mocking library to replace the dockerode module with dockerode-mock.

Finally specify the overrides you wish to use before and after each test.

import * as docker from 'dockerode-mock'

//Apply to all engines
docker.overrides = {
    'GET /_ping': { error: 'connection error' },
    'GET /containers/json?': { ... },
}

//Apply to specific engines
docker.overrides = {
    'GET 192.168.0.5/_ping': 'OK',
    'GET 192.168.0.5:4243/_ping': 'OK',
    'GET tcp://192.168.0.5:4243/_ping': { error: 'connection error' }
}