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

Function devContainerUp

src/test/testUtils.ts:91–104  ·  view source on GitHub ↗
(cli: string, workspaceFolder: string, options?: { cwd?: string; useBuildKit?: boolean; userDataFolder?: string; logLevel?: string; extraArgs?: string; prefix?: string; env?: NodeJS.ProcessEnv })

Source from the content-addressed store, hash-verified

89}
90
91export async function devContainerUp(cli: string, workspaceFolder: string, options?: { cwd?: string; useBuildKit?: boolean; userDataFolder?: string; logLevel?: string; extraArgs?: string; prefix?: string; env?: NodeJS.ProcessEnv }): Promise<UpResult> {
92 const buildkitOption = (options?.useBuildKit ?? false) ? '' : ' --buildkit=never';
93 const userDataFolderOption = (options?.userDataFolder ?? false) ? ` --user-data-folder=${options?.userDataFolder}` : '';
94 const logLevelOption = (options?.logLevel ?? false) ? ` --log-level ${options?.logLevel}` : '';
95 const extraArgs = (options?.extraArgs ?? false) ? ` ${options?.extraArgs}` : '';
96 const prefix = (options?.prefix ?? false) ? `${options?.prefix} ` : '';
97 const shellExecOptions = { cwd: options?.cwd, env: options?.env };
98 const res = await shellExec(`${prefix}${cli} up --workspace-folder ${workspaceFolder}${buildkitOption}${userDataFolderOption}${extraArgs} ${logLevelOption}`, shellExecOptions);
99 const response = JSON.parse(res.stdout);
100 assert.equal(response.outcome, 'success');
101 const { outcome, containerId, composeProjectName } = response as UpResult;
102 assert.ok(containerId, 'Container id not found.');
103 return { outcome, containerId, composeProjectName, stderr: res.stderr };
104}
105export async function devContainerDown(options: { containerId?: string | null; composeProjectName?: string | null; doNotThrow?: boolean }) {
106 if (options.containerId) {
107 await shellExec(`docker rm -f ${options.containerId}`, undefined, undefined, options.doNotThrow);

Callers 8

updateUID.test.tsFile · 0.90
describeTests1Function · 0.90
describeTests2Function · 0.90
cli.test.tsFile · 0.90
cli.up.test.tsFile · 0.90
e2e.test.tsFile · 0.90

Calls 1

shellExecFunction · 0.85

Tested by

no test coverage detected