Switch to Webpack Watch flavor of extension and relocate test code (#3078)
* Switch to Webpack Watch flavor of extension and relocate test code * Use newer @types/node package
This commit is contained in:
Родитель
ffd43e44e6
Коммит
2ee326e65f
|
@ -1 +0,0 @@
|
|||
test/
|
|
@ -1,3 +1,6 @@
|
|||
{
|
||||
"recommendations": ["dbaeumer.vscode-eslint"]
|
||||
"recommendations": [
|
||||
"dbaeumer.vscode-eslint",
|
||||
"eamodio.tsl-problem-matcher"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,86 +1,41 @@
|
|||
// A launch configuration that compiles the extension and then opens it inside a new window
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Extension",
|
||||
"name": "Run Extension",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}"
|
||||
],
|
||||
"env": {
|
||||
"AZCODE_DOCKER_IGNORE_BUNDLE": "1",
|
||||
"DEBUGTELEMETRY": "1"
|
||||
},
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/out/**/*.js"
|
||||
"${workspaceFolder}/dist/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "${defaultBuildTask}"
|
||||
},
|
||||
{
|
||||
"name": "Launch Extension (webpack)",
|
||||
// TODO: Running this requires running the webpack build manually first (background tasks can't be used as dependsOn at this time, https://github.com/microsoft/vscode/issues/70283)
|
||||
"name": "Extension Tests",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}"
|
||||
],
|
||||
"env": {
|
||||
"AZCODE_DOCKER_IGNORE_BUNDLE": "",
|
||||
"DEBUGTELEMETRY": "1"
|
||||
},
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/out/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "npm: webpack-prod"
|
||||
},
|
||||
{
|
||||
"name": "Launch Tests",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"${workspaceFolder}/test/test.code-workspace",
|
||||
"--extensionDevelopmentPath=${workspaceFolder}",
|
||||
"--extensionTestsPath=${workspaceFolder}/out/test/index"
|
||||
],
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/out/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "${defaultBuildTask}",
|
||||
"env": {
|
||||
"AZCODE_DOCKER_IGNORE_BUNDLE": "1",
|
||||
"MOCHA_grep": "", // RegExp of tests to run (empty means all)
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Launch Tests (webpack)",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"${workspaceFolder}/test/test.code-workspace",
|
||||
"--extensionDevelopmentPath=${workspaceFolder}",
|
||||
"--extensionTestsPath=${workspaceFolder}/dist/test/index"
|
||||
],
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"DEBUGTELEMETRY": "1"
|
||||
},
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/dist/**/*.js"
|
||||
"${workspaceFolder}/out/test/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "npm: webpack-prod",
|
||||
"env": {
|
||||
"AZCODE_DOCKER_IGNORE_BUNDLE": "",
|
||||
"MOCHA_grep": "", // RegExp of tests to run (empty means all)
|
||||
}
|
||||
"preLaunchTask": "npm: test-watch"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,29 +1,17 @@
|
|||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"files.exclude": {
|
||||
"out": false // set this to true to hide the "out" folder with the compiled JS files
|
||||
},
|
||||
"search.exclude": {
|
||||
"out": true,
|
||||
".git/**": true,
|
||||
"dist/**": true
|
||||
},
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"files.insertFinalNewline": true,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll": true
|
||||
},
|
||||
"eslint.validate": [
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"typescript"
|
||||
],
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"typescript.preferences.importModuleSpecifier": "relative",
|
||||
"files.associations": {
|
||||
"*.template": "plaintext",
|
||||
"*.html.template": "html"
|
||||
},
|
||||
"html.format.wrapLineLength": 0
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"files.insertFinalNewline": true,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll": true
|
||||
},
|
||||
"typescript.preferences.importModuleSpecifier": "relative",
|
||||
"files.associations": {
|
||||
"*.template": "plaintext",
|
||||
"*.html.template": "html"
|
||||
},
|
||||
"html.format.wrapLineLength": 0,
|
||||
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
|
||||
"typescript.tsc.autoDetect": "off"
|
||||
}
|
||||
|
|
|
@ -1,26 +1,33 @@
|
|||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "watch",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"reveal": "never"
|
||||
},
|
||||
"problemMatcher": "$tsc-watch"
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "webpack-prod",
|
||||
"presentation": {
|
||||
"reveal": "never"
|
||||
},
|
||||
"problemMatcher": "$tsc-watch"
|
||||
}
|
||||
]
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "watch",
|
||||
"problemMatcher": [
|
||||
"$ts-webpack-watch",
|
||||
"$tslint-webpack-watch"
|
||||
],
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"reveal": "never"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "test-watch",
|
||||
"problemMatcher": "$tsc-watch",
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"reveal": "never"
|
||||
},
|
||||
"group": "build"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* This is the external face of extension.bundle.js, the main webpack bundle for the extension.
|
||||
* Anything needing to be exposed outside of the extension sources must be exported from here, because
|
||||
* everything else will be in private modules in extension.bundle.js.
|
||||
*/
|
||||
|
||||
// Export activate and deactivate for main.js
|
||||
export { activateInternal } from './src/extension';
|
||||
export { deactivateInternal } from './src/extension';
|
||||
|
||||
// Exports for tests
|
||||
// The tests are not packaged with the webpack bundle and therefore only have access to code exported from this file.
|
||||
//
|
||||
// The tests should import '../extension.bundle.ts'. At design-time they live in tests/ and so will pick up this file (extension.bundle.ts).
|
||||
// At runtime the tests live in dist/tests and will therefore pick up the main webpack bundle at dist/extension.bundle.js.
|
||||
export { configPrefix } from './src/constants';
|
||||
export { CommandLineBuilder } from './src/utils/commandLineBuilder';
|
||||
export { delay } from './src/utils/promiseUtils';
|
||||
export { Lazy, AsyncLazy } from './src/utils/lazy';
|
||||
export { bufferToString } from './src/utils/spawnAsync';
|
||||
export { ext } from './src/extensionVariables';
|
||||
export { inferCommand, inferPackageName, InspectMode, NodePackage } from './src/utils/nodeUtils';
|
||||
export { nonNullProp } from './src/utils/nonNull';
|
||||
export { getDockerOSType } from "./src/utils/osUtils";
|
||||
export { Platform, PlatformOS } from './src/utils/platform';
|
||||
export { trimWithElipsis } from './src/utils/trimWithElipsis';
|
||||
export { recursiveFindTaskByType } from './src/tasks/TaskHelper';
|
||||
export { TaskDefinitionBase } from './src/tasks/TaskDefinitionBase';
|
||||
export { DebugConfigurationBase } from './src/debugging/DockerDebugConfigurationBase';
|
||||
export { ActivityMeasurementService } from './src/telemetry/ActivityMeasurementService';
|
||||
export { DockerApiClient } from './src/docker/DockerApiClient';
|
||||
export { DockerContext, isNewContextType } from './src/docker/Contexts';
|
||||
export { DockerContainer } from './src/docker/Containers';
|
||||
export { DockerImage } from './src/docker/Images';
|
||||
export { DockerNetwork } from './src/docker/Networks';
|
||||
export { DockerVolume } from './src/docker/Volumes';
|
||||
export { CommandTemplate, selectCommandTemplate, defaultCommandTemplates, TemplatePicker } from './src/commands/selectCommandTemplate';
|
||||
export { NonComposeGroupName } from './src/tree/containers/ContainersTreeItem';
|
||||
export { isHigherMinorVersion } from './src/commands/startPage/openStartPage';
|
||||
export { DockerContainerInfo } from './src/tree/containers/ContainersTreeItem';
|
||||
|
||||
export * from 'vscode-azureextensionui';
|
16
main.js
16
main.js
|
@ -5,21 +5,21 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
// This is the extension entrypoint, which imports extension.js, the actual extension code.
|
||||
//
|
||||
// This is in a separate file so we can properly measure extension.js load time.
|
||||
/* eslint-disable no-undef */ // Ignore the fact that the engine (which is VSCode) is unknown by the linter
|
||||
|
||||
let perfStats = {
|
||||
// This is the extension entrypoint, which imports extension.bundle.js, the actual extension code.
|
||||
//
|
||||
// This is in a separate file so we can properly measure extension.bundle.js load time.
|
||||
|
||||
const perfStats = {
|
||||
loadStartTime: Date.now(),
|
||||
loadEndTime: undefined
|
||||
};
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
|
||||
const ignoreBundle = !/^(false|0)?$/i.test(process.env.AZCODE_DOCKER_IGNORE_BUNDLE || '');
|
||||
const extensionPath = ignoreBundle ? "./out/src/extension" : "./dist/extension.bundle";
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const extension = require(extensionPath);
|
||||
const extension = require("./dist/extension.bundle");
|
||||
|
||||
async function activate(ctx) {
|
||||
return await extension.activateInternal(ctx, perfStats);
|
||||
|
@ -33,3 +33,5 @@ exports.activate = activate;
|
|||
exports.deactivate = deactivate;
|
||||
|
||||
perfStats.loadEndTime = Date.now();
|
||||
|
||||
/* eslint-enable no-undef */
|
||||
|
|
|
@ -38,15 +38,15 @@
|
|||
"@types/fs-extra": "^9.0.11",
|
||||
"@types/glob": "^7.1.3",
|
||||
"@types/mocha": "^8.2.0",
|
||||
"@types/node": "^12.20.7",
|
||||
"@types/node": "14.x",
|
||||
"@types/node-fetch": "^2.5.10",
|
||||
"@types/semver": "^7.3.4",
|
||||
"@types/tar-stream": "^2.2.0",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"@types/vscode": "1.55.0",
|
||||
"@types/xml2js": "^0.4.8",
|
||||
"@typescript-eslint/eslint-plugin": "^4.21.0",
|
||||
"@typescript-eslint/parser": "^4.21.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.28.4",
|
||||
"@typescript-eslint/parser": "^4.28.4",
|
||||
"@vscode/codicons": "^0.0.20",
|
||||
"@vscode/test-electron": "^1.6.1",
|
||||
"copy-webpack-plugin": "^9.0.1",
|
||||
|
@ -713,9 +713,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "12.20.16",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.16.tgz",
|
||||
"integrity": "sha512-6CLxw83vQf6DKqXxMPwl8qpF8I7THFZuIwLt4TnNsumxkp1VsRZWT8txQxncT/Rl2UojTsFzWgDG4FRMwafrlA=="
|
||||
"version": "14.17.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.5.tgz",
|
||||
"integrity": "sha512-bjqH2cX/O33jXT/UmReo2pM7DIJREPMnarixbQ57DOOzzFaI6D2+IcwaJQaJpv0M1E9TIhPCYVxrkcityLjlqA=="
|
||||
},
|
||||
"node_modules/@types/node-fetch": {
|
||||
"version": "2.5.11",
|
||||
|
@ -784,13 +784,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "4.28.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.28.3.tgz",
|
||||
"integrity": "sha512-jW8sEFu1ZeaV8xzwsfi6Vgtty2jf7/lJmQmDkDruBjYAbx5DA8JtbcMnP0rNPUG+oH5GoQBTSp+9613BzuIpYg==",
|
||||
"version": "4.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.28.4.tgz",
|
||||
"integrity": "sha512-s1oY4RmYDlWMlcV0kKPBaADn46JirZzvvH7c2CtAqxCY96S538JRBAzt83RrfkDheV/+G/vWNK0zek+8TB3Gmw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/experimental-utils": "4.28.3",
|
||||
"@typescript-eslint/scope-manager": "4.28.3",
|
||||
"@typescript-eslint/experimental-utils": "4.28.4",
|
||||
"@typescript-eslint/scope-manager": "4.28.4",
|
||||
"debug": "^4.3.1",
|
||||
"functional-red-black-tree": "^1.0.1",
|
||||
"regexpp": "^3.1.0",
|
||||
|
@ -815,15 +815,15 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/experimental-utils": {
|
||||
"version": "4.28.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.28.3.tgz",
|
||||
"integrity": "sha512-zZYl9TnrxwEPi3FbyeX0ZnE8Hp7j3OCR+ELoUfbwGHGxWnHg9+OqSmkw2MoCVpZksPCZYpQzC559Ee9pJNHTQw==",
|
||||
"version": "4.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.28.4.tgz",
|
||||
"integrity": "sha512-OglKWOQRWTCoqMSy6pm/kpinEIgdcXYceIcH3EKWUl4S8xhFtN34GQRaAvTIZB9DD94rW7d/U7tUg3SYeDFNHA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/json-schema": "^7.0.7",
|
||||
"@typescript-eslint/scope-manager": "4.28.3",
|
||||
"@typescript-eslint/types": "4.28.3",
|
||||
"@typescript-eslint/typescript-estree": "4.28.3",
|
||||
"@typescript-eslint/scope-manager": "4.28.4",
|
||||
"@typescript-eslint/types": "4.28.4",
|
||||
"@typescript-eslint/typescript-estree": "4.28.4",
|
||||
"eslint-scope": "^5.1.1",
|
||||
"eslint-utils": "^3.0.0"
|
||||
},
|
||||
|
@ -839,14 +839,14 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser": {
|
||||
"version": "4.28.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.28.3.tgz",
|
||||
"integrity": "sha512-ZyWEn34bJexn/JNYvLQab0Mo5e+qqQNhknxmc8azgNd4XqspVYR5oHq9O11fLwdZMRcj4by15ghSlIEq+H5ltQ==",
|
||||
"version": "4.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.28.4.tgz",
|
||||
"integrity": "sha512-4i0jq3C6n+og7/uCHiE6q5ssw87zVdpUj1k6VlVYMonE3ILdFApEzTWgppSRG4kVNB/5jxnH+gTeKLMNfUelQA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "4.28.3",
|
||||
"@typescript-eslint/types": "4.28.3",
|
||||
"@typescript-eslint/typescript-estree": "4.28.3",
|
||||
"@typescript-eslint/scope-manager": "4.28.4",
|
||||
"@typescript-eslint/types": "4.28.4",
|
||||
"@typescript-eslint/typescript-estree": "4.28.4",
|
||||
"debug": "^4.3.1"
|
||||
},
|
||||
"engines": {
|
||||
|
@ -866,13 +866,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "4.28.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.28.3.tgz",
|
||||
"integrity": "sha512-/8lMisZ5NGIzGtJB+QizQ5eX4Xd8uxedFfMBXOKuJGP0oaBBVEMbJVddQKDXyyB0bPlmt8i6bHV89KbwOelJiQ==",
|
||||
"version": "4.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.28.4.tgz",
|
||||
"integrity": "sha512-ZJBNs4usViOmlyFMt9X9l+X0WAFcDH7EdSArGqpldXu7aeZxDAuAzHiMAeI+JpSefY2INHrXeqnha39FVqXb8w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "4.28.3",
|
||||
"@typescript-eslint/visitor-keys": "4.28.3"
|
||||
"@typescript-eslint/types": "4.28.4",
|
||||
"@typescript-eslint/visitor-keys": "4.28.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^8.10.0 || ^10.13.0 || >=11.10.1"
|
||||
|
@ -883,9 +883,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/types": {
|
||||
"version": "4.28.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.28.3.tgz",
|
||||
"integrity": "sha512-kQFaEsQBQVtA9VGVyciyTbIg7S3WoKHNuOp/UF5RG40900KtGqfoiETWD/v0lzRXc+euVE9NXmfer9dLkUJrkA==",
|
||||
"version": "4.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.28.4.tgz",
|
||||
"integrity": "sha512-3eap4QWxGqkYuEmVebUGULMskR6Cuoc/Wii0oSOddleP4EGx1tjLnZQ0ZP33YRoMDCs5O3j56RBV4g14T4jvww==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^8.10.0 || ^10.13.0 || >=11.10.1"
|
||||
|
@ -896,13 +896,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "4.28.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.28.3.tgz",
|
||||
"integrity": "sha512-YAb1JED41kJsqCQt1NcnX5ZdTA93vKFCMP4lQYG6CFxd0VzDJcKttRlMrlG+1qiWAw8+zowmHU1H0OzjWJzR2w==",
|
||||
"version": "4.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.28.4.tgz",
|
||||
"integrity": "sha512-z7d8HK8XvCRyN2SNp+OXC2iZaF+O2BTquGhEYLKLx5k6p0r05ureUtgEfo5f6anLkhCxdHtCf6rPM1p4efHYDQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "4.28.3",
|
||||
"@typescript-eslint/visitor-keys": "4.28.3",
|
||||
"@typescript-eslint/types": "4.28.4",
|
||||
"@typescript-eslint/visitor-keys": "4.28.4",
|
||||
"debug": "^4.3.1",
|
||||
"globby": "^11.0.3",
|
||||
"is-glob": "^4.0.1",
|
||||
|
@ -923,12 +923,12 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "4.28.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.28.3.tgz",
|
||||
"integrity": "sha512-ri1OzcLnk1HH4gORmr1dllxDzzrN6goUIz/P4MHFV0YZJDCADPR3RvYNp0PW2SetKTThar6wlbFTL00hV2Q+fg==",
|
||||
"version": "4.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.28.4.tgz",
|
||||
"integrity": "sha512-NIAXAdbz1XdOuzqkJHjNKXKj8QQ4cv5cxR/g0uQhCYf/6//XrmfpaYsM7PnBcNbfvTDLUkqQ5TPNm1sozDdTWg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "4.28.3",
|
||||
"@typescript-eslint/types": "4.28.4",
|
||||
"eslint-visitor-keys": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
|
@ -7754,9 +7754,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "12.20.16",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.16.tgz",
|
||||
"integrity": "sha512-6CLxw83vQf6DKqXxMPwl8qpF8I7THFZuIwLt4TnNsumxkp1VsRZWT8txQxncT/Rl2UojTsFzWgDG4FRMwafrlA=="
|
||||
"version": "14.17.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.5.tgz",
|
||||
"integrity": "sha512-bjqH2cX/O33jXT/UmReo2pM7DIJREPMnarixbQ57DOOzzFaI6D2+IcwaJQaJpv0M1E9TIhPCYVxrkcityLjlqA=="
|
||||
},
|
||||
"@types/node-fetch": {
|
||||
"version": "2.5.11",
|
||||
|
@ -7824,13 +7824,13 @@
|
|||
}
|
||||
},
|
||||
"@typescript-eslint/eslint-plugin": {
|
||||
"version": "4.28.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.28.3.tgz",
|
||||
"integrity": "sha512-jW8sEFu1ZeaV8xzwsfi6Vgtty2jf7/lJmQmDkDruBjYAbx5DA8JtbcMnP0rNPUG+oH5GoQBTSp+9613BzuIpYg==",
|
||||
"version": "4.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.28.4.tgz",
|
||||
"integrity": "sha512-s1oY4RmYDlWMlcV0kKPBaADn46JirZzvvH7c2CtAqxCY96S538JRBAzt83RrfkDheV/+G/vWNK0zek+8TB3Gmw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/experimental-utils": "4.28.3",
|
||||
"@typescript-eslint/scope-manager": "4.28.3",
|
||||
"@typescript-eslint/experimental-utils": "4.28.4",
|
||||
"@typescript-eslint/scope-manager": "4.28.4",
|
||||
"debug": "^4.3.1",
|
||||
"functional-red-black-tree": "^1.0.1",
|
||||
"regexpp": "^3.1.0",
|
||||
|
@ -7839,55 +7839,55 @@
|
|||
}
|
||||
},
|
||||
"@typescript-eslint/experimental-utils": {
|
||||
"version": "4.28.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.28.3.tgz",
|
||||
"integrity": "sha512-zZYl9TnrxwEPi3FbyeX0ZnE8Hp7j3OCR+ELoUfbwGHGxWnHg9+OqSmkw2MoCVpZksPCZYpQzC559Ee9pJNHTQw==",
|
||||
"version": "4.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.28.4.tgz",
|
||||
"integrity": "sha512-OglKWOQRWTCoqMSy6pm/kpinEIgdcXYceIcH3EKWUl4S8xhFtN34GQRaAvTIZB9DD94rW7d/U7tUg3SYeDFNHA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/json-schema": "^7.0.7",
|
||||
"@typescript-eslint/scope-manager": "4.28.3",
|
||||
"@typescript-eslint/types": "4.28.3",
|
||||
"@typescript-eslint/typescript-estree": "4.28.3",
|
||||
"@typescript-eslint/scope-manager": "4.28.4",
|
||||
"@typescript-eslint/types": "4.28.4",
|
||||
"@typescript-eslint/typescript-estree": "4.28.4",
|
||||
"eslint-scope": "^5.1.1",
|
||||
"eslint-utils": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/parser": {
|
||||
"version": "4.28.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.28.3.tgz",
|
||||
"integrity": "sha512-ZyWEn34bJexn/JNYvLQab0Mo5e+qqQNhknxmc8azgNd4XqspVYR5oHq9O11fLwdZMRcj4by15ghSlIEq+H5ltQ==",
|
||||
"version": "4.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.28.4.tgz",
|
||||
"integrity": "sha512-4i0jq3C6n+og7/uCHiE6q5ssw87zVdpUj1k6VlVYMonE3ILdFApEzTWgppSRG4kVNB/5jxnH+gTeKLMNfUelQA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/scope-manager": "4.28.3",
|
||||
"@typescript-eslint/types": "4.28.3",
|
||||
"@typescript-eslint/typescript-estree": "4.28.3",
|
||||
"@typescript-eslint/scope-manager": "4.28.4",
|
||||
"@typescript-eslint/types": "4.28.4",
|
||||
"@typescript-eslint/typescript-estree": "4.28.4",
|
||||
"debug": "^4.3.1"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/scope-manager": {
|
||||
"version": "4.28.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.28.3.tgz",
|
||||
"integrity": "sha512-/8lMisZ5NGIzGtJB+QizQ5eX4Xd8uxedFfMBXOKuJGP0oaBBVEMbJVddQKDXyyB0bPlmt8i6bHV89KbwOelJiQ==",
|
||||
"version": "4.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.28.4.tgz",
|
||||
"integrity": "sha512-ZJBNs4usViOmlyFMt9X9l+X0WAFcDH7EdSArGqpldXu7aeZxDAuAzHiMAeI+JpSefY2INHrXeqnha39FVqXb8w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "4.28.3",
|
||||
"@typescript-eslint/visitor-keys": "4.28.3"
|
||||
"@typescript-eslint/types": "4.28.4",
|
||||
"@typescript-eslint/visitor-keys": "4.28.4"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/types": {
|
||||
"version": "4.28.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.28.3.tgz",
|
||||
"integrity": "sha512-kQFaEsQBQVtA9VGVyciyTbIg7S3WoKHNuOp/UF5RG40900KtGqfoiETWD/v0lzRXc+euVE9NXmfer9dLkUJrkA==",
|
||||
"version": "4.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.28.4.tgz",
|
||||
"integrity": "sha512-3eap4QWxGqkYuEmVebUGULMskR6Cuoc/Wii0oSOddleP4EGx1tjLnZQ0ZP33YRoMDCs5O3j56RBV4g14T4jvww==",
|
||||
"dev": true
|
||||
},
|
||||
"@typescript-eslint/typescript-estree": {
|
||||
"version": "4.28.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.28.3.tgz",
|
||||
"integrity": "sha512-YAb1JED41kJsqCQt1NcnX5ZdTA93vKFCMP4lQYG6CFxd0VzDJcKttRlMrlG+1qiWAw8+zowmHU1H0OzjWJzR2w==",
|
||||
"version": "4.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.28.4.tgz",
|
||||
"integrity": "sha512-z7d8HK8XvCRyN2SNp+OXC2iZaF+O2BTquGhEYLKLx5k6p0r05ureUtgEfo5f6anLkhCxdHtCf6rPM1p4efHYDQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "4.28.3",
|
||||
"@typescript-eslint/visitor-keys": "4.28.3",
|
||||
"@typescript-eslint/types": "4.28.4",
|
||||
"@typescript-eslint/visitor-keys": "4.28.4",
|
||||
"debug": "^4.3.1",
|
||||
"globby": "^11.0.3",
|
||||
"is-glob": "^4.0.1",
|
||||
|
@ -7896,12 +7896,12 @@
|
|||
}
|
||||
},
|
||||
"@typescript-eslint/visitor-keys": {
|
||||
"version": "4.28.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.28.3.tgz",
|
||||
"integrity": "sha512-ri1OzcLnk1HH4gORmr1dllxDzzrN6goUIz/P4MHFV0YZJDCADPR3RvYNp0PW2SetKTThar6wlbFTL00hV2Q+fg==",
|
||||
"version": "4.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.28.4.tgz",
|
||||
"integrity": "sha512-NIAXAdbz1XdOuzqkJHjNKXKj8QQ4cv5cxR/g0uQhCYf/6//XrmfpaYsM7PnBcNbfvTDLUkqQ5TPNm1sozDdTWg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "4.28.3",
|
||||
"@typescript-eslint/types": "4.28.4",
|
||||
"eslint-visitor-keys": "^2.0.0"
|
||||
}
|
||||
},
|
||||
|
|
21
package.json
21
package.json
|
@ -2729,16 +2729,15 @@
|
|||
"virtualWorkspaces": false
|
||||
},
|
||||
"scripts": {
|
||||
"watch": "tsc -watch -p ./",
|
||||
"build": "tsc -p ./",
|
||||
"ci-build": "npm run test",
|
||||
"package": "npm run webpack-prod && vsce package",
|
||||
"ci-package": "npm run test && vsce package",
|
||||
"watch": "webpack --watch",
|
||||
"build": "webpack --mode production --devtool hidden-source-map",
|
||||
"ci-build": "npm test",
|
||||
"package": "npm run build && vsce package",
|
||||
"ci-package": "npm test && vsce package",
|
||||
"lint": "eslint src --ext ts",
|
||||
"test": "node ./out/test/runTest.js",
|
||||
"webpack-dev": "webpack --mode development --devtool hidden-source-map",
|
||||
"webpack-prod": "webpack --mode production --devtool hidden-source-map",
|
||||
"pretest": "npm run build && npm run lint && npm run webpack-prod"
|
||||
"pretest": "tsc -p ./ && npm run lint && npm run build",
|
||||
"test-watch": "tsc -watch -p ./"
|
||||
},
|
||||
"extensionDependencies": [
|
||||
"vscode.docker",
|
||||
|
@ -2749,15 +2748,15 @@
|
|||
"@types/fs-extra": "^9.0.11",
|
||||
"@types/glob": "^7.1.3",
|
||||
"@types/mocha": "^8.2.0",
|
||||
"@types/node": "^12.20.7",
|
||||
"@types/node": "14.x",
|
||||
"@types/node-fetch": "^2.5.10",
|
||||
"@types/semver": "^7.3.4",
|
||||
"@types/tar-stream": "^2.2.0",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"@types/vscode": "1.55.0",
|
||||
"@types/xml2js": "^0.4.8",
|
||||
"@typescript-eslint/eslint-plugin": "^4.21.0",
|
||||
"@typescript-eslint/parser": "^4.21.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.28.4",
|
||||
"@typescript-eslint/parser": "^4.28.4",
|
||||
"@vscode/codicons": "^0.0.20",
|
||||
"@vscode/test-electron": "^1.6.1",
|
||||
"copy-webpack-plugin": "^9.0.1",
|
||||
|
|
|
@ -233,7 +233,7 @@ function activateLanguageClient(ctx: vscode.ExtensionContext): void {
|
|||
context.telemetry.properties.isActivationEvent = 'true';
|
||||
const serverModule = ext.context.asAbsolutePath(
|
||||
path.join(
|
||||
ext.ignoreBundle ? "node_modules" : "dist",
|
||||
"dist",
|
||||
"dockerfile-language-server-nodejs",
|
||||
"lib",
|
||||
"server.js"
|
||||
|
|
|
@ -6,15 +6,13 @@
|
|||
import * as vscode from 'vscode';
|
||||
|
||||
export class TestMemento implements vscode.Memento {
|
||||
private readonly values: { [key: string]: any } = {};
|
||||
private readonly values: { [key: string]: never } = {};
|
||||
|
||||
get<T>(key: string): T;
|
||||
get<T>(key: string, defaultValue: T): T;
|
||||
get(key: any, defaultValue?: any) {
|
||||
get<T>(key: string, defaultValue?: T): T | undefined {
|
||||
return this.values[key] ?? defaultValue;
|
||||
}
|
||||
|
||||
update(key: string, value: any): Thenable<void> {
|
||||
update(key: string, value: never): Thenable<void> {
|
||||
this.values[key] = value;
|
||||
return Promise.resolve();
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { isHigherMinorVersion } from '../../extension.bundle';
|
||||
import { isHigherMinorVersion } from '../../commands/startPage/openStartPage';
|
||||
import assert = require('assert');
|
||||
|
||||
suite("(unit) isHigherMinorVersion", () => {
|
|
@ -4,8 +4,10 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { runWithExtensionSettings } from '../runWithExtensionSettings';
|
||||
import { CommandTemplate, selectCommandTemplate, defaultCommandTemplates, ext, DockerContext, isNewContextType, TemplatePicker } from '../../extension.bundle';
|
||||
import { IActionContext, IAzureQuickPickItem, IAzureUserInput } from 'vscode-azureextensionui';
|
||||
import { CommandTemplate, selectCommandTemplate, defaultCommandTemplates, TemplatePicker } from '../../commands/selectCommandTemplate';
|
||||
import { ContextType, DockerContext, isNewContextType } from '../../docker/Contexts';
|
||||
import { ext } from '../../extensionVariables';
|
||||
import { IActionContext, IAzureQuickPickItem } from 'vscode-azureextensionui';
|
||||
import assert = require('assert');
|
||||
|
||||
const DefaultPickIndex = 0;
|
||||
|
@ -556,7 +558,7 @@ suite("(unit) selectCommandTemplate", () => {
|
|||
assert.equal(result.command, 'test', 'Incorrect command selected');
|
||||
|
||||
// Quick aside: validate that the context manager thinks an unknown context is new
|
||||
assert.equal(isNewContextType('abc' as any), true, 'Incorrect context type identification');
|
||||
assert.equal(isNewContextType('abc' as ContextType), true, 'Incorrect context type identification');
|
||||
assert.equal(result.context.telemetry.properties.isDefaultCommand, 'false', 'Wrong value for isDefaultCommand');
|
||||
assert.equal(result.context.telemetry.properties.isCommandRegexMatched, 'false', 'Wrong value for isCommandRegexMatched');
|
||||
assert.equal(result.context.telemetry.properties.commandContextType, '[]', 'Wrong value for commandContextType');
|
||||
|
@ -593,7 +595,7 @@ async function runWithCommandSetting(
|
|||
},
|
||||
|
||||
getCurrentContextType: async () => {
|
||||
return Promise.resolve(<any>contextType);
|
||||
return Promise.resolve(contextType as ContextType);
|
||||
}
|
||||
};
|
||||
|
|
@ -9,9 +9,7 @@ import * as mocha from 'mocha';
|
|||
import * as path from "path";
|
||||
import * as vscode from "vscode";
|
||||
|
||||
export namespace constants {
|
||||
export const testOutputName = 'testOutput';
|
||||
}
|
||||
const testOutputName = 'testOutput';
|
||||
|
||||
// The root workspace folder that vscode is opened against for tests
|
||||
let testRootFolder: string;
|
||||
|
@ -20,7 +18,7 @@ export function getTestRootFolder(): string {
|
|||
if (!testRootFolder) {
|
||||
// We're expecting to be opened against the test/test.code-workspace
|
||||
// workspace.
|
||||
let workspaceFolders = vscode.workspace.workspaceFolders;
|
||||
const workspaceFolders = vscode.workspace.workspaceFolders;
|
||||
if (!workspaceFolders || workspaceFolders.length === 0) {
|
||||
console.error("No workspace is open.");
|
||||
process.exit(1);
|
||||
|
@ -32,7 +30,7 @@ export function getTestRootFolder(): string {
|
|||
|
||||
testRootFolder = workspaceFolders[0].uri.fsPath;
|
||||
console.log(`testRootFolder: ${testRootFolder}`);
|
||||
if (path.basename(testRootFolder) !== constants.testOutputName) {
|
||||
if (path.basename(testRootFolder) !== testOutputName) {
|
||||
console.error("vscode is opened against the wrong folder for tests");
|
||||
process.exit(1);
|
||||
}
|
||||
|
@ -52,7 +50,7 @@ export function getTestRootFolder(): string {
|
|||
export function testInEmptyFolder(name: string, func?: mocha.AsyncFunc): void {
|
||||
test(name, !func ? undefined : async function (this: mocha.Context) {
|
||||
// Delete everything in the root testing folder
|
||||
assert(path.basename(testRootFolder) === constants.testOutputName, "Trying to delete wrong folder");;
|
||||
assert(path.basename(testRootFolder) === testOutputName, "Trying to delete wrong folder");
|
||||
await fse.emptyDir(testRootFolder);
|
||||
await func.apply(this);
|
||||
});
|
||||
|
@ -72,7 +70,7 @@ suiteSetup(async function (this: mocha.Context): Promise<void> {
|
|||
suiteTeardown(async function (this: mocha.Context): Promise<void> {
|
||||
console.log('global.test.ts: suiteTeardown');
|
||||
|
||||
if (testRootFolder && path.basename(testRootFolder) === constants.testOutputName) {
|
||||
fse.emptyDir(testRootFolder);
|
||||
if (testRootFolder && path.basename(testRootFolder) === testOutputName) {
|
||||
void fse.emptyDir(testRootFolder);
|
||||
}
|
||||
});
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import * as assert from 'assert';
|
||||
import { Suite } from 'mocha';
|
||||
import { nonNullProp } from '../extension.bundle';
|
||||
import { nonNullProp } from '../utils/nonNull';
|
||||
|
||||
suite("(unit) nonNull", async function (this: Suite): Promise<void> {
|
||||
type TestSubscription = {
|
||||
|
@ -13,7 +13,7 @@ suite("(unit) nonNull", async function (this: Suite): Promise<void> {
|
|||
arrayOrUndefined?: number[];
|
||||
stringOrNull: string | null;
|
||||
string: string;
|
||||
}
|
||||
};
|
||||
|
||||
function testNonNull<T>(testName: string, actual: T, expected: T) {
|
||||
test(testName, () => {
|
||||
|
@ -21,7 +21,7 @@ suite("(unit) nonNull", async function (this: Suite): Promise<void> {
|
|||
});
|
||||
}
|
||||
|
||||
function testNonNullThrows<T>(testName: string, block: () => any) {
|
||||
function testNonNullThrows(testName: string, block: () => unknown) {
|
||||
test(testName, () => {
|
||||
assert.throws(block, 'Expected an exception');
|
||||
});
|
|
@ -19,7 +19,7 @@ async function main(): Promise<void> {
|
|||
const extensionTestsPath = path.resolve(__dirname, './index');
|
||||
|
||||
// The workspace
|
||||
const testWorkspacePath = path.resolve(__dirname, '../../test/test.code-workspace');
|
||||
const testWorkspacePath = path.resolve(__dirname, '../../src/test/test.code-workspace');
|
||||
|
||||
const options: TestOptions = {
|
||||
extensionDevelopmentPath,
|
||||
|
@ -27,6 +27,7 @@ async function main(): Promise<void> {
|
|||
launchArgs: [testWorkspacePath, '--install-extension', 'ms-vscode.azure-account'],
|
||||
extensionTestsEnv: {
|
||||
DEBUGTELEMETRY: '1',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
MOCHA_grep: process.env.MOCHA_grep,
|
||||
},
|
||||
};
|
||||
|
@ -42,4 +43,5 @@ async function main(): Promise<void> {
|
|||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
main();
|
|
@ -4,12 +4,12 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ConfigurationTarget, workspace, WorkspaceConfiguration } from "vscode";
|
||||
import { configPrefix } from "../extension.bundle";
|
||||
import { configPrefix } from "../constants";
|
||||
|
||||
export async function runWithExtensionSettings<TCallback>(newValues: { [key: string]: any }, callback: () => Promise<TCallback>): Promise<TCallback> {
|
||||
export async function runWithExtensionSettings<TCallback>(newValues: { [key: string]: unknown }, callback: () => Promise<TCallback>): Promise<TCallback> {
|
||||
const config: WorkspaceConfiguration = workspace.getConfiguration(configPrefix);
|
||||
|
||||
const oldValues: { [key: string]: any } = {};
|
||||
const oldValues: { [key: string]: unknown } = {};
|
||||
|
||||
try {
|
||||
for (const key of Object.keys(newValues)) {
|
|
@ -4,9 +4,9 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { recursiveFindTaskByType } from '../../extension.bundle';
|
||||
import { TaskDefinitionBase } from '../../extension.bundle';
|
||||
import { DebugConfigurationBase } from '../../extension.bundle';
|
||||
import { recursiveFindTaskByType } from '../../tasks/TaskHelper';
|
||||
import { TaskDefinitionBase } from '../../tasks/TaskDefinitionBase';
|
||||
import { DebugConfigurationBase } from '../../debugging/DockerDebugConfigurationBase';
|
||||
|
||||
suite('(unit) tasks/TaskHelper/recursiveFindTaskByType', async () => {
|
||||
|
||||
|
@ -56,7 +56,7 @@ suite('(unit) tasks/TaskHelper/recursiveFindTaskByType', async () => {
|
|||
request: 'launch',
|
||||
name: 'My debug config',
|
||||
preLaunchTask: 'other task'
|
||||
}
|
||||
};
|
||||
|
||||
const missing: TaskDefinitionBase[] = [
|
||||
{
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { ActivityMeasurementService } from '../../extension.bundle';
|
||||
import { ActivityMeasurementService } from '../../telemetry/ActivityMeasurementService';
|
||||
import { TestMemento } from '../TestMemento';
|
||||
|
||||
function assertSameDate(a: number, b: number): void {
|
|
@ -3,13 +3,13 @@
|
|||
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { trimWithElipsis } from "../extension.bundle";
|
||||
import { trimWithElipsis } from '../utils/trimWithElipsis';
|
||||
import * as assert from 'assert';
|
||||
|
||||
suite('(unit) trimWithElipsis', () => {
|
||||
function genTest(s: string, max: number, expected: string): void {
|
||||
test(`${String(s)}: ${max}`, () => {
|
||||
let s2 = trimWithElipsis(s, max);
|
||||
const s2 = trimWithElipsis(s, max);
|
||||
assert.equal(s2, expected);
|
||||
});
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
*--------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { CommandLineBuilder } from '../../extension.bundle';
|
||||
import { CommandLineBuilder } from '../../utils/commandLineBuilder';
|
||||
import { ShellQuoting } from 'vscode';
|
||||
|
||||
suite('(unit) utils/CommandLineBuilder', () => {
|
|
@ -4,8 +4,8 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { Lazy, AsyncLazy } from "../../extension.bundle";
|
||||
import { delay } from '../../extension.bundle';
|
||||
import { Lazy, AsyncLazy } from '../../utils/lazy';
|
||||
import { delay } from '../../utils/promiseUtils';
|
||||
|
||||
suite('(unit) Lazy tests', () => {
|
||||
suite('Lazy<T>', () => {
|
|
@ -4,9 +4,9 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { inferPackageName, inferCommand, InspectMode, NodePackage } from "../../extension.bundle";
|
||||
import { inferPackageName, inferCommand, InspectMode, NodePackage } from '../../utils/nodeUtils';
|
||||
|
||||
suite('(unit) utils/nodeUtils', () => {
|
||||
suite('(unit) utils/nodeUtils', () => {
|
||||
suite('inferPackageName', () => {
|
||||
test('No package', async () => {
|
||||
const packageName = await inferPackageName(undefined, '/Users/user/app/package.json');
|
||||
|
@ -43,16 +43,16 @@ import { inferPackageName, inferCommand, InspectMode, NodePackage } from "../../
|
|||
}
|
||||
|
||||
test('No package', async () => {
|
||||
assert.rejects(() => inferCommand(undefined, 'default', 9229), 'An error should be thrown if there is no package');
|
||||
await assert.rejects(() => inferCommand(undefined, 'default', 9229), 'An error should be thrown if there is no package');
|
||||
});
|
||||
|
||||
test('No scripts or main', async () => {
|
||||
assert.rejects(() => inferCommand({}, 'default', 9229), 'An error should be thrown if there is no recognized NPM script or main script');
|
||||
await assert.rejects(() => inferCommand({}, 'default', 9229), 'An error should be thrown if there is no recognized NPM script or main script');
|
||||
});
|
||||
|
||||
inferCommandTest(
|
||||
'With start script and main',
|
||||
{ main: './bin/www1', scripts: { start: 'node ./bin/www2'} },
|
||||
{ main: './bin/www1', scripts: { start: 'node ./bin/www2' } },
|
||||
'default',
|
||||
9229,
|
||||
'node --inspect=0.0.0.0:9229 ./bin/www2',
|
||||
|
@ -60,7 +60,7 @@ import { inferPackageName, inferCommand, InspectMode, NodePackage } from "../../
|
|||
|
||||
inferCommandTest(
|
||||
'With case sensitive start script',
|
||||
{ main: './bin/www1', scripts: { start: 'Node ./bin/www2'} },
|
||||
{ main: './bin/www1', scripts: { start: 'Node ./bin/www2' } },
|
||||
'default',
|
||||
9229,
|
||||
'node --inspect=0.0.0.0:9229 ./bin/www2',
|
||||
|
@ -68,7 +68,7 @@ import { inferPackageName, inferCommand, InspectMode, NodePackage } from "../../
|
|||
|
||||
inferCommandTest(
|
||||
'With nodejs start script',
|
||||
{ main: './bin/www1', scripts: { start: 'nodejs ./bin/www2'} },
|
||||
{ main: './bin/www1', scripts: { start: 'nodejs ./bin/www2' } },
|
||||
'default',
|
||||
9229,
|
||||
'node --inspect=0.0.0.0:9229 ./bin/www2',
|
||||
|
@ -76,7 +76,7 @@ import { inferPackageName, inferCommand, InspectMode, NodePackage } from "../../
|
|||
|
||||
inferCommandTest(
|
||||
'Start script with preceeding environment',
|
||||
{ main: './bin/www1', scripts: { start: 'NODE_ENV=production node ./bin/www2'} },
|
||||
{ main: './bin/www1', scripts: { start: 'NODE_ENV=production node ./bin/www2' } },
|
||||
'default',
|
||||
9229,
|
||||
'node --inspect=0.0.0.0:9229 ./bin/www2',
|
||||
|
@ -84,7 +84,7 @@ import { inferPackageName, inferCommand, InspectMode, NodePackage } from "../../
|
|||
|
||||
inferCommandTest(
|
||||
'With unrecognized start script and main',
|
||||
{ main: './bin/www1', scripts: { start: 'mynode ./bin/www2'} },
|
||||
{ main: './bin/www1', scripts: { start: 'mynode ./bin/www2' } },
|
||||
'default',
|
||||
9229,
|
||||
'node --inspect=0.0.0.0:9229 ./bin/www1',
|
||||
|
@ -113,6 +113,6 @@ import { inferPackageName, inferCommand, InspectMode, NodePackage } from "../../
|
|||
9229,
|
||||
'node --inspect=0.0.0.0:9229 ./bin/www',
|
||||
'Should default to the main script when no start script exists');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
"es6"
|
||||
],
|
||||
"sourceMap": true,
|
||||
"rootDir": ".",
|
||||
"rootDir": "src",
|
||||
"strict": true, /* enable all strict type-checking options */
|
||||
"alwaysStrict": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
|
|
|
@ -63,7 +63,6 @@ const config = {
|
|||
},
|
||||
plugins: [
|
||||
// Copy some needed resource files from external sources
|
||||
// @ts-expect-error: Class incompatibility with CopyPlugin
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
'./node_modules/vscode-azureextensionui/resources/**/*.svg',
|
||||
|
@ -82,7 +81,6 @@ const config = {
|
|||
],
|
||||
optimization: {
|
||||
minimizer: [
|
||||
// @ts-expect-error: Class incompatibility with TerserPlugin
|
||||
new TerserPlugin({
|
||||
terserOptions: {
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
|
@ -116,7 +114,6 @@ const config = {
|
|||
};
|
||||
|
||||
if (debugWebpack) {
|
||||
// @ts-expect-error: Class incompatibility with BundleAnalyzerPlugin
|
||||
config.plugins.push(new BundleAnalyzerPlugin({ analyzerMode: 'static' }));
|
||||
console.log('Config:', config);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче