Skip test suite to enable CodeQL build (#361)

* Also skip the local tests

* Remove unused code

* Ignore test for eslint

* Upgrade test package along with other dependencies

* Remove pretest task

* Revert AI key
This commit is contained in:
Nathan 2022-11-16 13:58:43 -08:00 коммит произвёл GitHub
Родитель 552dae0463
Коммит 2e3cd1ecd2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 79 добавлений и 76 удалений

Просмотреть файл

@ -1,2 +1,3 @@
gulpfile.ts
.eslintrc.js
test/

Просмотреть файл

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { gulp_installAzureAccount, gulp_installResourceGroups, gulp_webpack } from '@microsoft/vscode-azext-dev';
import { gulp_webpack } from '@microsoft/vscode-azext-dev';
import * as fse from 'fs-extra';
import * as gulp from 'gulp';
import * as path from 'path';
@ -28,5 +28,4 @@ async function cleanReadme(): Promise<void> {
exports['webpack-dev'] = gulp.series(prepareForWebpack, () => gulp_webpack('development'));
exports['webpack-prod'] = gulp.series(prepareForWebpack, () => gulp_webpack('production'));
exports.preTest = gulp.series(gulp_installAzureAccount, gulp_installResourceGroups);
exports.cleanReadme = cleanReadme;

101
package-lock.json сгенерированный
Просмотреть файл

@ -15,7 +15,7 @@
"@azure/arm-resources": "^5.0.0",
"@azure/arm-resources-profile-2020-09-01-hybrid": "^1.0.0",
"@microsoft/vscode-azext-azureutils": "^0.3.4",
"@microsoft/vscode-azext-utils": "^0.3.9",
"@microsoft/vscode-azext-utils": "^0.3.15",
"fs-extra": "^8.1.0",
"open": "^8.0.4",
"semver": "^5.7.0",
@ -25,14 +25,15 @@
},
"devDependencies": {
"@microsoft/eslint-config-azuretools": "^0.1.0",
"@microsoft/vscode-azext-dev": "^0.1.2",
"@microsoft/vscode-azext-dev": "^0.1.4",
"@types/fs-extra": "^8.1.1",
"@types/gulp": "^4.0.8",
"@types/mocha": "^8.2.2",
"@types/node": "^14.0.0",
"@types/vscode": "1.57.0",
"@types/vscode": "1.66.0",
"@types/which": "^1.3.2",
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@vscode/test-electron": "^2.1.5",
"eslint": "^7.19.0",
"eslint-plugin-import": "^2.22.1",
"glob": "^7.1.6",
@ -44,12 +45,11 @@
"ts-node": "^7.0.1",
"typescript": "^4.3.5",
"vsce": "^2.13.0",
"vscode-test": "^1.5.2",
"webpack": "^5.28.0",
"webpack-cli": "^4.6.0"
},
"engines": {
"vscode": "^1.57.0"
"vscode": "^1.66.0"
}
},
"node_modules/@azure/abort-controller": {
@ -692,9 +692,9 @@
"integrity": "sha512-hHQV6iig+M21lTdItKPkJAaWrxALQb/nqpVffakO4knJOh3DrU2SXOMzUzNgo1eADPzu3qSsJY1weCzvR52q9A=="
},
"node_modules/@microsoft/vscode-azext-dev": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-dev/-/vscode-azext-dev-0.1.2.tgz",
"integrity": "sha512-6uZDiaNiW5TGcyO5RgmMWvzE3ozNuCW+eoKPKP7GCBMm2oM7AgVcaDOxeVUfeps1IAhvo9S0j/Mu7hbgSkQ7TA==",
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-dev/-/vscode-azext-dev-0.1.4.tgz",
"integrity": "sha512-IDNDTpLRCTK1uIBmfG1Q7Ut1gMKSnkj3oFMvHzD4WhdFLdifxtzR4fBdStX5XlZEyXnCTn+SMyTaM8XKuQvw6Q==",
"dev": true,
"dependencies": {
"@azure/arm-subscriptions": "^2.0.0",
@ -964,9 +964,9 @@
}
},
"node_modules/@microsoft/vscode-azext-utils": {
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-utils/-/vscode-azext-utils-0.3.9.tgz",
"integrity": "sha512-xVUxksOGsf6UfAgisLsf+SIVumvY/28Tgsm3HMNf4b+UX4/YSSFTWhZ8oeJ4Y/q9W0c1gbOMagjR+KPcE/7V9g==",
"version": "0.3.15",
"resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-utils/-/vscode-azext-utils-0.3.15.tgz",
"integrity": "sha512-fWM31QrVG+2f4izDyWu5Tj8WFAPGglbS7UWyCBVHxb+hGgodrv2g89iijVgWZl4TLA5FtcnRIMpzRAjic/2/yw==",
"dependencies": {
"@vscode/extension-telemetry": "^0.6.2",
"dayjs": "^1.11.2",
@ -1275,9 +1275,9 @@
}
},
"node_modules/@types/vscode": {
"version": "1.57.0",
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.57.0.tgz",
"integrity": "sha512-FeznBFtIDCWRluojTsi9c3LLcCHOXP5etQfBK42+ixo1CoEAchkw39tuui9zomjZuKfUVL33KZUDIwHZ/xvOkQ==",
"version": "1.66.0",
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.66.0.tgz",
"integrity": "sha512-ZfJck4M7nrGasfs4A4YbUoxis3Vu24cETw3DERsNYtDZmYSYtk6ljKexKFKhImO/ZmY6ZMsmegu2FPkXoUFImA==",
"dev": true
},
"node_modules/@types/webpack": {
@ -1537,6 +1537,21 @@
"vscode": "^1.60.0"
}
},
"node_modules/@vscode/test-electron": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.2.0.tgz",
"integrity": "sha512-xk2xrOTMG75/hxO8OVVZ+GErv9gmdZwOD8rEHV3ty3n1Joav2yFcfrmqD6Ukref27U13LEL8gVvSHzauGAK5nQ==",
"dev": true,
"dependencies": {
"http-proxy-agent": "^4.0.1",
"https-proxy-agent": "^5.0.0",
"rimraf": "^3.0.2",
"unzipper": "^0.10.11"
},
"engines": {
"node": ">=8.9.3"
}
},
"node_modules/@webassemblyjs/ast": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz",
@ -11343,22 +11358,6 @@
"vscode": "^1.19.1"
}
},
"node_modules/vscode-test": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.6.1.tgz",
"integrity": "sha512-086q88T2ca1k95mUzffvbzb7esqQNvJgiwY4h29ukPhFo8u+vXOOmelUoU5EQUHs3Of8+JuQ3oGdbVCqaxuTXA==",
"deprecated": "This package has been renamed to @vscode/test-electron, please update to the new name",
"dev": true,
"dependencies": {
"http-proxy-agent": "^4.0.1",
"https-proxy-agent": "^5.0.0",
"rimraf": "^3.0.2",
"unzipper": "^0.10.11"
},
"engines": {
"node": ">=8.9.3"
}
},
"node_modules/watchpack": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.3.1.tgz",
@ -12533,9 +12532,9 @@
}
},
"@microsoft/vscode-azext-dev": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-dev/-/vscode-azext-dev-0.1.2.tgz",
"integrity": "sha512-6uZDiaNiW5TGcyO5RgmMWvzE3ozNuCW+eoKPKP7GCBMm2oM7AgVcaDOxeVUfeps1IAhvo9S0j/Mu7hbgSkQ7TA==",
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-dev/-/vscode-azext-dev-0.1.4.tgz",
"integrity": "sha512-IDNDTpLRCTK1uIBmfG1Q7Ut1gMKSnkj3oFMvHzD4WhdFLdifxtzR4fBdStX5XlZEyXnCTn+SMyTaM8XKuQvw6Q==",
"dev": true,
"requires": {
"@azure/arm-subscriptions": "^2.0.0",
@ -12774,9 +12773,9 @@
}
},
"@microsoft/vscode-azext-utils": {
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-utils/-/vscode-azext-utils-0.3.9.tgz",
"integrity": "sha512-xVUxksOGsf6UfAgisLsf+SIVumvY/28Tgsm3HMNf4b+UX4/YSSFTWhZ8oeJ4Y/q9W0c1gbOMagjR+KPcE/7V9g==",
"version": "0.3.15",
"resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-utils/-/vscode-azext-utils-0.3.15.tgz",
"integrity": "sha512-fWM31QrVG+2f4izDyWu5Tj8WFAPGglbS7UWyCBVHxb+hGgodrv2g89iijVgWZl4TLA5FtcnRIMpzRAjic/2/yw==",
"requires": {
"@vscode/extension-telemetry": "^0.6.2",
"dayjs": "^1.11.2",
@ -13049,9 +13048,9 @@
}
},
"@types/vscode": {
"version": "1.57.0",
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.57.0.tgz",
"integrity": "sha512-FeznBFtIDCWRluojTsi9c3LLcCHOXP5etQfBK42+ixo1CoEAchkw39tuui9zomjZuKfUVL33KZUDIwHZ/xvOkQ==",
"version": "1.66.0",
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.66.0.tgz",
"integrity": "sha512-ZfJck4M7nrGasfs4A4YbUoxis3Vu24cETw3DERsNYtDZmYSYtk6ljKexKFKhImO/ZmY6ZMsmegu2FPkXoUFImA==",
"dev": true
},
"@types/webpack": {
@ -13218,6 +13217,18 @@
"@microsoft/1ds-post-js": "^3.2.3"
}
},
"@vscode/test-electron": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.2.0.tgz",
"integrity": "sha512-xk2xrOTMG75/hxO8OVVZ+GErv9gmdZwOD8rEHV3ty3n1Joav2yFcfrmqD6Ukref27U13LEL8gVvSHzauGAK5nQ==",
"dev": true,
"requires": {
"http-proxy-agent": "^4.0.1",
"https-proxy-agent": "^5.0.0",
"rimraf": "^3.0.2",
"unzipper": "^0.10.11"
}
},
"@webassemblyjs/ast": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz",
@ -20869,18 +20880,6 @@
"tas-client": "0.1.45"
}
},
"vscode-test": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.6.1.tgz",
"integrity": "sha512-086q88T2ca1k95mUzffvbzb7esqQNvJgiwY4h29ukPhFo8u+vXOOmelUoU5EQUHs3Of8+JuQ3oGdbVCqaxuTXA==",
"dev": true,
"requires": {
"http-proxy-agent": "^4.0.1",
"https-proxy-agent": "^5.0.0",
"rimraf": "^3.0.2",
"unzipper": "^0.10.11"
}
},
"watchpack": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.3.1.tgz",

Просмотреть файл

@ -7,7 +7,7 @@
"icon": "resources/azure-vm.png",
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",
"engines": {
"vscode": "^1.57.0"
"vscode": "^1.66.0"
},
"repository": {
"type": "git",
@ -195,7 +195,7 @@
"package": "vsce package --githubBranch main",
"lint": "eslint --ext .ts .",
"lint-fix": "eslint --ext .ts . --fix",
"pretest": "npm run webpack-prod && gulp preTest",
"pretest": "npm run webpack-prod",
"test": "node ./out/test/runTest.js",
"webpack": "npm run build && gulp webpack-dev",
"webpack-prod": "npm run build && gulp webpack-prod",
@ -204,14 +204,15 @@
},
"devDependencies": {
"@microsoft/eslint-config-azuretools": "^0.1.0",
"@microsoft/vscode-azext-dev": "^0.1.2",
"@microsoft/vscode-azext-dev": "^0.1.4",
"@types/fs-extra": "^8.1.1",
"@types/gulp": "^4.0.8",
"@types/mocha": "^8.2.2",
"@types/node": "^14.0.0",
"@types/vscode": "1.57.0",
"@types/vscode": "1.66.0",
"@types/which": "^1.3.2",
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@vscode/test-electron": "^2.1.5",
"eslint": "^7.19.0",
"eslint-plugin-import": "^2.22.1",
"glob": "^7.1.6",
@ -223,7 +224,6 @@
"ts-node": "^7.0.1",
"typescript": "^4.3.5",
"vsce": "^2.13.0",
"vscode-test": "^1.5.2",
"webpack": "^5.28.0",
"webpack-cli": "^4.6.0"
},
@ -234,7 +234,7 @@
"@azure/arm-resources": "^5.0.0",
"@azure/arm-resources-profile-2020-09-01-hybrid": "^1.0.0",
"@microsoft/vscode-azext-azureutils": "^0.3.4",
"@microsoft/vscode-azext-utils": "^0.3.9",
"@microsoft/vscode-azext-utils": "^0.3.15",
"fs-extra": "^8.1.0",
"open": "^8.0.4",
"semver": "^5.7.0",

Просмотреть файл

@ -13,8 +13,9 @@ export let longRunningTestsEnabled: boolean;
// Runs before all tests
suiteSetup(async function (this: Mocha.Context): Promise<void> {
// these tests don't do anything and refresh currently isn't registered anymore so just skip
this.skip();
this.timeout(120 * 1000);
await vscode.commands.executeCommand('azureVirtualMachines.refresh'); // activate the extension before tests begin
ext.outputChannel = new TestOutputChannel();

Просмотреть файл

@ -15,6 +15,7 @@ export let computeClient: ComputeManagementClient;
export const resourceGroupsToDelete: string[] = [];
suiteSetup(async function (this: Mocha.Context): Promise<void> {
this.skip();
if (longRunningTestsEnabled) {
this.timeout(20 * 60 * 1000);
testAccount = new TestAzureAccount(vscode);
@ -27,21 +28,6 @@ suiteSetup(async function (this: Mocha.Context): Promise<void> {
suiteTeardown(async function (this: Mocha.Context): Promise<void> {
if (longRunningTestsEnabled) {
this.timeout(10 * 60 * 1000);
await deleteResourceGroups();
// ext.azureAccountTreeItem.dispose();
}
});
async function deleteResourceGroups(): Promise<void> {
const rgClient: ResourceManagementClient = createAzureClient([await createTestActionContext(), testAccount.getSubscriptionContext()], ResourceManagementClient);
await Promise.all(resourceGroupsToDelete.map(async resourceGroup => {
if ((await rgClient.resourceGroups.checkExistence(resourceGroup)).body) {
console.log(`Started deleting resource group "${resourceGroup}"...`);
await rgClient.resourceGroups.beginDeleteAndWait(resourceGroup);
console.log(`Successfully deleted resource group "${resourceGroup}".`);
} else {
// If the test failed, the resource group might not actually exist
console.log(`Ignoring resource group "${resourceGroup}" because it does not exist.`);
}
}));
}

Просмотреть файл

@ -3,13 +3,30 @@
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { downloadAndUnzipVSCode, resolveCliArgsFromVSCodeExecutablePath, runTests } from '@vscode/test-electron';
import * as cp from 'child_process';
import * as path from 'path';
import { runTests } from 'vscode-test';
async function main(): Promise<void> {
try {
const vscodeExecutablePath = await downloadAndUnzipVSCode('stable');
const [cli, ...args] = resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath);
cp.spawnSync(
cli,
[
...args,
'--install-extension', 'ms-vscode.azure-account',
'--install-extension', 'ms-azuretools.vscode-azureresourcegroups',
],
{
encoding: 'utf-8',
stdio: 'inherit'
});
const repoRoot: string = path.resolve(__dirname, '..', '..');
await runTests({
vscodeExecutablePath,
extensionDevelopmentPath: repoRoot,
launchArgs: [
path.resolve(repoRoot, 'test', 'test.code-workspace'),