(params: DockerResolverParameters, workspaceFolder: string, quiet: boolean, disposables: (() => Promise<unknown> | undefined)[])
| 543 | } |
| 544 | |
| 545 | async function launchProject(params: DockerResolverParameters, workspaceFolder: string, quiet: boolean, disposables: (() => Promise<unknown> | undefined)[]): Promise<LaunchResult> { |
| 546 | const { common } = params; |
| 547 | let response = {} as LaunchResult; |
| 548 | |
| 549 | const normalizedWorkspaceFolder = normalizeDevContainerLabelPath(process.platform, workspaceFolder); |
| 550 | const idLabels = [`devcontainer.local_folder=${normalizedWorkspaceFolder}`, `devcontainer.is_test_run=true`]; |
| 551 | const options: ProvisionOptions = { |
| 552 | ...staticProvisionParams, |
| 553 | workspaceFolder, |
| 554 | additionalLabels: [], |
| 555 | logLevel: common.getLogLevel(), |
| 556 | mountWorkspaceGitRoot: true, |
| 557 | mountGitWorktreeCommonDir: false, |
| 558 | remoteEnv: common.remoteEnv, |
| 559 | skipFeatureAutoMapping: common.skipFeatureAutoMapping, |
| 560 | skipPersistingCustomizationsFromFeatures: common.skipPersistingCustomizationsFromFeatures, |
| 561 | omitConfigRemotEnvFromMetadata: common.omitConfigRemotEnvFromMetadata, |
| 562 | log: text => quiet ? null : process.stderr.write(text), |
| 563 | dotfiles: {} |
| 564 | }; |
| 565 | |
| 566 | try { |
| 567 | if (quiet) { |
| 568 | // Launch container but don't await it to reduce output noise |
| 569 | let isResolved = false; |
| 570 | const p = launch(options, idLabels, disposables); |
| 571 | p.then(function (res) { |
| 572 | process.stdout.write('\n'); |
| 573 | response = res; |
| 574 | isResolved = true; |
| 575 | }); |
| 576 | while (!isResolved) { |
| 577 | // Just so visual progress with dots |
| 578 | process.stdout.write('.'); |
| 579 | await new Promise((resolve) => setTimeout(resolve, 500)); |
| 580 | } |
| 581 | } else { |
| 582 | // Stream all the container setup logs. |
| 583 | response = await launch(options, idLabels, disposables); |
| 584 | } |
| 585 | |
| 586 | return { |
| 587 | ...response, |
| 588 | disposables, |
| 589 | }; |
| 590 | } catch (e: any) { |
| 591 | fail(`Failed to launch container:\n\n${e?.message ?? 'Unknown error'}`); |
| 592 | return response; // `fail` exits before we return this. |
| 593 | } |
| 594 | } |
| 595 | |
| 596 | async function execTest(testFileName: string, workspaceFolder: string, cliHost: CLIHost, injectedEnv: { [varName: string]: string | boolean } = {}) { |
| 597 | // Ensure all the tests scripts in the workspace folder are executable |
no test coverage detected