UNPKG

dockest

Version:

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

22 lines 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.teardownSingle = void 0; const execa_wrapper_1 = require("./execa-wrapper"); const errors_1 = require("../errors"); const stopContainerById = async ({ runner, runner: { containerId } }) => { const command = `docker stop ${containerId}`; (0, execa_wrapper_1.execaWrapper)(command, { runner, logPrefix: '[Stop Container]', logStdout: true }); }; const removeContainerById = async ({ runner, runner: { containerId } }) => { const command = `docker rm ${containerId} --volumes`; (0, execa_wrapper_1.execaWrapper)(command, { runner, logPrefix: '[Remove Container]', logStdout: true }); }; const teardownSingle = async ({ runner, runner: { containerId, serviceName } }) => { if (!containerId) { throw new errors_1.DockestError(`Invalid containerId (${containerId}) for service (${serviceName})`, { runner }); } await stopContainerById({ runner }); await removeContainerById({ runner }); }; exports.teardownSingle = teardownSingle; //# sourceMappingURL=teardown-single.js.map