MCPcopy Index your code
hub / github.com/devcontainers/cli / cleanup

Function cleanup

src/spec-node/featuresCLI/testCommandImpl.ts:81–91  ·  view source on GitHub ↗
(cliHost: CLIHost)

Source from the content-addressed store, hash-verified

79}
80
81async function cleanup(cliHost: CLIHost) {
82 // Delete any containers that have the 'devcontainer.is_test_run=true' label set.
83 const filterForContainerIdArgs = ['ps', '-a', '--filter', 'label=devcontainer.is_test_run=true', '--format', '{{.ID}}'];
84 const { stdout } = (await runCommandNoPty({ cmd: 'docker', args: filterForContainerIdArgs, output: nullLog, exec: cliHost.exec }));
85 const containerIds = stdout.toString().split('\n').filter(id => id !== '').map(s => s.trim());
86 log(`Cleaning up ${containerIds.length} test containers...`, { prefix: '🧹', info: true });
87 for (const containerId of containerIds) {
88 log(`Removing container ${containerId}...`, { prefix: '🧹', info: true });
89 await cliHost.exec({ cmd: 'docker', args: ['rm', '-f', containerId], output: nullLog });
90 }
91}
92
93async function runGlobalFeatureTests(args: FeaturesTestCommandInput, testResults: TestResult[] = []): Promise<TestResult[]> {
94 const { collectionFolder } = args;

Callers 1

doFeaturesTestCommandFunction · 0.70

Calls 3

runCommandNoPtyFunction · 0.90
logFunction · 0.85
execMethod · 0.65

Tested by

no test coverage detected