Skip to content

Commit

Permalink
Replace register with an extension activate
Browse files Browse the repository at this point in the history
  • Loading branch information
MicroFish91 committed Jul 29, 2024
1 parent 16e41a1 commit a76e26b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/global.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { registerAzureUtilsExtensionVariables } from '@microsoft/vscode-azext-azureutils';
import { TestOutputChannel, TestUserInput } from '@microsoft/vscode-azext-dev';
import * as vscode from 'vscode';
import { ext, registerOnActionStartHandler, registerUIExtensionVariables } from '../extension.bundle';
import { ext, registerOnActionStartHandler } from '../extension.bundle';

const longRunningLocalTestsEnabled: boolean = !/^(false|0)?$/i.test(process.env.AzCode_EnableLongRunningTestsLocal || '');
const longRunningRemoteTestsEnabled: boolean = !/^(false|0)?$/i.test(process.env.AzCode_UseAzureFederatedCredentials || '');
Expand All @@ -16,12 +15,14 @@ export const longRunningTestsEnabled: boolean = longRunningLocalTestsEnabled ||
// Runs before all tests
suiteSetup(async function (this: Mocha.Context): Promise<void> {
this.timeout(120 * 1000);
await vscode.commands.executeCommand('appService.Refresh'); // activate the extension before tests begin

ext.outputChannel = new TestOutputChannel();
registerUIExtensionVariables(ext);
registerAzureUtilsExtensionVariables(ext);
const appServiceExtension = vscode.extensions.getExtension('ms-azuretools.vscode-azureappservice');
if (!appServiceExtension) {
throw new Error('Could not find the Azure App Service extension.');
}
await appServiceExtension.activate();

ext.outputChannel = new TestOutputChannel();
registerOnActionStartHandler(context => {
// Use `TestUserInput` by default so we get an error if an unexpected call to `context.ui` occurs, rather than timing out
context.ui = new TestUserInput(vscode);
Expand Down

0 comments on commit a76e26b

Please sign in to comment.