From e5bb8789a24a67fbd34fbc698ac4906d1a0f53da Mon Sep 17 00:00:00 2001 From: Stephen Weatherford Date: Thu, 17 Aug 2023 21:56:05 -0700 Subject: [PATCH] exp --- gulpfile.ts | 34 ++++++++++++++++--- test/support/ensureExtensionHasInitialized.ts | 9 ++--- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/gulpfile.ts b/gulpfile.ts index 6c22beeaa..3917a2e5f 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -96,22 +96,48 @@ async function test(): Promise { const vscodeExecutablePath = await downloadAndUnzipVSCode(); const cliPath = resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath); + const extensionsDirs = path.resolve('.vscode-test/extensions'); + console.log("extensionsDirs: " + extensionsDirs); + const extensionInstallArguments = [ "--install-extension", "ms-dotnettools.vscode-dotnet-runtime", + `--extensions-dir=${extensionsDirs}`, + ]; + + const extensionListArguments = [ + "--list-extensions", + "--show-versions", + `--extensions-dir=${extensionsDirs}`, ]; - // Install .NET Install Tool as a dependency. - let result = cp.spawnSync(cliPath, extensionInstallArguments, { + console.log("Install .NET Install Tool as a dependency..."); + console.log("cliPath: " + cliPath); + console.log("extensionInstallArguments: " + extensionInstallArguments); + + //gulp_installVSCodeExtension("ms-dotnettools", "vscode-dotnet-runtime"); + let result = cp.spawnSync(cliPath, extensionListArguments, { + encoding: "utf-8", + stdio: "inherit", + }); + console.log("result.error: " + result.error); + console.log("result.output: " + result.output); + + result = cp.spawnSync(cliPath, extensionInstallArguments, { encoding: "utf-8", stdio: "inherit", }); + console.log("result.error: " + result.error); + console.log("result.output: " + result.output); if (result.status !== 0) { throw new Error("Failed to install dotnet runtime extension"); + } else { + console.log(".NET Install Tool installed successfully"); } - result = cp.spawnSync('node', ['./out/test/runTest.js'], { encoding: "utf-8", stdio: 'inherit', env }); - if (result.status !== 0) { + var testsResult = cp.spawnSync('node', ['./out/test/runTest.js'], { encoding: "utf-8", stdio: 'inherit', env }); + console.log("Tests result: " + testsResult.status); + if (testsResult.status !== 0) { throw new Error("Tests failed"); } } diff --git a/test/support/ensureExtensionHasInitialized.ts b/test/support/ensureExtensionHasInitialized.ts index 664c8ab3f..3976bc639 100644 --- a/test/support/ensureExtensionHasInitialized.ts +++ b/test/support/ensureExtensionHasInitialized.ts @@ -10,19 +10,20 @@ import { writeToLog } from "./testLog"; export async function ensureExtensionHasInitialized(totalTimeout: number): Promise { async function ensureDotnetExtensionActivated(): Promise { - writeToLog(">>> Looking for dotnet extension ", true); + const dotnetExtensionName = "ms-dotnettools.vscode-dotnet-runtime"; + writeToLog(`>>> Looking for dotnet extension ${dotnetExtensionName}`, true); let extensionDotnet: Extension | undefined; await delayWhileSync( 5 * 1000, () => { - extensionDotnet = extensions.getExtension("ms-dotnettools.vscode-dotnet-runtime"); - writeToLog(extensionDotnet !== undefined ? "Dotnet extension found" : "Dotnet extension not found", true); + extensionDotnet = extensions.getExtension(dotnetExtensionName); + writeToLog(extensionDotnet !== undefined ? `Dotnet extension ${dotnetExtensionName} found` : `Dotnet extension ${dotnetExtensionName} not found`, true); return !extensionDotnet; }, 5 * 60 * 1000); // tslint:disable-next-line: no-non-null-assertion await extensionDotnet!.activate(); - writeToLog(">>> Dotnet extension activated", true); + writeToLog(`>>> Dotnet extension ${dotnetExtensionName} is active`, true); // console.log("Dotnet extension: ", extensionDotnet); }