Skip to content

Commit

Permalink
exp
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Weatherford authored and Stephen Weatherford committed Aug 18, 2023
1 parent 37ba7a5 commit e5bb878
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
34 changes: 30 additions & 4 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,48 @@ async function test(): Promise<void> {
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");
}
}
Expand Down
9 changes: 5 additions & 4 deletions test/support/ensureExtensionHasInitialized.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@ import { writeToLog } from "./testLog";

export async function ensureExtensionHasInitialized(totalTimeout: number): Promise<void> {
async function ensureDotnetExtensionActivated(): Promise<void> {
writeToLog(">>> Looking for dotnet extension ", true);
const dotnetExtensionName = "ms-dotnettools.vscode-dotnet-runtime";
writeToLog(`>>> Looking for dotnet extension ${dotnetExtensionName}`, true);
let extensionDotnet: Extension<unknown> | 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);
}

Expand Down

0 comments on commit e5bb878

Please sign in to comment.