Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

export { azExtTestConfig as default } from '@microsoft/vscode-azext-eng/vscode-test'; // Other configurations exist
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@
"build:webview": "node esbuild.views.mjs",
"package": "vsce package --githubBranch main --no-dependencies",
"lint": "eslint --max-warnings 0",
"test": "node ./out/test/runTest.js"
"test": "vscode-test"
},
"devDependencies": {
"@azure/ms-rest-azure-env": "^2.0.0",
Expand Down
4 changes: 2 additions & 2 deletions test/global.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
*--------------------------------------------------------------------------------------------*/

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

export const longRunningLocalTestsEnabled: boolean = !/^(false|0)?$/i.test(process.env.AzCode_EnableLongRunningTestsLocal || '');
export const longRunningRemoteTestsEnabled: boolean = !/^(false|0)?$/i.test(process.env.AzCode_UseAzureFederatedCredentials || '');
Expand Down
2 changes: 1 addition & 1 deletion test/imageNameUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import * as assert from "assert";
import { getImageNameWithoutTag } from "../extension.bundle";
import { getImageNameWithoutTag } from "src/utils/imageNameUtils";

suite('imageNameUtils', () => {
test('getImageNameWithoutTag', () => {
Expand Down
55 changes: 0 additions & 55 deletions test/index.ts

This file was deleted.

3 changes: 2 additions & 1 deletion test/ingress/IngressPromptStep.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

import { AzExtFsExtra } from "@microsoft/vscode-azext-utils";
import * as assert from "assert";
import { IngressContext } from "src/commands/ingress/IngressContext";
import { tryConfigureIngressUsingDockerfile } from "src/commands/ingress/IngressPromptStep";
import { type Uri } from "vscode";
import { tryConfigureIngressUsingDockerfile, type IngressContext } from "../../extension.bundle";
import { getWorkspaceFolderUri } from "../testUtils";
import { wrapWithMockTelemetry } from "../wrapWithMockTelemetry";
import { type MockIngressContext } from "./MockIngressContext";
Expand Down
2 changes: 1 addition & 1 deletion test/ingress/MockIngressContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { type PortRange } from "../../extension.bundle";
import { PortRange } from "src/commands/ingress/tryGetDockerfileExposePorts";

export interface MockIngressContext {
containerApp?: { configuration: { ingress: { targetPort: number } } };
Expand Down
4 changes: 3 additions & 1 deletion test/ingress/getDefaultPort.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
*--------------------------------------------------------------------------------------------*/

import * as assert from "assert";
import { PortRange, getDefaultPort, type IngressContext } from "../../extension.bundle";
import { getDefaultPort } from "src/commands/ingress/editTargetPort/getDefaultPort";
import { IngressContext } from "src/commands/ingress/IngressContext";
import { PortRange } from "src/commands/ingress/tryGetDockerfileExposePorts";
import { wrapWithMockTelemetry } from "../wrapWithMockTelemetry";
import { type MockIngressContext } from "./MockIngressContext";

Expand Down
3 changes: 2 additions & 1 deletion test/ingress/tryGetDockerfileExposePorts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
*--------------------------------------------------------------------------------------------*/

import * as assert from "assert";
import { AzExtFsExtra } from "node_modules/@microsoft/vscode-azext-utils";
import { PortRange, tryGetDockerfileExposePorts } from "src/commands/ingress/tryGetDockerfileExposePorts";
import { type Uri } from "vscode";
import { AzExtFsExtra, PortRange, tryGetDockerfileExposePorts } from "../../extension.bundle";
import { getWorkspaceFolderUri } from "../testUtils";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@

import { type ManagedEnvironment } from '@azure/arm-appcontainers';
import { parseAzureResourceId } from '@microsoft/vscode-azext-azureutils';
import { runWithTestActionContext } from '@microsoft/vscode-azext-dev';
import { IParsedError, parseError, randomUtils, runWithTestActionContext } from '@microsoft/vscode-azext-utils';
import * as assert from 'assert';
import * as path from 'path';
import { createContainerApp } from 'src/commands/createContainerApp/createContainerApp';
import { createManagedEnvironment } from 'src/commands/createManagedEnvironment/createManagedEnvironment';
import { deployContainerApp } from 'src/commands/deployContainerApp/deployContainerApp';
import { DeployWorkspaceProjectResults } from 'src/commands/deployWorkspaceProject/getDeployWorkspaceProjectResults';
import { ContainerAppItem } from 'src/tree/ContainerAppItem';
import { settingUtils } from 'src/utils/settingUtils';
import { workspace, type Uri, type WorkspaceFolder } from 'vscode';
import { createContainerApp, createManagedEnvironment, deployContainerApp, parseError, randomUtils, settingUtils, type ContainerAppItem, type DeployWorkspaceProjectResults, type IParsedError } from '../../../extension.bundle';
import { longRunningTestsEnabled } from '../../global.test';
import { assertStringPropsMatch, getWorkspaceFolderUri } from '../../testUtils';
import { resourceGroupsToDelete } from '../global.nightly.test';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import { nonNullProp } from "@microsoft/vscode-azext-utils";
import { settingUtils } from "../../../extension.bundle";
import { settingUtils } from "src/utils/settingUtils";
import { longRunningTestsEnabled } from '../../global.test';
import { generateParallelTests, type DwpParallelTestScenario } from "./parallelTests";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
*--------------------------------------------------------------------------------------------*/

import { LocationListStep, parseAzureResourceGroupId, ResourceGroupCreateStep, type IResourceGroupWizardContext } from '@microsoft/vscode-azext-azureutils';
import { runWithTestActionContext } from '@microsoft/vscode-azext-dev';
import { AzureWizard, randomUtils, runWithTestActionContext } from '@microsoft/vscode-azext-utils';
import * as assert from 'assert';
import * as path from 'path';
import { deployWorkspaceProjectApi } from 'src/commands/api/deployWorkspaceProjectApi';
import { DeployWorkspaceProjectResults } from 'src/commands/deployWorkspaceProject/getDeployWorkspaceProjectResults';
import { settingUtils } from 'src/utils/settingUtils';
import { workspace, type Uri, type WorkspaceFolder } from 'vscode';
import { AzureWizard, deployWorkspaceProjectApi, randomUtils, settingUtils, type DeployWorkspaceProjectResults } from '../../../extension.bundle';
import { longRunningTestsEnabled } from '../../global.test';
import { assertStringPropsMatch, getWorkspaceFolderUri } from '../../testUtils';
import { resourceGroupsToDelete, subscriptionContext } from '../global.nightly.test';
Expand Down Expand Up @@ -67,10 +69,10 @@ async function createResourceGroup(): Promise<ResourceGroupId> {
...context,
...subscriptionContext,
newResourceGroupName,
}
};
await LocationListStep.setLocation(wizardContext, 'eastus');

const wizard: AzureWizard<IResourceGroupWizardContext> = new AzureWizard(wizardContext, {
const wizard = new AzureWizard<IResourceGroupWizardContext>(wizardContext, {
executeSteps: [new ResourceGroupCreateStep()],
});
await wizard.execute();
Expand Down
5 changes: 3 additions & 2 deletions test/nightly/deployWorkspaceProject/dwpTestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { type ContainerApp, type EnvironmentVar } from "@azure/arm-appcontainers
import { parseAzureResourceId } from "@microsoft/vscode-azext-azureutils";
import { nonNullProp, type IActionContext } from "@microsoft/vscode-azext-utils";
import * as assert from "assert";
import { createContainerAppsAPIClient, type DeployWorkspaceProjectResults } from "../../../extension.bundle";
import { DeployWorkspaceProjectResults } from "src/commands/deployWorkspaceProject/getDeployWorkspaceProjectResults";
import { createContainerAppsAPIClient } from "src/utils/azureClients";
import { type StringOrRegExpProps } from "../../typeUtils";
import { subscriptionContext } from "../global.nightly.test";
import { type PostTestAssertion } from "./scenarios/DeployWorkspaceProjectTestScenario";
Expand Down Expand Up @@ -50,6 +51,6 @@ export namespace dwpTestUtils {
assert.strictEqual(containerApp.configuration?.ingress?.targetPort, expectedContainerAppSettings.targetPort, errMsg ? errMsg + ' (container app target port)' : undefined);
assert.strictEqual(containerApp.template?.containers?.[0].image, `${resources.registryLoginServer}/${resources.imageName}`, errMsg ? errMsg + ' (container image name)' : undefined);
assert.deepStrictEqual(containerApp.template?.containers?.[0].env, expectedContainerAppSettings.env, errMsg ? errMsg + ' (container environment variables)' : undefined);
}
};
}
}
11 changes: 8 additions & 3 deletions test/nightly/deployWorkspaceProject/parallelTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { runWithTestActionContext } from "@microsoft/vscode-azext-dev";
import { AzExtFsExtra, IParsedError, parseError, runWithTestActionContext } from "@microsoft/vscode-azext-utils";
import * as assert from "assert";
import * as path from "path";
import { deployWorkspaceProject } from "src/commands/deployWorkspaceProject/deployWorkspaceProject";
import { DeployWorkspaceProjectResults } from "src/commands/deployWorkspaceProject/getDeployWorkspaceProjectResults";
import { DeploymentConfigurationSettings } from "src/commands/deployWorkspaceProject/settings/DeployWorkspaceProjectSettingsV2";
import { dwpSettingUtilsV2 } from "src/commands/deployWorkspaceProject/settings/dwpSettingUtilsV2";
import { ext } from "src/extensionVariables";
import { settingUtils } from "src/utils/settingUtils";
import { workspace, type Uri, type WorkspaceFolder } from "vscode";
import { AzExtFsExtra, deployWorkspaceProject, dwpSettingUtilsV2, ext, parseError, settingUtils, type DeploymentConfigurationSettings, type DeployWorkspaceProjectResults, type IParsedError } from "../../../extension.bundle";
import { assertStringPropsMatch, getWorkspaceFolderUri } from "../../testUtils";
import { resourceGroupsToDelete } from "../global.nightly.test";
import { type DeployWorkspaceProjectTestScenario } from "./scenarios/DeployWorkspaceProjectTestScenario";
Expand Down Expand Up @@ -84,7 +89,7 @@ function runTestScenario(scenario: DeployWorkspaceProjectTestScenario): DwpParal
}

await cleanWorkspaceFolderSettings(rootFolder);
}
};
}

async function cleanWorkspaceFolderSettings(rootFolder: WorkspaceFolder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { type DeploymentConfigurationSettings, type DeployWorkspaceProjectResults, type IActionContext } from "../../../../extension.bundle";
import { IActionContext } from "node_modules/@microsoft/vscode-azext-utils";
import { DeployWorkspaceProjectResults } from "src/commands/deployWorkspaceProject/getDeployWorkspaceProjectResults";
import { DeploymentConfigurationSettings } from "src/commands/deployWorkspaceProject/settings/DeployWorkspaceProjectSettingsV2";
import { type StringOrRegExpProps } from "../../../typeUtils";

export interface DeployWorkspaceProjectTestScenario {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { randomUtils } from "@microsoft/vscode-azext-utils";
import * as path from "path";
import { type DeploymentConfigurationSettings } from "../../../../../extension.bundle";
import { DeploymentConfigurationSettings } from "src/commands/deployWorkspaceProject/settings/DeployWorkspaceProjectSettingsV2";
import { type StringOrRegExpProps } from "../../../../typeUtils";
import { dwpTestUtils } from "../../dwpTestUtils";
import { type DeployWorkspaceProjectTestCase } from "../DeployWorkspaceProjectTestScenario";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { randomUtils } from "@microsoft/vscode-azext-utils";
import * as path from "path";
import { type DeploymentConfigurationSettings } from "../../../../../extension.bundle";
import { DeploymentConfigurationSettings } from "src/commands/deployWorkspaceProject/settings/DeployWorkspaceProjectSettingsV2";
import { type StringOrRegExpProps } from "../../../../typeUtils";
import { dwpTestUtils } from "../../dwpTestUtils";
import { type DeployWorkspaceProjectTestCase } from "../DeployWorkspaceProjectTestScenario";
Expand Down
5 changes: 2 additions & 3 deletions test/nightly/global.nightly.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@

import { ResourceManagementClient } from '@azure/arm-resources';
import { createAzureClient } from '@microsoft/vscode-azext-azureutils';
import { createTestActionContext, type TestActionContext } from '@microsoft/vscode-azext-dev';
import { createSubscriptionContext, subscriptionExperience, type ISubscriptionContext } from '@microsoft/vscode-azext-utils';
import { createSubscriptionContext, createTestActionContext, subscriptionExperience, type ISubscriptionContext, type TestActionContext } from '@microsoft/vscode-azext-utils';
import { type AzureSubscription } from '@microsoft/vscode-azureresources-api';
import { ext } from 'src/extensionVariables';
import * as vscode from 'vscode';
import { ext } from '../../extension.bundle';
import { longRunningTestsEnabled } from '../global.test';

export let subscriptionContext: ISubscriptionContext;
Expand Down
45 changes: 0 additions & 45 deletions test/runTest.ts

This file was deleted.

2 changes: 1 addition & 1 deletion test/validateUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import * as assert from 'assert';
import { validateUtils } from '../extension.bundle';
import { validateUtils } from 'src/utils/validateUtils';

type LowerCaseAlphanumericWithSymbolsParams = {
value: string;
Expand Down