From db8e1e2460e9754ec0672d958789382b6d15c5aa Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Mon, 21 Dec 2020 15:18:56 -0800 Subject: [PATCH] Update files to match new Prettier settings (#15030) --- .eslintrc | 18 +- .prettierignore | 3 - .prettierrc.js | 2 +- build/webpack/common.js | 6 +- build/webpack/plugins/less-plugin-base64.js | 2 +- build/webpack/webpack.extension.config.js | 34 +- .../webpack.extension.dependencies.config.js | 10 +- .../webpack.startPage-ui.config.builder.js | 94 ++--- package-lock.json | 12 +- package.json | 3 +- src/client/activation/activationManager.ts | 10 +- src/client/activation/activationService.ts | 28 +- src/client/activation/common/activatorBase.ts | 52 +-- .../activation/common/analysisOptions.ts | 6 +- .../activation/common/cancellationUtils.ts | 2 +- .../activation/common/downloadChannelRules.ts | 2 +- src/client/activation/common/downloader.ts | 22 +- .../common/languageServerChangeHandler.ts | 12 +- .../common/languageServerFolderService.ts | 8 +- .../common/languageServerPackageService.ts | 4 +- .../activation/common/packageRepository.ts | 8 +- src/client/activation/extensionSurvey.ts | 18 +- src/client/activation/jedi.ts | 32 +- src/client/activation/jedi/activator.ts | 2 +- src/client/activation/jedi/analysisOptions.ts | 2 +- .../activation/jedi/languageClientFactory.ts | 6 +- .../activation/jedi/languageServerProxy.ts | 18 +- src/client/activation/jedi/manager.ts | 12 +- .../activation/jedi/multiplexingActivator.ts | 16 +- .../activation/languageClientMiddleware.ts | 20 +- .../activation/languageServer/activator.ts | 6 +- .../languageServer/analysisOptions.ts | 7 +- .../languageServer/languageClientFactory.ts | 24 +- .../languageServerCompatibilityService.ts | 6 +- .../languageServerPackageRepository.ts | 2 +- .../languageServerPackageService.ts | 4 +- .../languageServer/languageServerProxy.ts | 10 +- .../activation/languageServer/manager.ts | 12 +- .../languageServer/outputChannel.ts | 2 +- .../activation/languageServer/platformData.ts | 4 +- src/client/activation/node/activator.ts | 4 +- src/client/activation/node/analysisOptions.ts | 4 +- .../activation/node/languageClientFactory.ts | 13 +- .../node/languageServerFolderService.ts | 4 +- .../node/languageServerPackageRepository.ts | 2 +- .../node/languageServerPackageService.ts | 2 +- .../activation/node/languageServerProxy.ts | 28 +- src/client/activation/node/manager.ts | 12 +- src/client/activation/none/activator.ts | 18 +- src/client/activation/progress.ts | 4 +- .../activation/refCountedLanguageServer.ts | 16 +- src/client/activation/serviceRegistry.ts | 54 +-- src/client/activation/types.ts | 12 +- src/client/api.ts | 18 +- .../diagnostics/applicationDiagnostics.ts | 8 +- src/client/application/diagnostics/base.ts | 4 +- .../diagnostics/checks/envPathVariable.ts | 14 +- .../checks/invalidLaunchJsonDebugger.ts | 32 +- .../checks/invalidPythonPathInDebugger.ts | 32 +- .../diagnostics/checks/lsNotSupported.ts | 12 +- .../checks/macPythonInterpreter.ts | 54 +-- .../checks/powerShellActivation.ts | 26 +- .../diagnostics/checks/pythonInterpreter.ts | 34 +- .../checks/pythonPathDeprecated.ts | 14 +- .../diagnostics/checks/upgradeCodeRunner.ts | 8 +- .../diagnostics/commands/execVSCCommand.ts | 2 +- .../diagnostics/commands/ignore.ts | 2 +- .../application/diagnostics/constants.ts | 2 +- src/client/application/diagnostics/filter.ts | 4 +- .../application/diagnostics/promptHandler.ts | 6 +- .../diagnostics/serviceRegistry.ts | 34 +- .../diagnostics/surceMapSupportService.ts | 8 +- src/client/application/diagnostics/types.ts | 4 +- .../application/misc/joinMailingListPrompt.ts | 6 +- .../common/application/activeResource.ts | 2 +- .../application/applicationEnvironment.ts | 4 +- .../common/application/applicationShell.ts | 12 +- .../common/application/commandManager.ts | 4 +- src/client/common/application/commands.ts | 4 +- .../application/commands/reloadCommand.ts | 2 +- .../common/application/customEditorService.ts | 10 +- src/client/common/application/debugService.ts | 6 +- .../application/debugSessionTelemetry.ts | 4 +- .../common/application/documentManager.ts | 2 +- src/client/common/application/notebook.ts | 20 +- src/client/common/application/types.ts | 28 +- .../application/webviewPanels/webviewPanel.ts | 16 +- .../webviewPanels/webviewPanelProvider.ts | 2 +- .../common/application/webviews/webview.ts | 4 +- src/client/common/application/workspace.ts | 12 +- src/client/common/configSettings.ts | 74 ++-- src/client/common/configuration/service.ts | 16 +- src/client/common/constants.ts | 2 +- src/client/common/crypto.ts | 2 +- .../common/dotnet/compatibilityService.ts | 2 +- src/client/common/dotnet/serviceRegistry.ts | 8 +- src/client/common/editor.ts | 4 +- .../debuggerDataViewerExperimentEnabler.ts | 4 +- src/client/common/experiments/groups.ts | 34 +- src/client/common/experiments/manager.ts | 18 +- src/client/common/experiments/service.ts | 10 +- src/client/common/extensions.ts | 2 +- .../common/featureDeprecationManager.ts | 24 +- .../insidersBuild/downloadChannelService.ts | 4 +- .../insidersBuild/insidersExtensionPrompt.ts | 14 +- .../insidersBuild/insidersExtensionService.ts | 16 +- src/client/common/insidersBuild/types.ts | 2 +- src/client/common/installer/channelManager.ts | 8 +- src/client/common/installer/condaInstaller.ts | 2 +- .../installer/extensionBuildInstaller.ts | 6 +- .../common/installer/moduleInstaller.ts | 6 +- .../common/installer/pipEnvInstaller.ts | 2 +- src/client/common/installer/pipInstaller.ts | 2 +- .../common/installer/poetryInstaller.ts | 4 +- .../common/installer/productInstaller.ts | 68 ++-- .../common/installer/serviceRegistry.ts | 20 +- src/client/common/interpreterPathService.ts | 26 +- src/client/common/logger.ts | 2 +- .../common/markdown/restTextConverter.ts | 2 +- src/client/common/net/fileDownloader.ts | 12 +- src/client/common/net/httpClient.ts | 2 +- src/client/common/net/socket/SocketStream.ts | 2 +- .../nuget/azureBlobStoreNugetRepository.ts | 14 +- src/client/common/open.ts | 2 +- src/client/common/persistentState.ts | 12 +- src/client/common/platform/errors.ts | 2 +- src/client/common/platform/fileSystem.ts | 28 +- .../common/platform/fileSystemWatcher.ts | 12 +- src/client/common/platform/fs-paths.ts | 16 +- src/client/common/platform/fs-temp.ts | 10 +- src/client/common/platform/pathUtils.ts | 4 +- src/client/common/platform/platformService.ts | 6 +- src/client/common/platform/registry.ts | 4 +- src/client/common/platform/types.ts | 2 +- .../common/process/internal/scripts/index.ts | 4 +- src/client/common/process/logger.ts | 2 +- src/client/common/process/proc.ts | 12 +- src/client/common/process/processFactory.ts | 2 +- .../common/process/pythonEnvironment.ts | 18 +- .../common/process/pythonExecutionFactory.ts | 22 +- src/client/common/process/pythonProcess.ts | 10 +- .../common/process/pythonToolService.ts | 6 +- src/client/common/process/types.ts | 4 +- src/client/common/serviceRegistry.ts | 38 +- .../common/startPage/codeCssGenerator.ts | 32 +- src/client/common/startPage/constants.ts | 2 +- src/client/common/startPage/messages.ts | 4 +- src/client/common/startPage/startPage.ts | 24 +- .../startPage/startPageMessageListener.ts | 2 +- src/client/common/startPage/themeFinder.ts | 16 +- src/client/common/startPage/webviewHost.ts | 6 +- .../common/startPage/webviewPanelHost.ts | 10 +- src/client/common/terminal/activator/base.ts | 4 +- src/client/common/terminal/activator/index.ts | 6 +- .../activator/powershellFailedHandler.ts | 6 +- src/client/common/terminal/commandPrompt.ts | 4 +- .../baseActivationProvider.ts | 6 +- .../environmentActivationProviders/bash.ts | 4 +- .../commandPrompt.ts | 8 +- .../condaActivationProvider.ts | 6 +- .../pipEnvActivationProvider.ts | 6 +- .../pyenvActivationProvider.ts | 2 +- src/client/common/terminal/factory.ts | 6 +- src/client/common/terminal/helper.ts | 16 +- src/client/common/terminal/service.ts | 10 +- src/client/common/terminal/shellDetector.ts | 8 +- .../shellDetectors/baseShellDetector.ts | 2 +- .../shellDetectors/settingsShellDetector.ts | 4 +- .../terminalNameShellDetector.ts | 2 +- .../userEnvironmentShellDetector.ts | 4 +- .../vscEnvironmentShellDetector.ts | 2 +- .../common/terminal/syncTerminalService.ts | 16 +- src/client/common/terminal/types.ts | 14 +- src/client/common/types.ts | 18 +- src/client/common/utils/async.ts | 4 +- src/client/common/utils/backgroundLoop.ts | 8 +- src/client/common/utils/cacheUtils.ts | 8 +- src/client/common/utils/decorators.ts | 12 +- src/client/common/utils/icons.ts | 2 +- src/client/common/utils/localize.ts | 190 +++++----- src/client/common/utils/misc.ts | 4 +- src/client/common/utils/multiStepInput.ts | 22 +- src/client/common/utils/platform.ts | 6 +- src/client/common/utils/resourceLifecycle.ts | 2 +- src/client/common/utils/sysTypes.ts | 2 +- src/client/common/utils/version.ts | 6 +- src/client/common/utils/workerPool.ts | 14 +- src/client/common/variables/environment.ts | 6 +- .../variables/environmentVariablesProvider.ts | 8 +- .../common/variables/serviceRegistry.ts | 4 +- src/client/common/variables/sysTypes.ts | 2 +- .../common/variables/systemVariables.ts | 8 +- .../debugger/extension/adapter/activator.ts | 8 +- .../debugger/extension/adapter/factory.ts | 12 +- .../debugger/extension/adapter/logging.ts | 2 +- .../adapter/outdatedDebuggerPrompt.ts | 4 +- .../extension/attachQuickPick/factory.ts | 4 +- .../extension/attachQuickPick/picker.ts | 10 +- .../extension/attachQuickPick/provider.ts | 6 +- .../attachQuickPick/psProcessParser.ts | 6 +- .../attachQuickPick/wmicProcessParser.ts | 4 +- src/client/debugger/extension/banner.ts | 4 +- .../debugConfigurationService.ts | 36 +- .../launch.json/completionProvider.ts | 18 +- .../launch.json/interpreterPathCommand.ts | 4 +- .../launch.json/updaterService.ts | 18 +- .../configuration/providers/djangoLaunch.ts | 10 +- .../configuration/providers/fastapiLaunch.ts | 8 +- .../configuration/providers/fileLaunch.ts | 4 +- .../configuration/providers/flaskLaunch.ts | 10 +- .../configuration/providers/moduleLaunch.ts | 8 +- .../configuration/providers/pidAttach.ts | 4 +- .../providers/providerFactory.ts | 2 +- .../configuration/providers/pyramidLaunch.ts | 10 +- .../configuration/providers/remoteAttach.ts | 24 +- .../configuration/resolvers/attach.ts | 14 +- .../extension/configuration/resolvers/base.ts | 26 +- .../configuration/resolvers/helper.ts | 2 +- .../configuration/resolvers/launch.ts | 16 +- .../debugger/extension/configuration/types.ts | 4 +- .../hooks/childProcessAttachHandler.ts | 2 +- .../hooks/childProcessAttachService.ts | 4 +- .../debugger/extension/hooks/constants.ts | 2 +- .../extension/hooks/eventHandlerDispatcher.ts | 10 +- .../debugger/extension/serviceRegistry.ts | 42 +-- src/client/debugger/extension/types.ts | 8 +- src/client/debugger/types.ts | 2 +- src/client/extension.ts | 4 +- src/client/extensionActivation.ts | 14 +- src/client/extensionInit.ts | 6 +- src/client/formatters/autoPep8Formatter.ts | 6 +- src/client/formatters/baseFormatter.ts | 6 +- src/client/formatters/blackFormatter.ts | 2 +- src/client/formatters/dummyFormatter.ts | 2 +- src/client/formatters/helper.ts | 2 +- src/client/formatters/lineFormatter.ts | 2 +- src/client/formatters/yapfFormatter.ts | 2 +- .../activation/preWarmVariables.ts | 4 +- src/client/interpreter/activation/service.ts | 20 +- .../terminalEnvironmentActivationService.ts | 8 +- src/client/interpreter/activation/types.ts | 2 +- .../wrapperEnvironmentActivationService.ts | 24 +- src/client/interpreter/autoSelection/index.ts | 8 +- .../interpreterEvaluation.ts | 10 +- .../interpreterSecurityService.ts | 4 +- .../interpreterSecurityStorage.ts | 18 +- src/client/interpreter/autoSelection/proxy.ts | 2 +- .../autoSelection/rules/baseRule.ts | 14 +- .../interpreter/autoSelection/rules/cached.ts | 6 +- .../autoSelection/rules/currentPath.ts | 6 +- .../autoSelection/rules/settings.ts | 4 +- .../interpreter/autoSelection/rules/system.ts | 8 +- .../autoSelection/rules/winRegistry.ts | 6 +- .../autoSelection/rules/workspaceEnv.ts | 10 +- src/client/interpreter/autoSelection/types.ts | 2 +- .../interpreterSelector/commands/base.ts | 14 +- .../commands/resetInterpreter.ts | 4 +- .../commands/setInterpreter.ts | 24 +- .../commands/setShebangInterpreter.ts | 14 +- .../interpreterSelector.ts | 6 +- .../configuration/pythonPathUpdaterService.ts | 10 +- .../pythonPathUpdaterServiceFactory.ts | 6 +- .../services/globalUpdaterService.ts | 2 +- .../services/workspaceFolderUpdaterService.ts | 4 +- .../services/workspaceUpdaterService.ts | 2 +- src/client/interpreter/configuration/types.ts | 2 +- src/client/interpreter/display/index.ts | 10 +- .../display/interpreterSelectionTip.ts | 10 +- .../interpreter/display/progressDisplay.ts | 6 +- .../display/shebangCodeLensProvider.ts | 6 +- src/client/interpreter/helpers.ts | 8 +- src/client/interpreter/interpreterService.ts | 28 +- src/client/interpreter/interpreterVersion.ts | 2 +- src/client/interpreter/serviceRegistry.ts | 48 +-- .../virtualEnvs/condaInheritEnvPrompt.ts | 8 +- src/client/interpreter/virtualEnvs/index.ts | 16 +- .../virtualEnvs/virtualEnvPrompt.ts | 14 +- src/client/ioc/container.ts | 4 +- src/client/ioc/serviceManager.ts | 14 +- src/client/ioc/types.ts | 14 +- .../jupyterExtensionDependencyManager.ts | 4 +- src/client/jupyter/jupyterIntegration.ts | 20 +- .../languageserver/notebookConverter.ts | 66 ++-- .../languageserver/notebookMiddlewareAddon.ts | 48 +-- src/client/jupyter/types.ts | 2 +- src/client/language/braceCounter.ts | 2 +- src/client/language/iterableTextRange.ts | 6 +- src/client/language/languageConfiguration.ts | 20 +- src/client/language/tokenizer.ts | 4 +- src/client/language/types.ts | 4 +- src/client/language/unicode.ts | 2 +- .../languageServices/jediProxyFactory.ts | 2 +- .../proposeLanguageServerBanner.ts | 8 +- src/client/linters/bandit.ts | 4 +- src/client/linters/baseLinter.ts | 16 +- src/client/linters/constants.ts | 2 +- .../linters/errorHandlers/baseErrorHandler.ts | 2 +- src/client/linters/flake8.ts | 2 +- src/client/linters/linterAvailability.ts | 8 +- src/client/linters/linterCommands.ts | 6 +- src/client/linters/linterInfo.ts | 4 +- src/client/linters/linterManager.ts | 6 +- src/client/linters/lintingEngine.ts | 8 +- src/client/linters/prospector.ts | 2 +- src/client/linters/pycodestyle.ts | 4 +- src/client/linters/pydocstyle.ts | 2 +- src/client/linters/pylint.ts | 10 +- src/client/linters/types.ts | 6 +- src/client/logging/formatters.ts | 10 +- src/client/logging/index.ts | 2 +- src/client/logging/levels.ts | 12 +- src/client/logging/logger.ts | 2 +- src/client/logging/trace.ts | 4 +- src/client/logging/transports.ts | 10 +- .../launchJsonCodeActionProvider.ts | 2 +- .../providers/codeActionProvider/main.ts | 6 +- .../pythonCodeActionProvider.ts | 4 +- src/client/providers/completionProvider.ts | 4 +- src/client/providers/completionSource.ts | 14 +- src/client/providers/definitionProvider.ts | 6 +- .../providers/docStringFoldingProvider.ts | 6 +- src/client/providers/formatProvider.ts | 8 +- src/client/providers/hoverProvider.ts | 2 +- src/client/providers/importSortProvider.ts | 16 +- src/client/providers/itemInfoSource.ts | 20 +- src/client/providers/jediProxy.ts | 52 +-- .../providers/objectDefinitionProvider.ts | 2 +- src/client/providers/providerUtilities.ts | 2 +- src/client/providers/referenceProvider.ts | 4 +- src/client/providers/renameProvider.ts | 4 +- src/client/providers/serviceRegistry.ts | 2 +- src/client/providers/signatureProvider.ts | 12 +- .../providers/simpleRefactorProvider.ts | 22 +- src/client/providers/symbolProvider.ts | 16 +- src/client/providers/terminalProvider.ts | 2 +- src/client/pythonEnvironments/api.ts | 4 +- .../pythonEnvironments/base/envsCache.ts | 10 +- .../pythonEnvironments/base/info/env.ts | 53 +-- .../pythonEnvironments/base/info/index.ts | 6 +- .../base/info/interpreter.ts | 5 +- .../base/info/pythonVersion.ts | 28 +- src/client/pythonEnvironments/base/locator.ts | 10 +- .../pythonEnvironments/base/locatorUtils.ts | 25 +- .../pythonEnvironments/base/locators.ts | 10 +- .../locators/common/resourceBasedLocator.ts | 2 +- .../base/locators/common/wrappingLocator.ts | 10 +- .../base/locators/composite/cachingLocator.ts | 37 +- .../base/locators/composite/cachingWrapper.ts | 23 +- .../locators/composite/environmentsReducer.ts | 4 +- .../composite/environmentsResolver.ts | 9 +- .../base/locators/lowLevel/filesLocator.ts | 11 +- .../locators/lowLevel/fsWatchingLocator.ts | 8 +- .../lowLevel/workspaceVirtualEnvLocator.ts | 16 +- src/client/pythonEnvironments/base/watcher.ts | 3 +- .../pythonEnvironments/common/commonUtils.ts | 8 +- .../common/environmentIdentifier.ts | 8 +- .../common/externalDependencies.ts | 4 +- .../pythonEnvironments/common/posixUtils.ts | 58 +-- .../common/pythonBinariesWatcher.ts | 18 +- .../common/windowsRegistry.ts | 4 +- .../pythonEnvironments/common/windowsUtils.ts | 10 +- .../discovery/locators/helpers.ts | 16 +- .../discovery/locators/index.ts | 34 +- .../locators/services/KnownPathsService.ts | 16 +- .../services/baseVirtualEnvService.ts | 66 ++-- .../services/cacheableLocatorService.ts | 10 +- .../discovery/locators/services/conda.ts | 19 +- .../locators/services/condaEnvFileService.ts | 10 +- .../locators/services/condaEnvService.ts | 4 +- .../locators/services/condaLocator.ts | 7 +- .../locators/services/condaService.ts | 23 +- .../locators/services/currentPathService.ts | 10 +- .../services/customVirtualEnvLocator.ts | 14 +- .../services/globalVirtualEnvService.ts | 2 +- .../globalVirtualEnvronmentLocator.ts | 9 +- .../locators/services/hashProviderFactory.ts | 5 +- .../locators/services/pipEnvHelper.ts | 8 +- .../locators/services/pipEnvService.ts | 3 +- .../services/posixKnownPathsLocator.ts | 14 +- .../locators/services/pyenvLocator.ts | 51 ++- .../services/virtualEnvironmentIdentifier.ts | 28 +- .../services/windowsRegistryLocator.ts | 6 +- .../services/windowsRegistryService.ts | 75 ++-- .../services/windowsStoreInterpreter.ts | 12 +- .../locators/services/windowsStoreLocator.ts | 34 +- .../services/workspaceVirtualEnvService.ts | 2 +- .../workspaceVirtualEnvWatcherService.ts | 4 +- src/client/pythonEnvironments/index.ts | 70 +--- .../info/environmentInfoService.ts | 8 +- src/client/pythonEnvironments/info/index.ts | 2 +- .../pythonEnvironments/info/interpreter.ts | 5 +- src/client/pythonEnvironments/legacyIOC.ts | 71 ++-- src/client/refactor/proxy.ts | 16 +- src/client/sourceMapSupport.ts | 4 +- src/client/startupTelemetry.ts | 14 +- src/client/telemetry/constants.ts | 4 +- src/client/telemetry/envFileTelemetry.ts | 2 +- src/client/telemetry/importTracker.ts | 2 +- src/client/telemetry/index.ts | 20 +- src/client/tensorBoard/serviceRegistry.ts | 8 +- .../tensorBoardCodeActionProvider.ts | 8 +- .../tensorBoardCodeLensProvider.ts | 4 +- .../tensorBoard/tensorBoardFileWatcher.ts | 10 +- .../tensorBoard/tensorBoardImportTracker.ts | 4 +- src/client/tensorBoard/tensorBoardPrompt.ts | 8 +- src/client/tensorBoard/tensorBoardSession.ts | 28 +- .../tensorBoard/tensorBoardSessionProvider.ts | 6 +- src/client/terminals/activation.ts | 6 +- .../codeExecution/codeExecutionManager.ts | 16 +- .../terminals/codeExecution/djangoContext.ts | 4 +- .../codeExecution/djangoShellCodeExecution.ts | 2 +- src/client/terminals/codeExecution/helper.ts | 8 +- src/client/terminals/codeExecution/repl.ts | 2 +- .../codeExecution/terminalCodeExecution.ts | 4 +- src/client/terminals/serviceRegistry.ts | 8 +- src/client/testing/codeLenses/main.ts | 6 +- src/client/testing/codeLenses/testFiles.ts | 38 +- src/client/testing/common/argumentsHelper.ts | 8 +- src/client/testing/common/constants.ts | 4 +- src/client/testing/common/debugLauncher.ts | 18 +- .../testing/common/enablementTracker.ts | 2 +- .../common/managers/baseTestManager.ts | 38 +- .../managers/testConfigurationManager.ts | 14 +- src/client/testing/common/runner.ts | 14 +- .../common/services/configSettingService.ts | 2 +- .../testing/common/services/contextService.ts | 6 +- .../common/services/discoveredTestParser.ts | 42 +-- .../testing/common/services/discovery.ts | 8 +- .../testing/common/services/storageService.ts | 4 +- .../common/services/testsStatusService.ts | 4 +- .../services/workspaceTestManagerService.ts | 4 +- src/client/testing/common/testUtils.ts | 28 +- .../common/testVisitors/flatteningVisitor.ts | 6 +- src/client/testing/common/types.ts | 10 +- .../testing/common/updateTestSettings.ts | 12 +- src/client/testing/common/xUnitParser.ts | 2 +- src/client/testing/configuration.ts | 24 +- src/client/testing/display/main.ts | 10 +- src/client/testing/display/picker.ts | 42 +-- .../testing/explorer/commandHandlers.ts | 6 +- .../testing/explorer/failedTestHandler.ts | 2 +- .../testing/explorer/testTreeViewItem.ts | 10 +- .../testing/explorer/testTreeViewProvider.ts | 10 +- src/client/testing/explorer/treeView.ts | 6 +- src/client/testing/main.ts | 100 ++--- .../testing/navigation/commandHandler.ts | 8 +- .../testing/navigation/functionNavigator.ts | 2 +- src/client/testing/navigation/helper.ts | 4 +- .../testing/navigation/serviceRegistry.ts | 8 +- .../testing/navigation/suiteNavigator.ts | 2 +- .../testing/navigation/symbolProvider.ts | 12 +- src/client/testing/navigation/types.ts | 4 +- src/client/testing/nosetest/main.ts | 12 +- src/client/testing/nosetest/runner.ts | 10 +- .../testing/nosetest/services/argsService.ts | 16 +- .../nosetest/services/discoveryService.ts | 4 +- .../nosetest/services/parserService.ts | 14 +- src/client/testing/pytest/main.ts | 16 +- src/client/testing/pytest/runner.ts | 10 +- .../testing/pytest/services/argsService.ts | 22 +- .../pytest/services/discoveryService.ts | 6 +- .../pytest/services/testMessageService.ts | 14 +- .../pytest/testConfigurationManager.ts | 4 +- src/client/testing/serviceRegistry.ts | 14 +- src/client/testing/types.ts | 22 +- src/client/testing/unittest/main.ts | 12 +- src/client/testing/unittest/runner.ts | 8 +- .../testing/unittest/services/argsService.ts | 6 +- .../unittest/services/discoveryService.ts | 6 +- .../unittest/services/parserService.ts | 8 +- src/client/testing/unittest/socketServer.ts | 2 +- .../typeFormatters/blockFormatProvider.ts | 8 +- .../typeFormatters/codeBlockFormatProvider.ts | 6 +- src/client/typeFormatters/dispatcher.ts | 6 +- src/client/typeFormatters/onEnterFormatter.ts | 4 +- src/client/workspaceSymbols/generator.ts | 4 +- src/client/workspaceSymbols/main.ts | 10 +- src/client/workspaceSymbols/parser.ts | 4 +- src/client/workspaceSymbols/provider.ts | 14 +- src/startPage-ui/react-common/image.tsx | 14 +- src/startPage-ui/startPage/index.tsx | 2 +- src/startPage-ui/startPage/startPage.tsx | 30 +- .../activation/activationManager.unit.test.ts | 26 +- .../activation/activationService.unit.test.ts | 118 +++--- .../activation/activeResource.unit.test.ts | 14 +- .../activation/extensionSurvey.unit.test.ts | 74 ++-- .../languageServer/activator.unit.test.ts | 8 +- .../analysisOptions.unit.test.ts | 10 +- .../downloadChannelRules.unit.test.ts | 8 +- .../languageServer/downloader.unit.test.ts | 16 +- .../languageClientFactory.unit.test.ts | 16 +- .../languageServer.unit.test.ts | 4 +- .../languageServerExtension.unit.test.ts | 2 +- .../languageServerFolderService.unit.test.ts | 42 +-- ...nguageServerPackageRepository.unit.test.ts | 8 +- .../languageServerPackageService.test.ts | 6 +- .../languageServerPackageService.unit.test.ts | 26 +- .../languageServer/manager.unit.test.ts | 12 +- .../languageServer/outputChannel.unit.test.ts | 8 +- .../languageServer/platformData.unit.test.ts | 6 +- .../activation/node/activator.unit.test.ts | 16 +- .../languageServerChangeHandler.unit.test.ts | 36 +- .../languageServerFolderService.unit.test.ts | 18 +- .../activation/serviceRegistry.unit.test.ts | 77 ++-- src/test/api.functional.test.ts | 14 +- .../applicationDiagnostics.unit.test.ts | 12 +- .../checks/envPathVariable.unit.test.ts | 20 +- .../invalidLaunchJsonDebugger.unit.test.ts | 26 +- .../invalidPythonPathInDebugger.unit.test.ts | 32 +- .../checks/lsNotSupported.unit.test.ts | 18 +- .../checks/macPythonInterpreter.unit.test.ts | 97 ++--- .../checks/powerShellActivation.unit.test.ts | 18 +- .../checks/pythonInterpreter.unit.test.ts | 68 ++-- .../checks/pythonPathDeprecated.unit.test.ts | 42 +-- .../checks/updateTestSettings.unit.test.ts | 42 +-- .../checks/upgradeCodeRunner.unit.test.ts | 24 +- .../commands/execVSCCommands.unit.test.ts | 4 +- .../diagnostics/commands/factory.unit.test.ts | 2 +- .../diagnostics/commands/ignore.unit.test.ts | 2 +- .../diagnostics/filter.unit.test.ts | 12 +- .../diagnostics/promptHandler.unit.test.ts | 56 +-- .../diagnostics/serviceRegistry.unit.test.ts | 72 ++-- .../sourceMapSupportService.unit.test.ts | 12 +- .../misc/joinMailingListPrompt.unit.test.ts | 18 +- src/test/common.ts | 24 +- src/test/common/configSettings.test.ts | 6 +- .../configSettings.pythonPath.unit.test.ts | 8 +- .../configSettings.unit.test.ts | 14 +- src/test/common/configuration/service.test.ts | 2 +- .../common/configuration/service.unit.test.ts | 10 +- .../dotnet/compatibilityService.unit.test.ts | 2 +- .../dotnet/serviceRegistry.unit.test.ts | 20 +- .../common/experiments/manager.unit.test.ts | 148 ++++---- .../common/experiments/service.unit.test.ts | 50 +-- .../common/experiments/telemetry.unit.test.ts | 4 +- .../featureDeprecationManager.unit.test.ts | 18 +- .../downloadChannelRules.unit.test.ts | 6 +- .../downloadChannelService.unit.test.ts | 18 +- .../insidersExtensionPrompt.unit.test.ts | 26 +- .../insidersExtensionService.unit.test.ts | 36 +- src/test/common/installer.test.ts | 66 ++-- .../installer/channelManager.unit.test.ts | 18 +- .../installer/condaInstaller.unit.test.ts | 6 +- .../extensionBuildInstaller.unit.test.ts | 10 +- .../installer.invalidPath.unit.test.ts | 6 +- .../common/installer/installer.unit.test.ts | 172 ++++----- .../installer/moduleInstaller.unit.test.ts | 40 +- .../installer/pipEnvInstaller.unit.test.ts | 8 +- .../installer/pipInstaller.unit.test.ts | 2 +- .../installer/poetryInstaller.unit.test.ts | 2 +- .../common/installer/productPath.unit.test.ts | 16 +- .../installer/serviceRegistry.unit.test.ts | 36 +- .../interpreterPathService.unit.test.ts | 54 +-- src/test/common/moduleInstaller.test.ts | 88 ++--- .../common/net/fileDownloader.unit.test.ts | 10 +- src/test/common/net/httpClient.unit.test.ts | 18 +- ...azureBobStoreRepository.functional.test.ts | 4 +- .../azureBobStoreRepository.unit.test.ts | 10 +- .../common/nuget/nugetService.unit.test.ts | 6 +- src/test/common/platform/errors.unit.test.ts | 12 +- .../platform/filesystem.functional.test.ts | 8 +- src/test/common/platform/filesystem.test.ts | 26 +- .../common/platform/filesystem.unit.test.ts | 46 +-- .../platform/fs-paths.functional.test.ts | 2 +- .../common/platform/fs-paths.unit.test.ts | 4 +- src/test/common/platform/fs-temp.unit.test.ts | 2 +- .../platformService.functional.test.ts | 2 +- src/test/common/platform/utils.ts | 4 +- src/test/common/process/execFactory.test.ts | 2 +- src/test/common/process/logger.unit.test.ts | 10 +- src/test/common/process/proc.exec.test.ts | 14 +- .../common/process/proc.observable.test.ts | 32 +- .../process/processFactory.unit.test.ts | 4 +- .../process/pythonEnvironment.unit.test.ts | 26 +- .../pythonExecutionFactory.unit.test.ts | 36 +- .../pythonProc.simple.multiroot.test.ts | 8 +- .../common/process/pythonProcess.unit.test.ts | 4 +- .../process/pythonToolService.unit.test.ts | 24 +- .../process/serviceRegistry.unit.test.ts | 10 +- src/test/common/serviceRegistry.unit.test.ts | 22 +- src/test/common/socketCallbackHandler.test.ts | 10 +- src/test/common/socketStream.test.ts | 2 +- .../terminals/activation.bash.unit.test.ts | 10 +- .../activation.commandPrompt.unit.test.ts | 14 +- .../terminals/activation.conda.unit.test.ts | 84 ++--- .../common/terminals/activation.unit.test.ts | 6 +- .../terminals/activator/base.unit.test.ts | 10 +- .../terminals/activator/index.unit.test.ts | 16 +- .../powerShellFailedHandler.unit.test.ts | 18 +- .../terminals/commandPrompt.unit.test.ts | 6 +- .../pipEnvActivationProvider.unit.test.ts | 10 +- .../terminalActivation.testvirtualenvs.ts | 20 +- .../common/terminals/factory.unit.test.ts | 4 +- src/test/common/terminals/helper.unit.test.ts | 18 +- .../pyenvActivationProvider.unit.test.ts | 8 +- .../common/terminals/service.unit.test.ts | 2 +- .../terminals/serviceRegistry.unit.test.ts | 16 +- .../terminals/shellDetector.unit.test.ts | 10 +- .../shellDetectors.unit.test.ts | 18 +- .../synchronousTerminalService.unit.test.ts | 8 +- src/test/common/utils/async.unit.test.ts | 2 +- src/test/common/utils/cacheUtils.unit.test.ts | 28 +- src/test/common/utils/decorators.unit.test.ts | 2 +- .../common/utils/localize.functional.test.ts | 6 +- src/test/common/utils/regexp.unit.test.ts | 8 +- src/test/common/utils/text.unit.test.ts | 10 +- src/test/common/utils/version.unit.test.ts | 34 +- .../utils/workerPool.functional.test.ts | 2 +- .../envVarsProvider.multiroot.test.ts | 8 +- .../common/variables/envVarsService.test.ts | 4 +- .../variables/envVarsService.unit.test.ts | 32 +- .../environmentVariablesProvider.unit.test.ts | 10 +- .../variables/serviceRegistry.unit.test.ts | 8 +- .../commands/resetInterpreter.unit.test.ts | 52 +-- .../commands/setInterpreter.unit.test.ts | 106 +++--- .../interpreterSelector.unit.test.ts | 16 +- src/test/constants.ts | 2 +- .../debugger/common/protocolparser.test.ts | 8 +- src/test/debugger/envVars.test.ts | 14 +- .../extension/adapter/activator.unit.test.ts | 6 +- .../extension/adapter/adapter.test.ts | 2 +- .../extension/adapter/factory.unit.test.ts | 14 +- .../extension/adapter/logging.unit.test.ts | 4 +- .../outdatedDebuggerPrompt.unit.test.ts | 18 +- .../adapter/remoteLaunchers.unit.test.ts | 14 +- .../attachQuickPick/factory.unit.test.ts | 2 +- .../attachQuickPick/provider.unit.test.ts | 92 ++--- .../psProcessParser.unit.test.ts | 38 +- .../wmicProcessParser.unit.test.ts | 32 +- .../debugger/extension/banner.unit.test.ts | 26 +- .../debugConfigurationService.unit.test.ts | 16 +- .../completionProvider.unit.test.ts | 10 +- .../launch.json/updaterServer.unit.test.ts | 24 +- .../providers/djangoLaunch.unit.test.ts | 8 +- .../providers/fastapiLaunch.unit.test.ts | 4 +- .../providers/fileLaunch.unit.test.ts | 2 +- .../providers/flaskLaunch.unit.test.ts | 12 +- .../providers/moduleLaunch.unit.test.ts | 4 +- .../providers/pidAttach.unit.test.ts | 2 +- .../providers/providerFactory.unit.test.ts | 2 +- .../providers/pyramidLaunch.unit.test.ts | 8 +- .../providers/remoteAttach.unit.test.ts | 18 +- .../resolvers/attach.unit.test.ts | 74 ++-- .../configuration/resolvers/base.unit.test.ts | 16 +- .../configuration/resolvers/common.ts | 2 +- .../resolvers/launch.unit.test.ts | 204 +++++------ .../childProcessAttachHandler.unit.test.ts | 2 +- .../childProcessAttachService.unit.test.ts | 16 +- .../extension/serviceRegistry.unit.test.ts | 100 ++--- src/test/debugger/utils.ts | 24 +- src/test/debuggerTest.ts | 2 +- src/test/extension-version.functional.test.ts | 4 +- src/test/fixtures.ts | 4 +- src/test/format/extension.dispatch.test.ts | 14 +- src/test/format/extension.format.test.ts | 10 +- .../format/extension.lineFormatter.test.ts | 12 +- .../format/extension.onEnterFormat.test.ts | 4 +- .../format/extension.onTypeFormat.test.ts | 192 +++++----- src/test/format/extension.sort.test.ts | 16 +- src/test/format/format.helper.test.ts | 10 +- src/test/format/formatter.unit.test.ts | 16 +- src/test/index.ts | 6 +- src/test/initialize.ts | 4 +- .../insiders/languageServer.insiders.test.ts | 12 +- .../install/channelManager.channels.test.ts | 16 +- .../install/channelManager.messages.test.ts | 18 +- .../activation/preWarmVariables.unit.test.ts | 2 +- .../activation/service.unit.test.ts | 46 +-- ...lEnvironmentActivationService.unit.test.ts | 8 +- ...rEnvironmentActivationService.unit.test.ts | 120 +++--- .../autoSelection/index.unit.test.ts | 52 +-- .../interpreterEvaluation.unit.test.ts | 26 +- .../interpreterSecurityService.unit.test.ts | 4 +- .../interpreterSecurityStorage.unit.test.ts | 8 +- .../autoSelection/proxy.unit.test.ts | 2 +- .../autoSelection/rules/base.unit.test.ts | 20 +- .../autoSelection/rules/cached.unit.test.ts | 10 +- .../rules/currentPath.unit.test.ts | 8 +- .../autoSelection/rules/settings.unit.test.ts | 8 +- .../autoSelection/rules/system.unit.test.ts | 8 +- .../rules/winRegistry.unit.test.ts | 8 +- .../rules/workspaceEnv.unit.test.ts | 12 +- .../currentPathService.unit.test.ts | 8 +- src/test/interpreters/display.unit.test.ts | 20 +- .../interpreterSelectionTip.unit.test.ts | 4 +- .../display/progressDisplay.unit.test.ts | 10 +- .../interpreterService.unit.test.ts | 56 +-- .../interpreterVersion.unit.test.ts | 8 +- src/test/interpreters/mocks.ts | 6 +- .../pythonPathUpdaterFactory.unit.test.ts | 28 +- .../interpreters/serviceRegistry.unit.test.ts | 12 +- .../condaInheritEnvPrompt.unit.test.ts | 42 +-- .../virtualEnvs/virtualEnvPrompt.unit.test.ts | 30 +- .../languageConfiguration.unit.test.ts | 18 +- src/test/language/tokenizer.unit.test.ts | 10 +- .../jedi/autocomplete/base.test.ts | 38 +- .../jedi/autocomplete/pep484.test.ts | 4 +- .../jedi/autocomplete/pep526.test.ts | 12 +- .../jedi/completionSource.unit.test.ts | 8 +- .../jedi/definitions/hover.jedi.test.ts | 68 ++-- .../jedi/definitions/navigation.test.ts | 26 +- .../jedi/definitions/parallel.jedi.test.ts | 14 +- src/test/languageServers/jedi/lspTeardown.ts | 2 +- .../jedi/pythonSignatureProvider.unit.test.ts | 82 ++--- .../jedi/signature/signature.jedi.test.ts | 16 +- .../jedi/symbolProvider.unit.test.ts | 72 ++-- src/test/linters/common.ts | 14 +- src/test/linters/lint.args.test.ts | 24 +- src/test/linters/lint.functional.test.ts | 156 ++++---- src/test/linters/lint.manager.unit.test.ts | 2 +- src/test/linters/lint.multilinter.test.ts | 4 +- src/test/linters/lint.multiroot.test.ts | 22 +- src/test/linters/lint.provider.test.ts | 10 +- src/test/linters/lint.test.ts | 12 +- src/test/linters/lint.unit.test.ts | 142 ++++---- src/test/linters/lintengine.test.ts | 20 +- .../linters/linter.availability.unit.test.ts | 120 +++--- src/test/linters/linterCommands.unit.test.ts | 10 +- src/test/linters/linterManager.unit.test.ts | 4 +- src/test/linters/linterinfo.unit.test.ts | 26 +- src/test/linters/mypy.unit.test.ts | 14 +- src/test/linters/pylint.test.ts | 16 +- src/test/linters/pylint.unit.test.ts | 42 +-- src/test/linters/serviceRegistry.unit.test.ts | 4 +- src/test/mockClasses.ts | 2 +- src/test/mocks/autoSelector.ts | 2 +- src/test/mocks/proc.ts | 8 +- src/test/mocks/vsc/arrays.ts | 4 +- src/test/mocks/vsc/charCode.ts | 2 +- src/test/mocks/vsc/extHostedTypes.ts | 126 +++---- src/test/mocks/vsc/htmlContent.ts | 2 +- src/test/mocks/vsc/index.ts | 18 +- src/test/mocks/vsc/selection.ts | 12 +- src/test/mocks/vsc/uri.ts | 18 +- src/test/mocks/vsc/uuid.ts | 4 +- src/test/multiRootTest.ts | 2 +- src/test/performance/load.perf.test.ts | 6 +- src/test/performanceTest.ts | 8 +- src/test/proc.ts | 2 +- .../codeActionProvider/main.unit.test.ts | 12 +- .../pythonCodeActionsProvider.unit.test.ts | 8 +- src/test/providers/foldingProvider.test.ts | 18 +- .../providers/importSortProvider.unit.test.ts | 52 +-- src/test/providers/repl.unit.test.ts | 10 +- .../providers/serviceRegistry.unit.test.ts | 8 +- .../shebangCodeLenseProvider.unit.test.ts | 4 +- src/test/providers/terminal.unit.test.ts | 14 +- src/test/pythonEnvironments/base/common.ts | 33 +- .../base/envsCache.unit.test.ts | 42 ++- .../base/info/pythonVersion.unit.test.ts | 5 +- .../base/locatorUtils.unit.test.ts | 38 +- .../base/locators.unit.test.ts | 4 +- .../composite/cachingLocator.unit.test.ts | 11 +- ...kspaceVirtualEnvLocator.testvirtualenvs.ts | 8 +- .../workspaceVirtualEnvLocator.unit.test.ts | 14 +- .../base/watcher.unit.test.ts | 8 +- .../common/environmentIdentifier.unit.test.ts | 65 +++- .../common/windowsUtils.unit.test.ts | 4 +- .../cacheableLocatorService.unit.test.ts | 4 +- .../locators/condaEnvFileService.unit.test.ts | 6 +- .../locators/condaEnvService.unit.test.ts | 92 ++--- .../locators/condaHelper.unit.test.ts | 163 ++++----- .../locators/condaLocator.unit.test.ts | 24 +- .../locators/condaService.unit.test.ts | 86 +++-- .../customVirtualEnvLocator.unit.test.ts | 87 +++-- .../discovery/locators/envTestUtils.ts | 6 +- ...rtualEnvironmentLocator.testvirtualenvs.ts | 5 +- ...obalVirtualEnvironmentLocator.unit.test.ts | 58 ++- .../locators/hasProviderFactory.unit.test.ts | 4 +- .../locators/hashProvider.unit.test.ts | 4 +- .../discovery/locators/helpers.unit.test.ts | 6 +- .../discovery/locators/index.unit.test.ts | 264 ++++---------- .../locators/interpreterFilter.unit.test.ts | 4 +- .../interpreterWatcherBuilder.unit.test.ts | 4 +- .../locators/knownPathService.unit.test.ts | 12 +- .../locators/pipEnvHelper.functional.test.ts | 17 +- .../locators/pipEnvHelper.unit.test.ts | 8 +- .../locators/pipEnvService.unit.test.ts | 24 +- .../posixKnownPathsLocator.unit.test.ts | 16 +- .../locators/progressService.unit.test.ts | 32 +- .../locators/pyenvLocator.testvirtualenvs.ts | 6 +- .../locators/pyenvLocator.unit.test.ts | 173 ++++++--- .../discovery/locators/venv.unit.test.ts | 12 +- .../virtualEnvironmentIdentifier.unit.test.ts | 22 +- .../discovery/locators/watcherTestUtils.ts | 2 +- .../windowsRegistryLocator.unit.test.ts | 156 ++++---- .../windowsRegistryService.unit.test.ts | 15 +- .../windowsStoreInterpreter.unit.test.ts | 6 +- .../locators/windowsStoreLocator.test.ts | 11 +- .../locators/windowsStoreLocator.unit.test.ts | 47 ++- .../workspaceVirtualEnvService.unit.test.ts | 4 +- ...spaceVirtualEnvWatcherService.unit.test.ts | 8 +- .../environmentInfoService.functional.test.ts | 5 +- .../info/interpreter.unit.test.ts | 4 +- src/test/pythonEnvironments/legacyIOC.ts | 7 +- .../pythonEnvironments/legacyIOC.unit.test.ts | 35 +- .../extension.refactor.extract.method.test.ts | 16 +- .../extension.refactor.extract.var.test.ts | 16 +- src/test/refactor/rename.test.ts | 32 +- src/test/serviceRegistry.ts | 28 +- src/test/smoke/common.ts | 6 +- src/test/smoke/datascience.smoke.test.ts | 6 +- src/test/smoke/runInTerminal.smoke.test.ts | 4 +- src/test/smokeTest.ts | 16 +- src/test/sourceMapSupport.test.ts | 12 +- src/test/sourceMapSupport.unit.test.ts | 10 +- src/test/standardTest.ts | 6 +- src/test/startPage/mockCommandManager.ts | 4 +- src/test/startPage/mockDocument.ts | 4 +- src/test/startPage/mockDocumentManager.ts | 8 +- src/test/startPage/mockPythonSettings.ts | 6 +- src/test/startPage/mockTextEditor.ts | 16 +- src/test/startPage/mockWorkspaceConfig.ts | 4 +- src/test/startPage/mountedWebView.ts | 6 +- src/test/startPage/reactHelpers.ts | 24 +- .../startPage/startPage.functional.test.tsx | 4 +- src/test/startPage/startPage.unit.test.ts | 6 +- src/test/startPage/startPageIocContainer.ts | 18 +- src/test/startPage/webBrowserPanel.ts | 12 +- .../telemetry/envFileTelemetry.unit.test.ts | 10 +- src/test/telemetry/index.unit.test.ts | 10 +- ...tensorBoardCodeActionProvider.unit.test.ts | 6 +- .../tensorBoardImportTracker.unit.test.ts | 4 +- src/test/terminals/activation.unit.test.ts | 6 +- .../codeExecutionManager.unit.test.ts | 8 +- .../djangoShellCodeExect.unit.test.ts | 20 +- .../terminals/codeExecution/helper.test.ts | 28 +- .../terminalCodeExec.unit.test.ts | 60 +-- .../terminals/serviceRegistry.unit.test.ts | 12 +- src/test/testLogger.ts | 2 +- src/test/testRunner.ts | 8 +- src/test/testing/argsService.test.ts | 4 +- ...roposeNewLanguageServerBanner.unit.test.ts | 54 +-- .../testing/codeLenses/testFiles.unit.test.ts | 26 +- .../testing/common/debugLauncher.unit.test.ts | 62 ++-- .../managers/baseTestManager.unit.test.ts | 26 +- .../testConfigurationManager.unit.test.ts | 2 +- .../configSettingService.unit.test.ts | 12 +- .../services/contextService.unit.test.ts | 2 +- .../discoveredTestParser.unit.test.ts | 26 +- .../common/services/discovery.unit.test.ts | 10 +- .../services/storageService.unit.test.ts | 26 +- .../services/testResultsService.unit.test.ts | 38 +- .../services/testStatusService.unit.test.ts | 28 +- .../testing/common/testUtils.unit.test.ts | 120 +++--- .../resultResetVisitor.unit.test.ts | 16 +- .../common/trackEnablement.unit.test.ts | 20 +- .../testing/common/xUnitParser.unit.test.ts | 8 +- src/test/testing/configuration.unit.test.ts | 40 +- src/test/testing/debugger.test.ts | 18 +- src/test/testing/display/main.unit.test.ts | 69 ++-- .../testing/display/picker.functional.test.ts | 18 +- src/test/testing/display/picker.unit.test.ts | 52 +-- src/test/testing/explorer/explorerTestData.ts | 18 +- .../explorer/failedTestHandler.unit.test.ts | 12 +- .../testExplorerCommandHandler.unit.test.ts | 12 +- .../explorer/testTreeViewItem.unit.test.ts | 2 +- .../testTreeViewProvider.unit.test.ts | 132 +++---- .../testing/explorer/treeView.unit.test.ts | 10 +- src/test/testing/helper.ts | 2 +- src/test/testing/mocks.ts | 6 +- .../navigation/commandHandlers.unit.test.ts | 26 +- .../navigation/functionNavigator.unit.test.ts | 6 +- .../testing/navigation/helper.unit.test.ts | 4 +- .../navigation/serviceRegistry.unit.test.ts | 18 +- .../navigation/suiteNavigator.unit.test.ts | 8 +- .../navigation/symbolNavigator.unit.test.ts | 26 +- .../nosetest/nosetest.discovery.unit.test.ts | 6 +- .../nosetest/nosetest.disovery.test.ts | 12 +- .../testing/nosetest/nosetest.run.test.ts | 12 +- src/test/testing/nosetest/nosetest.test.ts | 4 +- .../testing/pytest/pytest.discovery.test.ts | 287 +++++++-------- src/test/testing/pytest/pytest.run.test.ts | 70 ++-- src/test/testing/pytest/pytest.test.ts | 6 +- .../pytest/pytest.testMessageService.test.ts | 36 +- .../testing/pytest/pytest_run_tests_data.ts | 86 ++--- .../pytest/pytest_unittest_parser_data.ts | 344 +++++++++--------- .../services/discoveryService.unit.test.ts | 20 +- src/test/testing/rediscover.test.ts | 2 +- src/test/testing/results.ts | 48 +-- src/test/testing/serviceRegistry.ts | 14 +- .../testing/stoppingDiscoverAndTest.test.ts | 12 +- .../unittest/unittest.discovery.test.ts | 28 +- .../unittest/unittest.discovery.unit.test.ts | 42 +-- .../testing/unittest/unittest.run.test.ts | 86 ++--- src/test/testing/unittest/unittest.test.ts | 66 ++-- .../testing/unittest/unittest.unit.test.ts | 40 +- src/test/textUtils.ts | 2 +- src/test/utils/fs.ts | 2 +- src/test/utils/interpreters.ts | 2 +- src/test/workspaceSymbols/common.ts | 2 +- .../workspaceSymbols/generator.unit.test.ts | 14 +- src/test/workspaceSymbols/main.unit.test.ts | 36 +- .../workspaceSymbols/provider.unit.test.ts | 10 +- 894 files changed, 8092 insertions(+), 8105 deletions(-) delete mode 100644 .prettierignore diff --git a/.eslintrc b/.eslintrc index fe804c081f6a..0a40f0738760 100644 --- a/.eslintrc +++ b/.eslintrc @@ -11,7 +11,8 @@ "plugin:@typescript-eslint/recommended", "plugin:import/errors", "plugin:import/warnings", - "plugin:import/typescript" + "plugin:import/typescript", + "prettier" ], "rules": { // Overriding ESLint rules with Typescript-specific ones @@ -40,14 +41,7 @@ "no-useless-constructor": "off", "@typescript-eslint/no-useless-constructor": "error", "@typescript-eslint/no-var-requires": "off", - // Overriding formatting rules to let Prettier handle them - "comma-dangle": "off", - "function-paren-newline": "off", - "implicit-arrow-linebreak": "off", - "indent": "off", - "max-len": "off", - "object-curly-newline": ["error", {"ImportDeclaration": {"consistent": true}}], - "operator-linebreak": "off", + // Other rules "class-methods-use-this": ["error", {"exceptMethods": ["dispose"]}], "func-names": "off", @@ -63,12 +57,6 @@ "import/prefer-default-export": "off", "linebreak-style": "off", "no-await-in-loop": "off", - "no-confusing-arrow": [ - "error", - { - "allowParens": true - } - ], "no-console": "off", "no-control-regex": "off", "no-extend-native": "off", diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 953832c3207c..000000000000 --- a/.prettierignore +++ /dev/null @@ -1,3 +0,0 @@ -# Ignore the pythonEnvironments/ folder because we use ESLint there instead -src/client/pythonEnvironments/* -src/test/pythonEnvironments/* diff --git a/.prettierrc.js b/.prettierrc.js index 23ec5ae2a998..87a94b7bf466 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -3,7 +3,7 @@ module.exports = { printWidth: 120, tabWidth: 4, endOfLine: 'auto', - trailingComma: 'none', + trailingComma: 'all', overrides: [ { files: ['*.yml', '*.yaml'], diff --git a/build/webpack/common.js b/build/webpack/common.js index 1fee7773e884..4f065dfa3782 100644 --- a/build/webpack/common.js +++ b/build/webpack/common.js @@ -24,7 +24,7 @@ exports.nodeModulesToExternalize = [ 'diff-match-patch', 'sudo-prompt', 'node-stream-zip', - 'xml2js' + 'xml2js', ]; exports.nodeModulesToReplacePaths = [...exports.nodeModulesToExternalize]; function getDefaultPlugins(name) { @@ -37,8 +37,8 @@ function getDefaultPlugins(name) { reportFilename: `${name}.analyzer.html`, generateStatsFile: true, statsFilename: `${name}.stats.json`, - openAnalyzer: false // Open file manually if you want to see it :) - }) + openAnalyzer: false, // Open file manually if you want to see it :) + }), ); } return plugins; diff --git a/build/webpack/plugins/less-plugin-base64.js b/build/webpack/plugins/less-plugin-base64.js index f245baf46a8a..21c4bbf734b9 100644 --- a/build/webpack/plugins/less-plugin-base64.js +++ b/build/webpack/plugins/less-plugin-base64.js @@ -36,7 +36,7 @@ class Base64Visitor { 'data-uri', [new Base64MimeTypeNode(), URLNode.value], URLNode.index || 0, - URLNode.currentFileInfo + URLNode.currentFileInfo, ); } } diff --git a/build/webpack/webpack.extension.config.js b/build/webpack/webpack.extension.config.js index b6c01b0a6ca5..944fcaf47648 100644 --- a/build/webpack/webpack.extension.config.js +++ b/build/webpack/webpack.extension.config.js @@ -15,11 +15,11 @@ const config = { mode: 'production', target: 'node', entry: { - extension: './src/client/extension.ts' + extension: './src/client/extension.ts', }, devtool: 'source-map', node: { - __dirname: false + __dirname: false, }, module: { rules: [ @@ -27,28 +27,28 @@ const config = { test: /\.ts$/, use: [ { - loader: path.join(__dirname, 'loaders', 'externalizeDependencies.js') - } - ] + loader: path.join(__dirname, 'loaders', 'externalizeDependencies.js'), + }, + ], }, { test: /\.ts$/, exclude: /node_modules/, use: [ { - loader: 'ts-loader' - } - ] + loader: 'ts-loader', + }, + ], }, { test: /\.node$/, use: [ { - loader: 'node-loader' - } - ] - } - ] + loader: 'node-loader', + }, + ], + }, + ], }, externals: ['vscode', 'commonjs', ...existingModulesInOutDir], plugins: [...common.getDefaultPlugins('extension')], @@ -57,17 +57,17 @@ const config = { // Pointing pdfkit to a dummy js file so webpack doesn't fall over. // Since pdfkit has been externalized (it gets updated with the valid code by copying the pdfkit files // into the right destination). - pdfkit: path.resolve(__dirname, 'pdfkit.js') + pdfkit: path.resolve(__dirname, 'pdfkit.js'), }, extensions: ['.ts', '.js'], - plugins: [new tsconfig_paths_webpack_plugin.TsconfigPathsPlugin({ configFile: configFileName })] + plugins: [new tsconfig_paths_webpack_plugin.TsconfigPathsPlugin({ configFile: configFileName })], }, output: { filename: '[name].js', path: path.resolve(constants.ExtensionRootDir, 'out', 'client'), libraryTarget: 'commonjs2', - devtoolModuleFilenameTemplate: '../../[resource-path]' - } + devtoolModuleFilenameTemplate: '../../[resource-path]', + }, }; // tslint:disable-next-line:no-default-export exports.default = config; diff --git a/build/webpack/webpack.extension.dependencies.config.js b/build/webpack/webpack.extension.dependencies.config.js index 1f24d4f8ebed..7d3bd51b3155 100644 --- a/build/webpack/webpack.extension.dependencies.config.js +++ b/build/webpack/webpack.extension.dependencies.config.js @@ -18,7 +18,7 @@ const config = { entry: entryItems, devtool: 'source-map', node: { - __dirname: false + __dirname: false, }, module: {}, externals: ['vscode', 'commonjs'], @@ -26,17 +26,17 @@ const config = { ...common.getDefaultPlugins('dependencies'), // vsls requires our package.json to be next to node_modules. It's how they // 'find' the calling extension. - new copyWebpackPlugin([{ from: './package.json', to: '.' }]) + new copyWebpackPlugin([{ from: './package.json', to: '.' }]), ], resolve: { - extensions: ['.js'] + extensions: ['.js'], }, output: { filename: '[name].js', path: path.resolve(constants.ExtensionRootDir, 'out', 'client'), libraryTarget: 'commonjs2', - devtoolModuleFilenameTemplate: '../../[resource-path]' - } + devtoolModuleFilenameTemplate: '../../[resource-path]', + }, }; // tslint:disable-next-line:no-default-export exports.default = config; diff --git a/build/webpack/webpack.startPage-ui.config.builder.js b/build/webpack/webpack.startPage-ui.config.builder.js index 4dedb9e7d8bb..2a7bfb0c444c 100644 --- a/build/webpack/webpack.startPage-ui.config.builder.js +++ b/build/webpack/webpack.startPage-ui.config.builder.js @@ -24,7 +24,7 @@ function getEntry(bundle) { switch (bundle) { case 'viewers': return { - startPage: [`./src/startPage-ui/startPage/index.tsx`] + startPage: [`./src/startPage-ui/startPage/index.tsx`], }; default: throw new Error(`Bundle not supported ${bundle}`); @@ -37,8 +37,8 @@ function getPlugins(bundle) { checkSyntacticErrors: true, tsconfig: configFileName, reportFiles: ['src/startPage-ui/**/*.{ts,tsx}'], - memoryLimit: 9096 - }) + memoryLimit: 9096, + }), ]; if (isProdBuild) { plugins.push(...common.getDefaultPlugins(bundle)); @@ -47,8 +47,8 @@ function getPlugins(bundle) { case 'viewers': { const definePlugin = new webpack.DefinePlugin({ 'process.env': { - NODE_ENV: JSON.stringify('production') - } + NODE_ENV: JSON.stringify('production'), + }, }); plugins.push( @@ -58,9 +58,9 @@ function getPlugins(bundle) { template: 'src/startPage-ui/startPage/index.html', indexUrl: `${constants.ExtensionRootDir}/out/1`, chunks: ['commons', 'startPage'], - filename: 'index.startPage.html' - }) - ] + filename: 'index.startPage.html', + }), + ], ); break; } @@ -81,9 +81,9 @@ function buildConfiguration(bundle) { ...[ { from: path.join(constants.ExtensionRootDir, 'node_modules/font-awesome/**/*'), - to: path.join(constants.ExtensionRootDir, 'out', 'startPage-ui', bundleFolder, 'node_modules') - } - ] + to: path.join(constants.ExtensionRootDir, 'out', 'startPage-ui', bundleFolder, 'node_modules'), + }, + ], ); } const config = { @@ -92,7 +92,7 @@ function buildConfiguration(bundle) { output: { path: path.join(constants.ExtensionRootDir, 'out', 'startPage-ui', bundleFolder), filename: '[name].js', - chunkFilename: `[name].bundle.js` + chunkFilename: `[name].bundle.js`, }, mode: 'development', // Leave as is, we'll need to see stack traces when there are errors. devtool: isProdBuild ? 'source-map' : 'inline-source-map', @@ -111,7 +111,7 @@ function buildConfiguration(bundle) { name: 'commons', chunks: 'initial', minChunks: bundle === 'notebook' ? 2 : 1, // We want at least one shared bundle (2 for notebooks, as we want monago split into another). - filename: '[name].initial.bundle.js' + filename: '[name].initial.bundle.js', }, // Even though nteract has been split up, some of them are large as nteract alone is large. // This will ensure nteract (just some of the nteract) goes into a separate bundle. @@ -128,7 +128,7 @@ function buildConfiguration(bundle) { module.resource && module.resource.includes(`${path.sep}node_modules${path.sep}@nteract`) ); - } + }, }, // Bundling `plotly` with nteract isn't the best option, as this plotly alone is 6mb. // This will ensure it is in a seprate bundle, hence small files for SSH scenarios. @@ -143,7 +143,7 @@ function buildConfiguration(bundle) { return ( module.resource && module.resource.includes(`${path.sep}node_modules${path.sep}plotly`) ); - } + }, }, // Monaco is a monster. For SSH again, we pull this into a seprate bundle. // This is only a solution for SSH. @@ -160,14 +160,14 @@ function buildConfiguration(bundle) { return ( module.resource && module.resource.includes(`${path.sep}node_modules${path.sep}monaco`) ); - } - } - } + }, + }, + }, }, - chunkIds: 'named' + chunkIds: 'named', }, node: { - fs: 'empty' + fs: 'empty', }, plugins: [ new FixDefaultImportPlugin(), @@ -179,21 +179,21 @@ function buildConfiguration(bundle) { { from: './**/*theme*.json', to: '.' }, { from: path.join(constants.ExtensionRootDir, 'node_modules/requirejs/require.js'), - to: path.join(constants.ExtensionRootDir, 'out', 'startPage-ui', bundleFolder) + to: path.join(constants.ExtensionRootDir, 'out', 'startPage-ui', bundleFolder), }, - ...filesToCopy + ...filesToCopy, ], - { context: 'src' } + { context: 'src' }, ), new webpack.optimize.LimitChunkCountPlugin({ - maxChunks: 100 + maxChunks: 100, }), - ...getPlugins(bundle) + ...getPlugins(bundle), ], externals: ['log4js'], resolve: { // Add '.ts' and '.tsx' as resolvable extensions. - extensions: ['.ts', '.tsx', '.js', '.json', '.svg'] + extensions: ['.ts', '.tsx', '.js', '.json', '.svg'], }, module: { @@ -208,8 +208,8 @@ function buildConfiguration(bundle) { // there should be 1 cpu for the fork-ts-checker-webpack-plugin workers: require('os').cpus().length - 1, workerNodeArgs: ['--max-old-space-size=9096'], - poolTimeout: isProdBuild ? 1000 : Infinity // set this to Infinity in watch mode - see https://github.com/webpack-contrib/thread-loader - } + poolTimeout: isProdBuild ? 1000 : Infinity, // set this to Infinity in watch mode - see https://github.com/webpack-contrib/thread-loader + }, }, { loader: 'ts-loader', @@ -218,18 +218,18 @@ function buildConfiguration(bundle) { configFile: configFileName, // Faster (turn on only on CI, for dev we don't need this). transpileOnly: true, - reportFiles: ['src/startPage-ui/**/*.{ts,tsx}'] - } - } - ] + reportFiles: ['src/startPage-ui/**/*.{ts,tsx}'], + }, + }, + ], }, { test: /\.svg$/, - use: ['svg-inline-loader'] + use: ['svg-inline-loader'], }, { test: /\.css$/, - use: ['style-loader', 'css-loader'] + use: ['style-loader', 'css-loader'], }, { test: /\.js$/, @@ -237,9 +237,9 @@ function buildConfiguration(bundle) { use: [ { loader: path.resolve('./build/webpack/loaders/remarkLoader.js'), - options: {} - } - ] + options: {}, + }, + ], }, { test: /\.json$/, @@ -248,25 +248,25 @@ function buildConfiguration(bundle) { use: [ { loader: path.resolve('./build/webpack/loaders/jsonloader.js'), - options: {} - } - ] + options: {}, + }, + ], }, { test: /\.(png|woff|woff2|eot|gif|ttf)$/, use: [ { loader: 'url-loader?limit=100000', - options: { esModule: false } - } - ] + options: { esModule: false }, + }, + ], }, { test: /\.less$/, - use: ['style-loader', 'css-loader', 'less-loader'] - } - ] - } + use: ['style-loader', 'css-loader', 'less-loader'], + }, + ], + }, }; if (bundle === 'renderers') { diff --git a/package-lock.json b/package-lock.json index 5007751395f8..814972ed2d66 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6480,9 +6480,9 @@ } }, "eslint-config-prettier": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz", - "integrity": "sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA==", + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.15.0.tgz", + "integrity": "sha512-a1+kOYLR8wMGustcgAjdydMsQ2A/2ipRPwRKUmfYaSxc9ZPcrku080Ctl6zrZzZNs/U82MjSv+qKREkoq3bJaw==", "dev": true, "requires": { "get-stdin": "^6.0.0" @@ -6874,9 +6874,9 @@ } }, "eslint-plugin-prettier": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.2.tgz", - "integrity": "sha512-GlolCC9y3XZfv3RQfwGew7NnuFDKsfI4lbvRK+PIIo23SFH+LemGs4cKwzAaRa+Mdb+lQO/STaIayno8T5sJJA==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.3.0.tgz", + "integrity": "sha512-tMTwO8iUWlSRZIwS9k7/E4vrTsfvsrcM5p1eftyuqWH25nKsz/o6/54I7jwQ/3zobISyC7wMy9ZsFwgTxOcOpQ==", "dev": true, "requires": { "prettier-linter-helpers": "^1.0.0" diff --git a/package.json b/package.json index 8095595a2f4b..44488304aac4 100644 --- a/package.json +++ b/package.json @@ -2114,10 +2114,9 @@ "enzyme-adapter-react-16": "^1.6.0", "eslint": "^7.2.0", "eslint-config-airbnb": "^18.2.0", - "eslint-config-prettier": "^6.9.0", + "eslint-config-prettier": "^6.15.0", "eslint-plugin-import": "^2.22.0", "eslint-plugin-jsx-a11y": "^6.3.1", - "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.20.3", "eslint-plugin-react-hooks": "^4.0.0", "expose-loader": "^0.7.5", diff --git a/src/client/activation/activationManager.ts b/src/client/activation/activationManager.ts index bf53a1d18103..ca2276838036 100644 --- a/src/client/activation/activationManager.ts +++ b/src/client/activation/activationManager.ts @@ -37,7 +37,7 @@ export class ExtensionActivationManager implements IExtensionActivationManager { @inject(IActiveResourceService) private readonly activeResourceService: IActiveResourceService, @inject(IExperimentsManager) private readonly experiments: IExperimentsManager, @inject(IInterpreterPathService) private readonly interpreterPathService: IInterpreterPathService, - @inject(IInterpreterSecurityService) private readonly interpreterSecurityService: IInterpreterSecurityService + @inject(IInterpreterSecurityService) private readonly interpreterSecurityService: IInterpreterSecurityService, ) {} public dispose() { @@ -55,7 +55,7 @@ export class ExtensionActivationManager implements IExtensionActivationManager { // Activate all activation services together. await Promise.all([ Promise.all(this.singleActivationServices.map((item) => item.activate())), - this.activateWorkspace(this.activeResourceService.getActiveResource()) + this.activateWorkspace(this.activeResourceService.getActiveResource()), ]); await this.autoSelection.autoSelectInterpreter(undefined); } @@ -114,7 +114,7 @@ export class ExtensionActivationManager implements IExtensionActivationManager { this.isInterpreterSetForWorkspacePromises.set(workspaceKey, isInterpreterSetForWorkspace); await Promise.race([ isInterpreterSetForWorkspace.promise, - this.interpreterSecurityService.evaluateAndRecordInterpreterSafety(interpreter, resource) + this.interpreterSecurityService.evaluateAndRecordInterpreterSafety(interpreter, resource), ]); } } else { @@ -131,7 +131,7 @@ export class ExtensionActivationManager implements IExtensionActivationManager { protected addHandlers() { this.disposables.push(this.workspaceService.onDidChangeWorkspaceFolders(this.onWorkspaceFoldersChanged, this)); this.disposables.push( - this.interpreterPathService.onDidChange((i) => this.evaluateAutoSelectedInterpreterSafety(i.uri)) + this.interpreterPathService.onDidChange((i) => this.evaluateAutoSelectedInterpreterSafety(i.uri)), ); } protected addRemoveDocOpenedHandlers() { @@ -149,7 +149,7 @@ export class ExtensionActivationManager implements IExtensionActivationManager { protected onWorkspaceFoldersChanged() { //If an activated workspace folder was removed, delete its key const workspaceKeys = this.workspaceService.workspaceFolders!.map((workspaceFolder) => - this.getWorkspaceKey(workspaceFolder.uri) + this.getWorkspaceKey(workspaceFolder.uri), ); const activatedWkspcKeys = Array.from(this.activatedWorkspaces.keys()); const activatedWkspcFoldersRemoved = activatedWkspcKeys.filter((item) => workspaceKeys.indexOf(item) < 0); diff --git a/src/client/activation/activationService.ts b/src/client/activation/activationService.ts index e076b9625869..2433a3e8d818 100644 --- a/src/client/activation/activationService.ts +++ b/src/client/activation/activationService.ts @@ -11,7 +11,7 @@ import { IApplicationEnvironment, IApplicationShell, ICommandManager, - IWorkspaceService + IWorkspaceService, } from '../common/application/types'; import { STANDARD_OUTPUT_CHANNEL } from '../common/constants'; import { traceError } from '../common/logger'; @@ -22,7 +22,7 @@ import { IOutputChannel, IPersistentStateFactory, IPythonSettings, - Resource + Resource, } from '../common/types'; import { swallowExceptions } from '../common/utils/decorators'; import { LanguageService } from '../common/utils/localize'; @@ -39,7 +39,7 @@ import { IExtensionActivationService, ILanguageServerActivator, ILanguageServerCache, - LanguageServerType + LanguageServerType, } from './types'; const languageServerSetting: keyof IPythonSettings = 'languageServer'; @@ -64,7 +64,7 @@ export class LanguageServerExtensionActivationService constructor( @inject(IServiceContainer) private serviceContainer: IServiceContainer, - @inject(IPersistentStateFactory) private stateFactory: IPersistentStateFactory + @inject(IPersistentStateFactory) private stateFactory: IPersistentStateFactory, ) { this.workspaceService = this.serviceContainer.get(IWorkspaceService); this.interpreterService = this.serviceContainer.get(IInterpreterService); @@ -77,7 +77,7 @@ export class LanguageServerExtensionActivationService disposables.push(this.workspaceService.onDidChangeWorkspaceFolders(this.onWorkspaceFoldersChanged, this)); disposables.push(this.interpreterService.onDidChangeInterpreter(this.onDidChangeInterpreter.bind(this))); disposables.push( - commandManager.registerCommand(Commands.ClearAnalyisCache, this.onClearAnalysisCaches.bind(this)) + commandManager.registerCommand(Commands.ClearAnalyisCache, this.onClearAnalysisCaches.bind(this)), ); this.languageServerChangeHandler = new LanguageServerChangeHandler( @@ -85,7 +85,7 @@ export class LanguageServerExtensionActivationService this.serviceContainer.get(IExtensions), this.serviceContainer.get(IApplicationShell), this.serviceContainer.get(IApplicationEnvironment), - this.serviceContainer.get(ICommandManager) + this.serviceContainer.get(ICommandManager), ); disposables.push(this.languageServerChangeHandler); } @@ -148,7 +148,7 @@ export class LanguageServerExtensionActivationService public async sendTelemetryForChosenLanguageServer(languageServer: LanguageServerType): Promise { const state = this.stateFactory.createGlobalPersistentState( 'SWITCH_LS', - undefined + undefined, ); if (typeof state.value !== 'string') { await state.updateValue(languageServer); @@ -156,11 +156,11 @@ export class LanguageServerExtensionActivationService if (state.value !== languageServer) { await state.updateValue(languageServer); sendTelemetryEvent(EventName.PYTHON_LANGUAGE_SERVER_CURRENT_SELECTION, undefined, { - switchTo: languageServer + switchTo: languageServer, }); } else { sendTelemetryEvent(EventName.PYTHON_LANGUAGE_SERVER_CURRENT_SELECTION, undefined, { - lsStartup: languageServer + lsStartup: languageServer, }); } } @@ -188,7 +188,7 @@ export class LanguageServerExtensionActivationService protected async onWorkspaceFoldersChanged() { //If an activated workspace folder was removed, dispose its activator const workspaceKeys = await Promise.all( - this.workspaceService.workspaceFolders!.map((workspaceFolder) => this.getKey(workspaceFolder.uri)) + this.workspaceService.workspaceFolders!.map((workspaceFolder) => this.getKey(workspaceFolder.uri)), ); const activatedWkspcKeys = Array.from(this.cache.keys()); const activatedWkspcFoldersRemoved = activatedWkspcKeys.filter((item) => workspaceKeys.indexOf(item) < 0); @@ -213,19 +213,19 @@ export class LanguageServerExtensionActivationService private async createRefCountedServer( resource: Resource, interpreter: PythonEnvironment | undefined, - key: string + key: string, ): Promise { let serverType = this.getCurrentLanguageServerType(); if (serverType === LanguageServerType.Microsoft) { const lsNotSupportedDiagnosticService = this.serviceContainer.get( IDiagnosticsService, - LSNotSupportedDiagnosticServiceId + LSNotSupportedDiagnosticServiceId, ); const diagnostic = await lsNotSupportedDiagnosticService.diagnose(undefined); lsNotSupportedDiagnosticService.handle(diagnostic).ignoreErrors(); if (diagnostic.length) { sendTelemetryEvent(EventName.PYTHON_LANGUAGE_SERVER_PLATFORM_SUPPORTED, undefined, { - supported: false + supported: false, }); serverType = LanguageServerType.Jedi; } @@ -302,7 +302,7 @@ export class LanguageServerExtensionActivationService const resourcePortion = this.workspaceService.getWorkspaceFolderIdentifier( resource, - workspacePathNameForGlobalWorkspaces + workspacePathNameForGlobalWorkspaces, ); interpreter = interpreter ? interpreter : await this.interpreterService.getActiveInterpreter(resource); const interperterPortion = interpreter ? `${interpreter.path}-${interpreter.envName}` : ''; diff --git a/src/client/activation/common/activatorBase.ts b/src/client/activation/common/activatorBase.ts index 7a3c972ef960..0836d3570f85 100644 --- a/src/client/activation/common/activatorBase.ts +++ b/src/client/activation/common/activatorBase.ts @@ -18,7 +18,7 @@ import { SignatureHelpContext, SymbolInformation, TextDocument, - WorkspaceEdit + WorkspaceEdit, } from 'vscode'; import * as vscodeLanguageClient from 'vscode-languageclient/node'; @@ -44,7 +44,7 @@ export abstract class LanguageServerActivatorBase implements ILanguageServerActi protected readonly manager: ILanguageServerManager, private readonly workspace: IWorkspaceService, protected readonly fs: IFileSystem, - protected readonly configurationService: IConfigurationService + protected readonly configurationService: IConfigurationService, ) {} @traceDecorators.error('Failed to activate language server') @@ -81,7 +81,7 @@ export abstract class LanguageServerActivatorBase implements ILanguageServerActi sendProgress: languageClient.sendProgress.bind(languageClient), onRequest: languageClient.onRequest.bind(languageClient), onNotification: languageClient.onNotification.bind(languageClient), - onProgress: languageClient.onProgress.bind(languageClient) + onProgress: languageClient.onProgress.bind(languageClient), }; } } @@ -97,7 +97,7 @@ export abstract class LanguageServerActivatorBase implements ILanguageServerActi document: TextDocument, position: Position, newName: string, - token: CancellationToken + token: CancellationToken, ): ProviderResult { return this.handleProvideRenameEdits(document, position, newName, token); } @@ -105,7 +105,7 @@ export abstract class LanguageServerActivatorBase implements ILanguageServerActi public provideDefinition( document: TextDocument, position: Position, - token: CancellationToken + token: CancellationToken, ): ProviderResult { return this.handleProvideDefinition(document, position, token); } @@ -118,7 +118,7 @@ export abstract class LanguageServerActivatorBase implements ILanguageServerActi document: TextDocument, position: Position, context: ReferenceContext, - token: CancellationToken + token: CancellationToken, ): ProviderResult { return this.handleProvideReferences(document, position, context, token); } @@ -127,7 +127,7 @@ export abstract class LanguageServerActivatorBase implements ILanguageServerActi document: TextDocument, position: Position, token: CancellationToken, - context: CompletionContext + context: CompletionContext, ): ProviderResult { return this.handleProvideCompletionItems(document, position, token, context); } @@ -138,7 +138,7 @@ export abstract class LanguageServerActivatorBase implements ILanguageServerActi public provideDocumentSymbols( document: TextDocument, - token: CancellationToken + token: CancellationToken, ): ProviderResult { return this.handleProvideDocumentSymbols(document, token); } @@ -147,7 +147,7 @@ export abstract class LanguageServerActivatorBase implements ILanguageServerActi document: TextDocument, position: Position, token: CancellationToken, - context: SignatureHelpContext + context: SignatureHelpContext, ): ProviderResult { return this.handleProvideSignatureHelp(document, position, token, context); } @@ -163,14 +163,14 @@ export abstract class LanguageServerActivatorBase implements ILanguageServerActi document: TextDocument, position: Position, newName: string, - token: CancellationToken + token: CancellationToken, ): Promise { const languageClient = this.getLanguageClient(); if (languageClient) { const args: vscodeLanguageClient.RenameParams = { textDocument: languageClient.code2ProtocolConverter.asTextDocumentIdentifier(document), position: languageClient.code2ProtocolConverter.asPosition(position), - newName + newName, }; const result = await languageClient.sendRequest(vscodeLanguageClient.RenameRequest.type, args, token); if (result) { @@ -182,13 +182,13 @@ export abstract class LanguageServerActivatorBase implements ILanguageServerActi private async handleProvideDefinition( document: TextDocument, position: Position, - token: CancellationToken + token: CancellationToken, ): Promise { const languageClient = this.getLanguageClient(); if (languageClient) { const args: vscodeLanguageClient.TextDocumentPositionParams = { textDocument: languageClient.code2ProtocolConverter.asTextDocumentIdentifier(document), - position: languageClient.code2ProtocolConverter.asPosition(position) + position: languageClient.code2ProtocolConverter.asPosition(position), }; const result = await languageClient.sendRequest(vscodeLanguageClient.DefinitionRequest.type, args, token); if (result) { @@ -200,13 +200,13 @@ export abstract class LanguageServerActivatorBase implements ILanguageServerActi private async handleProvideHover( document: TextDocument, position: Position, - token: CancellationToken + token: CancellationToken, ): Promise { const languageClient = this.getLanguageClient(); if (languageClient) { const args: vscodeLanguageClient.TextDocumentPositionParams = { textDocument: languageClient.code2ProtocolConverter.asTextDocumentIdentifier(document), - position: languageClient.code2ProtocolConverter.asPosition(position) + position: languageClient.code2ProtocolConverter.asPosition(position), }; const result = await languageClient.sendRequest(vscodeLanguageClient.HoverRequest.type, args, token); if (result) { @@ -219,14 +219,14 @@ export abstract class LanguageServerActivatorBase implements ILanguageServerActi document: TextDocument, position: Position, context: ReferenceContext, - token: CancellationToken + token: CancellationToken, ): Promise { const languageClient = this.getLanguageClient(); if (languageClient) { const args: vscodeLanguageClient.ReferenceParams = { textDocument: languageClient.code2ProtocolConverter.asTextDocumentIdentifier(document), position: languageClient.code2ProtocolConverter.asPosition(position), - context + context, }; const result = await languageClient.sendRequest(vscodeLanguageClient.ReferencesRequest.type, args, token); if (result) { @@ -241,12 +241,12 @@ export abstract class LanguageServerActivatorBase implements ILanguageServerActi private async handleProvideCodeLenses( document: TextDocument, - token: CancellationToken + token: CancellationToken, ): Promise { const languageClient = this.getLanguageClient(); if (languageClient) { const args: vscodeLanguageClient.CodeLensParams = { - textDocument: languageClient.code2ProtocolConverter.asTextDocumentIdentifier(document) + textDocument: languageClient.code2ProtocolConverter.asTextDocumentIdentifier(document), }; const result = await languageClient.sendRequest(vscodeLanguageClient.CodeLensRequest.type, args, token); if (result) { @@ -259,7 +259,7 @@ export abstract class LanguageServerActivatorBase implements ILanguageServerActi document: TextDocument, position: Position, token: CancellationToken, - context: CompletionContext + context: CompletionContext, ): Promise { const languageClient = this.getLanguageClient(); if (languageClient) { @@ -273,17 +273,17 @@ export abstract class LanguageServerActivatorBase implements ILanguageServerActi private async handleProvideDocumentSymbols( document: TextDocument, - token: CancellationToken + token: CancellationToken, ): Promise { const languageClient = this.getLanguageClient(); if (languageClient) { const args: vscodeLanguageClient.DocumentSymbolParams = { - textDocument: languageClient.code2ProtocolConverter.asTextDocumentIdentifier(document) + textDocument: languageClient.code2ProtocolConverter.asTextDocumentIdentifier(document), }; const result = await languageClient.sendRequest( vscodeLanguageClient.DocumentSymbolRequest.type, args, - token + token, ); if (result && result.length) { // tslint:disable-next-line: no-any @@ -304,18 +304,18 @@ export abstract class LanguageServerActivatorBase implements ILanguageServerActi document: TextDocument, position: Position, token: CancellationToken, - _context: SignatureHelpContext + _context: SignatureHelpContext, ): Promise { const languageClient = this.getLanguageClient(); if (languageClient) { const args: vscodeLanguageClient.TextDocumentPositionParams = { textDocument: languageClient.code2ProtocolConverter.asTextDocumentIdentifier(document), - position: languageClient.code2ProtocolConverter.asPosition(position) + position: languageClient.code2ProtocolConverter.asPosition(position), }; const result = await languageClient.sendRequest( vscodeLanguageClient.SignatureHelpRequest.type, args, - token + token, ); if (result) { return languageClient.protocol2CodeConverter.asSignatureHelp(result); diff --git a/src/client/activation/common/analysisOptions.ts b/src/client/activation/common/analysisOptions.ts index a5f462f2daf8..60edc13c893e 100644 --- a/src/client/activation/common/analysisOptions.ts +++ b/src/client/activation/common/analysisOptions.ts @@ -21,7 +21,7 @@ export abstract class LanguageServerAnalysisOptionsBase implements ILanguageServ protected constructor( private readonly envVarsProvider: IEnvironmentVariablesProvider, - lsOutputChannel: ILanguageServerOutputChannel + lsOutputChannel: ILanguageServerOutputChannel, ) { this.output = lsOutputChannel.channel; } @@ -49,11 +49,11 @@ export abstract class LanguageServerAnalysisOptionsBase implements ILanguageServ documentSelector, workspaceFolder, synchronize: { - configurationSection: PYTHON_LANGUAGE + configurationSection: PYTHON_LANGUAGE, }, outputChannel: this.output, revealOutputChannelOn: RevealOutputChannelOn.Never, - initializationOptions: await this.getInitializationOptions() + initializationOptions: await this.getInitializationOptions(), }; } diff --git a/src/client/activation/common/cancellationUtils.ts b/src/client/activation/common/cancellationUtils.ts index 10f1c20c9dc3..ef5770536f04 100644 --- a/src/client/activation/common/cancellationUtils.ts +++ b/src/client/activation/common/cancellationUtils.ts @@ -16,7 +16,7 @@ import { CancellationSenderStrategy, CancellationStrategy, Disposable, - MessageConnection + MessageConnection, } from 'vscode-languageclient/node'; type CancellationId = string | number; diff --git a/src/client/activation/common/downloadChannelRules.ts b/src/client/activation/common/downloadChannelRules.ts index ebffee922377..d014b3c19599 100644 --- a/src/client/activation/common/downloadChannelRules.ts +++ b/src/client/activation/common/downloadChannelRules.ts @@ -32,7 +32,7 @@ export class DownloadBetaChannelRule implements IDownloadChannelRule { const globalState = stateFactory.createGlobalPersistentState( lastCheckedForLSDateTimeCacheKey, true, - frequencyForBetalLSDownloadCheck + frequencyForBetalLSDownloadCheck, ); // If we have checked it in the last 24 hours, then ensure we don't do it again. diff --git a/src/client/activation/common/downloader.ts b/src/client/activation/common/downloader.ts index b4e690e6b919..a50dc57fe617 100644 --- a/src/client/activation/common/downloader.ts +++ b/src/client/activation/common/downloader.ts @@ -21,7 +21,7 @@ import { ILanguageServerDownloader, ILanguageServerFolderService, ILanguageServerOutputChannel, - IPlatformData + IPlatformData, } from '../types'; // tslint:disable:no-require-imports no-any @@ -38,7 +38,7 @@ export class LanguageServerDownloader implements ILanguageServerDownloader { @inject(IApplicationShell) private readonly appShell: IApplicationShell, @inject(IFileSystem) private readonly fs: IFileSystem, @inject(IWorkspaceService) private readonly workspace: IWorkspaceService, - @inject(IServiceContainer) private readonly services: IServiceContainer + @inject(IServiceContainer) private readonly services: IServiceContainer, ) { this.output = this.lsOutputChannel.channel; } @@ -73,7 +73,7 @@ export class LanguageServerDownloader implements ILanguageServerDownloader { try { localTempFilePath = await this.downloadFile( downloadUri, - 'Downloading Microsoft Python Language Server... ' + 'Downloading Microsoft Python Language Server... ', ); } catch (err) { this.output.appendLine(LanguageService.downloadFailedOutputMessage()); @@ -84,7 +84,7 @@ export class LanguageServerDownloader implements ILanguageServerDownloader { EventName.PYTHON_LANGUAGE_SERVER_ERROR, undefined, { error: 'Failed to download (platform)' }, - err + err, ); throw new Error(err); } finally { @@ -93,7 +93,7 @@ export class LanguageServerDownloader implements ILanguageServerDownloader { success, lsVersion, usedSSL, - lsName + lsName, }); } @@ -109,14 +109,14 @@ export class LanguageServerDownloader implements ILanguageServerDownloader { EventName.PYTHON_LANGUAGE_SERVER_ERROR, undefined, { error: 'Failed to extract (platform)' }, - err + err, ); throw new Error(err); } finally { sendTelemetryEvent(EventName.PYTHON_LANGUAGE_SERVER_EXTRACTED, timer.elapsedTime, { success, lsVersion, - lsName + lsName, }); await this.fs.deleteFile(localTempFilePath); } @@ -134,7 +134,7 @@ export class LanguageServerDownloader implements ILanguageServerDownloader { const downloadOptions = { extension: downloadFileExtension, outputChannel: this.output, - progressMessagePrefix: title + progressMessagePrefix: title, }; return this.fileDownloader.downloadFile(uri, downloadOptions).then((file) => { this.output.appendLine(LanguageService.extractionCompletedOutputMessage()); @@ -150,14 +150,14 @@ export class LanguageServerDownloader implements ILanguageServerDownloader { const title = 'Extracting files... '; await window.withProgress( { - location: ProgressLocation.Window + location: ProgressLocation.Window, }, (progress) => { // tslint:disable-next-line:no-require-imports no-var-requires const StreamZip = require('node-stream-zip'); const zip = new StreamZip({ file: tempFilePath, - storeEntries: true + storeEntries: true, }); let totalFiles = 0; @@ -184,7 +184,7 @@ export class LanguageServerDownloader implements ILanguageServerDownloader { deferred.reject(e); }); return deferred.promise; - } + }, ); // Set file to executable (nothing happens in Windows, as chmod has no definition there) diff --git a/src/client/activation/common/languageServerChangeHandler.ts b/src/client/activation/common/languageServerChangeHandler.ts index c154ba83b1fb..5724cbc3dc50 100644 --- a/src/client/activation/common/languageServerChangeHandler.ts +++ b/src/client/activation/common/languageServerChangeHandler.ts @@ -12,13 +12,13 @@ import { LanguageServerType } from '../types'; export async function promptForPylanceInstall( appShell: IApplicationShell, - appEnv: IApplicationEnvironment + appEnv: IApplicationEnvironment, ): Promise { // If not installed, point user to Pylance at the store. const response = await appShell.showWarningMessage( Pylance.installPylanceMessage(), Common.bannerLabelYes(), - Common.bannerLabelNo() + Common.bannerLabelNo(), ); if (response === Common.bannerLabelYes()) { @@ -38,13 +38,13 @@ export class LanguageServerChangeHandler implements Disposable { private readonly extensions: IExtensions, private readonly appShell: IApplicationShell, private readonly appEnv: IApplicationEnvironment, - private readonly commands: ICommandManager + private readonly commands: ICommandManager, ) { this.pylanceInstalled = this.isPylanceInstalled(); this.disposables.push( extensions.onDidChange(async () => { await this.extensionsChangeHandler(); - }) + }), ); } @@ -78,7 +78,7 @@ export class LanguageServerChangeHandler implements Disposable { } else { response = await this.appShell.showInformationMessage( LanguageService.reloadAfterLanguageServerChange(), - Common.reload() + Common.reload(), ); if (response === Common.reload()) { this.commands.executeCommand('workbench.action.reloadWindow'); @@ -99,7 +99,7 @@ export class LanguageServerChangeHandler implements Disposable { const response = await this.appShell.showWarningMessage( Pylance.pylanceInstalledReloadPromptMessage(), Common.bannerLabelYes(), - Common.bannerLabelNo() + Common.bannerLabelNo(), ); this.pylanceInstallCompletedDeferred.resolve(); diff --git a/src/client/activation/common/languageServerFolderService.ts b/src/client/activation/common/languageServerFolderService.ts index ae501d8b709e..895387855221 100644 --- a/src/client/activation/common/languageServerFolderService.ts +++ b/src/client/activation/common/languageServerFolderService.ts @@ -16,14 +16,14 @@ import { FolderVersionPair, IDownloadChannelRule, ILanguageServerFolderService, - ILanguageServerPackageService + ILanguageServerPackageService, } from '../types'; @injectable() export abstract class LanguageServerFolderService implements ILanguageServerFolderService { constructor( @inject(IServiceContainer) protected readonly serviceContainer: IServiceContainer, - @unmanaged() protected readonly languageServerFolder: string + @unmanaged() protected readonly languageServerFolder: string, ) {} public async skipDownload(): Promise { @@ -57,7 +57,7 @@ export abstract class LanguageServerFolderService implements ILanguageServerFold public getLatestLanguageServerVersion(resource: Resource): Promise { const minVersion = this.getMinimalLanguageServerVersion(); const lsPackageService = this.serviceContainer.get( - ILanguageServerPackageService + ILanguageServerPackageService, ); return lsPackageService.getLatestNugetPackageVersion(resource, minVersion); } @@ -108,7 +108,7 @@ export abstract class LanguageServerFolderService implements ILanguageServerFold private getDownloadChannel() { const lsPackageService = this.serviceContainer.get( - ILanguageServerPackageService + ILanguageServerPackageService, ); return lsPackageService.getLanguageServerDownloadChannel(); } diff --git a/src/client/activation/common/languageServerPackageService.ts b/src/client/activation/common/languageServerPackageService.ts index feed13c03b53..385667e95329 100644 --- a/src/client/activation/common/languageServerPackageService.ts +++ b/src/client/activation/common/languageServerPackageService.ts @@ -23,7 +23,7 @@ export abstract class LanguageServerPackageService implements ILanguageServerPac constructor( protected readonly serviceContainer: IServiceContainer, protected readonly appEnv: IApplicationEnvironment, - protected readonly platform: IPlatformService + protected readonly platform: IPlatformService, ) {} public abstract getNugetPackageName(): string; @@ -80,7 +80,7 @@ export abstract class LanguageServerPackageService implements ILanguageServerPac package: LanguageServerDownloadChannel.stable, uri: `${azureCDNBlobStorageAccount}/${ LanguageServerDownloadChannel.stable - }/${this.getNugetPackageName()}.${minimumVersion}.nupkg` + }/${this.getNugetPackageName()}.${minimumVersion}.nupkg`, }; } } diff --git a/src/client/activation/common/packageRepository.ts b/src/client/activation/common/packageRepository.ts index ba073d7b1808..719a3d7c0296 100644 --- a/src/client/activation/common/packageRepository.ts +++ b/src/client/activation/common/packageRepository.ts @@ -13,7 +13,7 @@ export const azureCDNBlobStorageAccount = 'https://pvsc.azureedge.net'; export enum LanguageServerDownloadChannel { stable = 'stable', beta = 'beta', - daily = 'daily' + daily = 'daily', } @injectable() @@ -23,7 +23,7 @@ export abstract class StableLanguageServerPackageRepository extends AzureBlobSto serviceContainer, azureBlobStorageAccount, `${packageName}-${LanguageServerDownloadChannel.stable}`, - azureCDNBlobStorageAccount + azureCDNBlobStorageAccount, ); } } @@ -35,7 +35,7 @@ export abstract class BetaLanguageServerPackageRepository extends AzureBlobStore serviceContainer, azureBlobStorageAccount, `${packageName}-${LanguageServerDownloadChannel.beta}`, - azureCDNBlobStorageAccount + azureCDNBlobStorageAccount, ); } } @@ -47,7 +47,7 @@ export abstract class DailyLanguageServerPackageRepository extends AzureBlobStor serviceContainer, azureBlobStorageAccount, `${packageName}-${LanguageServerDownloadChannel.daily}`, - azureCDNBlobStorageAccount + azureCDNBlobStorageAccount, ); } } diff --git a/src/client/activation/extensionSurvey.ts b/src/client/activation/extensionSurvey.ts index 35e271490607..3bf2ee5f0c53 100644 --- a/src/client/activation/extensionSurvey.ts +++ b/src/client/activation/extensionSurvey.ts @@ -20,7 +20,7 @@ import { IExtensionSingleActivationService } from './types'; // persistent state names, exported to make use of in testing export enum extensionSurveyStateKeys { doNotShowAgain = 'doNotShowExtensionSurveyAgain', - disableSurveyForTime = 'doNotShowExtensionSurveyUntilTime' + disableSurveyForTime = 'doNotShowExtensionSurveyUntilTime', } const timeToDisableSurveyFor = 1000 * 60 * 60 * 24 * 7 * 12; // 12 weeks @@ -37,7 +37,7 @@ export class ExtensionSurveyPrompt implements IExtensionSingleActivationService @inject(IApplicationEnvironment) private appEnvironment: IApplicationEnvironment, @inject(IPlatformService) private platformService: IPlatformService, @optional() private sampleSizePerOneHundredUsers: number = 10, - @optional() private waitTimeToShowSurvey: number = WAIT_TIME_TO_SHOW_SURVEY + @optional() private waitTimeToShowSurvey: number = WAIT_TIME_TO_SHOW_SURVEY, ) {} public async activate(): Promise { @@ -59,7 +59,7 @@ export class ExtensionSurveyPrompt implements IExtensionSingleActivationService } const doNotShowSurveyAgain = this.persistentState.createGlobalPersistentState( extensionSurveyStateKeys.doNotShowAgain, - false + false, ); if (doNotShowSurveyAgain.value) { return false; @@ -67,7 +67,7 @@ export class ExtensionSurveyPrompt implements IExtensionSingleActivationService const isSurveyDisabledForTimeState = this.persistentState.createGlobalPersistentState( extensionSurveyStateKeys.disableSurveyForTime, false, - timeToDisableSurveyFor + timeToDisableSurveyFor, ); if (isSurveyDisabledForTimeState.value) { return false; @@ -85,16 +85,16 @@ export class ExtensionSurveyPrompt implements IExtensionSingleActivationService const prompts = [ ExtensionSurveyBanner.bannerLabelYes(), ExtensionSurveyBanner.maybeLater(), - Common.doNotShowAgain() + Common.doNotShowAgain(), ]; const telemetrySelections: ['Yes', 'Maybe later', 'Do not show again'] = [ 'Yes', 'Maybe later', - 'Do not show again' + 'Do not show again', ]; const selection = await this.appShell.showInformationMessage(ExtensionSurveyBanner.bannerMessage(), ...prompts); sendTelemetryEvent(EventName.EXTENSION_SURVEY_PROMPT, undefined, { - selection: selection ? telemetrySelections[prompts.indexOf(selection)] : undefined + selection: selection ? telemetrySelections[prompts.indexOf(selection)] : undefined, }); if (!selection) { return; @@ -106,7 +106,7 @@ export class ExtensionSurveyPrompt implements IExtensionSingleActivationService .createGlobalPersistentState( extensionSurveyStateKeys.disableSurveyForTime, false, - timeToDisableSurveyFor + timeToDisableSurveyFor, ) .updateValue(true); } else if (selection === Common.doNotShowAgain()) { @@ -122,7 +122,7 @@ export class ExtensionSurveyPrompt implements IExtensionSingleActivationService o: encodeURIComponent(this.platformService.osType), // platform v: encodeURIComponent(this.appEnvironment.vscodeVersion), e: encodeURIComponent(this.appEnvironment.packageJson.version), // extension version - m: encodeURIComponent(this.appEnvironment.sessionId) + m: encodeURIComponent(this.appEnvironment.sessionId), }); const url = `https://aka.ms/AA5rjx5?${query}`; this.browserService.launch(url); diff --git a/src/client/activation/jedi.ts b/src/client/activation/jedi.ts index 7b964d5e7974..84074bc83195 100644 --- a/src/client/activation/jedi.ts +++ b/src/client/activation/jedi.ts @@ -22,7 +22,7 @@ import { SignatureHelpContext, SymbolInformation, TextDocument, - WorkspaceEdit + WorkspaceEdit, } from 'vscode'; import { PYTHON } from '../common/constants'; @@ -121,22 +121,22 @@ export class JediExtensionActivator implements ILanguageServerActivator { // IDE. this.registrations.push( commands.registerCommand('python.goToPythonObject', () => - this.objectDefinitionProvider!.goToObjectDefinition() - ) + this.objectDefinitionProvider!.goToObjectDefinition(), + ), ); this.registrations.push(languages.registerRenameProvider(this.documentSelector, this.renameProvider)); this.registrations.push( - languages.registerDefinitionProvider(this.documentSelector, this.definitionProvider) + languages.registerDefinitionProvider(this.documentSelector, this.definitionProvider), ); this.registrations.push(languages.registerHoverProvider(this.documentSelector, this.hoverProvider)); this.registrations.push(languages.registerReferenceProvider(this.documentSelector, this.referenceProvider)); this.registrations.push( - languages.registerCompletionItemProvider(this.documentSelector, this.completionProvider, '.') + languages.registerCompletionItemProvider(this.documentSelector, this.completionProvider, '.'), ); this.registrations.push(languages.registerCodeLensProvider(this.documentSelector, this.codeLensProvider)); const onTypeDispatcher = new OnTypeFormattingDispatcher({ '\n': new OnEnterFormatter(), - ':': new BlockFormatProviders() + ':': new BlockFormatProviders(), }); const onTypeTriggers = onTypeDispatcher.getTriggerCharacters(); if (onTypeTriggers) { @@ -145,17 +145,17 @@ export class JediExtensionActivator implements ILanguageServerActivator { PYTHON, onTypeDispatcher, onTypeTriggers.first, - ...onTypeTriggers.more - ) + ...onTypeTriggers.more, + ), ); } this.registrations.push( - languages.registerDocumentSymbolProvider(this.documentSelector, this.symbolProvider) + languages.registerDocumentSymbolProvider(this.documentSelector, this.symbolProvider), ); const pythonSettings = this.serviceManager.get(IConfigurationService).getSettings(); if (pythonSettings.devOptions.indexOf('DISABLE_SIGNATURE') === -1) { this.registrations.push( - languages.registerSignatureHelpProvider(this.documentSelector, this.signatureProvider, '(', ',') + languages.registerSignatureHelpProvider(this.documentSelector, this.signatureProvider, '(', ','), ); } } @@ -165,7 +165,7 @@ export class JediExtensionActivator implements ILanguageServerActivator { document: TextDocument, position: Position, newName: string, - token: CancellationToken + token: CancellationToken, ): ProviderResult { if (this.renameProvider) { return this.renameProvider.provideRenameEdits(document, position, newName, token); @@ -174,7 +174,7 @@ export class JediExtensionActivator implements ILanguageServerActivator { public provideDefinition( document: TextDocument, position: Position, - token: CancellationToken + token: CancellationToken, ): ProviderResult { if (this.definitionProvider) { return this.definitionProvider.provideDefinition(document, position, token); @@ -189,7 +189,7 @@ export class JediExtensionActivator implements ILanguageServerActivator { document: TextDocument, position: Position, context: ReferenceContext, - token: CancellationToken + token: CancellationToken, ): ProviderResult { if (this.referenceProvider) { return this.referenceProvider.provideReferences(document, position, context, token); @@ -199,7 +199,7 @@ export class JediExtensionActivator implements ILanguageServerActivator { document: TextDocument, position: Position, token: CancellationToken, - _context: CompletionContext + _context: CompletionContext, ): ProviderResult { if (this.completionProvider) { return this.completionProvider.provideCompletionItems(document, position, token); @@ -222,7 +222,7 @@ export class JediExtensionActivator implements ILanguageServerActivator { } public provideDocumentSymbols( document: TextDocument, - token: CancellationToken + token: CancellationToken, ): ProviderResult { if (this.symbolProvider) { return this.symbolProvider.provideDocumentSymbols(document, token); @@ -232,7 +232,7 @@ export class JediExtensionActivator implements ILanguageServerActivator { document: TextDocument, position: Position, token: CancellationToken, - _context: SignatureHelpContext + _context: SignatureHelpContext, ): ProviderResult { if (this.signatureProvider) { return this.signatureProvider.provideSignatureHelp(document, position, token); diff --git a/src/client/activation/jedi/activator.ts b/src/client/activation/jedi/activator.ts index 460dfa64dc68..206b82ae9e67 100644 --- a/src/client/activation/jedi/activator.ts +++ b/src/client/activation/jedi/activator.ts @@ -24,7 +24,7 @@ export class JediLanguageServerActivator extends LanguageServerActivatorBase { @inject(ILanguageServerManager) manager: ILanguageServerManager, @inject(IWorkspaceService) workspace: IWorkspaceService, @inject(IFileSystem) fs: IFileSystem, - @inject(IConfigurationService) configurationService: IConfigurationService + @inject(IConfigurationService) configurationService: IConfigurationService, ) { super(manager, workspace, fs, configurationService); } diff --git a/src/client/activation/jedi/analysisOptions.ts b/src/client/activation/jedi/analysisOptions.ts index 5291b8e02d66..435d40b0b6ae 100644 --- a/src/client/activation/jedi/analysisOptions.ts +++ b/src/client/activation/jedi/analysisOptions.ts @@ -11,7 +11,7 @@ export class JediLanguageServerAnalysisOptions extends LanguageServerAnalysisOpt // eslint-disable-next-line @typescript-eslint/no-useless-constructor constructor( @inject(IEnvironmentVariablesProvider) envVarsProvider: IEnvironmentVariablesProvider, - @inject(ILanguageServerOutputChannel) lsOutputChannel: ILanguageServerOutputChannel + @inject(ILanguageServerOutputChannel) lsOutputChannel: ILanguageServerOutputChannel, ) { super(envVarsProvider, lsOutputChannel); } diff --git a/src/client/activation/jedi/languageClientFactory.ts b/src/client/activation/jedi/languageClientFactory.ts index 329a7c3b2d9f..1b361cf098a3 100644 --- a/src/client/activation/jedi/languageClientFactory.ts +++ b/src/client/activation/jedi/languageClientFactory.ts @@ -21,7 +21,7 @@ export class JediLanguageClientFactory implements ILanguageClientFactory { public async createLanguageClient( resource: Resource, _interpreter: PythonEnvironment | undefined, - clientOptions: LanguageClientOptions + clientOptions: LanguageClientOptions, ): Promise { // Just run the language server using a module const jediServerModulePath = path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'runJediLanguageServer.py'); @@ -30,7 +30,7 @@ export class JediLanguageClientFactory implements ILanguageClientFactory { const args = [jediServerModulePath]; const serverOptions: ServerOptions = { command: pythonPath, - args + args, }; // eslint-disable-next-line global-require @@ -39,7 +39,7 @@ export class JediLanguageClientFactory implements ILanguageClientFactory { PYTHON_LANGUAGE, languageClientName, serverOptions, - clientOptions + clientOptions, ); } } diff --git a/src/client/activation/jedi/languageServerProxy.ts b/src/client/activation/jedi/languageServerProxy.ts index 2915972ac2b9..f086225481f4 100644 --- a/src/client/activation/jedi/languageServerProxy.ts +++ b/src/client/activation/jedi/languageServerProxy.ts @@ -8,7 +8,7 @@ import { Disposable, LanguageClient, LanguageClientOptions, - State + State, } from 'vscode-languageclient/node'; import { DeprecatePythonPath } from '../../common/experiments/groups'; @@ -46,14 +46,14 @@ export class JediLanguageServerProxy implements ILanguageServerProxy { @inject(ITestManagementService) private readonly testManager: ITestManagementService, @inject(IConfigurationService) private readonly configurationService: IConfigurationService, @inject(IExperimentsManager) private readonly experiments: IExperimentsManager, - @inject(IInterpreterPathService) private readonly interpreterPathService: IInterpreterPathService + @inject(IInterpreterPathService) private readonly interpreterPathService: IInterpreterPathService, ) { this.startupCompleted = createDeferred(); } private static versionTelemetryProps(instance: JediLanguageServerProxy) { return { - lsVersion: instance.lsVersion + lsVersion: instance.lsVersion, }; } @@ -85,12 +85,12 @@ export class JediLanguageServerProxy implements ILanguageServerProxy { undefined, true, undefined, - JediLanguageServerProxy.versionTelemetryProps + JediLanguageServerProxy.versionTelemetryProps, ) public async start( resource: Resource, interpreter: PythonEnvironment | undefined, - options: LanguageClientOptions + options: LanguageClientOptions, ): Promise { if (!this.languageClient) { this.lsVersion = @@ -135,7 +135,7 @@ export class JediLanguageServerProxy implements ILanguageServerProxy { undefined, true, undefined, - JediLanguageServerProxy.versionTelemetryProps + JediLanguageServerProxy.versionTelemetryProps, ) protected async serverReady(): Promise { while (this.languageClient && !this.languageClient.initializeResult) { @@ -172,9 +172,9 @@ export class JediLanguageServerProxy implements ILanguageServerProxy { // This is needed as interpreter changes via the interpreter path service happen // outside of VS Code's settings (which would mean VS Code sends the config updates itself). this.languageClient!.sendNotification(DidChangeConfigurationNotification.type, { - settings: null + settings: null, }); - }) + }), ); } @@ -185,7 +185,7 @@ export class JediLanguageServerProxy implements ILanguageServerProxy { const formattedProperties = { ...telemetryEvent.Properties, // Replace all slashes in the method name so it doesn't get scrubbed by vscode-extension-telemetry. - method: telemetryEvent.Properties.method?.replace(/\//g, '.') + method: telemetryEvent.Properties.method?.replace(/\//g, '.'), }; sendTelemetryEvent(eventName, telemetryEvent.Measurements, formattedProperties); }); diff --git a/src/client/activation/jedi/manager.ts b/src/client/activation/jedi/manager.ts index c7173ce9172b..66df9a5605b8 100644 --- a/src/client/activation/jedi/manager.ts +++ b/src/client/activation/jedi/manager.ts @@ -21,7 +21,7 @@ import { ILanguageServerAnalysisOptions, ILanguageServerManager, ILanguageServerProxy, - LanguageServerType + LanguageServerType, } from '../types'; @injectable() @@ -45,18 +45,18 @@ export class JediLanguageServerManager implements ILanguageServerManager { @inject(ILanguageServerAnalysisOptions) @named(LanguageServerType.Jedi) private readonly analysisOptions: ILanguageServerAnalysisOptions, - @inject(ICommandManager) commandManager: ICommandManager + @inject(ICommandManager) commandManager: ICommandManager, ) { this.disposables.push( commandManager.registerCommand(Commands.RestartLS, () => { this.restartLanguageServer().ignoreErrors(); - }) + }), ); } private static versionTelemetryProps(instance: JediLanguageServerManager) { return { - lsVersion: instance.lsVersion + lsVersion: instance.lsVersion, }; } @@ -125,7 +125,7 @@ export class JediLanguageServerManager implements ILanguageServerManager { undefined, true, undefined, - JediLanguageServerManager.versionTelemetryProps + JediLanguageServerManager.versionTelemetryProps, ) @traceDecorators.verbose('Starting language server') protected async startLanguageServer(): Promise { @@ -136,7 +136,7 @@ export class JediLanguageServerManager implements ILanguageServerManager { this.serviceContainer, LanguageServerType.Jedi, () => this.languageServerProxy?.languageClient, - this.lsVersion + this.lsVersion, ); options.middleware = this.middleware; diff --git a/src/client/activation/jedi/multiplexingActivator.ts b/src/client/activation/jedi/multiplexingActivator.ts index f8819b13b9cf..b531efb1febb 100644 --- a/src/client/activation/jedi/multiplexingActivator.ts +++ b/src/client/activation/jedi/multiplexingActivator.ts @@ -9,7 +9,7 @@ import { Position, ReferenceContext, SignatureHelpContext, - TextDocument + TextDocument, } from 'vscode'; import { ServerCapabilities } from 'vscode-languageserver-protocol'; // tslint:disable-next-line: import-name @@ -22,7 +22,7 @@ import { IConfigurationService, IExperimentService, IPythonExtensionBanner, - Resource + Resource, } from '../../common/types'; import { IServiceManager } from '../../ioc/types'; import { PythonEnvironment } from '../../pythonEnvironments/info'; @@ -51,7 +51,7 @@ export class MultiplexingJediLanguageServerActivator implements ILanguageServerA @inject(IExperimentService) experimentService: IExperimentService, @inject(IPythonExtensionBanner) @named(BANNER_NAME_PROPOSE_LS) - private proposePylancePopup: IPythonExtensionBanner + private proposePylancePopup: IPythonExtensionBanner, ) { // Check experiment service to see if using new Jedi LSP protocol this.realLanguageServerPromise = experimentService.inExperiment(JediLSP.experiment).then((inExperiment) => { @@ -62,7 +62,7 @@ export class MultiplexingJediLanguageServerActivator implements ILanguageServerA this.manager.get(ILanguageServerManager), this.manager.get(IWorkspaceService), this.manager.get(IFileSystem), - this.manager.get(IConfigurationService) + this.manager.get(IConfigurationService), ); return this.realLanguageServer; }); @@ -110,7 +110,7 @@ export class MultiplexingJediLanguageServerActivator implements ILanguageServerA document: TextDocument, position: Position, newName: string, - token: CancellationToken + token: CancellationToken, ) { const server = await this.realLanguageServerPromise; return server.provideRenameEdits(document, position, newName, token); @@ -130,7 +130,7 @@ export class MultiplexingJediLanguageServerActivator implements ILanguageServerA document: TextDocument, position: Position, context: ReferenceContext, - token: CancellationToken + token: CancellationToken, ) { const server = await this.realLanguageServerPromise; return server.provideReferences(document, position, context, token); @@ -140,7 +140,7 @@ export class MultiplexingJediLanguageServerActivator implements ILanguageServerA document: TextDocument, position: Position, token: CancellationToken, - context: CompletionContext + context: CompletionContext, ) { const server = await this.realLanguageServerPromise; return server.provideCompletionItems(document, position, token, context); @@ -160,7 +160,7 @@ export class MultiplexingJediLanguageServerActivator implements ILanguageServerA document: TextDocument, position: Position, token: CancellationToken, - context: SignatureHelpContext + context: SignatureHelpContext, ) { const server = await this.realLanguageServerPromise; return server.provideSignatureHelp(document, position, token, context); diff --git a/src/client/activation/languageClientMiddleware.ts b/src/client/activation/languageClientMiddleware.ts index 48b903c5106f..c95c56eff99b 100644 --- a/src/client/activation/languageClientMiddleware.ts +++ b/src/client/activation/languageClientMiddleware.ts @@ -20,7 +20,7 @@ import { SymbolInformation, TextEdit, Uri, - WorkspaceEdit + WorkspaceEdit, } from 'vscode'; import { ConfigurationParams, @@ -29,7 +29,7 @@ import { HandlerResult, LanguageClient, Middleware, - ResponseError + ResponseError, } from 'vscode-languageclient/node'; import { IJupyterExtensionDependencyManager, IVSCodeNotebook } from '../common/application/types'; @@ -67,7 +67,7 @@ export class LanguageClientMiddleware implements Middleware { configuration: ( params: ConfigurationParams, token: CancellationToken, - next: ConfigurationRequest.HandlerSignature + next: ConfigurationRequest.HandlerSignature, ): HandlerResult => { const configService = this.serviceContainer.get(IConfigurationService); @@ -96,7 +96,7 @@ export class LanguageClientMiddleware implements Middleware { } return addPythonPath(result); - } + }, // tslint:enable:no-any }; private notebookAddon: NotebookMiddlewareAddon | undefined; @@ -107,7 +107,7 @@ export class LanguageClientMiddleware implements Middleware { readonly serviceContainer: IServiceContainer, serverType: LanguageServerType, getClient: () => LanguageClient | undefined, - public readonly serverVersion?: string + public readonly serverVersion?: string, ) { this.handleDiagnostics = this.handleDiagnostics.bind(this); // VS Code calls function without context. this.didOpen = this.didOpen.bind(this); @@ -131,7 +131,7 @@ export class LanguageClientMiddleware implements Middleware { const experimentsManager = this.serviceContainer.get(IExperimentsManager); const jupyterDependencyManager = this.serviceContainer.get( - IJupyterExtensionDependencyManager + IJupyterExtensionDependencyManager, ); const notebookApi = this.serviceContainer.get(IVSCodeNotebook); const disposables = this.serviceContainer.get(IDisposableRegistry) || []; @@ -149,7 +149,7 @@ export class LanguageClientMiddleware implements Middleware { getClient, fileSystem, PYTHON_LANGUAGE, - /.*\.ipynb/m + /.*\.ipynb/m, ); } disposables.push( @@ -163,11 +163,11 @@ export class LanguageClientMiddleware implements Middleware { getClient, fileSystem, PYTHON_LANGUAGE, - /.*\.ipynb/m + /.*\.ipynb/m, ); } } - }) + }), ); } @@ -413,7 +413,7 @@ function captureTelemetryForLSPMethod(method: string, debounceMilliseconds: numb const properties = { lsVersion: this.serverVersion || 'unknown', - method: formattedMethod + method: formattedMethod, }; const stopWatch = new StopWatch(); diff --git a/src/client/activation/languageServer/activator.ts b/src/client/activation/languageServer/activator.ts index 69d810540817..9fdccbb8bbbc 100644 --- a/src/client/activation/languageServer/activator.ts +++ b/src/client/activation/languageServer/activator.ts @@ -32,7 +32,7 @@ export class DotNetLanguageServerActivator extends LanguageServerActivatorBase { @inject(IConfigurationService) configurationService: IConfigurationService, @inject(IPythonExtensionBanner) @named(BANNER_NAME_PROPOSE_LS) - private proposePylancePopup: IPythonExtensionBanner + private proposePylancePopup: IPythonExtensionBanner, ) { super(manager, workspace, fs, configurationService); } @@ -54,7 +54,7 @@ export class DotNetLanguageServerActivator extends LanguageServerActivatorBase { public async prepareLanguageServerForNoICU(languageServerFolderPath: string): Promise { const targetJsonFile = path.join( languageServerFolderPath, - 'Microsoft.Python.LanguageServer.runtimeconfig.json' + 'Microsoft.Python.LanguageServer.runtimeconfig.json', ); // tslint:disable-next-line:no-any let content: any = {}; @@ -80,7 +80,7 @@ export class DotNetLanguageServerActivator extends LanguageServerActivatorBase { private async ensureLanguageServerFileIsAvailable( resource: Resource, - fileName: string + fileName: string, ): Promise { const settings = this.configurationService.getSettings(resource); if (settings.downloadLanguageServer === false) { diff --git a/src/client/activation/languageServer/analysisOptions.ts b/src/client/activation/languageServer/analysisOptions.ts index c9e2806b5154..cfcd6ff0163b 100644 --- a/src/client/activation/languageServer/analysisOptions.ts +++ b/src/client/activation/languageServer/analysisOptions.ts @@ -29,7 +29,8 @@ export class DotNetLanguageServerAnalysisOptions extends LanguageServerAnalysisO @inject(IWorkspaceService) private readonly workspace: IWorkspaceService, @inject(ILanguageServerOutputChannel) lsOutputChannel: ILanguageServerOutputChannel, @inject(IPathUtils) private readonly pathUtils: IPathUtils, - @inject(ILanguageServerFolderService) private readonly languageServerFolderService: ILanguageServerFolderService + @inject(ILanguageServerFolderService) + private readonly languageServerFolderService: ILanguageServerFolderService, ) { super(envVarsProvider, lsOutputChannel); } @@ -104,12 +105,12 @@ export class DotNetLanguageServerAnalysisOptions extends LanguageServerAnalysisO return { interpreter: { - properties + properties, }, searchPaths, typeStubSearchPaths: this.typeshedPaths, cacheFolderPath: this.getCacheFolderPath(), - excludeFiles: this.excludedFiles + excludeFiles: this.excludedFiles, }; } diff --git a/src/client/activation/languageServer/languageClientFactory.ts b/src/client/activation/languageServer/languageClientFactory.ts index e49b4b841b71..2359973a6468 100644 --- a/src/client/activation/languageServer/languageClientFactory.ts +++ b/src/client/activation/languageServer/languageClientFactory.ts @@ -20,32 +20,32 @@ const languageClientName = 'Python Tools'; export class DotNetDownloadedLanguageClientFactory implements ILanguageClientFactory { constructor( private readonly platformData: IPlatformData, - private readonly languageServerFolderService: ILanguageServerFolderService + private readonly languageServerFolderService: ILanguageServerFolderService, ) {} public async createLanguageClient( resource: Resource, _interpreter: PythonEnvironment | undefined, clientOptions: LanguageClientOptions, - env?: NodeJS.ProcessEnv + env?: NodeJS.ProcessEnv, ): Promise { const languageServerFolder = await this.languageServerFolderService.getLanguageServerFolderName(resource); const serverModule = path.join( EXTENSION_ROOT_DIR, languageServerFolder, - this.platformData.engineExecutableName + this.platformData.engineExecutableName, ); const options = { stdio: 'pipe', env }; const serverOptions: ServerOptions = { run: { command: serverModule, args: [], options }, - debug: { command: serverModule, args: ['--debug'], options } + debug: { command: serverModule, args: ['--debug'], options }, }; const vscodeLanguageClient = require('vscode-languageclient/node') as typeof import('vscode-languageclient/node'); return new vscodeLanguageClient.LanguageClient( PYTHON_LANGUAGE, languageClientName, serverOptions, - clientOptions + clientOptions, ); } } @@ -53,28 +53,28 @@ export class DotNetDownloadedLanguageClientFactory implements ILanguageClientFac export class DotNetSimpleLanguageClientFactory implements ILanguageClientFactory { constructor( private readonly platformData: IPlatformData, - private readonly languageServerFolderService: ILanguageServerFolderService + private readonly languageServerFolderService: ILanguageServerFolderService, ) {} public async createLanguageClient( resource: Resource, _interpreter: PythonEnvironment | undefined, clientOptions: LanguageClientOptions, - env?: NodeJS.ProcessEnv + env?: NodeJS.ProcessEnv, ): Promise { const languageServerFolder = await this.languageServerFolderService.getLanguageServerFolderName(resource); const options = { stdio: 'pipe', env }; const serverModule = path.join(EXTENSION_ROOT_DIR, languageServerFolder, this.platformData.engineDllName); const serverOptions: ServerOptions = { run: { command: dotNetCommand, args: [serverModule], options }, - debug: { command: dotNetCommand, args: [serverModule, '--debug'], options } + debug: { command: dotNetCommand, args: [serverModule, '--debug'], options }, }; const vscodeLanguageClient = require('vscode-languageclient/node') as typeof import('vscode-languageclient/node'); return new vscodeLanguageClient.LanguageClient( PYTHON_LANGUAGE, languageClientName, serverOptions, - clientOptions + clientOptions, ); } } @@ -90,13 +90,13 @@ export class DotNetLanguageClientFactory implements ILanguageClientFactory { @inject(ILanguageServerFolderService) private readonly languageServerFolderService: ILanguageServerFolderService, @unmanaged() private readonly downloadedFactory: ILanguageClientFactory, - @unmanaged() private readonly simpleFactory: ILanguageClientFactory + @unmanaged() private readonly simpleFactory: ILanguageClientFactory, ) {} public async createLanguageClient( resource: Resource, interpreter: PythonEnvironment | undefined, - clientOptions: LanguageClientOptions + clientOptions: LanguageClientOptions, ): Promise { const settings = this.configurationService.getSettings(resource); let factory: ILanguageClientFactory; @@ -113,7 +113,7 @@ export class DotNetLanguageClientFactory implements ILanguageClientFactory { private async getEnvVars( resource: Resource, - interpreter: PythonEnvironment | undefined + interpreter: PythonEnvironment | undefined, ): Promise { const envVars = await this.environmentActivationService.getActivatedEnvironmentVariables(resource, interpreter); if (envVars && Object.keys(envVars).length > 0) { diff --git a/src/client/activation/languageServer/languageServerCompatibilityService.ts b/src/client/activation/languageServer/languageServerCompatibilityService.ts index 48c1e0729595..6d2a4cdf68db 100644 --- a/src/client/activation/languageServer/languageServerCompatibilityService.ts +++ b/src/client/activation/languageServer/languageServerCompatibilityService.ts @@ -13,20 +13,20 @@ import { ILanguageServerCompatibilityService } from '../types'; @injectable() export class LanguageServerCompatibilityService implements ILanguageServerCompatibilityService { constructor( - @inject(IDotNetCompatibilityService) private readonly dotnetCompatibility: IDotNetCompatibilityService + @inject(IDotNetCompatibilityService) private readonly dotnetCompatibility: IDotNetCompatibilityService, ) {} public async isSupported(): Promise { try { const supported = await this.dotnetCompatibility.isSupported(); sendTelemetryEvent(EventName.PYTHON_LANGUAGE_SERVER_PLATFORM_SUPPORTED, undefined, { - supported: supported + supported: supported, }); return supported; } catch (ex) { traceError('Unable to determine whether LS is supported', ex); sendTelemetryEvent(EventName.PYTHON_LANGUAGE_SERVER_PLATFORM_SUPPORTED, undefined, { supported: false, - failureType: 'UnknownError' + failureType: 'UnknownError', }); return false; } diff --git a/src/client/activation/languageServer/languageServerPackageRepository.ts b/src/client/activation/languageServer/languageServerPackageRepository.ts index b9c8f3da797e..5da19c895dc8 100644 --- a/src/client/activation/languageServer/languageServerPackageRepository.ts +++ b/src/client/activation/languageServer/languageServerPackageRepository.ts @@ -8,7 +8,7 @@ import { IServiceContainer } from '../../ioc/types'; import { BetaLanguageServerPackageRepository, DailyLanguageServerPackageRepository, - StableLanguageServerPackageRepository + StableLanguageServerPackageRepository, } from '../common/packageRepository'; const languageServerPackageName = 'python-language-server'; diff --git a/src/client/activation/languageServer/languageServerPackageService.ts b/src/client/activation/languageServer/languageServerPackageService.ts index 9a912645fb4f..62e2b7077aee 100644 --- a/src/client/activation/languageServer/languageServerPackageService.ts +++ b/src/client/activation/languageServer/languageServerPackageService.ts @@ -16,7 +16,7 @@ export const PackageNames = { [PlatformName.Windows32Bit]: `${downloadBaseFileName}-${PlatformName.Windows32Bit}`, [PlatformName.Windows64Bit]: `${downloadBaseFileName}-${PlatformName.Windows64Bit}`, [PlatformName.Linux64Bit]: `${downloadBaseFileName}-${PlatformName.Linux64Bit}`, - [PlatformName.Mac64Bit]: `${downloadBaseFileName}-${PlatformName.Mac64Bit}` + [PlatformName.Mac64Bit]: `${downloadBaseFileName}-${PlatformName.Mac64Bit}`, }; @injectable() @@ -24,7 +24,7 @@ export class DotNetLanguageServerPackageService extends LanguageServerPackageSer constructor( @inject(IServiceContainer) serviceContainer: IServiceContainer, @inject(IApplicationEnvironment) appEnv: IApplicationEnvironment, - @inject(IPlatformService) platform: IPlatformService + @inject(IPlatformService) platform: IPlatformService, ) { super(serviceContainer, appEnv, platform); } diff --git a/src/client/activation/languageServer/languageServerProxy.ts b/src/client/activation/languageServer/languageServerProxy.ts index 4d79366b1263..90874752bb47 100644 --- a/src/client/activation/languageServer/languageServerProxy.ts +++ b/src/client/activation/languageServer/languageServerProxy.ts @@ -29,7 +29,7 @@ export class DotNetLanguageServerProxy implements ILanguageServerProxy { constructor( @inject(ILanguageClientFactory) private readonly factory: ILanguageClientFactory, @inject(ITestManagementService) private readonly testManager: ITestManagementService, - @inject(IConfigurationService) private readonly configurationService: IConfigurationService + @inject(IConfigurationService) private readonly configurationService: IConfigurationService, ) { this.startupCompleted = createDeferred(); } @@ -56,7 +56,7 @@ export class DotNetLanguageServerProxy implements ILanguageServerProxy { public async start( resource: Resource, interpreter: PythonEnvironment | undefined, - options: LanguageClientOptions + options: LanguageClientOptions, ): Promise { if (!this.languageClient) { this.languageClient = await this.factory.createLanguageClient(resource, interpreter, options); @@ -92,8 +92,8 @@ export class DotNetLanguageServerProxy implements ILanguageServerProxy { this.startupCompleted.promise .then(() => this.languageClient!.sendRequest('python/loadExtension', args).then(noop, (ex) => - traceError('Request python/loadExtension failed', ex) - ) + traceError('Request python/loadExtension failed', ex), + ), ) .ignoreErrors(); } @@ -132,7 +132,7 @@ export class DotNetLanguageServerProxy implements ILanguageServerProxy { const formattedProperties = { ...telemetryEvent.Properties, // Replace all slashes in the method name so it doesn't get scrubbed by vscode-extension-telemetry. - method: telemetryEvent.Properties.method?.replace(/\//g, '.') + method: telemetryEvent.Properties.method?.replace(/\//g, '.'), }; sendTelemetryEvent(eventName, telemetryEvent.Measurements, formattedProperties); }); diff --git a/src/client/activation/languageServer/manager.ts b/src/client/activation/languageServer/manager.ts index 1faf30a92884..1d9770c90b23 100644 --- a/src/client/activation/languageServer/manager.ts +++ b/src/client/activation/languageServer/manager.ts @@ -20,7 +20,7 @@ import { ILanguageServerFolderService, ILanguageServerManager, ILanguageServerProxy, - LanguageServerType + LanguageServerType, } from '../types'; @injectable() @@ -40,18 +40,18 @@ export class DotNetLanguageServerManager implements ILanguageServerManager { private readonly analysisOptions: ILanguageServerAnalysisOptions, @inject(ILanguageServerExtension) private readonly lsExtension: ILanguageServerExtension, @inject(ILanguageServerFolderService) private readonly folderService: ILanguageServerFolderService, - @inject(ICommandManager) commandManager: ICommandManager + @inject(ICommandManager) commandManager: ICommandManager, ) { this.disposables.push( commandManager.registerCommand(Commands.RestartLS, () => { this.restartLanguageServer().ignoreErrors(); - }) + }), ); } private static versionTelemetryProps(instance: DotNetLanguageServerManager) { return { - lsVersion: instance.lsVersion + lsVersion: instance.lsVersion, }; } @@ -114,7 +114,7 @@ export class DotNetLanguageServerManager implements ILanguageServerManager { undefined, true, undefined, - DotNetLanguageServerManager.versionTelemetryProps + DotNetLanguageServerManager.versionTelemetryProps, ) @traceDecorators.verbose('Starting language server') protected async startLanguageServer(): Promise { @@ -125,7 +125,7 @@ export class DotNetLanguageServerManager implements ILanguageServerManager { this.serviceContainer, LanguageServerType.Microsoft, () => this.languageServerProxy?.languageClient, - this.lsVersion + this.lsVersion, ); // Make sure the middleware is connected if we restart and we we're already connected. diff --git a/src/client/activation/languageServer/outputChannel.ts b/src/client/activation/languageServer/outputChannel.ts index 2d4815b3af97..426fe0131588 100644 --- a/src/client/activation/languageServer/outputChannel.ts +++ b/src/client/activation/languageServer/outputChannel.ts @@ -16,7 +16,7 @@ export class LanguageServerOutputChannel implements ILanguageServerOutputChannel private registered = false; constructor( @inject(IApplicationShell) private readonly appShell: IApplicationShell, - @inject(ICommandManager) private readonly commandManager: ICommandManager + @inject(ICommandManager) private readonly commandManager: ICommandManager, ) {} public get channel() { diff --git a/src/client/activation/languageServer/platformData.ts b/src/client/activation/languageServer/platformData.ts index f616be1fc764..bab753acc2d0 100644 --- a/src/client/activation/languageServer/platformData.ts +++ b/src/client/activation/languageServer/platformData.ts @@ -11,13 +11,13 @@ export enum PlatformName { Windows32Bit = 'win-x86', Windows64Bit = 'win-x64', Mac64Bit = 'osx-x64', - Linux64Bit = 'linux-x64' + Linux64Bit = 'linux-x64', } export enum PlatformLSExecutables { Windows = 'Microsoft.Python.LanguageServer.exe', MacOS = 'Microsoft.Python.LanguageServer', - Linux = 'Microsoft.Python.LanguageServer' + Linux = 'Microsoft.Python.LanguageServer', } @injectable() diff --git a/src/client/activation/node/activator.ts b/src/client/activation/node/activator.ts index fc438bece25b..12b2dc937a66 100644 --- a/src/client/activation/node/activator.ts +++ b/src/client/activation/node/activator.ts @@ -32,7 +32,7 @@ export class NodeLanguageServerActivator extends LanguageServerActivatorBase { @inject(IConfigurationService) configurationService: IConfigurationService, @inject(IExtensions) private readonly extensions: IExtensions, @inject(IApplicationShell) private readonly appShell: IApplicationShell, - @inject(IApplicationEnvironment) private readonly appEnv: IApplicationEnvironment + @inject(IApplicationEnvironment) private readonly appEnv: IApplicationEnvironment, ) { super(manager, workspace, fs, configurationService); } @@ -58,7 +58,7 @@ export class NodeLanguageServerActivator extends LanguageServerActivatorBase { private async handleResolveCompletionItem( item: CompletionItem, - token: CancellationToken + token: CancellationToken, ): Promise { const languageClient = this.getLanguageClient(); diff --git a/src/client/activation/node/analysisOptions.ts b/src/client/activation/node/analysisOptions.ts index 889a3a85ce05..b7fbf7791eeb 100644 --- a/src/client/activation/node/analysisOptions.ts +++ b/src/client/activation/node/analysisOptions.ts @@ -10,14 +10,14 @@ import { ILanguageServerOutputChannel } from '../types'; export class NodeLanguageServerAnalysisOptions extends LanguageServerAnalysisOptionsBase { constructor( @inject(IEnvironmentVariablesProvider) envVarsProvider: IEnvironmentVariablesProvider, - @inject(ILanguageServerOutputChannel) lsOutputChannel: ILanguageServerOutputChannel + @inject(ILanguageServerOutputChannel) lsOutputChannel: ILanguageServerOutputChannel, ) { super(envVarsProvider, lsOutputChannel); } protected async getInitializationOptions() { return { - experimentationSupport: true + experimentationSupport: true, }; } } diff --git a/src/client/activation/node/languageClientFactory.ts b/src/client/activation/node/languageClientFactory.ts index 210e649d6373..c5e404049629 100644 --- a/src/client/activation/node/languageClientFactory.ts +++ b/src/client/activation/node/languageClientFactory.ts @@ -19,13 +19,14 @@ const languageClientName = 'Python Tools'; export class NodeLanguageClientFactory implements ILanguageClientFactory { constructor( @inject(IFileSystem) private readonly fs: IFileSystem, - @inject(ILanguageServerFolderService) private readonly languageServerFolderService: ILanguageServerFolderService + @inject(ILanguageServerFolderService) + private readonly languageServerFolderService: ILanguageServerFolderService, ) {} public async createLanguageClient( resource: Resource, _interpreter: PythonEnvironment | undefined, - clientOptions: LanguageClientOptions + clientOptions: LanguageClientOptions, ): Promise { // this must exist for node language client const commandArgs = (clientOptions.connectionOptions @@ -46,7 +47,7 @@ export class NodeLanguageClientFactory implements ILanguageClientFactory { run: { module: bundlePath, transport: TransportKind.ipc, - args: commandArgs + args: commandArgs, }, // In debug mode, use the non-bundled code if it's present. The production // build includes only the bundled package, so we don't want to crash if @@ -55,8 +56,8 @@ export class NodeLanguageClientFactory implements ILanguageClientFactory { module: modulePath, transport: TransportKind.ipc, options: debugOptions, - args: commandArgs - } + args: commandArgs, + }, }; const vscodeLanguageClient = require('vscode-languageclient/node'); @@ -64,7 +65,7 @@ export class NodeLanguageClientFactory implements ILanguageClientFactory { PYTHON_LANGUAGE, languageClientName, serverOptions, - clientOptions + clientOptions, ); } } diff --git a/src/client/activation/node/languageServerFolderService.ts b/src/client/activation/node/languageServerFolderService.ts index 0ccb89b28fc3..821e8d97e124 100644 --- a/src/client/activation/node/languageServerFolderService.ts +++ b/src/client/activation/node/languageServerFolderService.ts @@ -44,7 +44,7 @@ export class NodeLanguageServerFolderService implements ILanguageServerFolderSer @inject(IServiceContainer) serviceContainer: IServiceContainer, @inject(IConfigurationService) private configService: IConfigurationService, @inject(IWorkspaceService) private workspaceService: IWorkspaceService, - @inject(IExtensions) readonly extensions: IExtensions + @inject(IExtensions) readonly extensions: IExtensions, ) { this.fallback = new FallbackNodeLanguageServerFolderService(serviceContainer); } @@ -75,7 +75,7 @@ export class NodeLanguageServerFolderService implements ILanguageServerFolderSer assert.ok(path.isAbsolute(lsf.path)); return { path: lsf.path, - version: new SemVer(lsf.version) + version: new SemVer(lsf.version), }; } return this.fallback.getCurrentLanguageServerDirectory(); diff --git a/src/client/activation/node/languageServerPackageRepository.ts b/src/client/activation/node/languageServerPackageRepository.ts index 39ab7ac86a78..130169303273 100644 --- a/src/client/activation/node/languageServerPackageRepository.ts +++ b/src/client/activation/node/languageServerPackageRepository.ts @@ -9,7 +9,7 @@ import { IServiceContainer } from '../../ioc/types'; import { BetaLanguageServerPackageRepository, DailyLanguageServerPackageRepository, - StableLanguageServerPackageRepository + StableLanguageServerPackageRepository, } from '../common/packageRepository'; @injectable() diff --git a/src/client/activation/node/languageServerPackageService.ts b/src/client/activation/node/languageServerPackageService.ts index feacaba70a8a..520fb20285bd 100644 --- a/src/client/activation/node/languageServerPackageService.ts +++ b/src/client/activation/node/languageServerPackageService.ts @@ -14,7 +14,7 @@ export class NodeLanguageServerPackageService extends LanguageServerPackageServi constructor( @inject(IServiceContainer) serviceContainer: IServiceContainer, @inject(IApplicationEnvironment) appEnv: IApplicationEnvironment, - @inject(IPlatformService) platform: IPlatformService + @inject(IPlatformService) platform: IPlatformService, ) { super(serviceContainer, appEnv, platform); } diff --git a/src/client/activation/node/languageServerProxy.ts b/src/client/activation/node/languageServerProxy.ts index 8ac1ba049750..0d1fa9f42e2d 100644 --- a/src/client/activation/node/languageServerProxy.ts +++ b/src/client/activation/node/languageServerProxy.ts @@ -8,7 +8,7 @@ import { Disposable, LanguageClient, LanguageClientOptions, - State + State, } from 'vscode-languageclient/node'; import { DeprecatePythonPath } from '../../common/experiments/groups'; @@ -18,7 +18,7 @@ import { IExperimentService, IExperimentsManager, IInterpreterPathService, - Resource + Resource, } from '../../common/types'; import { createDeferred, Deferred, sleep } from '../../common/utils/async'; import { swallowExceptions } from '../../common/utils/decorators'; @@ -72,14 +72,14 @@ export class NodeLanguageServerProxy implements ILanguageServerProxy { @inject(ILanguageServerFolderService) private readonly folderService: ILanguageServerFolderService, @inject(IExperimentsManager) private readonly experiments: IExperimentsManager, @inject(IExperimentService) private readonly experimentService: IExperimentService, - @inject(IInterpreterPathService) private readonly interpreterPathService: IInterpreterPathService + @inject(IInterpreterPathService) private readonly interpreterPathService: IInterpreterPathService, ) { this.startupCompleted = createDeferred(); } private static versionTelemetryProps(instance: NodeLanguageServerProxy) { return { - lsVersion: instance.lsVersion + lsVersion: instance.lsVersion, }; } @@ -111,12 +111,12 @@ export class NodeLanguageServerProxy implements ILanguageServerProxy { undefined, true, undefined, - NodeLanguageServerProxy.versionTelemetryProps + NodeLanguageServerProxy.versionTelemetryProps, ) public async start( resource: Resource, interpreter: PythonEnvironment | undefined, - options: LanguageClientOptions + options: LanguageClientOptions, ): Promise { if (!this.languageClient) { const directory = await this.folderService.getCurrentLanguageServerDirectory(); @@ -158,7 +158,7 @@ export class NodeLanguageServerProxy implements ILanguageServerProxy { undefined, true, undefined, - NodeLanguageServerProxy.versionTelemetryProps + NodeLanguageServerProxy.versionTelemetryProps, ) protected async serverReady(): Promise { while (this.languageClient && !this.languageClient.initializeResult) { @@ -195,9 +195,9 @@ export class NodeLanguageServerProxy implements ILanguageServerProxy { // This is needed as interpreter changes via the interpreter path service happen // outside of VS Code's settings (which would mean VS Code sends the config updates itself). this.languageClient!.sendNotification(DidChangeConfigurationNotification.type, { - settings: null + settings: null, }); - }) + }), ); } @@ -208,13 +208,13 @@ export class NodeLanguageServerProxy implements ILanguageServerProxy { const formattedProperties = { ...telemetryEvent.Properties, // Replace all slashes in the method name so it doesn't get scrubbed by vscode-extension-telemetry. - method: telemetryEvent.Properties.method?.replace(/\//g, '.') + method: telemetryEvent.Properties.method?.replace(/\//g, '.'), }; sendTelemetryEvent( eventName, telemetryEvent.Measurements, formattedProperties, - telemetryEvent.Exception + telemetryEvent.Exception, ); }); } @@ -224,17 +224,17 @@ export class NodeLanguageServerProxy implements ILanguageServerProxy { async (params: InExperiment.IRequest): Promise => { const inExperiment = await this.experimentService.inExperiment(params.experimentName); return { inExperiment }; - } + }, ); this.languageClient!.onRequest( GetExperimentValue.Method, async ( - params: GetExperimentValue.IRequest + params: GetExperimentValue.IRequest, ): Promise> => { const value = await this.experimentService.getExperimentValue(params.experimentName); return { value }; - } + }, ); } } diff --git a/src/client/activation/node/manager.ts b/src/client/activation/node/manager.ts index c4f2aebabb88..53d863c27e04 100644 --- a/src/client/activation/node/manager.ts +++ b/src/client/activation/node/manager.ts @@ -19,7 +19,7 @@ import { ILanguageServerFolderService, ILanguageServerManager, ILanguageServerProxy, - LanguageServerType + LanguageServerType, } from '../types'; @injectable() @@ -39,18 +39,18 @@ export class NodeLanguageServerManager implements ILanguageServerManager { private readonly analysisOptions: ILanguageServerAnalysisOptions, @inject(ILanguageServerFolderService) private readonly folderService: ILanguageServerFolderService, - @inject(ICommandManager) commandManager: ICommandManager + @inject(ICommandManager) commandManager: ICommandManager, ) { this.disposables.push( commandManager.registerCommand(Commands.RestartLS, () => { this.restartLanguageServer().ignoreErrors(); - }) + }), ); } private static versionTelemetryProps(instance: NodeLanguageServerManager) { return { - lsVersion: instance.lsVersion + lsVersion: instance.lsVersion, }; } @@ -110,7 +110,7 @@ export class NodeLanguageServerManager implements ILanguageServerManager { undefined, true, undefined, - NodeLanguageServerManager.versionTelemetryProps + NodeLanguageServerManager.versionTelemetryProps, ) @traceDecorators.verbose('Starting language server') protected async startLanguageServer(): Promise { @@ -121,7 +121,7 @@ export class NodeLanguageServerManager implements ILanguageServerManager { this.serviceContainer, LanguageServerType.Node, () => this.languageServerProxy?.languageClient, - this.lsVersion + this.lsVersion, ); // Make sure the middleware is connected if we restart and we we're already connected. diff --git a/src/client/activation/none/activator.ts b/src/client/activation/none/activator.ts index d9a2e1414f7e..8b4a1af700fb 100644 --- a/src/client/activation/none/activator.ts +++ b/src/client/activation/none/activator.ts @@ -18,7 +18,7 @@ import { SignatureHelpContext, SymbolInformation, TextDocument, - WorkspaceEdit + WorkspaceEdit, } from 'vscode'; import { isTestExecution } from '../../common/constants'; import { BANNER_NAME_PROPOSE_LS, IPythonExtensionBanner, Resource } from '../../common/types'; @@ -37,7 +37,7 @@ export class NoLanguageServerExtensionActivator implements ILanguageServerActiva constructor( @inject(IPythonExtensionBanner) @named(BANNER_NAME_PROPOSE_LS) - private proposePylancePopup: IPythonExtensionBanner + private proposePylancePopup: IPythonExtensionBanner, ) {} public async start(_resource: Resource, _interpreter?: PythonEnvironment): Promise { if (!isTestExecution()) { @@ -55,21 +55,21 @@ export class NoLanguageServerExtensionActivator implements ILanguageServerActiva _document: TextDocument, _position: Position, _newName: string, - _token: CancellationToken + _token: CancellationToken, ): ProviderResult { return null; } public provideDefinition( _document: TextDocument, _position: Position, - _token: CancellationToken + _token: CancellationToken, ): ProviderResult { return null; } public provideHover( _document: TextDocument, _position: Position, - _token: CancellationToken + _token: CancellationToken, ): ProviderResult { return null; } @@ -77,7 +77,7 @@ export class NoLanguageServerExtensionActivator implements ILanguageServerActiva _document: TextDocument, _position: Position, _context: ReferenceContext, - _token: CancellationToken + _token: CancellationToken, ): ProviderResult { return null; } @@ -85,7 +85,7 @@ export class NoLanguageServerExtensionActivator implements ILanguageServerActiva _document: TextDocument, _position: Position, _token: CancellationToken, - _context: CompletionContext + _context: CompletionContext, ): ProviderResult { return null; } @@ -94,7 +94,7 @@ export class NoLanguageServerExtensionActivator implements ILanguageServerActiva } public provideDocumentSymbols( _document: TextDocument, - _token: CancellationToken + _token: CancellationToken, ): ProviderResult { return null; } @@ -102,7 +102,7 @@ export class NoLanguageServerExtensionActivator implements ILanguageServerActiva _document: TextDocument, _position: Position, _token: CancellationToken, - _context: SignatureHelpContext + _context: SignatureHelpContext, ): ProviderResult { return null; } diff --git a/src/client/activation/progress.ts b/src/client/activation/progress.ts index a0934ad2b00b..5abcb9e553c0 100644 --- a/src/client/activation/progress.ts +++ b/src/client/activation/progress.ts @@ -55,12 +55,12 @@ export class ProgressReporting implements Disposable { window.withProgress( { location: ProgressLocation.Window, - title: '' + title: '', }, (progress) => { this.progress = progress; return this.progressDeferred!.promise; - } + }, ); } } diff --git a/src/client/activation/refCountedLanguageServer.ts b/src/client/activation/refCountedLanguageServer.ts index 52e76bf6a4de..17917f6a7e47 100644 --- a/src/client/activation/refCountedLanguageServer.ts +++ b/src/client/activation/refCountedLanguageServer.ts @@ -17,7 +17,7 @@ import { SignatureHelpContext, SymbolInformation, TextDocument, - WorkspaceEdit + WorkspaceEdit, } from 'vscode'; import { Resource } from '../common/types'; @@ -30,7 +30,7 @@ export class RefCountedLanguageServer implements ILanguageServerActivator { constructor( private impl: ILanguageServerActivator, private _type: LanguageServerType, - private disposeCallback: () => void + private disposeCallback: () => void, ) {} public increment = () => { @@ -76,14 +76,14 @@ export class RefCountedLanguageServer implements ILanguageServerActivator { document: TextDocument, position: Position, newName: string, - token: CancellationToken + token: CancellationToken, ): ProviderResult { return this.impl.provideRenameEdits(document, position, newName, token); } public provideDefinition( document: TextDocument, position: Position, - token: CancellationToken + token: CancellationToken, ): ProviderResult { return this.impl.provideDefinition(document, position, token); } @@ -94,7 +94,7 @@ export class RefCountedLanguageServer implements ILanguageServerActivator { document: TextDocument, position: Position, context: ReferenceContext, - token: CancellationToken + token: CancellationToken, ): ProviderResult { return this.impl.provideReferences(document, position, context, token); } @@ -102,7 +102,7 @@ export class RefCountedLanguageServer implements ILanguageServerActivator { document: TextDocument, position: Position, token: CancellationToken, - context: CompletionContext + context: CompletionContext, ): ProviderResult { return this.impl.provideCompletionItems(document, position, token, context); } @@ -116,7 +116,7 @@ export class RefCountedLanguageServer implements ILanguageServerActivator { } public provideDocumentSymbols( document: TextDocument, - token: CancellationToken + token: CancellationToken, ): ProviderResult { return this.impl.provideDocumentSymbols(document, token); } @@ -124,7 +124,7 @@ export class RefCountedLanguageServer implements ILanguageServerActivator { document: TextDocument, position: Position, token: CancellationToken, - context: SignatureHelpContext + context: SignatureHelpContext, ): ProviderResult { return this.impl.provideSignatureHelp(document, position, token, context); } diff --git a/src/client/activation/serviceRegistry.ts b/src/client/activation/serviceRegistry.ts index 34350ba3e5f3..38c9ae2923fe 100644 --- a/src/client/activation/serviceRegistry.ts +++ b/src/client/activation/serviceRegistry.ts @@ -27,7 +27,7 @@ import { DotNetLanguageServerFolderService } from './languageServer/languageServ import { BetaDotNetLanguageServerPackageRepository, DailyDotNetLanguageServerPackageRepository, - StableDotNetLanguageServerPackageRepository + StableDotNetLanguageServerPackageRepository, } from './languageServer/languageServerPackageRepository'; import { DotNetLanguageServerPackageService } from './languageServer/languageServerPackageService'; import { DotNetLanguageServerProxy } from './languageServer/languageServerProxy'; @@ -41,7 +41,7 @@ import { NodeLanguageServerFolderService } from './node/languageServerFolderServ import { BetaNodeLanguageServerPackageRepository, DailyNodeLanguageServerPackageRepository, - StableNodeLanguageServerPackageRepository + StableNodeLanguageServerPackageRepository, } from './node/languageServerPackageRepository'; import { NodeLanguageServerPackageService } from './node/languageServerPackageService'; import { NodeLanguageServerProxy } from './node/languageServerProxy'; @@ -65,7 +65,7 @@ import { ILanguageServerPackageService, ILanguageServerProxy, IPlatformData, - LanguageServerType + LanguageServerType, } from './types'; // tslint:disable-next-line: max-func-body-length @@ -78,38 +78,38 @@ export function registerTypes(serviceManager: IServiceManager, languageServerTyp serviceManager.addSingleton( IPythonExtensionBanner, ProposePylanceBanner, - BANNER_NAME_PROPOSE_LS + BANNER_NAME_PROPOSE_LS, ); if (languageServerType === LanguageServerType.Microsoft) { serviceManager.add( ILanguageServerAnalysisOptions, DotNetLanguageServerAnalysisOptions, - LanguageServerType.Microsoft + LanguageServerType.Microsoft, ); serviceManager.add( ILanguageServerActivator, DotNetLanguageServerActivator, - LanguageServerType.Microsoft + LanguageServerType.Microsoft, ); serviceManager.addSingleton( INugetRepository, StableDotNetLanguageServerPackageRepository, - LanguageServerDownloadChannel.stable + LanguageServerDownloadChannel.stable, ); serviceManager.addSingleton( INugetRepository, BetaDotNetLanguageServerPackageRepository, - LanguageServerDownloadChannel.beta + LanguageServerDownloadChannel.beta, ); serviceManager.addSingleton( INugetRepository, DailyDotNetLanguageServerPackageRepository, - LanguageServerDownloadChannel.daily + LanguageServerDownloadChannel.daily, ); serviceManager.addSingleton( ILanguageServerCompatibilityService, - LanguageServerCompatibilityService + LanguageServerCompatibilityService, ); serviceManager.addSingleton(ILanguageClientFactory, DotNetLanguageClientFactory); serviceManager.addSingleton(IPlatformData, PlatformData); @@ -117,62 +117,62 @@ export function registerTypes(serviceManager: IServiceManager, languageServerTyp serviceManager.add(ILanguageServerProxy, DotNetLanguageServerProxy); serviceManager.addSingleton( ILanguageServerFolderService, - DotNetLanguageServerFolderService + DotNetLanguageServerFolderService, ); serviceManager.addSingleton( ILanguageServerPackageService, - DotNetLanguageServerPackageService + DotNetLanguageServerPackageService, ); registerDotNetTypes(serviceManager); } else if (languageServerType === LanguageServerType.Node) { serviceManager.add( ILanguageServerAnalysisOptions, NodeLanguageServerAnalysisOptions, - LanguageServerType.Node + LanguageServerType.Node, ); serviceManager.add( ILanguageServerActivator, NodeLanguageServerActivator, - LanguageServerType.Node + LanguageServerType.Node, ); serviceManager.addSingleton( INugetRepository, StableNodeLanguageServerPackageRepository, - LanguageServerDownloadChannel.stable + LanguageServerDownloadChannel.stable, ); serviceManager.addSingleton( INugetRepository, BetaNodeLanguageServerPackageRepository, - LanguageServerDownloadChannel.beta + LanguageServerDownloadChannel.beta, ); serviceManager.addSingleton( INugetRepository, DailyNodeLanguageServerPackageRepository, - LanguageServerDownloadChannel.daily + LanguageServerDownloadChannel.daily, ); serviceManager.addSingleton(ILanguageClientFactory, NodeLanguageClientFactory); serviceManager.add(ILanguageServerManager, NodeLanguageServerManager); serviceManager.add(ILanguageServerProxy, NodeLanguageServerProxy); serviceManager.addSingleton( ILanguageServerFolderService, - NodeLanguageServerFolderService + NodeLanguageServerFolderService, ); serviceManager.addSingleton( ILanguageServerPackageService, - NodeLanguageServerPackageService + NodeLanguageServerPackageService, ); } else if (languageServerType === LanguageServerType.Jedi) { serviceManager.add( ILanguageServerActivator, MultiplexingJediLanguageServerActivator, - LanguageServerType.Jedi + LanguageServerType.Jedi, ); // Note: These other services are required when using the Jedi LSP. serviceManager.add( ILanguageServerAnalysisOptions, JediLanguageServerAnalysisOptions, - LanguageServerType.Jedi + LanguageServerType.Jedi, ); serviceManager.addSingleton(ILanguageClientFactory, JediLanguageClientFactory); serviceManager.add(ILanguageServerManager, JediLanguageServerManager); @@ -181,34 +181,34 @@ export function registerTypes(serviceManager: IServiceManager, languageServerTyp serviceManager.add( ILanguageServerActivator, NoLanguageServerExtensionActivator, - LanguageServerType.None + LanguageServerType.None, ); } serviceManager.addSingleton( IDownloadChannelRule, DownloadDailyChannelRule, - LanguageServerDownloadChannel.daily + LanguageServerDownloadChannel.daily, ); serviceManager.addSingleton( IDownloadChannelRule, DownloadBetaChannelRule, - LanguageServerDownloadChannel.beta + LanguageServerDownloadChannel.beta, ); serviceManager.addSingleton( IDownloadChannelRule, DownloadBetaChannelRule, - LanguageServerDownloadChannel.stable + LanguageServerDownloadChannel.stable, ); serviceManager.addSingleton(ILanguageServerDownloader, LanguageServerDownloader); serviceManager.addSingleton( ILanguageServerOutputChannel, - LanguageServerOutputChannel + LanguageServerOutputChannel, ); serviceManager.addSingleton( IExtensionSingleActivationService, - ExtensionSurveyPrompt + ExtensionSurveyPrompt, ); serviceManager.addSingleton(IExtensionSingleActivationService, AATesting); } diff --git a/src/client/activation/types.ts b/src/client/activation/types.ts index 68316191360d..641aa46c3c32 100644 --- a/src/client/activation/types.ts +++ b/src/client/activation/types.ts @@ -13,7 +13,7 @@ import { HoverProvider, ReferenceProvider, RenameProvider, - SignatureHelpProvider + SignatureHelpProvider, } from 'vscode'; import { LanguageClient, LanguageClientOptions } from 'vscode-languageclient/node'; import * as lsp from 'vscode-languageserver-protocol'; @@ -66,7 +66,7 @@ export enum LanguageServerType { Jedi = 'Jedi', Microsoft = 'Microsoft', Node = 'Pylance', - None = 'None' + None = 'None', } export const DotNetLanguageServerFolder = 'languageServer'; @@ -148,7 +148,7 @@ export interface ILanguageServerCompatibilityService { export enum LanguageClientFactory { base = 'base', simple = 'simple', - downloaded = 'downloaded' + downloaded = 'downloaded', } export const ILanguageClientFactory = Symbol('ILanguageClientFactory'); export interface ILanguageClientFactory { @@ -156,7 +156,7 @@ export interface ILanguageClientFactory { resource: Resource, interpreter: PythonEnvironment | undefined, clientOptions: LanguageClientOptions, - env?: NodeJS.ProcessEnv + env?: NodeJS.ProcessEnv, ): Promise; } export const ILanguageServerAnalysisOptions = Symbol('ILanguageServerAnalysisOptions'); @@ -187,7 +187,7 @@ export interface ILanguageServerProxy extends IDisposable { start( resource: Resource, interpreter: PythonEnvironment | undefined, - options: LanguageClientOptions + options: LanguageClientOptions, ): Promise; /** * Sends a request to LS so as to load other extensions. @@ -203,7 +203,7 @@ export enum PlatformName { Windows32Bit = 'win-x86', Windows64Bit = 'win-x64', Mac64Bit = 'osx-x64', - Linux64Bit = 'linux-x64' + Linux64Bit = 'linux-x64', } export const IPlatformData = Symbol('IPlatformData'); export interface IPlatformData { diff --git a/src/client/api.ts b/src/client/api.ts index b2e059a69bf1..ed30dbc92ca2 100644 --- a/src/client/api.ts +++ b/src/client/api.ts @@ -65,7 +65,7 @@ export interface IExtensionApi { * @returns {({ execCommand: string[] | undefined })} */ getExecutionDetails( - resource?: Resource + resource?: Resource, ): { /** * E.g of execution commands returned could be, @@ -100,7 +100,7 @@ export function buildApi( // tslint:disable-next-line:no-any ready: Promise, serviceManager: IServiceManager, - serviceContainer: IServiceContainer + serviceContainer: IServiceContainer, ): IExtensionApi { const configurationService = serviceContainer.get(IConfigurationService); const interpreterService = serviceContainer.get(IInterpreterService); @@ -113,23 +113,23 @@ export function buildApi( return Promise.reject(ex); }), jupyter: { - registerHooks: () => jupyterIntegration.integrateWithJupyterExtension() + registerHooks: () => jupyterIntegration.integrateWithJupyterExtension(), }, debug: { async getRemoteLauncherCommand( host: string, port: number, - waitUntilDebuggerAttaches: boolean = true + waitUntilDebuggerAttaches: boolean = true, ): Promise { return getDebugpyLauncherArgs({ host, port, - waitUntilDebuggerAttaches + waitUntilDebuggerAttaches, }); }, async getDebuggerPackagePath(): Promise { return getDebugpyPackagePath(); - } + }, }, settings: { onDidChangeExecutionDetails: interpreterService.onDidChangeInterpreterConfiguration, @@ -137,7 +137,7 @@ export function buildApi( const pythonPath = configurationService.getSettings(resource).pythonPath; // If pythonPath equals an empty string, no interpreter is set. return { execCommand: pythonPath === '' ? undefined : [pythonPath] }; - } + }, }, // These are for backwards compatibility. Other extensions are using these APIs and we don't want // to force them to move to the jupyter extension ... yet. @@ -148,8 +148,8 @@ export function buildApi( : (noop as any), showDataViewer: jupyterIntegration ? jupyterIntegration.showDataViewer.bind(jupyterIntegration) - : (noop as any) - } + : (noop as any), + }, }; // In test environment return the DI Container. diff --git a/src/client/application/diagnostics/applicationDiagnostics.ts b/src/client/application/diagnostics/applicationDiagnostics.ts index aebfa942edb7..1c7f3035a728 100644 --- a/src/client/application/diagnostics/applicationDiagnostics.ts +++ b/src/client/application/diagnostics/applicationDiagnostics.ts @@ -16,7 +16,7 @@ import { IDiagnostic, IDiagnosticsService, ISourceMapSupportService } from './ty export class ApplicationDiagnostics implements IApplicationDiagnostics { constructor( @inject(IServiceContainer) private readonly serviceContainer: IServiceContainer, - @inject(IOutputChannel) @named(STANDARD_OUTPUT_CHANNEL) private readonly outputChannel: IOutputChannel + @inject(IOutputChannel) @named(STANDARD_OUTPUT_CHANNEL) private readonly outputChannel: IOutputChannel, ) {} public register() { this.serviceContainer.get(ISourceMapSupportService).register(); @@ -30,12 +30,12 @@ export class ApplicationDiagnostics implements IApplicationDiagnostics { // Perform these validation checks in the foreground. await this.runDiagnostics( services.filter((item) => !item.runInBackground), - resource + resource, ); // Perform these validation checks in the background. this.runDiagnostics( services.filter((item) => item.runInBackground), - resource + resource, ).ignoreErrors(); } private async runDiagnostics(diagnosticServices: IDiagnosticsService[], resource: Resource): Promise { @@ -46,7 +46,7 @@ export class ApplicationDiagnostics implements IApplicationDiagnostics { this.log(diagnostics); await diagnosticService.handle(diagnostics); } - }) + }), ); } private log(diagnostics: IDiagnostic[]): void { diff --git a/src/client/application/diagnostics/base.ts b/src/client/application/diagnostics/base.ts index bebe0108fe62..34bcca90a779 100644 --- a/src/client/application/diagnostics/base.ts +++ b/src/client/application/diagnostics/base.ts @@ -22,7 +22,7 @@ export abstract class BaseDiagnostic implements IDiagnostic { public readonly scope: DiagnosticScope, public readonly resource: Resource, public readonly invokeHandler: 'always' | 'default' = 'default', - public readonly shouldShowPrompt = true + public readonly shouldShowPrompt = true, ) {} } @@ -34,7 +34,7 @@ export abstract class BaseDiagnosticsService implements IDiagnosticsService, IDi @unmanaged() private readonly supportedDiagnosticCodes: string[], @unmanaged() protected serviceContainer: IServiceContainer, @unmanaged() disposableRegistry: IDisposableRegistry, - @unmanaged() public readonly runInBackground: boolean = false + @unmanaged() public readonly runInBackground: boolean = false, ) { this.filterService = serviceContainer.get(IDiagnosticFilterService); disposableRegistry.push(this); diff --git a/src/client/application/diagnostics/checks/envPathVariable.ts b/src/client/application/diagnostics/checks/envPathVariable.ts index 2c137662055e..33365428ba9e 100644 --- a/src/client/application/diagnostics/checks/envPathVariable.ts +++ b/src/client/application/diagnostics/checks/envPathVariable.ts @@ -27,7 +27,7 @@ export class InvalidEnvironmentPathVariableDiagnostic extends BaseDiagnostic { message, DiagnosticSeverity.Warning, DiagnosticScope.Global, - resource + resource, ); } } @@ -40,13 +40,13 @@ export class EnvironmentPathVariableDiagnosticsService extends BaseDiagnosticsSe private readonly platform: IPlatformService; constructor( @inject(IServiceContainer) serviceContainer: IServiceContainer, - @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry + @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry, ) { super([DiagnosticCodes.InvalidEnvironmentPathVariableDiagnostic], serviceContainer, disposableRegistry, true); this.platform = this.serviceContainer.get(IPlatformService); this.messageService = serviceContainer.get>( IDiagnosticHandlerService, - DiagnosticCommandPromptHandlerServiceId + DiagnosticCommandPromptHandlerServiceId, ); } public async diagnose(resource: Resource): Promise { @@ -70,16 +70,16 @@ export class EnvironmentPathVariableDiagnosticsService extends BaseDiagnosticsSe const commandFactory = this.serviceContainer.get(IDiagnosticsCommandFactory); const options = [ { - prompt: 'Ignore' + prompt: 'Ignore', }, { prompt: 'Always Ignore', - command: commandFactory.createCommand(diagnostic, { type: 'ignore', options: DiagnosticScope.Global }) + command: commandFactory.createCommand(diagnostic, { type: 'ignore', options: DiagnosticScope.Global }), }, { prompt: 'More Info', - command: commandFactory.createCommand(diagnostic, { type: 'launch', options: 'https://aka.ms/Niq35h' }) - } + command: commandFactory.createCommand(diagnostic, { type: 'launch', options: 'https://aka.ms/Niq35h' }), + }, ]; await this.messageService.handle(diagnostic, { commandPrompts: options }); diff --git a/src/client/application/diagnostics/checks/invalidLaunchJsonDebugger.ts b/src/client/application/diagnostics/checks/invalidLaunchJsonDebugger.ts index 048ad7cef142..b3ac3f505087 100644 --- a/src/client/application/diagnostics/checks/invalidLaunchJsonDebugger.ts +++ b/src/client/application/diagnostics/checks/invalidLaunchJsonDebugger.ts @@ -21,7 +21,7 @@ const messages = { [DiagnosticCodes.InvalidDebuggerTypeDiagnostic]: Diagnostics.invalidDebuggerTypeDiagnostic(), [DiagnosticCodes.JustMyCodeDiagnostic]: Diagnostics.justMyCodeDiagnostic(), [DiagnosticCodes.ConsoleTypeDiagnostic]: Diagnostics.consoleTypeDiagnostic(), - [DiagnosticCodes.ConfigPythonPathDiagnostic]: '' + [DiagnosticCodes.ConfigPythonPathDiagnostic]: '', }; export class InvalidLaunchJsonDebuggerDiagnostic extends BaseDiagnostic { @@ -32,7 +32,7 @@ export class InvalidLaunchJsonDebuggerDiagnostic extends BaseDiagnostic { | DiagnosticCodes.ConsoleTypeDiagnostic | DiagnosticCodes.ConfigPythonPathDiagnostic, resource: Resource, - shouldShowPrompt: boolean = true + shouldShowPrompt: boolean = true, ) { super( code, @@ -41,7 +41,7 @@ export class InvalidLaunchJsonDebuggerDiagnostic extends BaseDiagnostic { DiagnosticScope.WorkspaceFolder, resource, 'always', - shouldShowPrompt + shouldShowPrompt, ); } } @@ -57,18 +57,18 @@ export class InvalidLaunchJsonDebuggerService extends BaseDiagnosticsService { @inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService, @inject(IDiagnosticHandlerService) @named(DiagnosticCommandPromptHandlerServiceId) - private readonly messageService: IDiagnosticHandlerService + private readonly messageService: IDiagnosticHandlerService, ) { super( [ DiagnosticCodes.InvalidDebuggerTypeDiagnostic, DiagnosticCodes.JustMyCodeDiagnostic, DiagnosticCodes.ConsoleTypeDiagnostic, - DiagnosticCodes.ConfigPythonPathDiagnostic + DiagnosticCodes.ConfigPythonPathDiagnostic, ], serviceContainer, disposableRegistry, - true + true, ); } @@ -93,8 +93,8 @@ export class InvalidLaunchJsonDebuggerService extends BaseDiagnosticsService { await Promise.all( this.workspaceService.workspaceFolders!.map((workspaceFolder) => - this.fixLaunchJsonInWorkspace(code, workspaceFolder) - ) + this.fixLaunchJsonInWorkspace(code, workspaceFolder), + ), ); } @@ -108,7 +108,7 @@ export class InvalidLaunchJsonDebuggerService extends BaseDiagnosticsService { const diagnostics: IDiagnostic[] = []; if (fileContents.indexOf('"pythonExperimental"') > 0) { diagnostics.push( - new InvalidLaunchJsonDebuggerDiagnostic(DiagnosticCodes.InvalidDebuggerTypeDiagnostic, resource) + new InvalidLaunchJsonDebuggerDiagnostic(DiagnosticCodes.InvalidDebuggerTypeDiagnostic, resource), ); } if (fileContents.indexOf('"debugStdLib"') > 0) { @@ -123,7 +123,7 @@ export class InvalidLaunchJsonDebuggerService extends BaseDiagnosticsService { fileContents.indexOf('{config:python.interpreterPath}') > 0 ) { diagnostics.push( - new InvalidLaunchJsonDebuggerDiagnostic(DiagnosticCodes.ConfigPythonPathDiagnostic, resource, false) + new InvalidLaunchJsonDebuggerDiagnostic(DiagnosticCodes.ConfigPythonPathDiagnostic, resource, false), ); } return diagnostics; @@ -143,12 +143,12 @@ export class InvalidLaunchJsonDebuggerService extends BaseDiagnosticsService { diagnostic, invoke: async (): Promise => { await this.fixLaunchJson(diagnostic.code); - } - } + }, + }, }, { - prompt: Common.noIWillDoItLater() - } + prompt: Common.noIWillDoItLater(), + }, ]; await this.messageService.handle(diagnostic, { commandPrompts }); @@ -180,12 +180,12 @@ export class InvalidLaunchJsonDebuggerService extends BaseDiagnosticsService { fileContents = this.findAndReplace( fileContents, '{config:python.pythonPath}', - '{command:python.interpreterPath}' + '{command:python.interpreterPath}', ); fileContents = this.findAndReplace( fileContents, '{config:python.interpreterPath}', - '{command:python.interpreterPath}' + '{command:python.interpreterPath}', ); break; } diff --git a/src/client/application/diagnostics/checks/invalidPythonPathInDebugger.ts b/src/client/application/diagnostics/checks/invalidPythonPathInDebugger.ts index 73f60ce7edfa..1fdcb2e139d4 100644 --- a/src/client/application/diagnostics/checks/invalidPythonPathInDebugger.ts +++ b/src/client/application/diagnostics/checks/invalidPythonPathInDebugger.ts @@ -24,12 +24,12 @@ import { IDiagnostic, IDiagnosticCommand, IDiagnosticHandlerService, - IInvalidPythonPathInDebuggerService + IInvalidPythonPathInDebuggerService, } from '../types'; const messages = { [DiagnosticCodes.InvalidPythonPathInDebuggerSettingsDiagnostic]: Diagnostics.invalidPythonPathInDebuggerSettings(), - [DiagnosticCodes.InvalidPythonPathInDebuggerLaunchDiagnostic]: Diagnostics.invalidPythonPathInDebuggerLaunch() + [DiagnosticCodes.InvalidPythonPathInDebuggerLaunchDiagnostic]: Diagnostics.invalidPythonPathInDebuggerLaunch(), }; export class InvalidPythonPathInDebuggerDiagnostic extends BaseDiagnostic { @@ -37,7 +37,7 @@ export class InvalidPythonPathInDebuggerDiagnostic extends BaseDiagnostic { code: | DiagnosticCodes.InvalidPythonPathInDebuggerLaunchDiagnostic | DiagnosticCodes.InvalidPythonPathInDebuggerSettingsDiagnostic, - resource: Resource + resource: Resource, ) { super(code, messages[code], DiagnosticSeverity.Error, DiagnosticScope.WorkspaceFolder, resource, 'always'); } @@ -58,16 +58,16 @@ export class InvalidPythonPathInDebuggerService extends BaseDiagnosticsService @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry, @inject(IDiagnosticHandlerService) @named(DiagnosticCommandPromptHandlerServiceId) - protected readonly messageService: IDiagnosticHandlerService + protected readonly messageService: IDiagnosticHandlerService, ) { super( [ DiagnosticCodes.InvalidPythonPathInDebuggerSettingsDiagnostic, - DiagnosticCodes.InvalidPythonPathInDebuggerLaunchDiagnostic + DiagnosticCodes.InvalidPythonPathInDebuggerLaunchDiagnostic, ], serviceContainer, disposableRegistry, - true + true, ); } public async diagnose(_resource: Resource): Promise { @@ -87,8 +87,8 @@ export class InvalidPythonPathInDebuggerService extends BaseDiagnosticsService this.handle([ new InvalidPythonPathInDebuggerDiagnostic( DiagnosticCodes.InvalidPythonPathInDebuggerLaunchDiagnostic, - resource - ) + resource, + ), ]) .catch((ex) => traceError('Failed to handle invalid python path in launch.json debugger', ex)) .ignoreErrors(); @@ -96,8 +96,8 @@ export class InvalidPythonPathInDebuggerService extends BaseDiagnosticsService this.handle([ new InvalidPythonPathInDebuggerDiagnostic( DiagnosticCodes.InvalidPythonPathInDebuggerSettingsDiagnostic, - resource - ) + resource, + ), ]) .catch((ex) => traceError('Failed to handle invalid python path in settings.json debugger', ex)) .ignoreErrors(); @@ -126,9 +126,9 @@ export class InvalidPythonPathInDebuggerService extends BaseDiagnosticsService prompt: 'Select Python Interpreter', command: this.commandFactory.createCommand(diagnostic, { type: 'executeVSCCommand', - options: 'python.setInterpreter' - }) - } + options: 'python.setInterpreter', + }), + }, ]; } case DiagnosticCodes.InvalidPythonPathInDebuggerLaunchDiagnostic: { @@ -141,9 +141,9 @@ export class InvalidPythonPathInDebuggerService extends BaseDiagnosticsService const launchJson = this.getLaunchJsonFile(workspc.workspaceFolders![0]); const doc = await this.documentManager.openTextDocument(launchJson); await this.documentManager.showTextDocument(doc); - } - } - } + }, + }, + }, ]; } default: { diff --git a/src/client/application/diagnostics/checks/lsNotSupported.ts b/src/client/application/diagnostics/checks/lsNotSupported.ts index c33154fbbff7..a22fcba18536 100644 --- a/src/client/application/diagnostics/checks/lsNotSupported.ts +++ b/src/client/application/diagnostics/checks/lsNotSupported.ts @@ -22,7 +22,7 @@ export class LSNotSupportedDiagnostic extends BaseDiagnostic { message, DiagnosticSeverity.Warning, DiagnosticScope.Global, - resource + resource, ); } } @@ -37,7 +37,7 @@ export class LSNotSupportedDiagnosticService extends BaseDiagnosticsService { @inject(IDiagnosticHandlerService) @named(DiagnosticCommandPromptHandlerServiceId) protected readonly messageService: IDiagnosticHandlerService, - @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry + @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry, ) { super([DiagnosticCodes.LSNotSupportedDiagnostic], serviceContainer, disposableRegistry, false); } @@ -62,13 +62,13 @@ export class LSNotSupportedDiagnosticService extends BaseDiagnosticsService { prompt: 'More Info', command: commandFactory.createCommand(diagnostic, { type: 'launch', - options: 'https://aka.ms/pythonlsrequirements' - }) + options: 'https://aka.ms/pythonlsrequirements', + }), }, { prompt: 'Do not show again', - command: commandFactory.createCommand(diagnostic, { type: 'ignore', options: DiagnosticScope.Global }) - } + command: commandFactory.createCommand(diagnostic, { type: 'ignore', options: DiagnosticScope.Global }), + }, ]; await this.messageService.handle(diagnostic, { commandPrompts: options }); diff --git a/src/client/application/diagnostics/checks/macPythonInterpreter.ts b/src/client/application/diagnostics/checks/macPythonInterpreter.ts index 7c2acce2bf67..dfaf48d009a3 100644 --- a/src/client/application/diagnostics/checks/macPythonInterpreter.ts +++ b/src/client/application/diagnostics/checks/macPythonInterpreter.ts @@ -15,7 +15,7 @@ import { IExperimentsManager, IInterpreterPathService, InterpreterConfigurationScope, - Resource + Resource, } from '../../../common/types'; import { IInterpreterHelper, IInterpreterService } from '../../../interpreter/contracts'; import { IServiceContainer } from '../../../ioc/types'; @@ -30,7 +30,7 @@ const messages = { [DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic]: 'You have selected the macOS system install of Python, which is not recommended for use with the Python extension. Some functionality will be limited, please select a different interpreter.', [DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic]: - 'The macOS system install of Python is not recommended, some functionality in the extension will be limited. Install another version of Python for the best experience.' + 'The macOS system install of Python is not recommended, some functionality in the extension will be limited. Install another version of Python for the best experience.', }; export class InvalidMacPythonInterpreterDiagnostic extends BaseDiagnostic { @@ -38,7 +38,7 @@ export class InvalidMacPythonInterpreterDiagnostic extends BaseDiagnostic { code: | DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic | DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic, - resource: Resource + resource: Resource, ) { super(code, messages[code], DiagnosticSeverity.Error, DiagnosticScope.WorkspaceFolder, resource); } @@ -55,16 +55,16 @@ export class InvalidMacPythonInterpreterService extends BaseDiagnosticsService { @inject(IInterpreterService) private readonly interpreterService: IInterpreterService, @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry, @inject(IPlatformService) private readonly platform: IPlatformService, - @inject(IInterpreterHelper) private readonly helper: IInterpreterHelper + @inject(IInterpreterHelper) private readonly helper: IInterpreterHelper, ) { super( [ DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic, - DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic + DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic, ], serviceContainer, disposableRegistry, - true + true, ); this.addPythonPathChangedHandler(); } @@ -108,16 +108,16 @@ export class InvalidMacPythonInterpreterService extends BaseDiagnosticsService { return [ new InvalidMacPythonInterpreterDiagnostic( DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic, - resource - ) + resource, + ), ]; } } return [ new InvalidMacPythonInterpreterDiagnostic( DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic, - resource - ) + resource, + ), ]; } protected async onHandle(diagnostics: IDiagnostic[]): Promise { @@ -126,7 +126,7 @@ export class InvalidMacPythonInterpreterService extends BaseDiagnosticsService { } const messageService = this.serviceContainer.get>( IDiagnosticHandlerService, - DiagnosticCommandPromptHandlerServiceId + DiagnosticCommandPromptHandlerServiceId, ); await Promise.all( diagnostics.map(async (diagnostic) => { @@ -137,7 +137,7 @@ export class InvalidMacPythonInterpreterService extends BaseDiagnosticsService { } const commandPrompts = this.getCommandPrompts(diagnostic); return messageService.handle(diagnostic, { commandPrompts, message: diagnostic.message }); - }) + }), ); } protected addPythonPathChangedHandler() { @@ -153,7 +153,7 @@ export class InvalidMacPythonInterpreterService extends BaseDiagnosticsService { } protected async onDidChangeConfiguration( event?: ConfigurationChangeEvent, - interpreterConfigurationScope?: InterpreterConfigurationScope + interpreterConfigurationScope?: InterpreterConfigurationScope, ) { let workspaceUri: Resource; if (event) { @@ -162,7 +162,7 @@ export class InvalidMacPythonInterpreterService extends BaseDiagnosticsService { ? workspaceService.workspaceFolders!.map((workspace) => workspace.uri) : [undefined]; const workspaceUriIndex = workspacesUris.findIndex((uri) => - event.affectsConfiguration('python.pythonPath', uri) + event.affectsConfiguration('python.pythonPath', uri), ); if (workspaceUriIndex === -1) { return; @@ -172,7 +172,7 @@ export class InvalidMacPythonInterpreterService extends BaseDiagnosticsService { workspaceUri = interpreterConfigurationScope.uri; } else { throw new Error( - 'One of `interpreterConfigurationScope` or `event` should be defined when calling `onDidChangeConfiguration`.' + 'One of `interpreterConfigurationScope` or `event` should be defined when calling `onDidChangeConfiguration`.', ); } // Lets wait, for more changes, dirty simple throttling. @@ -197,16 +197,16 @@ export class InvalidMacPythonInterpreterService extends BaseDiagnosticsService { prompt: 'Select Python Interpreter', command: commandFactory.createCommand(diagnostic, { type: 'executeVSCCommand', - options: 'python.setInterpreter' - }) + options: 'python.setInterpreter', + }), }, { prompt: 'Do not show again', command: commandFactory.createCommand(diagnostic, { type: 'ignore', - options: DiagnosticScope.Global - }) - } + options: DiagnosticScope.Global, + }), + }, ]; } case DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic: { @@ -215,23 +215,23 @@ export class InvalidMacPythonInterpreterService extends BaseDiagnosticsService { prompt: 'Learn more', command: commandFactory.createCommand(diagnostic, { type: 'launch', - options: 'https://code.visualstudio.com/docs/python/python-tutorial#_prerequisites' - }) + options: 'https://code.visualstudio.com/docs/python/python-tutorial#_prerequisites', + }), }, { prompt: 'Download', command: commandFactory.createCommand(diagnostic, { type: 'launch', - options: 'https://www.python.org/downloads' - }) + options: 'https://www.python.org/downloads', + }), }, { prompt: 'Do not show again', command: commandFactory.createCommand(diagnostic, { type: 'ignore', - options: DiagnosticScope.Global - }) - } + options: DiagnosticScope.Global, + }), + }, ]; } default: { diff --git a/src/client/application/diagnostics/checks/powerShellActivation.ts b/src/client/application/diagnostics/checks/powerShellActivation.ts index a2e8c08ff5c5..cf8be6df9446 100644 --- a/src/client/application/diagnostics/checks/powerShellActivation.ts +++ b/src/client/application/diagnostics/checks/powerShellActivation.ts @@ -29,7 +29,7 @@ export class PowershellActivationNotAvailableDiagnostic extends BaseDiagnostic { DiagnosticSeverity.Warning, DiagnosticScope.Global, resource, - 'always' + 'always', ); } } @@ -42,17 +42,17 @@ export class PowerShellActivationHackDiagnosticsService extends BaseDiagnosticsS protected readonly messageService: IDiagnosticHandlerService; constructor( @inject(IServiceContainer) serviceContainer: IServiceContainer, - @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry + @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry, ) { super( [DiagnosticCodes.EnvironmentActivationInPowerShellWithBatchFilesNotSupportedDiagnostic], serviceContainer, disposableRegistry, - true + true, ); this.messageService = serviceContainer.get>( IDiagnosticHandlerService, - DiagnosticCommandPromptHandlerServiceId + DiagnosticCommandPromptHandlerServiceId, ); } public async diagnose(_resource: Resource): Promise { @@ -78,28 +78,28 @@ export class PowerShellActivationHackDiagnosticsService extends BaseDiagnosticsS diagnostic, invoke: async (): Promise => { sendTelemetryEvent(EventName.DIAGNOSTICS_ACTION, undefined, { - action: 'switchToCommandPrompt' + action: 'switchToCommandPrompt', }); useCommandPromptAsDefaultShell(currentProcess, configurationService).catch((ex) => - traceError('Use Command Prompt as default shell', ex) + traceError('Use Command Prompt as default shell', ex), ); - } - } + }, + }, }, { - prompt: 'Ignore' + prompt: 'Ignore', }, { prompt: 'Always Ignore', - command: commandFactory.createCommand(diagnostic, { type: 'ignore', options: DiagnosticScope.Global }) + command: commandFactory.createCommand(diagnostic, { type: 'ignore', options: DiagnosticScope.Global }), }, { prompt: 'More Info', command: commandFactory.createCommand(diagnostic, { type: 'launch', - options: 'https://aka.ms/CondaPwsh' - }) - } + options: 'https://aka.ms/CondaPwsh', + }), + }, ]; await this.messageService.handle(diagnostic, { commandPrompts: options }); diff --git a/src/client/application/diagnostics/checks/pythonInterpreter.ts b/src/client/application/diagnostics/checks/pythonInterpreter.ts index 6040234f7f2a..123d243518f6 100644 --- a/src/client/application/diagnostics/checks/pythonInterpreter.ts +++ b/src/client/application/diagnostics/checks/pythonInterpreter.ts @@ -20,14 +20,14 @@ import { IDiagnostic, IDiagnosticCommand, IDiagnosticHandlerService, - IDiagnosticMessageOnCloseHandler + IDiagnosticMessageOnCloseHandler, } from '../types'; const messages = { [DiagnosticCodes.NoPythonInterpretersDiagnostic]: 'Python is not installed. Please download and install Python before using the extension.', [DiagnosticCodes.NoCurrentlySelectedPythonInterpreterDiagnostic]: - 'No Python interpreter is selected. You need to select a Python interpreter to enable features such as IntelliSense, linting, and debugging.' + 'No Python interpreter is selected. You need to select a Python interpreter to enable features such as IntelliSense, linting, and debugging.', }; export class InvalidPythonInterpreterDiagnostic extends BaseDiagnostic { @@ -35,7 +35,7 @@ export class InvalidPythonInterpreterDiagnostic extends BaseDiagnostic { code: | DiagnosticCodes.NoPythonInterpretersDiagnostic | DiagnosticCodes.NoCurrentlySelectedPythonInterpreterDiagnostic, - resource: Resource + resource: Resource, ) { super(code, messages[code], DiagnosticSeverity.Error, DiagnosticScope.WorkspaceFolder, resource); } @@ -47,16 +47,16 @@ export const InvalidPythonInterpreterServiceId = 'InvalidPythonInterpreterServic export class InvalidPythonInterpreterService extends BaseDiagnosticsService { constructor( @inject(IServiceContainer) serviceContainer: IServiceContainer, - @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry + @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry, ) { super( [ DiagnosticCodes.NoPythonInterpretersDiagnostic, - DiagnosticCodes.NoCurrentlySelectedPythonInterpreterDiagnostic + DiagnosticCodes.NoCurrentlySelectedPythonInterpreterDiagnostic, ], serviceContainer, disposableRegistry, - false + false, ); } public async diagnose(resource: Resource): Promise { @@ -85,8 +85,8 @@ export class InvalidPythonInterpreterService extends BaseDiagnosticsService { return [ new InvalidPythonInterpreterDiagnostic( DiagnosticCodes.NoCurrentlySelectedPythonInterpreterDiagnostic, - resource - ) + resource, + ), ]; } @@ -98,7 +98,7 @@ export class InvalidPythonInterpreterService extends BaseDiagnosticsService { } const messageService = this.serviceContainer.get>( IDiagnosticHandlerService, - DiagnosticCommandPromptHandlerServiceId + DiagnosticCommandPromptHandlerServiceId, ); await Promise.all( diagnostics.map(async (diagnostic) => { @@ -108,7 +108,7 @@ export class InvalidPythonInterpreterService extends BaseDiagnosticsService { const commandPrompts = this.getCommandPrompts(diagnostic); const onClose = this.getOnCloseHandler(diagnostic); return messageService.handle(diagnostic, { commandPrompts, message: diagnostic.message, onClose }); - }) + }), ); } private getCommandPrompts(diagnostic: IDiagnostic): { prompt: string; command?: IDiagnosticCommand }[] { @@ -120,9 +120,9 @@ export class InvalidPythonInterpreterService extends BaseDiagnosticsService { prompt: 'Download', command: commandFactory.createCommand(diagnostic, { type: 'launch', - options: 'https://www.python.org/downloads' - }) - } + options: 'https://www.python.org/downloads', + }), + }, ]; } case DiagnosticCodes.NoCurrentlySelectedPythonInterpreterDiagnostic: { @@ -131,9 +131,9 @@ export class InvalidPythonInterpreterService extends BaseDiagnosticsService { prompt: 'Select Python Interpreter', command: commandFactory.createCommand(diagnostic, { type: 'executeVSCCommand', - options: 'python.setInterpreter' - }) - } + options: 'python.setInterpreter', + }), + }, ]; } default: { @@ -145,7 +145,7 @@ export class InvalidPythonInterpreterService extends BaseDiagnosticsService { if (diagnostic.code === DiagnosticCodes.NoPythonInterpretersDiagnostic) { return (response?: string) => { sendTelemetryEvent(EventName.PYTHON_NOT_INSTALLED_PROMPT, undefined, { - selection: response ? 'Download' : 'Ignore' + selection: response ? 'Download' : 'Ignore', }); }; } diff --git a/src/client/application/diagnostics/checks/pythonPathDeprecated.ts b/src/client/application/diagnostics/checks/pythonPathDeprecated.ts index 305be378d831..528eec1ca1f1 100644 --- a/src/client/application/diagnostics/checks/pythonPathDeprecated.ts +++ b/src/client/application/diagnostics/checks/pythonPathDeprecated.ts @@ -24,7 +24,7 @@ export class PythonPathDeprecatedDiagnostic extends BaseDiagnostic { message, DiagnosticSeverity.Information, DiagnosticScope.WorkspaceFolder, - resource + resource, ); } } @@ -39,7 +39,7 @@ export class PythonPathDeprecatedDiagnosticService extends BaseDiagnosticsServic @inject(IDiagnosticHandlerService) @named(DiagnosticCommandPromptHandlerServiceId) protected readonly messageService: IDiagnosticHandlerService, - @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry + @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry, ) { super([DiagnosticCodes.PythonPathDeprecatedDiagnostic], serviceContainer, disposableRegistry, true); this.workspaceService = this.serviceContainer.get(IWorkspaceService); @@ -67,7 +67,7 @@ export class PythonPathDeprecatedDiagnosticService extends BaseDiagnosticsServic const workspaceConfig = this.workspaceService.getConfiguration('python', resource); await Promise.all([ workspaceConfig.update('pythonPath', undefined, ConfigurationTarget.Workspace), - workspaceConfig.update('pythonPath', undefined, ConfigurationTarget.WorkspaceFolder) + workspaceConfig.update('pythonPath', undefined, ConfigurationTarget.WorkspaceFolder), ]); } @@ -86,13 +86,13 @@ export class PythonPathDeprecatedDiagnosticService extends BaseDiagnosticsServic prompt: Common.openOutputPanel(), command: { diagnostic, - invoke: async (): Promise => this.output.show(true) - } + invoke: async (): Promise => this.output.show(true), + }, }, { prompt: Common.doNotShowAgain(), - command: commandFactory.createCommand(diagnostic, { type: 'ignore', options: DiagnosticScope.Global }) - } + command: commandFactory.createCommand(diagnostic, { type: 'ignore', options: DiagnosticScope.Global }), + }, ]; await this.messageService.handle(diagnostic, { commandPrompts: options }); diff --git a/src/client/application/diagnostics/checks/upgradeCodeRunner.ts b/src/client/application/diagnostics/checks/upgradeCodeRunner.ts index 9285b41d72e7..81007c5fd297 100644 --- a/src/client/application/diagnostics/checks/upgradeCodeRunner.ts +++ b/src/client/application/diagnostics/checks/upgradeCodeRunner.ts @@ -24,7 +24,7 @@ export class UpgradeCodeRunnerDiagnostic extends BaseDiagnostic { message, DiagnosticSeverity.Information, DiagnosticScope.Global, - resource + resource, ); } } @@ -40,7 +40,7 @@ export class UpgradeCodeRunnerDiagnosticService extends BaseDiagnosticsService { @named(DiagnosticCommandPromptHandlerServiceId) protected readonly messageService: IDiagnosticHandlerService, @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry, - @inject(IExtensions) private readonly extensions: IExtensions + @inject(IExtensions) private readonly extensions: IExtensions, ) { super([DiagnosticCodes.UpgradeCodeRunnerDiagnostic], serviceContainer, disposableRegistry, true); this.workspaceService = this.serviceContainer.get(IWorkspaceService); @@ -86,8 +86,8 @@ export class UpgradeCodeRunnerDiagnosticService extends BaseDiagnosticsService { const options = [ { prompt: Common.doNotShowAgain(), - command: commandFactory.createCommand(diagnostic, { type: 'ignore', options: DiagnosticScope.Global }) - } + command: commandFactory.createCommand(diagnostic, { type: 'ignore', options: DiagnosticScope.Global }), + }, ]; await this.messageService.handle(diagnostic, { commandPrompts: options }); diff --git a/src/client/application/diagnostics/commands/execVSCCommand.ts b/src/client/application/diagnostics/commands/execVSCCommand.ts index cb935f05d33d..50c7367f199a 100644 --- a/src/client/application/diagnostics/commands/execVSCCommand.ts +++ b/src/client/application/diagnostics/commands/execVSCCommand.ts @@ -15,7 +15,7 @@ export class ExecuteVSCCommand extends BaseDiagnosticCommand { constructor( diagnostic: IDiagnostic, private serviceContainer: IServiceContainer, - private commandName: CommandsWithoutArgs + private commandName: CommandsWithoutArgs, ) { super(diagnostic); } diff --git a/src/client/application/diagnostics/commands/ignore.ts b/src/client/application/diagnostics/commands/ignore.ts index 07078cc17fe6..311128195975 100644 --- a/src/client/application/diagnostics/commands/ignore.ts +++ b/src/client/application/diagnostics/commands/ignore.ts @@ -13,7 +13,7 @@ export class IgnoreDiagnosticCommand extends BaseDiagnosticCommand { constructor( diagnostic: IDiagnostic, private serviceContainer: IServiceContainer, - private readonly scope: DiagnosticScope + private readonly scope: DiagnosticScope, ) { super(diagnostic); } diff --git a/src/client/application/diagnostics/constants.ts b/src/client/application/diagnostics/constants.ts index b975ae9222a0..a5c8c69a53d3 100644 --- a/src/client/application/diagnostics/constants.ts +++ b/src/client/application/diagnostics/constants.ts @@ -18,5 +18,5 @@ export enum DiagnosticCodes { JustMyCodeDiagnostic = 'JustMyCodeDiagnostic', ConsoleTypeDiagnostic = 'ConsoleTypeDiagnostic', ConfigPythonPathDiagnostic = 'ConfigPythonPathDiagnostic', - UpgradeCodeRunnerDiagnostic = 'UpgradeCodeRunnerDiagnostic' + UpgradeCodeRunnerDiagnostic = 'UpgradeCodeRunnerDiagnostic', } diff --git a/src/client/application/diagnostics/filter.ts b/src/client/application/diagnostics/filter.ts index 7aaf94f490e3..a304a6f558fc 100644 --- a/src/client/application/diagnostics/filter.ts +++ b/src/client/application/diagnostics/filter.ts @@ -10,7 +10,7 @@ import { DiagnosticScope, IDiagnosticFilterService } from './types'; export enum FilterKeys { GlobalDiagnosticFilter = 'GLOBAL_DIAGNOSTICS_FILTER', - WorkspaceDiagnosticFilter = 'WORKSPACE_DIAGNOSTICS_FILTER' + WorkspaceDiagnosticFilter = 'WORKSPACE_DIAGNOSTICS_FILTER', } @injectable() @@ -21,7 +21,7 @@ export class DiagnosticFilterService implements IDiagnosticFilterService { const globalState = factory.createGlobalPersistentState(FilterKeys.GlobalDiagnosticFilter, []); const workspaceState = factory.createWorkspacePersistentState( FilterKeys.WorkspaceDiagnosticFilter, - [] + [], ); return globalState.value.indexOf(code) >= 0 || workspaceState.value.indexOf(code) >= 0; } diff --git a/src/client/application/diagnostics/promptHandler.ts b/src/client/application/diagnostics/promptHandler.ts index 210a7c5ecee3..25b946b2ffb5 100644 --- a/src/client/application/diagnostics/promptHandler.ts +++ b/src/client/application/diagnostics/promptHandler.ts @@ -28,13 +28,13 @@ export class DiagnosticCommandPromptHandlerService implements IDiagnosticHandler } public async handle( diagnostic: IDiagnostic, - options: MessageCommandPrompt = { commandPrompts: [] } + options: MessageCommandPrompt = { commandPrompts: [] }, ): Promise { const prompts = options.commandPrompts.map((option) => option.prompt); const response = await this.displayMessage( options.message ? options.message : diagnostic.message, diagnostic.severity, - prompts + prompts, ); if (options.onClose) { options.onClose(response); @@ -50,7 +50,7 @@ export class DiagnosticCommandPromptHandlerService implements IDiagnosticHandler private async displayMessage( message: string, severity: DiagnosticSeverity, - prompts: string[] + prompts: string[], ): Promise { switch (severity) { case DiagnosticSeverity.Error: { diff --git a/src/client/application/diagnostics/serviceRegistry.ts b/src/client/application/diagnostics/serviceRegistry.ts index 9aefb8e742d9..1388a2bab248 100644 --- a/src/client/application/diagnostics/serviceRegistry.ts +++ b/src/client/application/diagnostics/serviceRegistry.ts @@ -9,29 +9,29 @@ import { IApplicationDiagnostics } from '../types'; import { ApplicationDiagnostics } from './applicationDiagnostics'; import { EnvironmentPathVariableDiagnosticsService, - EnvironmentPathVariableDiagnosticsServiceId + EnvironmentPathVariableDiagnosticsServiceId, } from './checks/envPathVariable'; import { InvalidLaunchJsonDebuggerService, - InvalidLaunchJsonDebuggerServiceId + InvalidLaunchJsonDebuggerServiceId, } from './checks/invalidLaunchJsonDebugger'; import { InvalidPythonPathInDebuggerService, - InvalidPythonPathInDebuggerServiceId + InvalidPythonPathInDebuggerServiceId, } from './checks/invalidPythonPathInDebugger'; import { LSNotSupportedDiagnosticService, LSNotSupportedDiagnosticServiceId } from './checks/lsNotSupported'; import { InvalidMacPythonInterpreterService, - InvalidMacPythonInterpreterServiceId + InvalidMacPythonInterpreterServiceId, } from './checks/macPythonInterpreter'; import { PowerShellActivationHackDiagnosticsService, - PowerShellActivationHackDiagnosticsServiceId + PowerShellActivationHackDiagnosticsServiceId, } from './checks/powerShellActivation'; import { InvalidPythonInterpreterService, InvalidPythonInterpreterServiceId } from './checks/pythonInterpreter'; import { PythonPathDeprecatedDiagnosticService, - PythonPathDeprecatedDiagnosticServiceId + PythonPathDeprecatedDiagnosticServiceId, } from './checks/pythonPathDeprecated'; import { UpgradeCodeRunnerDiagnosticService, UpgradeCodeRunnerDiagnosticServiceId } from './checks/upgradeCodeRunner'; import { DiagnosticsCommandFactory } from './commands/factory'; @@ -40,7 +40,7 @@ import { DiagnosticFilterService } from './filter'; import { DiagnosticCommandPromptHandlerService, DiagnosticCommandPromptHandlerServiceId, - MessageCommandPrompt + MessageCommandPrompt, } from './promptHandler'; import { IDiagnosticFilterService, IDiagnosticHandlerService, IDiagnosticsService } from './types'; @@ -49,48 +49,48 @@ export function registerTypes(serviceManager: IServiceManager, languageServerTyp serviceManager.addSingleton>( IDiagnosticHandlerService, DiagnosticCommandPromptHandlerService, - DiagnosticCommandPromptHandlerServiceId + DiagnosticCommandPromptHandlerServiceId, ); serviceManager.addSingleton( IDiagnosticsService, EnvironmentPathVariableDiagnosticsService, - EnvironmentPathVariableDiagnosticsServiceId + EnvironmentPathVariableDiagnosticsServiceId, ); serviceManager.addSingleton( IDiagnosticsService, InvalidLaunchJsonDebuggerService, - InvalidLaunchJsonDebuggerServiceId + InvalidLaunchJsonDebuggerServiceId, ); serviceManager.addSingleton( IDiagnosticsService, InvalidPythonInterpreterService, - InvalidPythonInterpreterServiceId + InvalidPythonInterpreterServiceId, ); serviceManager.addSingleton( IDiagnosticsService, InvalidPythonPathInDebuggerService, - InvalidPythonPathInDebuggerServiceId + InvalidPythonPathInDebuggerServiceId, ); serviceManager.addSingleton( IDiagnosticsService, PowerShellActivationHackDiagnosticsService, - PowerShellActivationHackDiagnosticsServiceId + PowerShellActivationHackDiagnosticsServiceId, ); serviceManager.addSingleton( IDiagnosticsService, InvalidMacPythonInterpreterService, - InvalidMacPythonInterpreterServiceId + InvalidMacPythonInterpreterServiceId, ); serviceManager.addSingleton( IDiagnosticsService, PythonPathDeprecatedDiagnosticService, - PythonPathDeprecatedDiagnosticServiceId + PythonPathDeprecatedDiagnosticServiceId, ); serviceManager.addSingleton( IDiagnosticsService, UpgradeCodeRunnerDiagnosticService, - UpgradeCodeRunnerDiagnosticServiceId + UpgradeCodeRunnerDiagnosticServiceId, ); serviceManager.addSingleton(IDiagnosticsCommandFactory, DiagnosticsCommandFactory); serviceManager.addSingleton(IApplicationDiagnostics, ApplicationDiagnostics); @@ -99,7 +99,7 @@ export function registerTypes(serviceManager: IServiceManager, languageServerTyp serviceManager.addSingleton( IDiagnosticsService, LSNotSupportedDiagnosticService, - LSNotSupportedDiagnosticServiceId + LSNotSupportedDiagnosticServiceId, ); } } diff --git a/src/client/application/diagnostics/surceMapSupportService.ts b/src/client/application/diagnostics/surceMapSupportService.ts index b2630f99f5eb..02ff47375411 100644 --- a/src/client/application/diagnostics/surceMapSupportService.ts +++ b/src/client/application/diagnostics/surceMapSupportService.ts @@ -17,11 +17,11 @@ export class SourceMapSupportService implements ISourceMapSupportService { @inject(ICommandManager) private readonly commandManager: ICommandManager, @inject(IDisposableRegistry) private readonly disposables: IDisposableRegistry, @inject(IConfigurationService) private readonly configurationService: IConfigurationService, - @inject(IApplicationShell) private readonly shell: IApplicationShell + @inject(IApplicationShell) private readonly shell: IApplicationShell, ) {} public register(): void { this.disposables.push( - this.commandManager.registerCommand(Commands.Enable_SourceMap_Support, this.onEnable, this) + this.commandManager.registerCommand(Commands.Enable_SourceMap_Support, this.onEnable, this), ); } public async enable(): Promise { @@ -29,7 +29,7 @@ export class SourceMapSupportService implements ISourceMapSupportService { 'diagnostics.sourceMapsEnabled', true, undefined, - ConfigurationTarget.Global + ConfigurationTarget.Global, ); await this.commandManager.executeCommand('workbench.action.reloadWindow'); } @@ -37,7 +37,7 @@ export class SourceMapSupportService implements ISourceMapSupportService { const enableSourceMapsAndReloadVSC = Diagnostics.enableSourceMapsAndReloadVSC(); const selection = await this.shell.showWarningMessage( Diagnostics.warnBeforeEnablingSourceMaps(), - enableSourceMapsAndReloadVSC + enableSourceMapsAndReloadVSC, ); if (selection === enableSourceMapsAndReloadVSC) { await this.enable(); diff --git a/src/client/application/diagnostics/types.ts b/src/client/application/diagnostics/types.ts index 22715c59a7a5..c28f3f9c7c67 100644 --- a/src/client/application/diagnostics/types.ts +++ b/src/client/application/diagnostics/types.ts @@ -10,12 +10,12 @@ import { DiagnosticCodes } from './constants'; export enum DiagnosticScope { Global = 'Global', - WorkspaceFolder = 'WorkspaceFolder' + WorkspaceFolder = 'WorkspaceFolder', } export enum DiagnosticIgnoreScope { always = 'always', - session = 'session' + session = 'session', } export interface IDiagnostic { diff --git a/src/client/application/misc/joinMailingListPrompt.ts b/src/client/application/misc/joinMailingListPrompt.ts index 8eaf96a21cc4..42a05d8dcbb7 100644 --- a/src/client/application/misc/joinMailingListPrompt.ts +++ b/src/client/application/misc/joinMailingListPrompt.ts @@ -22,7 +22,7 @@ export class JoinMailingListPrompt implements IExtensionSingleActivationService @inject(IPersistentStateFactory) private readonly factory: IPersistentStateFactory, @inject(IExperimentService) private readonly experiments: IExperimentService, @inject(IBrowserService) private browserService: IBrowserService, - @inject(IApplicationEnvironment) private appEnvironment: IApplicationEnvironment + @inject(IApplicationEnvironment) private appEnvironment: IApplicationEnvironment, ) { this.storage = this.factory.createGlobalPersistentState('JoinMailingListPrompt', false); } @@ -62,14 +62,14 @@ export class JoinMailingListPrompt implements IExtensionSingleActivationService const selection = await this.shell.showInformationMessage( promptContent, Common.bannerLabelYes(), - Common.bannerLabelNo() + Common.bannerLabelNo(), ); if (selection === Common.bannerLabelYes()) { sendTelemetryEvent(EventName.JOIN_MAILING_LIST_PROMPT, undefined, { selection: 'Yes' }); const query = querystring.stringify({ m: encodeURIComponent(this.appEnvironment.sessionId), - utm_source: 'vscode' + utm_source: 'vscode', }); const url = `https://aka.ms/python-vscode-mailinglist?${query}`; this.browserService.launch(url); diff --git a/src/client/common/application/activeResource.ts b/src/client/common/application/activeResource.ts index a89386b0d9cf..4230fb5de921 100644 --- a/src/client/common/application/activeResource.ts +++ b/src/client/common/application/activeResource.ts @@ -11,7 +11,7 @@ import { IActiveResourceService, IDocumentManager, IWorkspaceService } from './t export class ActiveResourceService implements IActiveResourceService { constructor( @inject(IDocumentManager) private readonly documentManager: IDocumentManager, - @inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService + @inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService, ) {} public getActiveResource(): Resource { diff --git a/src/client/common/application/applicationEnvironment.ts b/src/client/common/application/applicationEnvironment.ts index 3d01d85f4b35..04c2bf5086e2 100644 --- a/src/client/common/application/applicationEnvironment.ts +++ b/src/client/common/application/applicationEnvironment.ts @@ -17,7 +17,7 @@ export class ApplicationEnvironment implements IApplicationEnvironment { constructor( @inject(IPlatformService) private readonly platform: IPlatformService, @inject(IPathUtils) private readonly pathUtils: IPathUtils, - @inject(ICurrentProcess) private readonly process: ICurrentProcess + @inject(ICurrentProcess) private readonly process: ICurrentProcess, ) {} public get userSettingsFile(): string | undefined { @@ -30,7 +30,7 @@ export class ApplicationEnvironment implements IApplicationEnvironment { 'Application Support', vscodeFolderName, 'User', - 'settings.json' + 'settings.json', ); case OSType.Linux: return path.join(this.pathUtils.home, '.config', vscodeFolderName, 'User', 'settings.json'); diff --git a/src/client/common/application/applicationShell.ts b/src/client/common/application/applicationShell.ts index cd28fc986b0d..773df118807c 100644 --- a/src/client/common/application/applicationShell.ts +++ b/src/client/common/application/applicationShell.ts @@ -31,7 +31,7 @@ import { window, WindowState, WorkspaceFolder, - WorkspaceFolderPickOptions + WorkspaceFolderPickOptions, } from 'vscode'; import { IApplicationShell } from './types'; @@ -79,12 +79,12 @@ export class ApplicationShell implements IApplicationShell { public showQuickPick( items: string[] | Thenable, options?: QuickPickOptions, - token?: CancellationToken + token?: CancellationToken, ): Thenable; public showQuickPick( items: T[] | Thenable, options?: QuickPickOptions, - token?: CancellationToken + token?: CancellationToken, ): Thenable; public showQuickPick(items: any, options?: any, token?: any): Thenable { return window.showQuickPick(items, options, token); @@ -118,20 +118,20 @@ export class ApplicationShell implements IApplicationShell { } public withProgress( options: ProgressOptions, - task: (progress: Progress<{ message?: string; increment?: number }>, token: CancellationToken) => Thenable + task: (progress: Progress<{ message?: string; increment?: number }>, token: CancellationToken) => Thenable, ): Thenable { return window.withProgress(options, task); } public withProgressCustomIcon( icon: string, - task: (progress: Progress<{ message?: string; increment?: number }>, token: CancellationToken) => Thenable + task: (progress: Progress<{ message?: string; increment?: number }>, token: CancellationToken) => Thenable, ): Thenable { const token = new CancellationTokenSource().token; const statusBarProgress = this.createStatusBarItem(StatusBarAlignment.Left); const progress = { report: (value: { message?: string; increment?: number }) => { statusBarProgress.text = `${icon} ${value.message}`; - } + }, }; statusBarProgress.show(); return task(progress, token).then((result) => { diff --git a/src/client/common/application/commandManager.ts b/src/client/common/application/commandManager.ts index 07d610ac5a23..2f31288d967d 100644 --- a/src/client/common/application/commandManager.ts +++ b/src/client/common/application/commandManager.ts @@ -12,7 +12,7 @@ import { ICommandManager, IJupyterExtensionDependencyManager } from './types'; export class CommandManager implements ICommandManager { constructor( @inject(IJupyterExtensionDependencyManager) - private jupyterExtensionDependencyManager: IJupyterExtensionDependencyManager + private jupyterExtensionDependencyManager: IJupyterExtensionDependencyManager, ) {} /** @@ -51,7 +51,7 @@ export class CommandManager implements ICommandManager { public registerTextEditorCommand( command: string, callback: (textEditor: TextEditor, edit: TextEditorEdit, ...args: any[]) => void, - thisArg?: any + thisArg?: any, ): Disposable { return commands.registerTextEditorCommand(command, callback, thisArg); } diff --git a/src/client/common/application/commands.ts b/src/client/common/application/commands.ts index 5ea5bb3c92e9..0062df8f15d7 100644 --- a/src/client/common/application/commands.ts +++ b/src/client/common/application/commands.ts @@ -99,14 +99,14 @@ export interface ICommandNameArgumentTypeMapping extends ICommandNameWithoutArgu undefined | TestWorkspaceFolder, undefined | CommandSource, undefined | Uri, - undefined | TestsToRun + undefined | TestsToRun, ]; // When command is invoked from a tree node, first argument is the node data. [Commands.Tests_Debug]: [ undefined | TestWorkspaceFolder, undefined | CommandSource, undefined | Uri, - undefined | TestsToRun + undefined | TestsToRun, ]; [Commands.Tests_Run_Parametrized]: [undefined, undefined | CommandSource, Uri, TestFunction[], boolean]; // When command is invoked from a tree node, first argument is the node data. diff --git a/src/client/common/application/commands/reloadCommand.ts b/src/client/common/application/commands/reloadCommand.ts index 36fded88b797..312cb674e7df 100644 --- a/src/client/common/application/commands/reloadCommand.ts +++ b/src/client/common/application/commands/reloadCommand.ts @@ -16,7 +16,7 @@ import { IApplicationShell, ICommandManager } from '../types'; export class ReloadVSCodeCommandHandler implements IExtensionSingleActivationService { constructor( @inject(ICommandManager) private readonly commandManager: ICommandManager, - @inject(IApplicationShell) private readonly appShell: IApplicationShell + @inject(IApplicationShell) private readonly appShell: IApplicationShell, ) {} public async activate(): Promise { this.commandManager.registerCommand('python.reloadVSCode', this.onReloadVSCode, this); diff --git a/src/client/common/application/customEditorService.ts b/src/client/common/application/customEditorService.ts index 4163c9af509d..f928724c0dfa 100644 --- a/src/client/common/application/customEditorService.ts +++ b/src/client/common/application/customEditorService.ts @@ -19,7 +19,7 @@ export class CustomEditorService implements ICustomEditorService { @inject(ICommandManager) private commandManager: ICommandManager, @inject(UseCustomEditorApi) private readonly useCustomEditorApi: boolean, @inject(IWorkspaceService) private readonly workspace: IWorkspaceService, - @inject(IExtensionContext) private readonly extensionContext: IExtensionContext + @inject(IExtensionContext) private readonly extensionContext: IExtensionContext, ) { this.enableCustomEditors().catch((e) => traceError(`Error setting up custom editors: `, e)); } @@ -30,7 +30,7 @@ export class CustomEditorService implements ICustomEditorService { options?: { readonly webviewOptions?: vscode.WebviewPanelOptions; readonly supportsMultipleEditorsPerDocument?: boolean; - } + }, ): vscode.Disposable { if (this.useCustomEditorApi) { // tslint:disable-next-line: no-any @@ -64,11 +64,11 @@ export class CustomEditorService implements ICustomEditorService { ) { editorAssociations.push({ viewType: ViewType, - filenamePattern: '*.ipynb' + filenamePattern: '*.ipynb', }); await Promise.all([ this.extensionContext.globalState.update(EditorAssociationUpdatedKey, true), - settings.update('editorAssociations', editorAssociations, vscode.ConfigurationTarget.Global) + settings.update('editorAssociations', editorAssociations, vscode.ConfigurationTarget.Global), ]); } @@ -82,7 +82,7 @@ export class CustomEditorService implements ICustomEditorService { const updatedSettings = editorAssociations.filter((item) => item.viewType !== ViewType); await Promise.all([ this.extensionContext.globalState.update(EditorAssociationUpdatedKey, false), - settings.update('editorAssociations', updatedSettings, vscode.ConfigurationTarget.Global) + settings.update('editorAssociations', updatedSettings, vscode.ConfigurationTarget.Global), ]); } } diff --git a/src/client/common/application/debugService.ts b/src/client/common/application/debugService.ts index f553b6cd6f5c..9505f2663b93 100644 --- a/src/client/common/application/debugService.ts +++ b/src/client/common/application/debugService.ts @@ -15,7 +15,7 @@ import { DebugSessionCustomEvent, Disposable, Event, - WorkspaceFolder + WorkspaceFolder, } from 'vscode'; import { IDebugService } from './types'; @@ -57,7 +57,7 @@ export class DebugService implements IDebugService { public startDebugging( folder: WorkspaceFolder | undefined, nameOrConfiguration: string | DebugConfiguration, - parentSession?: DebugSession + parentSession?: DebugSession, ): Thenable { return debug.startDebugging(folder, nameOrConfiguration, parentSession); } @@ -69,7 +69,7 @@ export class DebugService implements IDebugService { } public registerDebugAdapterDescriptorFactory( debugType: string, - factory: DebugAdapterDescriptorFactory + factory: DebugAdapterDescriptorFactory, ): Disposable { return debug.registerDebugAdapterDescriptorFactory(debugType, factory); } diff --git a/src/client/common/application/debugSessionTelemetry.ts b/src/client/common/application/debugSessionTelemetry.ts index 692ded155a13..1e71cc0fca7f 100644 --- a/src/client/common/application/debugSessionTelemetry.ts +++ b/src/client/common/application/debugSessionTelemetry.ts @@ -56,7 +56,7 @@ class TelemetryTracker implements DebugAdapterTracker { } const telemetryProps = { trigger: this.trigger, - console: this.console + console: this.console, }; sendTelemetryEvent(eventName, this.timer.elapsedTime, telemetryProps); } @@ -66,7 +66,7 @@ class TelemetryTracker implements DebugAdapterTracker { export class DebugSessionTelemetry implements DebugAdapterTrackerFactory, IExtensionSingleActivationService { constructor( @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry, - @inject(IDebugService) debugService: IDebugService + @inject(IDebugService) debugService: IDebugService, ) { disposableRegistry.push(debugService.registerDebugAdapterTrackerFactory('python', this)); } diff --git a/src/client/common/application/documentManager.ts b/src/client/common/application/documentManager.ts index d3fe7dd2140e..8147dc55cfcf 100644 --- a/src/client/common/application/documentManager.ts +++ b/src/client/common/application/documentManager.ts @@ -16,7 +16,7 @@ import { ViewColumn, window, workspace, - WorkspaceEdit + WorkspaceEdit, } from 'vscode'; import { IDocumentManager } from './types'; diff --git a/src/client/common/application/notebook.ts b/src/client/common/application/notebook.ts index be34838e3496..cb407b97d2d3 100644 --- a/src/client/common/application/notebook.ts +++ b/src/client/common/application/notebook.ts @@ -13,7 +13,7 @@ import type { NotebookDocumentFilter, NotebookEditor, NotebookKernel, - NotebookKernelProvider + NotebookKernelProvider, } from 'vscode-proposed'; import { UseProposedApi } from '../constants'; import { IDisposableRegistry } from '../types'; @@ -84,7 +84,7 @@ export class VSCodeNotebook implements IVSCodeNotebook { constructor( @inject(UseProposedApi) private readonly useProposedApi: boolean, @inject(IDisposableRegistry) private readonly disposables: IDisposableRegistry, - @inject(IApplicationEnvironment) readonly env: IApplicationEnvironment + @inject(IApplicationEnvironment) readonly env: IApplicationEnvironment, ) { if (this.useProposedApi && this.env.channel === 'insiders') { this.addEventHandlers(); @@ -104,13 +104,13 @@ export class VSCodeNotebook implements IVSCodeNotebook { options?: { transientOutputs: boolean; transientMetadata: { [K in keyof NotebookCellMetadata]?: boolean }; - } + }, ): Disposable { return this.notebook.registerNotebookContentProvider(notebookType, provider, options); } public registerNotebookKernelProvider( selector: NotebookDocumentFilter, - provider: NotebookKernelProvider + provider: NotebookKernelProvider, ): Disposable { return this.notebook.registerNotebookKernelProvider(selector, provider); } @@ -122,16 +122,16 @@ export class VSCodeNotebook implements IVSCodeNotebook { this.disposables.push( ...[ this.notebook.onDidChangeCellLanguage((e) => - this._onDidChangeNotebookDocument.fire({ ...e, type: 'changeCellLanguage' }) + this._onDidChangeNotebookDocument.fire({ ...e, type: 'changeCellLanguage' }), ), this.notebook.onDidChangeCellMetadata((e) => - this._onDidChangeNotebookDocument.fire({ ...e, type: 'changeCellMetadata' }) + this._onDidChangeNotebookDocument.fire({ ...e, type: 'changeCellMetadata' }), ), this.notebook.onDidChangeNotebookDocumentMetadata((e) => - this._onDidChangeNotebookDocument.fire({ ...e, type: 'changeNotebookMetadata' }) + this._onDidChangeNotebookDocument.fire({ ...e, type: 'changeNotebookMetadata' }), ), this.notebook.onDidChangeCellOutputs((e) => - this._onDidChangeNotebookDocument.fire({ ...e, type: 'changeCellOutputs' }) + this._onDidChangeNotebookDocument.fire({ ...e, type: 'changeCellOutputs' }), ), this.notebook.onDidChangeNotebookCells((e) => { if (this.handledCellChanges.has(e)) { @@ -139,8 +139,8 @@ export class VSCodeNotebook implements IVSCodeNotebook { } this.handledCellChanges.add(e); this._onDidChangeNotebookDocument.fire({ ...e, type: 'changeCells' }); - }) - ] + }), + ], ); } } diff --git a/src/client/common/application/types.ts b/src/client/common/application/types.ts index e766773ebcf7..cff7045c1e26 100644 --- a/src/client/common/application/types.ts +++ b/src/client/common/application/types.ts @@ -56,7 +56,7 @@ import { WorkspaceEdit, WorkspaceFolder, WorkspaceFolderPickOptions, - WorkspaceFoldersChangeEvent + WorkspaceFoldersChangeEvent, } from 'vscode'; import type { NotebookCellLanguageChangeEvent as VSCNotebookCellLanguageChangeEvent, @@ -71,7 +71,7 @@ import type { NotebookDocumentMetadataChangeEvent as VSCNotebookDocumentMetadataChangeEvent, NotebookEditor, NotebookKernel, - NotebookKernelProvider + NotebookKernelProvider, } from 'vscode-proposed'; import { IAsyncDisposable, Resource } from '../types'; @@ -238,7 +238,7 @@ export interface IApplicationShell { showQuickPick( items: string[] | Thenable, options?: QuickPickOptions, - token?: CancellationToken + token?: CancellationToken, ): Thenable; /** @@ -252,7 +252,7 @@ export interface IApplicationShell { showQuickPick( items: T[] | Thenable, options?: QuickPickOptions, - token?: CancellationToken + token?: CancellationToken, ): Thenable; /** @@ -385,7 +385,7 @@ export interface IApplicationShell { */ withProgress( options: ProgressOptions, - task: (progress: Progress<{ message?: string; increment?: number }>, token: CancellationToken) => Thenable + task: (progress: Progress<{ message?: string; increment?: number }>, token: CancellationToken) => Thenable, ): Thenable; /** @@ -412,7 +412,7 @@ export interface IApplicationShell { */ withProgressCustomIcon( icon: string, - task: (progress: Progress<{ message?: string; increment?: number }>, token: CancellationToken) => Thenable + task: (progress: Progress<{ message?: string; increment?: number }>, token: CancellationToken) => Thenable, ): Thenable; /** @@ -449,7 +449,7 @@ export interface ICommandManager { registerCommand( command: E, callback: (...args: U) => any, - thisArg?: any + thisArg?: any, ): Disposable; /** @@ -469,7 +469,7 @@ export interface ICommandManager { registerTextEditorCommand( command: string, callback: (textEditor: TextEditor, edit: TextEditorEdit, ...args: any[]) => void, - thisArg?: any + thisArg?: any, ): Disposable; /** @@ -784,7 +784,7 @@ export interface IWorkspaceService { globPattern: GlobPattern, ignoreCreateEvents?: boolean, ignoreChangeEvents?: boolean, - ignoreDeleteEvents?: boolean + ignoreDeleteEvents?: boolean, ): FileSystemWatcher; /** @@ -806,7 +806,7 @@ export interface IWorkspaceService { include: GlobPattern, exclude?: GlobPattern, maxResults?: number, - token?: CancellationToken + token?: CancellationToken, ): Thenable; /** @@ -937,7 +937,7 @@ export interface IDebugService { startDebugging( folder: WorkspaceFolder | undefined, nameOrConfiguration: string | DebugConfiguration, - parentSession?: DebugSession + parentSession?: DebugSession, ): Thenable; /** @@ -1460,7 +1460,7 @@ export interface CustomEditorProvider backupCustomDocument( document: T, context: CustomDocumentBackupContext, - cancellation: CancellationToken + cancellation: CancellationToken, ): Thenable; } @@ -1497,7 +1497,7 @@ export interface ICustomEditorService { * can properly synchronize the states of all editor instances for a resource so that they are consistent. */ readonly supportsMultipleEditorsPerDocument?: boolean; - } + }, ): Disposable; /** * Opens a file with a custom editor @@ -1558,7 +1558,7 @@ export interface IVSCodeNotebook { * Default to false. If the content provider doesn't persisit a metadata property in the file document, it should be set to true. */ transientMetadata: { [K in keyof NotebookCellMetadata]?: boolean }; - } + }, ): Disposable; registerNotebookKernelProvider(selector: NotebookDocumentFilter, provider: NotebookKernelProvider): Disposable; diff --git a/src/client/common/application/webviewPanels/webviewPanel.ts b/src/client/common/application/webviewPanels/webviewPanel.ts index 0f49489b2258..44faeb82e547 100644 --- a/src/client/common/application/webviewPanels/webviewPanel.ts +++ b/src/client/common/application/webviewPanels/webviewPanel.ts @@ -22,7 +22,7 @@ export class WebviewPanel extends Webview implements IWebviewPanel { fs: IFileSystem, private disposableRegistry: IDisposableRegistry, private panelOptions: IWebviewPanelOptions, - additionalRootPaths: Uri[] = [] + additionalRootPaths: Uri[] = [], ) { super(fs, panelOptions); @@ -31,8 +31,8 @@ export class WebviewPanel extends Webview implements IWebviewPanel { localResourceRoots: [ Uri.file(this.panelOptions.rootPath), Uri.file(this.panelOptions.cwd), - ...additionalRootPaths - ] + ...additionalRootPaths, + ], }; if (panelOptions.webViewPanel) { this.panel = panelOptions.webViewPanel; @@ -45,8 +45,8 @@ export class WebviewPanel extends Webview implements IWebviewPanel { { retainContextWhenHidden: true, enableFindWidget: true, - ...webViewOptions - } + ...webViewOptions, + }, ); } @@ -106,21 +106,21 @@ export class WebviewPanel extends Webview implements IWebviewPanel { this.panel.onDidDispose(() => { this.panel = undefined; this.panelOptions.listener.dispose().ignoreErrors(); - }) + }), ); this.disposableRegistry.push( this.panel.webview.onDidReceiveMessage((message) => { // Pass the message onto our listener this.panelOptions.listener.onMessage(message.type, message.payload); - }) + }), ); this.disposableRegistry.push( this.panel.onDidChangeViewState((_e) => { // Pass the state change onto our listener this.panelOptions.listener.onChangeViewState(this); - }) + }), ); // Set initial state diff --git a/src/client/common/application/webviewPanels/webviewPanelProvider.ts b/src/client/common/application/webviewPanels/webviewPanelProvider.ts index 441824c02f12..b0f69fa47a4d 100644 --- a/src/client/common/application/webviewPanels/webviewPanelProvider.ts +++ b/src/client/common/application/webviewPanels/webviewPanelProvider.ts @@ -16,7 +16,7 @@ export class WebviewPanelProvider implements IWebviewPanelProvider { constructor( @inject(IDisposableRegistry) private readonly disposableRegistry: IDisposableRegistry, @inject(IFileSystem) private readonly fs: IFileSystem, - @inject(IExtensionContext) private readonly context: IExtensionContext + @inject(IExtensionContext) private readonly context: IExtensionContext, ) {} // tslint:disable-next-line:no-any diff --git a/src/client/common/application/webviews/webview.ts b/src/client/common/application/webviews/webview.ts index 8ae82ddb0010..6d0bef3da356 100644 --- a/src/client/common/application/webviews/webview.ts +++ b/src/client/common/application/webviews/webview.ts @@ -52,8 +52,8 @@ export class Webview implements IWebview { const fontAwesomePath = webview .asWebviewUri( Uri.file( - path.join(this.options.rootPath, 'node_modules', 'font-awesome', 'css', 'font-awesome.min.css') - ) + path.join(this.options.rootPath, 'node_modules', 'font-awesome', 'css', 'font-awesome.min.css'), + ), ) .toString(); return ` diff --git a/src/client/common/application/workspace.ts b/src/client/common/application/workspace.ts index 67b12cbda6c7..f3eb57c6156c 100644 --- a/src/client/common/application/workspace.ts +++ b/src/client/common/application/workspace.ts @@ -13,7 +13,7 @@ import { workspace, WorkspaceConfiguration, WorkspaceFolder, - WorkspaceFoldersChangeEvent + WorkspaceFoldersChangeEvent, } from 'vscode'; import { Resource } from '../types'; import { getOSType, OSType } from '../utils/platform'; @@ -54,20 +54,20 @@ export class WorkspaceService implements IWorkspaceService { globPattern: GlobPattern, ignoreCreateEvents?: boolean, ignoreChangeEvents?: boolean, - ignoreDeleteEvents?: boolean + ignoreDeleteEvents?: boolean, ): FileSystemWatcher { return workspace.createFileSystemWatcher( globPattern, ignoreCreateEvents, ignoreChangeEvents, - ignoreDeleteEvents + ignoreDeleteEvents, ); } public findFiles( include: GlobPattern, exclude?: GlobPattern, maxResults?: number, - token?: CancellationToken + token?: CancellationToken, ): Thenable { const excludePattern = exclude === undefined ? this.searchExcludes : exclude; return workspace.findFiles(include, excludePattern, maxResults, token); @@ -76,7 +76,9 @@ export class WorkspaceService implements IWorkspaceService { const workspaceFolder = resource ? workspace.getWorkspaceFolder(resource) : undefined; return workspaceFolder ? path.normalize( - getOSType() === OSType.Windows ? workspaceFolder.uri.fsPath.toUpperCase() : workspaceFolder.uri.fsPath + getOSType() === OSType.Windows + ? workspaceFolder.uri.fsPath.toUpperCase() + : workspaceFolder.uri.fsPath, ) : defaultValue; } diff --git a/src/client/common/configSettings.ts b/src/client/common/configSettings.ts index 582a7e1982db..0d34b2f05e26 100644 --- a/src/client/common/configSettings.ts +++ b/src/client/common/configSettings.ts @@ -10,7 +10,7 @@ import { Event, EventEmitter, Uri, - WorkspaceConfiguration + WorkspaceConfiguration, } from 'vscode'; import { LanguageServerType } from '../activation/types'; import '../common/extensions'; @@ -41,7 +41,7 @@ import { ITestingSettings, IWorkspaceSymbolSettings, LoggingLevelSettingType, - Resource + Resource, } from './types'; import { debounceSync } from './utils/decorators'; import { SystemVariables } from './variables/systemVariables'; @@ -129,7 +129,7 @@ export class PythonSettings implements IPythonSettings { workspace?: IWorkspaceService, private readonly experimentsManager?: IExperimentsManager, private readonly interpreterPathService?: IInterpreterPathService, - private readonly interpreterSecurityService?: IInterpreterSecurityService + private readonly interpreterSecurityService?: IInterpreterSecurityService, ) { this.workspace = workspace || new WorkspaceService(); this.workspaceRoot = workspaceFolder; @@ -142,7 +142,7 @@ export class PythonSettings implements IPythonSettings { workspace?: IWorkspaceService, experimentsManager?: IExperimentsManager, interpreterPathService?: IInterpreterPathService, - interpreterSecurityService?: IInterpreterSecurityService + interpreterSecurityService?: IInterpreterSecurityService, ): PythonSettings { workspace = workspace || new WorkspaceService(); const workspaceFolderUri = PythonSettings.getSettingsUriAndTarget(resource, workspace).uri; @@ -155,7 +155,7 @@ export class PythonSettings implements IPythonSettings { workspace, experimentsManager, interpreterPathService, - interpreterSecurityService + interpreterSecurityService, ); PythonSettings.pythonSettings.set(workspaceFolderKey, settings); // Pass null to avoid VSC from complaining about not passing in a value. @@ -163,7 +163,7 @@ export class PythonSettings implements IPythonSettings { const config = workspace.getConfiguration('editor', resource ? resource : (null as any)); const formatOnType = config ? config.get('formatOnType', false) : false; sendTelemetryEvent(EventName.COMPLETION_ADD_BRACKETS, undefined, { - enabled: settings.autoComplete ? settings.autoComplete.addBrackets : false + enabled: settings.autoComplete ? settings.autoComplete.addBrackets : false, }); sendTelemetryEvent(EventName.FORMAT_ON_TYPE, undefined, { enabled: formatOnType }); } @@ -174,7 +174,7 @@ export class PythonSettings implements IPythonSettings { // tslint:disable-next-line:type-literal-delimiter public static getSettingsUriAndTarget( resource: Uri | undefined, - workspace?: IWorkspaceService + workspace?: IWorkspaceService, ): { uri: Uri | undefined; target: ConfigurationTarget } { workspace = workspace || new WorkspaceService(); const workspaceFolder = resource ? workspace.getWorkspaceFolder(resource) : undefined; @@ -239,10 +239,10 @@ export class PythonSettings implements IPythonSettings { this.poetryPath = poetryPath && poetryPath.length > 0 ? getAbsolutePath(poetryPath, workspaceRoot) : poetryPath; this.downloadLanguageServer = systemVariables.resolveAny( - pythonSettings.get('downloadLanguageServer', true) + pythonSettings.get('downloadLanguageServer', true), )!; this.autoUpdateLanguageServer = systemVariables.resolveAny( - pythonSettings.get('autoUpdateLanguageServer', true) + pythonSettings.get('autoUpdateLanguageServer', true), )!; this.useIsolation = systemVariables.resolveAny(pythonSettings.get('useIsolation', true))!; @@ -346,11 +346,11 @@ export class PythonSettings implements IPythonSettings { error: DiagnosticSeverity.Error, fatal: DiagnosticSeverity.Error, refactor: DiagnosticSeverity.Hint, - warning: DiagnosticSeverity.Warning + warning: DiagnosticSeverity.Warning, }, pycodestyleCategorySeverity: { E: DiagnosticSeverity.Error, - W: DiagnosticSeverity.Warning + W: DiagnosticSeverity.Warning, }, flake8CategorySeverity: { E: DiagnosticSeverity.Error, @@ -358,28 +358,28 @@ export class PythonSettings implements IPythonSettings { // Per http://flake8.pycqa.org/en/latest/glossary.html#term-error-code // 'F' does not mean 'fatal as in PyLint but rather 'pyflakes' such as // unused imports, variables, etc. - F: DiagnosticSeverity.Warning + F: DiagnosticSeverity.Warning, }, mypyCategorySeverity: { error: DiagnosticSeverity.Error, - note: DiagnosticSeverity.Hint + note: DiagnosticSeverity.Hint, }, - pylintUseMinimalCheckers: false + pylintUseMinimalCheckers: false, }; this.linting.pylintPath = getAbsolutePath(systemVariables.resolveAny(this.linting.pylintPath), workspaceRoot); this.linting.flake8Path = getAbsolutePath(systemVariables.resolveAny(this.linting.flake8Path), workspaceRoot); this.linting.pycodestylePath = getAbsolutePath( systemVariables.resolveAny(this.linting.pycodestylePath), - workspaceRoot + workspaceRoot, ); this.linting.pylamaPath = getAbsolutePath(systemVariables.resolveAny(this.linting.pylamaPath), workspaceRoot); this.linting.prospectorPath = getAbsolutePath( systemVariables.resolveAny(this.linting.prospectorPath), - workspaceRoot + workspaceRoot, ); this.linting.pydocstylePath = getAbsolutePath( systemVariables.resolveAny(this.linting.pydocstylePath), - workspaceRoot + workspaceRoot, ); this.linting.mypyPath = getAbsolutePath(systemVariables.resolveAny(this.linting.mypyPath), workspaceRoot); this.linting.banditPath = getAbsolutePath(systemVariables.resolveAny(this.linting.banditPath), workspaceRoot); @@ -401,21 +401,21 @@ export class PythonSettings implements IPythonSettings { blackArgs: [], blackPath: 'black', yapfArgs: [], - yapfPath: 'yapf' + yapfPath: 'yapf', }; this.formatting.autopep8Path = getAbsolutePath( systemVariables.resolveAny(this.formatting.autopep8Path), - workspaceRoot + workspaceRoot, ); this.formatting.yapfPath = getAbsolutePath(systemVariables.resolveAny(this.formatting.yapfPath), workspaceRoot); this.formatting.blackPath = getAbsolutePath( systemVariables.resolveAny(this.formatting.blackPath), - workspaceRoot + workspaceRoot, ); // tslint:disable-next-line:no-backbone-get-set-outside-model no-non-null-assertion const autoCompleteSettings = systemVariables.resolveAny( - pythonSettings.get('autoComplete') + pythonSettings.get('autoComplete'), )!; if (this.autoComplete) { Object.assign(this.autoComplete, autoCompleteSettings); @@ -429,17 +429,17 @@ export class PythonSettings implements IPythonSettings { extraPaths: [], addBrackets: false, showAdvancedMembers: false, - typeshedPaths: [] + typeshedPaths: [], }; // tslint:disable-next-line:no-backbone-get-set-outside-model no-non-null-assertion const workspaceSymbolsSettings = systemVariables.resolveAny( - pythonSettings.get('workspaceSymbols') + pythonSettings.get('workspaceSymbols'), )!; if (this.workspaceSymbols) { Object.assign( this.workspaceSymbols, - workspaceSymbolsSettings + workspaceSymbolsSettings, ); } else { this.workspaceSymbols = workspaceSymbolsSettings; @@ -453,11 +453,11 @@ export class PythonSettings implements IPythonSettings { exclusionPatterns: [], rebuildOnFileSave: true, rebuildOnStart: true, - tagFilePath: workspaceRoot ? path.join(workspaceRoot, 'tags') : '' + tagFilePath: workspaceRoot ? path.join(workspaceRoot, 'tags') : '', }; this.workspaceSymbols.tagFilePath = getAbsolutePath( systemVariables.resolveAny(this.workspaceSymbols.tagFilePath), - workspaceRoot + workspaceRoot, ); // tslint:disable-next-line:no-backbone-get-set-outside-model no-non-null-assertion @@ -480,7 +480,7 @@ export class PythonSettings implements IPythonSettings { unittestEnabled: false, nosetestPath: 'nosetests', pytestPath: 'pytest', - autoTestDiscoverOnSaveEnabled: true + autoTestDiscoverOnSaveEnabled: true, } as ITestingSettings; } } @@ -499,12 +499,12 @@ export class PythonSettings implements IPythonSettings { pytestPath: 'pytest', unittestArgs: [], unittestEnabled: false, - autoTestDiscoverOnSaveEnabled: true + autoTestDiscoverOnSaveEnabled: true, }; this.testing.pytestPath = getAbsolutePath(systemVariables.resolveAny(this.testing.pytestPath), workspaceRoot); this.testing.nosetestPath = getAbsolutePath( systemVariables.resolveAny(this.testing.nosetestPath), - workspaceRoot + workspaceRoot, ); if (this.testing.cwd) { this.testing.cwd = getAbsolutePath(systemVariables.resolveAny(this.testing.cwd), workspaceRoot); @@ -534,7 +534,7 @@ export class PythonSettings implements IPythonSettings { executeInFileDir: true, launchArgs: [], activateEnvironment: true, - activateEnvInCurrentTerminal: false + activateEnvInCurrentTerminal: false, }; const experiments = systemVariables.resolveAny(pythonSettings.get('experiments'))!; @@ -548,7 +548,7 @@ export class PythonSettings implements IPythonSettings { : { enabled: true, optInto: [], - optOutFrom: [] + optOutFrom: [], }; const showStartPage = pythonSettings.get('showStartPage'); @@ -584,7 +584,7 @@ export class PythonSettings implements IPythonSettings { }; this.disposables.push(this.workspace.onDidChangeWorkspaceFolders(this.onWorkspaceFoldersChanged, this)); this.disposables.push( - this.interpreterAutoSelectionService.onDidChangeAutoSelectedInterpreter(onDidChange.bind(this)) + this.interpreterAutoSelectionService.onDidChangeAutoSelectedInterpreter(onDidChange.bind(this)), ); if (this.interpreterSecurityService) { this.disposables.push(this.interpreterSecurityService.onDidChangeSafeInterpreters(onDidChange.bind(this))); @@ -594,7 +594,7 @@ export class PythonSettings implements IPythonSettings { if (event.affectsConfiguration('python')) { onDidChange(); } - }) + }), ); if (this.interpreterPathService) { this.disposables.push(this.interpreterPathService.onDidChange(onDidChange.bind(this))); @@ -613,7 +613,7 @@ export class PythonSettings implements IPythonSettings { private getPythonPath( pythonSettings: WorkspaceConfiguration, systemVariables: SystemVariables, - workspaceRoot: string | undefined + workspaceRoot: string | undefined, ) { /** * Note that while calling `IExperimentsManager.inExperiment()`, we assume `IExperimentsManager.activate()` is already called. @@ -627,7 +627,7 @@ export class PythonSettings implements IPythonSettings { this.pythonPath = systemVariables.resolveAny( inExperiment && this.interpreterPathService ? this.interpreterPathService.get(this.workspaceRoot) - : pythonSettings.get('pythonPath') + : pythonSettings.get('pythonPath'), )!; if ( !process.env.CI_DISABLE_AUTO_SELECTION && @@ -635,7 +635,7 @@ export class PythonSettings implements IPythonSettings { this.interpreterAutoSelectionService ) { const autoSelectedPythonInterpreter = this.interpreterAutoSelectionService.getAutoSelectedInterpreter( - this.workspaceRoot + this.workspaceRoot, ); if (inExperiment && this.interpreterSecurityService) { if ( @@ -709,7 +709,7 @@ function getPythonExecutable(pythonPath: string): string { 'python2', 'python3.7', 'python3.8', - 'python3.9' + 'python3.9', ]; for (let executableName of KnownPythonExecutables) { diff --git a/src/client/common/configuration/service.ts b/src/client/common/configuration/service.ts index b922254d8b05..eea03eee3ade 100644 --- a/src/client/common/configuration/service.ts +++ b/src/client/common/configuration/service.ts @@ -5,7 +5,7 @@ import { inject, injectable } from 'inversify'; import { ConfigurationTarget, Uri, WorkspaceConfiguration } from 'vscode'; import { IInterpreterAutoSeletionProxyService, - IInterpreterSecurityService + IInterpreterSecurityService, } from '../../interpreter/autoSelection/types'; import { IServiceContainer } from '../../ioc/types'; import { IWorkspaceService } from '../application/types'; @@ -22,12 +22,12 @@ export class ConfigurationService implements IConfigurationService { } public getSettings(resource?: Uri): IPythonSettings { const InterpreterAutoSelectionService = this.serviceContainer.get( - IInterpreterAutoSeletionProxyService + IInterpreterAutoSeletionProxyService, ); const interpreterPathService = this.serviceContainer.get(IInterpreterPathService); const experiments = this.serviceContainer.get(IExperimentsManager); const interpreterSecurityService = this.serviceContainer.get( - IInterpreterSecurityService + IInterpreterSecurityService, ); return PythonSettings.getInstance( resource, @@ -35,7 +35,7 @@ export class ConfigurationService implements IConfigurationService { this.workspaceService, experiments, interpreterPathService, - interpreterSecurityService + interpreterSecurityService, ); } @@ -44,7 +44,7 @@ export class ConfigurationService implements IConfigurationService { setting: string, value?: {}, resource?: Uri, - configTarget?: ConfigurationTarget + configTarget?: ConfigurationTarget, ): Promise { const experiments = this.serviceContainer.get(IExperimentsManager); const interpreterPathService = this.serviceContainer.get(IInterpreterPathService); @@ -52,7 +52,7 @@ export class ConfigurationService implements IConfigurationService { experiments.sendTelemetryIfInExperiment(DeprecatePythonPath.control); const defaultSetting = { uri: resource, - target: configTarget || ConfigurationTarget.WorkspaceFolder + target: configTarget || ConfigurationTarget.WorkspaceFolder, }; let settingsInfo = defaultSetting; if (section === 'python' && configTarget !== ConfigurationTarget.Global) { @@ -89,7 +89,7 @@ export class ConfigurationService implements IConfigurationService { setting: string, value?: {}, resource?: Uri, - configTarget?: ConfigurationTarget + configTarget?: ConfigurationTarget, ): Promise { return this.updateSectionSetting('python', setting, value, resource, configTarget); } @@ -102,7 +102,7 @@ export class ConfigurationService implements IConfigurationService { configSection: WorkspaceConfiguration, target: ConfigurationTarget, settingName: string, - value?: {} + value?: {}, ): Promise { if (this.isTestExecution() && !isUnitTestExecution()) { let retries = 0; diff --git a/src/client/common/constants.ts b/src/client/common/constants.ts index 57c5b1f4bf30..36b98168e0d4 100644 --- a/src/client/common/constants.ts +++ b/src/client/common/constants.ts @@ -9,7 +9,7 @@ export const PYTHON = [ { scheme: 'file', language: PYTHON_LANGUAGE }, { scheme: 'untitled', language: PYTHON_LANGUAGE }, { scheme: 'vscode-notebook', language: PYTHON_LANGUAGE }, - { scheme: NotebookCellScheme, language: PYTHON_LANGUAGE } + { scheme: NotebookCellScheme, language: PYTHON_LANGUAGE }, ]; export const PYTHON_ALLFILES = [{ language: PYTHON_LANGUAGE }]; diff --git a/src/client/common/crypto.ts b/src/client/common/crypto.ts index 3067ebb4a801..10c58732728c 100644 --- a/src/client/common/crypto.ts +++ b/src/client/common/crypto.ts @@ -17,7 +17,7 @@ export class CryptoUtils implements ICryptoUtils { public createHash( data: string, hashFormat: E, - algorithm: 'SHA512' | 'SHA256' | 'FNV' = 'FNV' + algorithm: 'SHA512' | 'SHA256' | 'FNV' = 'FNV', ): IHashFormat[E] { let hash: string; if (algorithm === 'FNV') { diff --git a/src/client/common/dotnet/compatibilityService.ts b/src/client/common/dotnet/compatibilityService.ts index 421fd7f5dfa9..f94f6406bb7d 100644 --- a/src/client/common/dotnet/compatibilityService.ts +++ b/src/client/common/dotnet/compatibilityService.ts @@ -24,7 +24,7 @@ export class DotNetCompatibilityService implements IDotNetCompatibilityService { @inject(IOSDotNetCompatibilityService) @named(OSType.OSX) macService: IOSDotNetCompatibilityService, @inject(IOSDotNetCompatibilityService) @named(OSType.Windows) winService: IOSDotNetCompatibilityService, @inject(IOSDotNetCompatibilityService) @named(OSType.Linux) linuxService: IOSDotNetCompatibilityService, - @inject(IPlatformService) private readonly platformService: IPlatformService + @inject(IPlatformService) private readonly platformService: IPlatformService, ) { this.mappedServices.set(OSType.Unknown, unknownOsService); this.mappedServices.set(OSType.OSX, macService); diff --git a/src/client/common/dotnet/serviceRegistry.ts b/src/client/common/dotnet/serviceRegistry.ts index 1c1f18bb5845..5004f481da4e 100644 --- a/src/client/common/dotnet/serviceRegistry.ts +++ b/src/client/common/dotnet/serviceRegistry.ts @@ -16,21 +16,21 @@ export function registerTypes(serviceManager: IServiceManager) { serviceManager.addSingleton( IOSDotNetCompatibilityService, MacDotNetCompatibilityService, - OSType.OSX + OSType.OSX, ); serviceManager.addSingleton( IOSDotNetCompatibilityService, WindowsDotNetCompatibilityService, - OSType.Windows + OSType.Windows, ); serviceManager.addSingleton( IOSDotNetCompatibilityService, LinuxDotNetCompatibilityService, - OSType.Linux + OSType.Linux, ); serviceManager.addSingleton( IOSDotNetCompatibilityService, UnknownOSDotNetCompatibilityService, - OSType.Unknown + OSType.Unknown, ); } diff --git a/src/client/common/editor.ts b/src/client/common/editor.ts index e8a908e2d612..9c050c299138 100644 --- a/src/client/common/editor.ts +++ b/src/client/common/editor.ts @@ -14,7 +14,7 @@ import { isNotebookCell } from './utils/misc'; enum EditAction { Delete, Insert, - Replace + Replace, } const NEW_LINE_LENGTH = EOL.length; @@ -86,7 +86,7 @@ export function getTextEditsFromPatch(before: string, patch: string): TextEdit[] export function getWorkspaceEditsFromPatch( filePatches: string[], workspaceRoot: string | undefined, - fs: IFileSystem + fs: IFileSystem, ): WorkspaceEdit { const workspaceEdit = new WorkspaceEdit(); filePatches.forEach((patch) => { diff --git a/src/client/common/experiments/debuggerDataViewerExperimentEnabler.ts b/src/client/common/experiments/debuggerDataViewerExperimentEnabler.ts index 89c0ca37607a..6539a82dd431 100644 --- a/src/client/common/experiments/debuggerDataViewerExperimentEnabler.ts +++ b/src/client/common/experiments/debuggerDataViewerExperimentEnabler.ts @@ -9,7 +9,7 @@ import { IExperimentService } from '../types'; export class DebuggerDataViewerExperimentEnabler implements IExtensionSingleActivationService { constructor( @inject(ICommandManager) private readonly commandManager: ICommandManager, - @inject(IExperimentService) private readonly experimentService: IExperimentService + @inject(IExperimentService) private readonly experimentService: IExperimentService, ) {} public async activate(): Promise { @@ -21,7 +21,7 @@ export class DebuggerDataViewerExperimentEnabler implements IExtensionSingleActi // context menu item from the variable window context menu during a debugging session const isDataViewerExperimentEnabled = new ContextKey( 'python.isDebuggerDataViewerExperimentEnabled', - this.commandManager + this.commandManager, ); await isDataViewerExperimentEnabled.set(await this.experimentService.inExperiment('debuggerDataViewer')); } diff --git a/src/client/common/experiments/groups.ts b/src/client/common/experiments/groups.ts index 5526dc6c84ff..fe463793d0b7 100644 --- a/src/client/common/experiments/groups.ts +++ b/src/client/common/experiments/groups.ts @@ -1,19 +1,19 @@ // Experiment to check whether to always display the test explorer. export enum AlwaysDisplayTestExplorerGroups { control = 'AlwaysDisplayTestExplorer - control', - experiment = 'AlwaysDisplayTestExplorer - experiment' + experiment = 'AlwaysDisplayTestExplorer - experiment', } // Experiment to check whether to show "Extension Survey prompt" or not. export enum ShowExtensionSurveyPrompt { control = 'ShowExtensionSurveyPrompt - control', - enabled = 'ShowExtensionSurveyPrompt - enabled' + enabled = 'ShowExtensionSurveyPrompt - enabled', } // Experiment to check whether to enable re-load for web apps while debugging. export enum WebAppReload { control = 'Reload - control', - experiment = 'Reload - experiment' + experiment = 'Reload - experiment', } /** @@ -24,25 +24,25 @@ export enum WebAppReload { */ export enum UseTerminalToGetActivatedEnvVars { control = 'UseTerminalToGetActivatedEnvVars - control', - experiment = 'UseTerminalToGetActivatedEnvVars - experiment' + experiment = 'UseTerminalToGetActivatedEnvVars - experiment', } // Dummy experiment added to validate metrics of A/B testing export enum ValidateABTesting { control = 'AA_testing - control', - experiment = 'AA_testing - experiment' + experiment = 'AA_testing - experiment', } // Collect language server request timings. export enum CollectLSRequestTiming { control = 'CollectLSRequestTiming - control', - experiment = 'CollectLSRequestTiming - experiment' + experiment = 'CollectLSRequestTiming - experiment', } // Collect Node language server request timings. export enum CollectNodeLSRequestTiming { control = 'CollectNodeLSRequestTiming - control', - experiment = 'CollectNodeLSRequestTiming - experiment' + experiment = 'CollectNodeLSRequestTiming - experiment', } /* @@ -50,59 +50,59 @@ export enum CollectNodeLSRequestTiming { */ export enum DeprecatePythonPath { control = 'DeprecatePythonPath - control', - experiment = 'DeprecatePythonPath - experiment' + experiment = 'DeprecatePythonPath - experiment', } // Experiment to offer switch to Pylance language server export enum TryPylance { experiment = 'tryPylance', jediPrompt1 = 'tryPylancePromptText1', - jediPrompt2 = 'tryPylancePromptText2' + jediPrompt2 = 'tryPylancePromptText2', } // Experiment for the content of the tip being displayed on first extension launch: // interpreter selection tip, feedback survey or nothing. export enum SurveyAndInterpreterTipNotification { tipExperiment = 'pythonTipPromptWording', - surveyExperiment = 'pythonMailingListPromptWording' + surveyExperiment = 'pythonMailingListPromptWording', } // Experiment to switch Jedi to use an LSP instead of direct providers export enum JediLSP { - experiment = 'jediLSP' + experiment = 'jediLSP', } // Experiment to show a prompt asking users to join python mailing list. export enum JoinMailingListPromptVariants { variant1 = 'pythonJoinMailingListVar1', variant2 = 'pythonJoinMailingListVar2', - variant3 = 'pythonJoinMailingListVar3' + variant3 = 'pythonJoinMailingListVar3', } // Experiment to use a different method for normalizing code to be sent to the REPL. export enum SendSelectionToREPL { - experiment = 'pythonSendEntireLineToREPL' + experiment = 'pythonSendEntireLineToREPL', } // Feature flag for 'Python: Launch TensorBoard' feature export enum NativeTensorBoard { - experiment = 'nativeTensorBoard' + experiment = 'nativeTensorBoard', } // Experiment to show a prompt asking users to install or select linter export enum LinterInstallationPromptVariants { pylintFirst = 'pythonInstallPylintButtonFirst', flake8First = 'pythonInstallFlake8ButtonFirst', - noPrompt = 'pythonNotDisplayLinterPrompt' + noPrompt = 'pythonNotDisplayLinterPrompt', } // AB test codeactions vs codelenses as an entrypoint for native TensorBoard sessions export enum NativeTensorBoardEntrypoints { codeActions = 'pythonTensorBoardCodeActions', - codeLenses = 'pythonTensorBoardCodeLenses' + codeLenses = 'pythonTensorBoardCodeLenses', } // Experiment to control which environment discovery mechanism can be used export enum DiscoveryVariants { discoverWithFileWatching = 'pythonDiscoveryModule', - discoveryWithoutFileWatching = 'pythonDiscoveryModuleWithoutWatcher' + discoveryWithoutFileWatching = 'pythonDiscoveryModuleWithoutWatcher', } diff --git a/src/client/common/experiments/manager.ts b/src/client/common/experiments/manager.ts index cd2713cb865f..84b91bdbfe9f 100644 --- a/src/client/common/experiments/manager.ts +++ b/src/client/common/experiments/manager.ts @@ -23,7 +23,7 @@ import { IOutputChannel, IPersistentState, IPersistentStateFactory, - IPythonSettings + IPythonSettings, } from '../types'; import { sleep } from '../utils/async'; import { swallowExceptions } from '../utils/decorators'; @@ -97,16 +97,16 @@ export class ExperimentsManager implements IExperimentsManager { @inject(IOutputChannel) @named(STANDARD_OUTPUT_CHANNEL) private readonly output: IOutputChannel, @inject(IFileSystem) private readonly fs: IFileSystem, @inject(IConfigurationService) private readonly configurationService: IConfigurationService, - @optional() private experimentEffortTimeout: number = EXPERIMENTS_EFFORT_TIMEOUT_MS + @optional() private experimentEffortTimeout: number = EXPERIMENTS_EFFORT_TIMEOUT_MS, ) { this.isDownloadedStorageValid = this.persistentStateFactory.createGlobalPersistentState( isDownloadedStorageValidKey, false, - EXPIRY_DURATION_MS + EXPIRY_DURATION_MS, ); this.experimentStorage = this.persistentStateFactory.createGlobalPersistentState( experimentStorageKey, - undefined + undefined, ); this.downloadedExperimentsStorage = this.persistentStateFactory.createGlobalPersistentState< ABExperiments | undefined @@ -162,7 +162,7 @@ export class ExperimentsManager implements IExperimentsManager { this._experimentsOptedOutFrom.includes(experiment.name) ) { sendTelemetryEvent(EventName.PYTHON_EXPERIMENTS_OPT_IN_OUT, undefined, { - expNameOptedOutOf: experiment.name + expNameOptedOutOf: experiment.name, }); continue; } @@ -171,7 +171,7 @@ export class ExperimentsManager implements IExperimentsManager { this._experimentsOptedInto.includes(experiment.name) ) { sendTelemetryEvent(EventName.PYTHON_EXPERIMENTS_OPT_IN_OUT, undefined, { - expNameOptedInto: experiment.name + expNameOptedInto: experiment.name, }); this.userExperiments.push(experiment); } else { @@ -214,7 +214,7 @@ export class ExperimentsManager implements IExperimentsManager { */ @traceDecorators.error('Failed to download and store experiments') public async downloadAndStoreExperiments( - storage: IPersistentState = this.downloadedExperimentsStorage + storage: IPersistentState = this.downloadedExperimentsStorage, ): Promise { const downloadedExperiments = await this.httpClient.getJSON(configUri, false); if (!this.areExperimentsValid(downloadedExperiments)) { @@ -317,7 +317,7 @@ export class ExperimentsManager implements IExperimentsManager { const success = await Promise.race([ // Download and store experiments in the storage for the current session this.downloadAndStoreExperiments(this.experimentStorage).then(() => true), - sleep(this.experimentEffortTimeout).then(() => false) + sleep(this.experimentEffortTimeout).then(() => false), ]); sendTelemetryEvent(EventName.PYTHON_EXPERIMENTS_DOWNLOAD_SUCCESS_RATE, undefined, { success }); return success; @@ -326,7 +326,7 @@ export class ExperimentsManager implements IExperimentsManager { EventName.PYTHON_EXPERIMENTS_DOWNLOAD_SUCCESS_RATE, undefined, { success: false, error: 'Downloading experiments failed with error' }, - ex + ex, ); traceError('Effort to download experiments within timeout failed with error', ex); return false; diff --git a/src/client/common/experiments/service.ts b/src/client/common/experiments/service.ts index b318732dacde..f8c83e4983d6 100644 --- a/src/client/common/experiments/service.ts +++ b/src/client/common/experiments/service.ts @@ -16,7 +16,7 @@ import { IExperimentService, IMemento, IOutputChannel, - IPythonSettings + IPythonSettings, } from '../types'; import { Experiments } from '../utils/localize'; import { ExperimentationTelemetry } from './telemetry'; @@ -41,7 +41,7 @@ export class ExperimentService implements IExperimentService { @inject(IConfigurationService) readonly configurationService: IConfigurationService, @inject(IApplicationEnvironment) private readonly appEnvironment: IApplicationEnvironment, @inject(IMemento) @named(GLOBAL_MEMENTO) private readonly globalState: Memento, - @inject(IOutputChannel) @named(STANDARD_OUTPUT_CHANNEL) private readonly output: IOutputChannel + @inject(IOutputChannel) @named(STANDARD_OUTPUT_CHANNEL) private readonly output: IOutputChannel, ) { this.settings = configurationService.getSettings(undefined); @@ -72,7 +72,7 @@ export class ExperimentService implements IExperimentService { this.appEnvironment.packageJson.version!, targetPopulation, telemetryReporter, - this.globalState + this.globalState, ); this.logExperiments(); @@ -87,7 +87,7 @@ export class ExperimentService implements IExperimentService { // so we need to perform these checks and send the corresponding telemetry manually. if (this._optOutFrom.includes('All') || this._optOutFrom.includes(experiment)) { sendTelemetryEvent(EventName.PYTHON_EXPERIMENTS_OPT_IN_OUT, undefined, { - expNameOptedOutOf: experiment + expNameOptedOutOf: experiment, }); return false; @@ -95,7 +95,7 @@ export class ExperimentService implements IExperimentService { if (this._optInto.includes('All') || this._optInto.includes(experiment)) { sendTelemetryEvent(EventName.PYTHON_EXPERIMENTS_OPT_IN_OUT, undefined, { - expNameOptedInto: experiment + expNameOptedInto: experiment, }); return true; diff --git a/src/client/common/extensions.ts b/src/client/common/extensions.ts index a41675749ab9..0b76423ec32b 100644 --- a/src/client/common/extensions.ts +++ b/src/client/common/extensions.ts @@ -46,7 +46,7 @@ declare interface String { */ String.prototype.splitLines = function ( this: string, - splitOptions: { trim: boolean; removeEmptyEntries: boolean } = { removeEmptyEntries: true, trim: true } + splitOptions: { trim: boolean; removeEmptyEntries: boolean } = { removeEmptyEntries: true, trim: true }, ): string[] { let lines = this.split(/\r?\n/g); if (splitOptions && splitOptions.trim) { diff --git a/src/client/common/featureDeprecationManager.ts b/src/client/common/featureDeprecationManager.ts index d102d70fb0b9..8b081729c0ab 100644 --- a/src/client/common/featureDeprecationManager.ts +++ b/src/client/common/featureDeprecationManager.ts @@ -10,7 +10,7 @@ import { DeprecatedFeatureInfo, DeprecatedSettingAndValue, IFeatureDeprecationManager, - IPersistentStateFactory + IPersistentStateFactory, } from './types'; const deprecatedFeatures: DeprecatedFeatureInfo[] = [ @@ -18,22 +18,22 @@ const deprecatedFeatures: DeprecatedFeatureInfo[] = [ doNotDisplayPromptStateKey: 'SHOW_DEPRECATED_FEATURE_PROMPT_FORMAT_ON_SAVE', message: "The setting 'python.formatting.formatOnSave' is deprecated, please use 'editor.formatOnSave'.", moreInfoUrl: 'https://github.com/Microsoft/vscode-python/issues/309', - setting: { setting: 'formatting.formatOnSave', values: ['true', true] } + setting: { setting: 'formatting.formatOnSave', values: ['true', true] }, }, { doNotDisplayPromptStateKey: 'SHOW_DEPRECATED_FEATURE_PROMPT_LINT_ON_TEXT_CHANGE', message: "The setting 'python.linting.lintOnTextChange' is deprecated, please enable 'python.linting.lintOnSave' and 'files.autoSave'.", moreInfoUrl: 'https://github.com/Microsoft/vscode-python/issues/313', - setting: { setting: 'linting.lintOnTextChange', values: ['true', true] } + setting: { setting: 'linting.lintOnTextChange', values: ['true', true] }, }, { doNotDisplayPromptStateKey: 'SHOW_DEPRECATED_FEATURE_PROMPT_FOR_AUTO_COMPLETE_PRELOAD_MODULES', message: "The setting 'python.autoComplete.preloadModules' is deprecated, please consider using Pylance Language Server ('python.languageServer' setting).", moreInfoUrl: 'https://github.com/Microsoft/vscode-python/issues/1704', - setting: { setting: 'autoComplete.preloadModules' } - } + setting: { setting: 'autoComplete.preloadModules' }, + }, ]; @injectable() @@ -43,7 +43,7 @@ export class FeatureDeprecationManager implements IFeatureDeprecationManager { @inject(IPersistentStateFactory) private persistentStateFactory: IPersistentStateFactory, @inject(ICommandManager) private cmdMgr: ICommandManager, @inject(IWorkspaceService) private workspace: IWorkspaceService, - @inject(IApplicationShell) private appShell: IApplicationShell + @inject(IApplicationShell) private appShell: IApplicationShell, ) {} public dispose() { @@ -58,7 +58,7 @@ export class FeatureDeprecationManager implements IFeatureDeprecationManager { if (Array.isArray(deprecatedInfo.commands)) { deprecatedInfo.commands.forEach((cmd) => { this.disposables.push( - this.cmdMgr.registerCommand(cmd, () => this.notifyDeprecation(deprecatedInfo), this) + this.cmdMgr.registerCommand(cmd, () => this.notifyDeprecation(deprecatedInfo), this), ); }); } @@ -70,7 +70,7 @@ export class FeatureDeprecationManager implements IFeatureDeprecationManager { public async notifyDeprecation(deprecatedInfo: DeprecatedFeatureInfo): Promise { const notificationPromptEnabled = this.persistentStateFactory.createGlobalPersistentState( deprecatedInfo.doNotDisplayPromptStateKey, - true + true, ); if (!notificationPromptEnabled.value) { return; @@ -106,26 +106,26 @@ export class FeatureDeprecationManager implements IFeatureDeprecationManager { } notify = this.isDeprecatedSettingAndValueUsed( this.workspace.getConfiguration('python', workspaceFolder.uri), - deprecatedInfo.setting! + deprecatedInfo.setting!, ); }); } else { notify = this.isDeprecatedSettingAndValueUsed( this.workspace.getConfiguration('python'), - deprecatedInfo.setting! + deprecatedInfo.setting!, ); } if (notify) { this.notifyDeprecation(deprecatedInfo).catch((ex) => - traceVerbose('Python Extension: notifyDeprecation', ex) + traceVerbose('Python Extension: notifyDeprecation', ex), ); } } public isDeprecatedSettingAndValueUsed( pythonConfig: WorkspaceConfiguration, - deprecatedSetting: DeprecatedSettingAndValue + deprecatedSetting: DeprecatedSettingAndValue, ) { if (!pythonConfig.has(deprecatedSetting.setting)) { return false; diff --git a/src/client/common/insidersBuild/downloadChannelService.ts b/src/client/common/insidersBuild/downloadChannelService.ts index c0096c080045..8f86aaa65d8f 100644 --- a/src/client/common/insidersBuild/downloadChannelService.ts +++ b/src/client/common/insidersBuild/downloadChannelService.ts @@ -18,7 +18,7 @@ export class ExtensionChannelService implements IExtensionChannelService { constructor( @inject(IConfigurationService) private readonly configService: IConfigurationService, @inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService, - @inject(IDisposableRegistry) disposables: IDisposable[] + @inject(IDisposableRegistry) disposables: IDisposable[], ) { disposables.push(this.workspaceService.onDidChangeConfiguration(this.onDidChangeConfiguration.bind(this))); } @@ -33,7 +33,7 @@ export class ExtensionChannelService implements IExtensionChannelService { .inspect(insidersChannelSetting); if (!settings) { throw new Error( - `WorkspaceConfiguration.inspect returns 'undefined' for setting 'python.${insidersChannelSetting}'` + `WorkspaceConfiguration.inspect returns 'undefined' for setting 'python.${insidersChannelSetting}'`, ); } return !settings.globalValue; diff --git a/src/client/common/insidersBuild/insidersExtensionPrompt.ts b/src/client/common/insidersBuild/insidersExtensionPrompt.ts index 1988d2c15bdf..9939142ac4ad 100644 --- a/src/client/common/insidersBuild/insidersExtensionPrompt.ts +++ b/src/client/common/insidersBuild/insidersExtensionPrompt.ts @@ -22,11 +22,11 @@ export class InsidersExtensionPrompt implements IInsiderExtensionPrompt { @inject(IApplicationShell) private readonly appShell: IApplicationShell, @inject(IExtensionChannelService) private readonly insidersDownloadChannelService: IExtensionChannelService, @inject(ICommandManager) private readonly cmdManager: ICommandManager, - @inject(IPersistentStateFactory) private readonly persistentStateFactory: IPersistentStateFactory + @inject(IPersistentStateFactory) private readonly persistentStateFactory: IPersistentStateFactory, ) { this.hasUserBeenNotified = this.persistentStateFactory.createGlobalPersistentState( insidersPromptStateKey, - false + false, ); } @@ -35,18 +35,18 @@ export class InsidersExtensionPrompt implements IInsiderExtensionPrompt { const prompts = [ ExtensionChannels.yesWeekly(), ExtensionChannels.yesDaily(), - ExtensionSurveyBanner.bannerLabelNo() + ExtensionSurveyBanner.bannerLabelNo(), ]; const telemetrySelections: ['Yes, weekly', 'Yes, daily', 'No, thanks'] = [ 'Yes, weekly', 'Yes, daily', - 'No, thanks' + 'No, thanks', ]; const selection = await this.appShell.showInformationMessage(ExtensionChannels.promptMessage(), ...prompts); await this.hasUserBeenNotified.updateValue(true); sendTelemetryEvent(EventName.INSIDERS_PROMPT, undefined, { - selection: selection ? telemetrySelections[prompts.indexOf(selection)] : undefined + selection: selection ? telemetrySelections[prompts.indexOf(selection)] : undefined, }); if (!selection) { @@ -63,10 +63,10 @@ export class InsidersExtensionPrompt implements IInsiderExtensionPrompt { public async promptToReload(): Promise { const selection = await this.appShell.showInformationMessage( ExtensionChannels.reloadToUseInsidersMessage(), - Common.reload() + Common.reload(), ); sendTelemetryEvent(EventName.INSIDERS_RELOAD_PROMPT, undefined, { - selection: selection ? 'Reload' : undefined + selection: selection ? 'Reload' : undefined, }); if (selection === Common.reload()) { this.cmdManager.executeCommand('workbench.action.reloadWindow').then(noop); diff --git a/src/client/common/insidersBuild/insidersExtensionService.ts b/src/client/common/insidersBuild/insidersExtensionService.ts index 63f0e8f8eda3..210ef2c89712 100644 --- a/src/client/common/insidersBuild/insidersExtensionService.ts +++ b/src/client/common/insidersBuild/insidersExtensionService.ts @@ -26,7 +26,7 @@ export class InsidersExtensionService implements IExtensionSingleActivationServi @inject(IExtensionBuildInstaller) @named(INSIDERS_INSTALLER) private readonly insidersInstaller: IExtensionBuildInstaller, - @inject(IDisposableRegistry) public readonly disposables: IDisposable[] + @inject(IDisposableRegistry) public readonly disposables: IDisposable[], ) {} public async activate() { @@ -38,22 +38,22 @@ export class InsidersExtensionService implements IExtensionSingleActivationServi this.disposables.push( this.extensionChannelService.onDidChannelChange((channel) => { return this.handleChannel(channel, true); - }) + }), ); this.disposables.push( this.cmdManager.registerCommand(Commands.SwitchOffInsidersChannel, () => - this.extensionChannelService.updateChannel('off') - ) + this.extensionChannelService.updateChannel('off'), + ), ); this.disposables.push( this.cmdManager.registerCommand(Commands.SwitchToInsidersDaily, () => - this.extensionChannelService.updateChannel('daily') - ) + this.extensionChannelService.updateChannel('daily'), + ), ); this.disposables.push( this.cmdManager.registerCommand(Commands.SwitchToInsidersWeekly, () => - this.extensionChannelService.updateChannel('weekly') - ) + this.extensionChannelService.updateChannel('weekly'), + ), ); } diff --git a/src/client/common/insidersBuild/types.ts b/src/client/common/insidersBuild/types.ts index 5c47c63ce1ff..142cc1c26d80 100644 --- a/src/client/common/insidersBuild/types.ts +++ b/src/client/common/insidersBuild/types.ts @@ -38,6 +38,6 @@ export enum ExtensionChannel { */ off = 'off', weekly = 'weekly', - daily = 'daily' + daily = 'daily', } export type ExtensionChannels = 'off' | 'weekly' | 'daily'; diff --git a/src/client/common/installer/channelManager.ts b/src/client/common/installer/channelManager.ts index 14bda4002749..76624aaddfb9 100644 --- a/src/client/common/installer/channelManager.ts +++ b/src/client/common/installer/channelManager.ts @@ -20,7 +20,7 @@ export class InstallationChannelManager implements IInstallationChannelManager { public async getInstallationChannel( product: Product, - resource?: InterpreterUri + resource?: InterpreterUri, ): Promise { const channels = await this.getInstallationChannels(resource); if (channels.length === 1) { @@ -39,13 +39,13 @@ export class InstallationChannelManager implements IInstallationChannelManager { return { label: `Install using ${installer.displayName}`, description: '', - installer + installer, }; }); const selection = await appShell.showQuickPick(options, { matchOnDescription: true, matchOnDetail: true, - placeHolder + placeHolder, }); return selection ? selection.installer : undefined; } @@ -95,7 +95,7 @@ export class InstallationChannelManager implements IInstallationChannelManager { appShell.openUrl( `https://www.bing.com/search?q=Install Pip ${osName} ${ interpreter.envType === EnvironmentType.Conda ? 'Conda' : '' - }` + }`, ); } } diff --git a/src/client/common/installer/condaInstaller.ts b/src/client/common/installer/condaInstaller.ts index 4fc2cc7f2333..7ea69ecba49b 100644 --- a/src/client/common/installer/condaInstaller.ts +++ b/src/client/common/installer/condaInstaller.ts @@ -79,7 +79,7 @@ export class CondaInstaller extends ModuleInstaller { args.push('-y'); return { args, - execPath: condaFile + execPath: condaFile, }; } diff --git a/src/client/common/installer/extensionBuildInstaller.ts b/src/client/common/installer/extensionBuildInstaller.ts index 1e6aee90ced0..984578e1bc4d 100644 --- a/src/client/common/installer/extensionBuildInstaller.ts +++ b/src/client/common/installer/extensionBuildInstaller.ts @@ -21,7 +21,7 @@ export class StableBuildInstaller implements IExtensionBuildInstaller { constructor( @inject(IOutputChannel) @named(STANDARD_OUTPUT_CHANNEL) private readonly output: IOutputChannel, @inject(ICommandManager) private readonly cmdManager: ICommandManager, - @inject(IApplicationShell) private readonly appShell: IApplicationShell + @inject(IApplicationShell) private readonly appShell: IApplicationShell, ) {} @traceDecorators.error('Installing stable build of extension failed') @@ -42,7 +42,7 @@ export class InsidersBuildInstaller implements IExtensionBuildInstaller { @inject(IFileDownloader) private readonly fileDownloader: IFileDownloader, @inject(IFileSystem) private readonly fs: IFileSystem, @inject(ICommandManager) private readonly cmdManager: ICommandManager, - @inject(IApplicationShell) private readonly appShell: IApplicationShell + @inject(IApplicationShell) private readonly appShell: IApplicationShell, ) {} @traceDecorators.error('Installing insiders build of extension failed') @@ -63,7 +63,7 @@ export class InsidersBuildInstaller implements IExtensionBuildInstaller { const downloadOptions = { extension: vsixFileExtension, outputChannel: this.output, - progressMessagePrefix: ExtensionChannels.downloadingInsidersMessage() + progressMessagePrefix: ExtensionChannels.downloadingInsidersMessage(), }; return this.fileDownloader.downloadFile(developmentBuildUri, downloadOptions).then((file) => { this.output.appendLine(ExtensionChannels.downloadCompletedOutputMessage()); diff --git a/src/client/common/installer/moduleInstaller.ts b/src/client/common/installer/moduleInstaller.ts index c227c9e56906..8c81f86b193b 100644 --- a/src/client/common/installer/moduleInstaller.ts +++ b/src/client/common/installer/moduleInstaller.ts @@ -72,10 +72,10 @@ export abstract class ModuleInstaller implements IModuleInstaller { const options: ProgressOptions = { location: ProgressLocation.Notification, cancellable: true, - title: Products.installingModule().format(name) + title: Products.installingModule().format(name), }; await shell.withProgress(options, async (_, token: CancellationToken) => - install(wrapCancellationTokens(token, cancel)) + install(wrapCancellationTokens(token, cancel)), ); } else { await install(cancel); @@ -85,7 +85,7 @@ export abstract class ModuleInstaller implements IModuleInstaller { protected elevatedInstall(execPath: string, args: string[]) { const options = { - name: 'VS Code Python' + name: 'VS Code Python', }; const outputChannel = this.serviceContainer.get(IOutputChannel, STANDARD_OUTPUT_CHANNEL); const command = `"${execPath.replace(/\\/g, '/')}" ${args.join(' ')}`; diff --git a/src/client/common/installer/pipEnvInstaller.ts b/src/client/common/installer/pipEnvInstaller.ts index ea4ed5be906f..5d75c7b6c446 100644 --- a/src/client/common/installer/pipEnvInstaller.ts +++ b/src/client/common/installer/pipEnvInstaller.ts @@ -46,7 +46,7 @@ export class PipEnvInstaller extends ModuleInstaller { } return { args: args, - execPath: pipenvName + execPath: pipenvName, }; } } diff --git a/src/client/common/installer/pipInstaller.ts b/src/client/common/installer/pipInstaller.ts index 9b0afd3abbc2..b2d13a26e03a 100644 --- a/src/client/common/installer/pipInstaller.ts +++ b/src/client/common/installer/pipInstaller.ts @@ -38,7 +38,7 @@ export class PipInstaller extends ModuleInstaller { } return { args: [...proxyArgs, 'install', '-U', moduleName], - moduleName: 'pip' + moduleName: 'pip', }; } private isPipAvailable(info?: InterpreterUri): Promise { diff --git a/src/client/common/installer/poetryInstaller.ts b/src/client/common/installer/poetryInstaller.ts index 68f759e559b8..b8a7f750e256 100644 --- a/src/client/common/installer/poetryInstaller.ts +++ b/src/client/common/installer/poetryInstaller.ts @@ -36,7 +36,7 @@ export class PoetryInstaller extends ModuleInstaller { @inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService, @inject(IConfigurationService) private readonly configurationService: IConfigurationService, @inject(IFileSystem) private readonly fs: IFileSystem, - @inject(IProcessServiceFactory) private readonly processFactory: IProcessServiceFactory + @inject(IProcessServiceFactory) private readonly processFactory: IProcessServiceFactory, ) { super(serviceContainer); } @@ -72,7 +72,7 @@ export class PoetryInstaller extends ModuleInstaller { } return { args, - execPath + execPath, }; } } diff --git a/src/client/common/installer/productInstaller.ts b/src/client/common/installer/productInstaller.ts index ce5d5b2f79fe..058e41076e40 100644 --- a/src/client/common/installer/productInstaller.ts +++ b/src/client/common/installer/productInstaller.ts @@ -26,7 +26,7 @@ import { IPersistentStateFactory, ModuleNamePurpose, Product, - ProductType + ProductType, } from '../types'; import { Common, Installer, Linters, TensorBoard } from '../utils/localize'; import { isResource, noop } from '../utils/misc'; @@ -36,7 +36,7 @@ import { IModuleInstaller, InterpreterUri, IProductPathService, - IProductService + IProductService, } from './types'; export { Product } from '../types'; @@ -61,7 +61,7 @@ export abstract class BaseInstaller { public promptToInstall( product: Product, resource?: InterpreterUri, - cancel?: CancellationToken + cancel?: CancellationToken, ): Promise { // If this method gets called twice, while previous promise has not been resolved, then return that same promise. // E.g. previous promise is not resolved as a message has been displayed to the user, so no point displaying @@ -83,7 +83,7 @@ export abstract class BaseInstaller { public async install( product: Product, resource?: InterpreterUri, - cancel?: CancellationToken + cancel?: CancellationToken, ): Promise { if (product === Product.unittest) { return InstallerResponse.Installed; @@ -101,7 +101,7 @@ export abstract class BaseInstaller { .catch((ex) => traceError(`Error in installing the module '${moduleName}', ${ex}`)); return this.isInstalled(product, resource).then((isInstalled) => - isInstalled ? InstallerResponse.Installed : InstallerResponse.Ignore + isInstalled ? InstallerResponse.Installed : InstallerResponse.Ignore, ); } @@ -132,7 +132,7 @@ export abstract class BaseInstaller { protected abstract promptToInstallImplementation( product: Product, resource?: InterpreterUri, - cancel?: CancellationToken + cancel?: CancellationToken, ): Promise; protected getExecutableNameFromSettings(product: Product, resource?: Uri): string { const productType = this.productService.getProductType(product); @@ -156,13 +156,13 @@ export class CTagsInstaller extends BaseInstaller { this.outputChannel.appendLine('Install Universal Ctags Win32 to enable support for Workspace Symbols'); this.outputChannel.appendLine('Download the CTags binary from the Universal CTags site.'); this.outputChannel.appendLine( - 'Option 1: Extract ctags.exe from the downloaded zip to any folder within your PATH so that Visual Studio Code can run it.' + 'Option 1: Extract ctags.exe from the downloaded zip to any folder within your PATH so that Visual Studio Code can run it.', ); this.outputChannel.appendLine( - 'Option 2: Extract to any folder and add the path to this folder to the command setting.' + 'Option 2: Extract to any folder and add the path to this folder to the command setting.', ); this.outputChannel.appendLine( - 'Option 3: Extract to any folder and define that path in the python.workspaceSymbols.ctagsPath setting of your user settings file (settings.json).' + 'Option 3: Extract to any folder and define that path in the python.workspaceSymbols.ctagsPath setting of your user settings file (settings.json).', ); this.outputChannel.show(); } else { @@ -178,12 +178,12 @@ export class CTagsInstaller extends BaseInstaller { protected async promptToInstallImplementation( product: Product, resource?: Uri, - _cancel?: CancellationToken + _cancel?: CancellationToken, ): Promise { const item = await this.appShell.showErrorMessage( 'Install CTags to enable Python workspace symbols?', 'Yes', - 'No' + 'No', ); return item === 'Yes' ? this.install(product, resource) : InstallerResponse.Ignore; } @@ -193,7 +193,7 @@ export class FormatterInstaller extends BaseInstaller { protected async promptToInstallImplementation( product: Product, resource?: Uri, - cancel?: CancellationToken + cancel?: CancellationToken, ): Promise { // Hard-coded on purpose because the UI won't necessarily work having // another formatter. @@ -255,7 +255,7 @@ export class LinterInstaller extends BaseInstaller { protected async promptToInstallImplementation( product: Product, resource?: Uri, - cancel?: CancellationToken + cancel?: CancellationToken, ): Promise { // This is a hack, really we should be handling this in a service that // controls the prompts we show. The issue here was that if we show @@ -277,7 +277,7 @@ export class LinterInstaller extends BaseInstaller { // We won't show a prompt, so tell the extension to treat as though user // ignored the prompt. sendTelemetryEvent(EventName.LINTER_INSTALL_PROMPT, undefined, { - prompt: 'noPrompt' + prompt: 'noPrompt', }); const productName = ProductNames.get(product)!; @@ -292,7 +292,7 @@ export class LinterInstaller extends BaseInstaller { } sendTelemetryEvent(EventName.LINTER_INSTALL_PROMPT, undefined, { - prompt: 'old' + prompt: 'old', }); return this.oldPromptForInstallation(product, resource, cancel); } @@ -340,7 +340,7 @@ export class LinterInstaller extends BaseInstaller { const prompt = pylintFirst ? 'pylintFirst' : 'flake8first'; sendTelemetryEvent(EventName.LINTER_INSTALL_PROMPT, undefined, { - prompt + prompt, }); const response = await this.appShell.showInformationMessage(message, ...options); @@ -348,20 +348,20 @@ export class LinterInstaller extends BaseInstaller { if (response === installPylint) { sendTelemetryEvent(EventName.LINTER_INSTALL_PROMPT_ACTION, undefined, { prompt, - action: 'installPylint' + action: 'installPylint', }); return this.install(Product.pylint, resource, cancel); } else if (response === installFlake8) { sendTelemetryEvent(EventName.LINTER_INSTALL_PROMPT_ACTION, undefined, { prompt, - action: 'installFlake8' + action: 'installFlake8', }); await this.linterManager.setActiveLintersAsync([Product.flake8], resource); return this.install(Product.flake8, resource, cancel); } else if (response === doNotShowAgain) { sendTelemetryEvent(EventName.LINTER_INSTALL_PROMPT_ACTION, undefined, { prompt, - action: 'disablePrompt' + action: 'disablePrompt', }); await this.setStoredResponse(disableLinterInstallPromptKey, true); return InstallerResponse.Ignore; @@ -369,7 +369,7 @@ export class LinterInstaller extends BaseInstaller { sendTelemetryEvent(EventName.LINTER_INSTALL_PROMPT_ACTION, undefined, { prompt, - action: 'close' + action: 'close', }); return InstallerResponse.Ignore; } @@ -400,14 +400,14 @@ export class LinterInstaller extends BaseInstaller { if (response === install) { sendTelemetryEvent(EventName.LINTER_NOT_INSTALLED_PROMPT, undefined, { tool: productName as LinterId, - action: 'install' + action: 'install', }); return this.install(product, resource, cancel); } else if (response === doNotShowAgain) { await this.setStoredResponse(disableLinterInstallPromptKey, true); sendTelemetryEvent(EventName.LINTER_NOT_INSTALLED_PROMPT, undefined, { tool: productName as LinterId, - action: 'disablePrompt' + action: 'disablePrompt', }); return InstallerResponse.Ignore; } @@ -431,7 +431,7 @@ export class LinterInstaller extends BaseInstaller { 'linting.pycodestyleEnabled', 'linting.prospectorEnabled', 'linting.pydocstyleEnabled', - 'linting.pylamaEnabled' + 'linting.pylamaEnabled', ]; const values = keys.map((key) => { @@ -472,7 +472,7 @@ export class TestFrameworkInstaller extends BaseInstaller { protected async promptToInstallImplementation( product: Product, resource?: Uri, - cancel?: CancellationToken + cancel?: CancellationToken, ): Promise { const productName = ProductNames.get(product)!; @@ -494,13 +494,13 @@ export class RefactoringLibraryInstaller extends BaseInstaller { protected async promptToInstallImplementation( product: Product, resource?: Uri, - cancel?: CancellationToken + cancel?: CancellationToken, ): Promise { const productName = ProductNames.get(product)!; const item = await this.appShell.showErrorMessage( `Refactoring library ${productName} is not installed. Install?`, 'Yes', - 'No' + 'No', ); return item === 'Yes' ? this.install(product, resource, cancel) : InstallerResponse.Ignore; } @@ -511,7 +511,7 @@ export class DataScienceInstaller extends BaseInstaller { public async install( product: Product, interpreterUri?: InterpreterUri, - cancel?: CancellationToken + cancel?: CancellationToken, ): Promise { // Precondition if (isResource(interpreterUri)) { @@ -545,7 +545,7 @@ export class DataScienceInstaller extends BaseInstaller { .catch((ex) => traceError(`Error in installing the module '${moduleName}', ${ex}`)); return this.isInstalled(product, interpreter).then((isInstalled) => - isInstalled ? InstallerResponse.Installed : InstallerResponse.Ignore + isInstalled ? InstallerResponse.Installed : InstallerResponse.Ignore, ); } /** @@ -555,13 +555,13 @@ export class DataScienceInstaller extends BaseInstaller { protected async promptToInstallImplementation( product: Product, resource?: InterpreterUri, - cancel?: CancellationToken + cancel?: CancellationToken, ): Promise { const productName = ProductNames.get(product)!; const item = await this.appShell.showErrorMessage( Installer.dataScienceInstallPrompt().format(productName), 'Yes', - 'No' + 'No', ); if (item === 'Yes') { return this.install(product, resource, cancel); @@ -574,7 +574,7 @@ export class TensorBoardInstaller extends DataScienceInstaller { protected async promptToInstallImplementation( product: Product, resource: Uri, - cancel: CancellationToken + cancel: CancellationToken, ): Promise { // Show a prompt message specific to TensorBoard const yes = Common.bannerLabelYes(); @@ -591,7 +591,7 @@ export class ProductInstaller implements IInstaller { constructor( @inject(IServiceContainer) private serviceContainer: IServiceContainer, - @inject(IOutputChannel) @named(STANDARD_OUTPUT_CHANNEL) private outputChannel: OutputChannel + @inject(IOutputChannel) @named(STANDARD_OUTPUT_CHANNEL) private outputChannel: OutputChannel, ) { this.productService = serviceContainer.get(IProductService); this.interpreterService = this.serviceContainer.get(IInterpreterService); @@ -602,7 +602,7 @@ export class ProductInstaller implements IInstaller { public async promptToInstall( product: Product, resource?: InterpreterUri, - cancel?: CancellationToken + cancel?: CancellationToken, ): Promise { const currentInterpreter = isResource(resource) ? await this.interpreterService.getActiveInterpreter(resource) @@ -615,7 +615,7 @@ export class ProductInstaller implements IInstaller { public async install( product: Product, resource?: InterpreterUri, - cancel?: CancellationToken + cancel?: CancellationToken, ): Promise { return this.createInstaller(product).install(product, resource, cancel); } diff --git a/src/client/common/installer/serviceRegistry.ts b/src/client/common/installer/serviceRegistry.ts index 2b9af2bdc24a..9e5351203d05 100644 --- a/src/client/common/installer/serviceRegistry.ts +++ b/src/client/common/installer/serviceRegistry.ts @@ -19,7 +19,7 @@ import { LinterProductPathService, RefactoringLibraryProductPathService, TensorBoardProductPathService, - TestFrameworkProductPathService + TestFrameworkProductPathService, } from './productPath'; import { ProductService } from './productService'; import { @@ -29,7 +29,7 @@ import { INSIDERS_INSTALLER, IProductPathService, IProductService, - STABLE_INSTALLER + STABLE_INSTALLER, } from './types'; export function registerTypes(serviceManager: IServiceManager) { @@ -41,45 +41,45 @@ export function registerTypes(serviceManager: IServiceManager) { serviceManager.addSingleton( IExtensionBuildInstaller, StableBuildInstaller, - STABLE_INSTALLER + STABLE_INSTALLER, ); serviceManager.addSingleton( IExtensionBuildInstaller, InsidersBuildInstaller, - INSIDERS_INSTALLER + INSIDERS_INSTALLER, ); serviceManager.addSingleton(IProductService, ProductService); serviceManager.addSingleton( IProductPathService, CTagsProductPathService, - ProductType.WorkspaceSymbols + ProductType.WorkspaceSymbols, ); serviceManager.addSingleton( IProductPathService, FormatterProductPathService, - ProductType.Formatter + ProductType.Formatter, ); serviceManager.addSingleton(IProductPathService, LinterProductPathService, ProductType.Linter); serviceManager.addSingleton( IProductPathService, TestFrameworkProductPathService, - ProductType.TestFramework + ProductType.TestFramework, ); serviceManager.addSingleton( IProductPathService, RefactoringLibraryProductPathService, - ProductType.RefactoringLibrary + ProductType.RefactoringLibrary, ); serviceManager.addSingleton( IProductPathService, DataScienceProductPathService, - ProductType.DataScience + ProductType.DataScience, ); serviceManager.addSingleton( IProductPathService, TensorBoardProductPathService, - ProductType.TensorBoard + ProductType.TensorBoard, ); serviceManager.addSingleton(IWebviewPanelProvider, WebviewPanelProvider); } diff --git a/src/client/common/interpreterPathService.ts b/src/client/common/interpreterPathService.ts index a5bbc17108b5..c510dc5e348d 100644 --- a/src/client/common/interpreterPathService.ts +++ b/src/client/common/interpreterPathService.ts @@ -20,7 +20,7 @@ import { IPersistentState, IPersistentStateFactory, IPythonSettings, - Resource + Resource, } from './types'; export const workspaceKeysForWhichTheCopyIsDone_Key = 'workspaceKeysForWhichTheCopyIsDone_Key'; @@ -45,7 +45,7 @@ export class InterpreterPathService implements IInterpreterPathService { constructor( @inject(IPersistentStateFactory) private readonly persistentStateFactory: IPersistentStateFactory, @inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService, - @inject(IDisposableRegistry) disposables: IDisposable[] + @inject(IDisposableRegistry) disposables: IDisposable[], ) { disposables.push(this.workspaceService.onDidChangeConfiguration(this.onDidChangeConfiguration.bind(this))); this.fileSystemPaths = FileSystemPaths.withDefaults(); @@ -64,11 +64,11 @@ export class InterpreterPathService implements IInterpreterPathService { if (resource) { workspaceFolderSetting = this.persistentStateFactory.createGlobalPersistentState( this.getSettingKey(resource, ConfigurationTarget.WorkspaceFolder), - undefined + undefined, ); workspaceSetting = this.persistentStateFactory.createGlobalPersistentState( this.getSettingKey(resource, ConfigurationTarget.Workspace), - undefined + undefined, ); } const globalValue = this.workspaceService.getConfiguration('python')!.inspect('defaultInterpreterPath')! @@ -76,7 +76,7 @@ export class InterpreterPathService implements IInterpreterPathService { return { globalValue, workspaceFolderValue: workspaceFolderSetting?.value, - workspaceValue: workspaceSetting?.value + workspaceValue: workspaceSetting?.value, }; } @@ -93,7 +93,7 @@ export class InterpreterPathService implements IInterpreterPathService { public async update( resource: Resource, configTarget: ConfigurationTarget, - pythonPath: string | undefined + pythonPath: string | undefined, ): Promise { resource = PythonSettings.getSettingsUriAndTarget(resource, this.workspaceService).uri; if (configTarget === ConfigurationTarget.Global) { @@ -112,7 +112,7 @@ export class InterpreterPathService implements IInterpreterPathService { const settingKey = this.getSettingKey(resource, configTarget); const persistentSetting = this.persistentStateFactory.createGlobalPersistentState( settingKey, - undefined + undefined, ); if (persistentSetting.value !== pythonPath) { await persistentSetting.updateValue(pythonPath); @@ -122,7 +122,7 @@ export class InterpreterPathService implements IInterpreterPathService { public getSettingKey( resource: Uri, - configTarget: ConfigurationTarget.Workspace | ConfigurationTarget.WorkspaceFolder + configTarget: ConfigurationTarget.Workspace | ConfigurationTarget.WorkspaceFolder, ): string { let settingKey: string; const folderKey = this.workspaceService.getWorkspaceFolderIdentifier(resource); @@ -131,7 +131,7 @@ export class InterpreterPathService implements IInterpreterPathService { } else { settingKey = this.workspaceService.workspaceFile ? `WORKSPACE_INTERPRETER_PATH_${this.fileSystemPaths.normCase( - this.workspaceService.workspaceFile.fsPath + this.workspaceService.workspaceFile.fsPath, )}` : // Only a single folder is opened, use fsPath of the folder as key `WORKSPACE_FOLDER_INTERPRETER_PATH_${folderKey}`; @@ -145,7 +145,7 @@ export class InterpreterPathService implements IInterpreterPathService { await Promise.all([ this._copyWorkspaceFolderValueToNewStorage(resource, oldSettings.workspaceFolderValue), this._copyWorkspaceValueToNewStorage(resource, oldSettings.workspaceValue), - this._moveGlobalSettingValueToNewStorage(oldSettings.globalValue) + this._moveGlobalSettingValueToNewStorage(oldSettings.globalValue), ]); } @@ -158,7 +158,7 @@ export class InterpreterPathService implements IInterpreterPathService { } const flaggedWorkspaceFolderKeysStorage = this.persistentStateFactory.createGlobalPersistentState( workspaceFolderKeysForWhichTheCopyIsDone_Key, - [] + [], ); const flaggedWorkspaceFolderKeys = flaggedWorkspaceFolderKeysStorage.value; const shouldUpdateWorkspaceFolderSetting = !flaggedWorkspaceFolderKeys.includes(workspaceFolderKey); @@ -178,7 +178,7 @@ export class InterpreterPathService implements IInterpreterPathService { } const flaggedWorkspaceKeysStorage = this.persistentStateFactory.createGlobalPersistentState( workspaceKeysForWhichTheCopyIsDone_Key, - [] + [], ); const flaggedWorkspaceKeys = flaggedWorkspaceKeysStorage.value; const shouldUpdateWorkspaceSetting = !flaggedWorkspaceKeys.includes(workspaceKey); @@ -192,7 +192,7 @@ export class InterpreterPathService implements IInterpreterPathService { // Move global setting into the new storage if it hasn't been moved already const isGlobalSettingCopiedStorage = this.persistentStateFactory.createGlobalPersistentState( isGlobalSettingCopiedKey, - false + false, ); const shouldUpdateGlobalSetting = !isGlobalSettingCopiedStorage.value; if (shouldUpdateGlobalSetting) { diff --git a/src/client/common/logger.ts b/src/client/common/logger.ts index d332dd6028e5..ab1f3922c376 100644 --- a/src/client/common/logger.ts +++ b/src/client/common/logger.ts @@ -5,6 +5,6 @@ export { logError as traceError, logInfo as traceInfo, logVerbose as traceVerbose, - logWarning as traceWarning + logWarning as traceWarning, } from '../logging'; export { TraceOptions as LogOptions } from '../logging/trace'; diff --git a/src/client/common/markdown/restTextConverter.ts b/src/client/common/markdown/restTextConverter.ts index 0881b37f3cfb..9cefe937764d 100644 --- a/src/client/common/markdown/restTextConverter.ts +++ b/src/client/common/markdown/restTextConverter.ts @@ -9,7 +9,7 @@ import { isDecimal, isWhiteSpace } from '../../language/characters'; enum State { Default, Preformatted, - Code + Code, } export class RestTextConverter { diff --git a/src/client/common/net/fileDownloader.ts b/src/client/common/net/fileDownloader.ts index 61499d2c28b7..2077b85553ef 100644 --- a/src/client/common/net/fileDownloader.ts +++ b/src/client/common/net/fileDownloader.ts @@ -18,7 +18,7 @@ export class FileDownloader implements IFileDownloader { constructor( @inject(IHttpClient) private readonly httpClient: IHttpClient, @inject(IFileSystem) private readonly fs: IFileSystem, - @inject(IApplicationShell) private readonly appShell: IApplicationShell + @inject(IApplicationShell) private readonly appShell: IApplicationShell, ) {} public async downloadFile(uri: string, options: DownloadOptions): Promise { if (options.outputChannel) { @@ -31,7 +31,7 @@ export class FileDownloader implements IFileDownloader { (ex) => { tempFile.dispose(); return Promise.reject(ex); - } + }, ); return tempFile.filePath; @@ -39,7 +39,7 @@ export class FileDownloader implements IFileDownloader { public async downloadFileWithStatusBarProgress( uri: string, progressMessage: string, - tmpFilePath: string + tmpFilePath: string, ): Promise { await this.appShell.withProgressCustomIcon(Octicons.Downloading, async (progress) => { const req = await this.httpClient.downloadFile(uri); @@ -53,13 +53,13 @@ export class FileDownloader implements IFileDownloader { progress: Progress<{ message?: string; increment?: number }>, request: requestTypes.Request, fileStream: WriteStream, - progressMessagePrefix: string + progressMessagePrefix: string, ): Promise { return new Promise((resolve, reject) => { request.on('response', (response) => { if (response.statusCode !== 200) { reject( - new Error(`Failed with status ${response.statusCode}, ${response.statusMessage}, Uri ${uri}`) + new Error(`Failed with status ${response.statusCode}, ${response.statusMessage}, Uri ${uri}`), ); } }); @@ -102,6 +102,6 @@ function formatProgressMessageWithState(progressMessagePrefix: string, state: Re progressMessagePrefix, received.toString(), total.toString(), - percentage.toString() + percentage.toString(), ); } diff --git a/src/client/common/net/httpClient.ts b/src/client/common/net/httpClient.ts index adceb9b1e8a3..7562fcb8bb07 100644 --- a/src/client/common/net/httpClient.ts +++ b/src/client/common/net/httpClient.ts @@ -68,7 +68,7 @@ export class HttpClient implements IHttpClient { } if (response.statusCode !== 200) { return reject( - new Error(`Failed with status ${response.statusCode}, ${response.statusMessage}, Uri ${uri}`) + new Error(`Failed with status ${response.statusCode}, ${response.statusMessage}, Uri ${uri}`), ); } resolve(body); diff --git a/src/client/common/net/socket/SocketStream.ts b/src/client/common/net/socket/SocketStream.ts index 0576d3026fb5..daef56f6e106 100644 --- a/src/client/common/net/socket/SocketStream.ts +++ b/src/client/common/net/socket/SocketStream.ts @@ -7,7 +7,7 @@ const uint64be = require('uint64be'); enum DataType { string, int32, - int64 + int64, } export class SocketStream { diff --git a/src/client/common/nuget/azureBlobStoreNugetRepository.ts b/src/client/common/nuget/azureBlobStoreNugetRepository.ts index ae19c65e81be..45328dda7269 100644 --- a/src/client/common/nuget/azureBlobStoreNugetRepository.ts +++ b/src/client/common/nuget/azureBlobStoreNugetRepository.ts @@ -19,7 +19,7 @@ export class AzureBlobStoreNugetRepository implements INugetRepository { @unmanaged() protected readonly azureBlobStorageAccount: string, @unmanaged() protected readonly azureBlobStorageContainer: string, @unmanaged() protected readonly azureCDNBlobStorageAccount: string, - private getBlobStore: (uri: string) => Promise = _getAZBlobStore + private getBlobStore: (uri: string) => Promise = _getAZBlobStore, ) {} public async getPackages(packageName: string, resource: Resource): Promise { @@ -28,7 +28,7 @@ export class AzureBlobStoreNugetRepository implements INugetRepository { this.azureBlobStorageContainer, packageName, this.azureCDNBlobStorageAccount, - resource + resource, ); } @@ -39,19 +39,19 @@ export class AzureBlobStoreNugetRepository implements INugetRepository { azureBlobStorageContainer: string, packageName: string, azureCDNBlobStorageAccount: string, - resource: Resource + resource: Resource, ) { const results = await this.listBlobStoreCatalog( this.fixBlobStoreURI(azureBlobStorageAccount, resource), azureBlobStorageContainer, - packageName + packageName, ); const nugetService = this.serviceContainer.get(INugetService); return results.map((item) => { return { package: item.name, uri: `${azureCDNBlobStorageAccount}/${azureBlobStorageContainer}/${item.name}`, - version: nugetService.getVersionFromPackageFileName(item.name) + version: nugetService.getVersionFromPackageFileName(item.name), }; }); } @@ -59,7 +59,7 @@ export class AzureBlobStoreNugetRepository implements INugetRepository { private async listBlobStoreCatalog( azureBlobStorageAccount: string, azureBlobStorageContainer: string, - packageName: string + packageName: string, ): Promise { const blobStore = await this.getBlobStore(azureBlobStorageAccount); return new Promise((resolve, reject) => { @@ -110,7 +110,7 @@ interface IAZBlobStore { prefix: string, // tslint:disable-next-line:no-any currentToken: any, - callback: ErrorOrResult + callback: ErrorOrResult, ): void; } diff --git a/src/client/common/open.ts b/src/client/common/open.ts index 6fe0a566a867..20ff26a001e7 100644 --- a/src/client/common/open.ts +++ b/src/client/common/open.ts @@ -39,7 +39,7 @@ export function open(opts: any): Promise { '-e', 'do script "' + sudoPrefix + [opts.app].concat(appArgs).join(' ') + '"', '-e', - 'end tell' + 'end tell', ]; } else if (process.platform === 'win32') { cmd = 'cmd'; diff --git a/src/client/common/persistentState.ts b/src/client/common/persistentState.ts index 193a950cc944..49bf31d6beb8 100644 --- a/src/client/common/persistentState.ts +++ b/src/client/common/persistentState.ts @@ -11,7 +11,7 @@ import { IMemento, IPersistentState, IPersistentStateFactory, - WORKSPACE_MEMENTO + WORKSPACE_MEMENTO, } from './types'; export class PersistentState implements IPersistentState { @@ -19,7 +19,7 @@ export class PersistentState implements IPersistentState { private storage: Memento, private key: string, private defaultValue?: T, - private expiryDurationMs?: number + private expiryDurationMs?: number, ) {} public get value(): T { @@ -48,19 +48,19 @@ export class PersistentState implements IPersistentState { export class PersistentStateFactory implements IPersistentStateFactory { constructor( @inject(IMemento) @named(GLOBAL_MEMENTO) private globalState: Memento, - @inject(IMemento) @named(WORKSPACE_MEMENTO) private workspaceState: Memento + @inject(IMemento) @named(WORKSPACE_MEMENTO) private workspaceState: Memento, ) {} public createGlobalPersistentState( key: string, defaultValue?: T, - expiryDurationMs?: number + expiryDurationMs?: number, ): IPersistentState { return new PersistentState(this.globalState, key, defaultValue, expiryDurationMs); } public createWorkspacePersistentState( key: string, defaultValue?: T, - expiryDurationMs?: number + expiryDurationMs?: number, ): IPersistentState { return new PersistentState(this.workspaceState, key, defaultValue, expiryDurationMs); } @@ -87,6 +87,6 @@ export function getGlobalStorage(context: IExtensionContext, key: string): IP }, set(value: T) { return raw.updateValue(value); - } + }, }; } diff --git a/src/client/common/platform/errors.ts b/src/client/common/platform/errors.ts index 8d3fe1b6bbe3..6fa6b3d9fd9a 100644 --- a/src/client/common/platform/errors.ts +++ b/src/client/common/platform/errors.ts @@ -42,7 +42,7 @@ namespace vscErrors { FILE_EXISTS, IS_DIR, NOT_DIR, - NO_PERM + NO_PERM, ]; function errorMatches(err: Error, expectedName: string): boolean | undefined { if (!known.includes(err.name)) { diff --git a/src/client/common/platform/fileSystem.ts b/src/client/common/platform/fileSystem.ts index c79075788416..f377f6abefbc 100644 --- a/src/client/common/platform/fileSystem.ts +++ b/src/client/common/platform/fileSystem.ts @@ -26,7 +26,7 @@ import { ITempFileSystem, ReadStream, TemporaryFile, - WriteStream + WriteStream, } from './types'; const ENCODING: string = 'utf8'; @@ -57,13 +57,13 @@ export function convertStat(old: fs.Stats, filetype: FileType): FileStat { // for now we round to the nearest integer. // See: https://github.com/microsoft/vscode/issues/84526 ctime: Math.round(old.ctimeMs), - mtime: Math.round(old.mtimeMs) + mtime: Math.round(old.mtimeMs), }; } function filterByFileType( files: [string, FileType][], // the files to filter - fileType: FileType // the file type to look for + fileType: FileType, // the file type to look for ): [string, FileType][] { // We preserve the pre-existing behavior of following symlinks. if (fileType === FileType.Unknown) { @@ -124,14 +124,14 @@ export class RawFileSystem implements IRawFileSystem { // the VS Code FS API to use protected readonly vscfs: IVSCodeFileSystemAPI, // the node FS API to use - protected readonly fsExtra: IRawFSExtra + protected readonly fsExtra: IRawFSExtra, ) {} // Create a new object using common-case default values. public static withDefaults( paths?: IRawPath, // default: a new FileSystemPaths object (using defaults) vscfs?: IVSCodeFileSystemAPI, // default: the actual "vscode.workspace.fs" namespace - fsExtra?: IRawFSExtra // default: the "fs-extra" module + fsExtra?: IRawFSExtra, // default: the "fs-extra" module ): RawFileSystem { return new RawFileSystem( paths || FileSystemPaths.withDefaults(), @@ -139,7 +139,7 @@ export class RawFileSystem implements IRawFileSystem { // The "fs-extra" module is effectively equivalent to node's "fs" // module (but is a bit more async-friendly). So we use that // instead of "fs". - fsExtra || fs + fsExtra || fs, ); } @@ -229,7 +229,7 @@ export class RawFileSystem implements IRawFileSystem { // See: https://github.com/microsoft/vscode/issues/84177 await this.vscfs.stat(vscode.Uri.file(this.paths.dirname(dest))); await this.vscfs.copy(srcURI, destURI, { - overwrite: true + overwrite: true, }); } @@ -237,7 +237,7 @@ export class RawFileSystem implements IRawFileSystem { const uri = vscode.Uri.file(filename); return this.vscfs.delete(uri, { recursive: false, - useTrash: false + useTrash: false, }); } @@ -251,7 +251,7 @@ export class RawFileSystem implements IRawFileSystem { } return this.vscfs.delete(uri, { recursive: true, - useTrash: false + useTrash: false, }); } @@ -264,7 +264,7 @@ export class RawFileSystem implements IRawFileSystem { await this.vscfs.stat(uri); return this.vscfs.delete(uri, { recursive: true, - useTrash: false + useTrash: false, }); } @@ -330,7 +330,7 @@ export class FileSystemUtils implements IFileSystemUtils { public readonly paths: IFileSystemPaths, public readonly tmp: ITempFileSystem, private readonly getHash: (data: string) => string, - private readonly globFiles: (pat: string, options?: { cwd: string; dot?: boolean }) => Promise + private readonly globFiles: (pat: string, options?: { cwd: string; dot?: boolean }) => Promise, ) {} // Create a new object using common-case default values. public static withDefaults( @@ -338,7 +338,7 @@ export class FileSystemUtils implements IFileSystemUtils { pathUtils?: IFileSystemPathUtils, tmp?: ITempFileSystem, getHash?: (data: string) => string, - globFiles?: (pat: string, options?: { cwd: string }) => Promise + globFiles?: (pat: string, options?: { cwd: string }) => Promise, ): FileSystemUtils { pathUtils = pathUtils || FileSystemPathUtils.withDefaults(); return new FileSystemUtils( @@ -347,7 +347,7 @@ export class FileSystemUtils implements IFileSystemUtils { pathUtils.paths, tmp || TemporaryFileSystem.withDefaults(), getHash || getHashString, - globFiles || promisify(glob) + globFiles || promisify(glob), ); } @@ -374,7 +374,7 @@ export class FileSystemUtils implements IFileSystemUtils { filename: string, // the file type to expect; if not provided then any file type // matches; otherwise a mismatch results in a "false" value - fileType?: FileType + fileType?: FileType, ): Promise { let stat: FileStat; try { diff --git a/src/client/common/platform/fileSystemWatcher.ts b/src/client/common/platform/fileSystemWatcher.ts index 6080dfe8fa0b..1ef9be0e1a21 100644 --- a/src/client/common/platform/fileSystemWatcher.ts +++ b/src/client/common/platform/fileSystemWatcher.ts @@ -16,14 +16,14 @@ import { normCasePath } from './fs-paths'; export enum FileChangeType { Changed = 'changed', Created = 'created', - Deleted = 'deleted' + Deleted = 'deleted', } const POLLING_INTERVAL = 5000; export function watchLocationForPattern( baseDir: string, pattern: string, - callback: (type: FileChangeType, absPath: string) => void + callback: (type: FileChangeType, absPath: string) => void, ): IDisposable { // Use VSCode API iff base directory to exists within the current workspace folders const found = workspace.workspaceFolders?.find((e) => normCasePath(baseDir).startsWith(normCasePath(e.uri.fsPath))); @@ -37,7 +37,7 @@ export function watchLocationForPattern( function watchLocationUsingVSCodeAPI( baseDir: string, pattern: string, - callback: (type: FileChangeType, absPath: string) => void + callback: (type: FileChangeType, absPath: string) => void, ): IDisposable { const globPattern = new RelativePattern(baseDir, pattern); const disposables = new Disposables(); @@ -52,7 +52,7 @@ function watchLocationUsingVSCodeAPI( function watchLocationUsingChokidar( baseDir: string, pattern: string, - callback: (type: FileChangeType, absPath: string) => void + callback: (type: FileChangeType, absPath: string) => void, ): IDisposable { const watcherOpts: chokidar.WatchOptions = { cwd: baseDir, @@ -73,9 +73,9 @@ function watchLocationUsingChokidar( '/proc/**', '/sys/**', '**/lib/**', - '**/includes/**' + '**/includes/**', ], // https://github.com/microsoft/vscode/issues/23954 - followSymlinks: true + followSymlinks: true, }; traceVerbose(`Start watching: ${baseDir} with pattern ${pattern} using chokidar`); let watcher: chokidar.FSWatcher | null = chokidar.watch(pattern, watcherOpts); diff --git a/src/client/common/platform/fs-paths.ts b/src/client/common/platform/fs-paths.ts index afa18fe7dc52..850525f3a147 100644 --- a/src/client/common/platform/fs-paths.ts +++ b/src/client/common/platform/fs-paths.ts @@ -22,14 +22,14 @@ export class FileSystemPaths implements IFileSystemPaths { // "true" if targeting a case-insensitive host (like Windows) private readonly isCaseInsensitive: boolean, // (effectively) the node "path" module to use - private readonly raw: INodePath + private readonly raw: INodePath, ) {} // Create a new object using common-case default values. // We do not use an alternate constructor because defaults in the // constructor runs counter to our typical approach. public static withDefaults( // default: use "isWindows" - isCaseInsensitive?: boolean + isCaseInsensitive?: boolean, ): FileSystemPaths { if (isCaseInsensitive === undefined) { isCaseInsensitive = getOSType() === OSType.Windows; @@ -37,7 +37,7 @@ export class FileSystemPaths implements IFileSystemPaths { return new FileSystemPaths( isCaseInsensitive, // Use the actual node "path" module. - nodepath + nodepath, ); } @@ -72,7 +72,7 @@ export class Executables { // the $PATH delimiter to use public readonly delimiter: string, // the OS type to target - private readonly osType: OSType + private readonly osType: OSType, ) {} // Create a new object using common-case default values. // We do not use an alternate constructor because defaults in the @@ -82,7 +82,7 @@ export class Executables { // Use node's value. nodepath.delimiter, // Use the current OS. - getOSType() + getOSType(), ); } @@ -105,14 +105,14 @@ export class FileSystemPathUtils implements IFileSystemPathUtils { // the low-level OS "executables" to use (and expose) public readonly executables: IExecutables, // other low-level FS path operations to use - private readonly raw: IRawPaths + private readonly raw: IRawPaths, ) {} // Create a new object using common-case default values. // We do not use an alternate constructor because defaults in the // constructor runs counter to our typical approach. public static withDefaults( // default: a new FileSystemPaths object (using defaults) - paths?: IFileSystemPaths + paths?: IFileSystemPaths, ): FileSystemPathUtils { if (paths === undefined) { paths = FileSystemPaths.withDefaults(); @@ -123,7 +123,7 @@ export class FileSystemPathUtils implements IFileSystemPathUtils { paths, Executables.withDefaults(), // Use the actual node "path" module. - nodepath + nodepath, ); } diff --git a/src/client/common/platform/fs-temp.ts b/src/client/common/platform/fs-temp.ts index 64d2870a47e4..7c88184b8847 100644 --- a/src/client/common/platform/fs-temp.ts +++ b/src/client/common/platform/fs-temp.ts @@ -12,7 +12,7 @@ interface IRawTempFS { file( config: tmp.Options, // tslint:disable-next-line:no-any - callback?: (err: any, path: string, fd: number, cleanupCallback: () => void) => void + callback?: (err: any, path: string, fd: number, cleanupCallback: () => void) => void, ): void; } @@ -20,12 +20,12 @@ interface IRawTempFS { export class TemporaryFileSystem implements ITempFileSystem { constructor( // (effectively) the third-party "tmp" module to use - private readonly raw: IRawTempFS + private readonly raw: IRawTempFS, ) {} public static withDefaults(): TemporaryFileSystem { return new TemporaryFileSystem( // Use the actual "tmp" module. - tmp + tmp, ); } @@ -33,7 +33,7 @@ export class TemporaryFileSystem implements ITempFileSystem { public createFile(suffix: string, mode?: number): Promise { const opts = { postfix: suffix, - mode + mode, }; return new Promise((resolve, reject) => { this.raw.file(opts, (err, filename, _fd, cleanUp) => { @@ -42,7 +42,7 @@ export class TemporaryFileSystem implements ITempFileSystem { } resolve({ filePath: filename, - dispose: cleanUp + dispose: cleanUp, }); }); }); diff --git a/src/client/common/platform/pathUtils.ts b/src/client/common/platform/pathUtils.ts index 6d3a5522db8e..04a00c5fc225 100644 --- a/src/client/common/platform/pathUtils.ts +++ b/src/client/common/platform/pathUtils.ts @@ -15,7 +15,7 @@ export class PathUtils implements IPathUtils { private readonly utils: FileSystemPathUtils; constructor( // "true" if targeting a Windows host. - @inject(IsWindows) isWindows: boolean + @inject(IsWindows) isWindows: boolean, ) { const osType = isWindows ? OSType.Windows : OSType.Unknown; // We cannot just use FileSystemPathUtils.withDefaults() because @@ -24,7 +24,7 @@ export class PathUtils implements IPathUtils { untildify('~'), FileSystemPaths.withDefaults(), new Executables(path.delimiter, osType), - path + path, ); } diff --git a/src/client/common/platform/platformService.ts b/src/client/common/platform/platformService.ts index affc8913e572..6dfc65462b92 100644 --- a/src/client/common/platform/platformService.ts +++ b/src/client/common/platform/platformService.ts @@ -19,7 +19,7 @@ export class PlatformService implements IPlatformService { constructor() { if (this.osType === OSType.Unknown) { sendTelemetryEvent(EventName.PLATFORM_INFO, undefined, { - failureType: PlatformErrors.FailedToDetermineOS + failureType: PlatformErrors.FailedToDetermineOS, }); } } @@ -43,14 +43,14 @@ export class PlatformService implements IPlatformService { const ver = coerce(os.release()); if (ver) { sendTelemetryEvent(EventName.PLATFORM_INFO, undefined, { - osVersion: `${ver.major}.${ver.minor}.${ver.patch}` + osVersion: `${ver.major}.${ver.minor}.${ver.patch}`, }); return (this.version = ver); } throw new Error('Unable to parse version'); } catch (ex) { sendTelemetryEvent(EventName.PLATFORM_INFO, undefined, { - failureType: PlatformErrors.FailedToParseVersion + failureType: PlatformErrors.FailedToParseVersion, }); return parseVersion(os.release()); } diff --git a/src/client/common/platform/registry.ts b/src/client/common/platform/registry.ts index 3e920f03c30c..07daae425251 100644 --- a/src/client/common/platform/registry.ts +++ b/src/client/common/platform/registry.ts @@ -6,7 +6,7 @@ import { IRegistry, RegistryHive } from './types'; enum RegistryArchitectures { x86 = 'x86', - x64 = 'x64' + x64 = 'x64', } @injectable() @@ -22,7 +22,7 @@ export class RegistryImplementation implements IRegistry { (ex) => { traceError('Fetching key value from windows registry resulted in an error', ex); return undefined; - } + }, ); } } diff --git a/src/client/common/platform/types.ts b/src/client/common/platform/types.ts index 1f533a0f80c2..d4eb673b04d5 100644 --- a/src/client/common/platform/types.ts +++ b/src/client/common/platform/types.ts @@ -12,7 +12,7 @@ import { Architecture, OSType } from '../utils/platform'; export enum RegistryHive { HKCU, - HKLM + HKLM, } export const IRegistry = Symbol('IRegistry'); diff --git a/src/client/common/process/internal/scripts/index.ts b/src/client/common/process/internal/scripts/index.ts index b395b4a52cff..da39848400a2 100644 --- a/src/client/common/process/internal/scripts/index.ts +++ b/src/client/common/process/internal/scripts/index.ts @@ -286,7 +286,7 @@ namespace _symbolProvider { export function symbolProvider( filename: string, // If "text" is provided then it gets passed to the script as-is. - text?: string + text?: string, ): [string[], (out: string) => _symbolProvider.Symbols] { const script = path.join(SCRIPTS_DIR, 'symbolProvider.py'); const args = maybeIsolated([script, filename]); @@ -342,7 +342,7 @@ export function shell_exec(command: string, lockfile: string, shellArgs: string[ // The shell args must come after the command // but before the lockfile. ...shellArgs, - lockfile.fileToCommandArgument() + lockfile.fileToCommandArgument(), ]); } diff --git a/src/client/common/process/logger.ts b/src/client/common/process/logger.ts index a17896fdd467..9adc2bc4cac8 100644 --- a/src/client/common/process/logger.ts +++ b/src/client/common/process/logger.ts @@ -14,7 +14,7 @@ import { IProcessLogger, SpawnOptions } from './types'; export class ProcessLogger implements IProcessLogger { constructor( @inject(IOutputChannel) @named(STANDARD_OUTPUT_CHANNEL) private readonly outputChannel: IOutputChannel, - @inject(IPathUtils) private readonly pathUtils: IPathUtils + @inject(IPathUtils) private readonly pathUtils: IPathUtils, ) {} public logProcess(file: string, args: string[], options?: SpawnOptions) { diff --git a/src/client/common/process/proc.ts b/src/client/common/process/proc.ts index 54cf2f53bf43..33e7adc41fd5 100644 --- a/src/client/common/process/proc.ts +++ b/src/client/common/process/proc.ts @@ -16,7 +16,7 @@ import { Output, ShellOptions, SpawnOptions, - StdErrError + StdErrError, } from './types'; // tslint:disable:no-any @@ -70,7 +70,7 @@ export class ProcessService extends EventEmitter implements IProcessService { if (proc) { proc.unref(); } - } + }, }; this.processesToKill.add(disposable); @@ -89,7 +89,7 @@ export class ProcessService extends EventEmitter implements IProcessService { proc.kill(); procExited = true; } - }) + }), ); } @@ -127,7 +127,7 @@ export class ProcessService extends EventEmitter implements IProcessService { return { proc, out: output, - dispose: disposable.dispose + dispose: disposable.dispose, }; } public exec(file: string, args: string[], options: SpawnOptions = {}): Promise> { @@ -140,7 +140,7 @@ export class ProcessService extends EventEmitter implements IProcessService { if (!proc.killed && !deferred.completed) { proc.kill(); } - } + }, }; this.processesToKill.add(disposable); const disposables: IDisposable[] = []; @@ -209,7 +209,7 @@ export class ProcessService extends EventEmitter implements IProcessService { if (!proc.killed) { proc.kill(); } - } + }, }; this.processesToKill.add(disposable); }); diff --git a/src/client/common/process/processFactory.ts b/src/client/common/process/processFactory.ts index d6da78721138..13bf4f09a250 100644 --- a/src/client/common/process/processFactory.ts +++ b/src/client/common/process/processFactory.ts @@ -16,7 +16,7 @@ export class ProcessServiceFactory implements IProcessServiceFactory { @inject(IEnvironmentVariablesProvider) private readonly envVarsService: IEnvironmentVariablesProvider, @inject(IProcessLogger) private readonly processLogger: IProcessLogger, @inject(IBufferDecoder) private readonly decoder: IBufferDecoder, - @inject(IDisposableRegistry) private readonly disposableRegistry: IDisposableRegistry + @inject(IDisposableRegistry) private readonly disposableRegistry: IDisposableRegistry, ) {} public async create(resource?: Uri): Promise { const customEnvVars = await this.envVarsService.getEnvironmentVariables(resource); diff --git a/src/client/common/process/pythonEnvironment.ts b/src/client/common/process/pythonEnvironment.ts index 2f3a86c953cb..c1e347c0c050 100644 --- a/src/client/common/process/pythonEnvironment.ts +++ b/src/client/common/process/pythonEnvironment.ts @@ -24,7 +24,7 @@ class PythonEnvironment { // from ProcessService: exec(file: string, args: string[]): Promise>; shellExec(command: string, timeout: number): Promise>; - } + }, ) {} public getExecutionInfo(pythonArgs: string[] = []): PythonExecInfo { @@ -81,14 +81,14 @@ function createDeps( observablePythonArgv: string[] | undefined, // from ProcessService: exec: (file: string, args: string[], options?: SpawnOptions) => Promise>, - shellExec: (command: string, options?: ShellOptions) => Promise> + shellExec: (command: string, options?: ShellOptions) => Promise>, ) { return { getPythonArgv: (python: string) => pythonArgv || [python], getObservablePythonArgv: (python: string) => observablePythonArgv || [python], isValidExecutable, exec: async (cmd: string, args: string[]) => exec(cmd, args, { throwOnStdErr: true }), - shellExec: async (text: string, timeout: number) => shellExec(text, { timeout }) + shellExec: async (text: string, timeout: number) => shellExec(text, { timeout }), }; } @@ -96,7 +96,7 @@ export function createPythonEnv( pythonPath: string, // These are used to generate the deps. procs: IProcessService, - fs: IFileSystem + fs: IFileSystem, ): PythonEnvironment { const deps = createDeps( async (filename) => fs.fileExists(filename), @@ -104,7 +104,7 @@ export function createPythonEnv( undefined, undefined, (file, args, opts) => procs.exec(file, args, opts), - (command, opts) => procs.shellExec(command, opts) + (command, opts) => procs.shellExec(command, opts), ); return new PythonEnvironment(pythonPath, deps); } @@ -115,7 +115,7 @@ export function createCondaEnv( pythonPath: string, // These are used to generate the deps. procs: IProcessService, - fs: IFileSystem + fs: IFileSystem, ): PythonEnvironment { const runArgs = ['run']; if (condaInfo.name === '') { @@ -133,7 +133,7 @@ export function createCondaEnv( // See https://github.com/microsoft/vscode-python/issues/8473. undefined, (file, args, opts) => procs.exec(file, args, opts), - (command, opts) => procs.shellExec(command, opts) + (command, opts) => procs.shellExec(command, opts), ); return new PythonEnvironment(pythonPath, deps); } @@ -141,7 +141,7 @@ export function createCondaEnv( export function createWindowsStoreEnv( pythonPath: string, // These are used to generate the deps. - procs: IProcessService + procs: IProcessService, ): PythonEnvironment { const deps = createDeps( /** @@ -157,7 +157,7 @@ export function createWindowsStoreEnv( undefined, undefined, (file, args, opts) => procs.exec(file, args, opts), - (command, opts) => procs.shellExec(command, opts) + (command, opts) => procs.shellExec(command, opts), ); return new PythonEnvironment(pythonPath, deps); } diff --git a/src/client/common/process/pythonExecutionFactory.ts b/src/client/common/process/pythonExecutionFactory.ts index 009f75f72cf0..1c3c1bfe0219 100644 --- a/src/client/common/process/pythonExecutionFactory.ts +++ b/src/client/common/process/pythonExecutionFactory.ts @@ -25,7 +25,7 @@ import { IProcessService, IProcessServiceFactory, IPythonExecutionFactory, - IPythonExecutionService + IPythonExecutionService, } from './types'; // Minimum version number of conda required to be able to use 'conda run' @@ -43,7 +43,7 @@ export class PythonExecutionFactory implements IPythonExecutionFactory { @inject(IConfigurationService) private readonly configService: IConfigurationService, @inject(ICondaService) private readonly condaService: ICondaService, @inject(IBufferDecoder) private readonly decoder: IBufferDecoder, - @inject(WindowsStoreInterpreter) private readonly windowsStoreInterpreter: IWindowsStoreInterpreter + @inject(WindowsStoreInterpreter) private readonly windowsStoreInterpreter: IWindowsStoreInterpreter, ) { // Acquire other objects here so that if we are called during dispose they are available. this.disposables = this.serviceContainer.get(IDisposableRegistry); @@ -62,24 +62,24 @@ export class PythonExecutionFactory implements IPythonExecutionFactory { processService, this.fileSystem, undefined, - await this.windowsStoreInterpreter.isWindowsStoreInterpreter(pythonPath) + await this.windowsStoreInterpreter.isWindowsStoreInterpreter(pythonPath), ); } public async createActivatedEnvironment( - options: ExecutionFactoryCreateWithEnvironmentOptions + options: ExecutionFactoryCreateWithEnvironmentOptions, ): Promise { const envVars = await this.activationHelper.getActivatedEnvironmentVariables( options.resource, options.interpreter, - options.allowEnvironmentFetchExceptions + options.allowEnvironmentFetchExceptions, ); const hasEnvVars = envVars && Object.keys(envVars).length > 0; sendTelemetryEvent(EventName.PYTHON_INTERPRETER_ACTIVATION_ENVIRONMENT_VARIABLES, undefined, { hasEnvVars }); if (!hasEnvVars) { return this.create({ resource: options.resource, - pythonPath: options.interpreter ? options.interpreter.path : undefined + pythonPath: options.interpreter ? options.interpreter.path : undefined, }); } const pythonPath = options.interpreter @@ -96,7 +96,7 @@ export class PythonExecutionFactory implements IPythonExecutionFactory { public async createCondaExecutionService( pythonPath: string, processService?: IProcessService, - resource?: Uri + resource?: Uri, ): Promise { const processServicePromise = processService ? Promise.resolve(processService) @@ -105,7 +105,7 @@ export class PythonExecutionFactory implements IPythonExecutionFactory { this.condaService.getCondaVersion(), this.condaService.getCondaEnvironment(pythonPath), this.condaService.getCondaFile(), - processServicePromise + processServicePromise, ]); if (condaVersion && gte(condaVersion, CONDA_RUN_VERSION) && condaEnvironment && condaFile && procService) { @@ -119,7 +119,7 @@ export class PythonExecutionFactory implements IPythonExecutionFactory { procService, this.fileSystem, // This is what causes a CondaEnvironment to be returned: - [condaFile, condaEnvironment] + [condaFile, condaEnvironment], ); } @@ -132,7 +132,7 @@ function createPythonService( procService: IProcessService, fs: IFileSystem, conda?: [string, CondaEnvironmentInfo], - isWindowsStore?: boolean + isWindowsStore?: boolean, ): IPythonExecutionService { let env = createPythonEnv(pythonPath, procService, fs); if (conda) { @@ -150,6 +150,6 @@ function createPythonService( execObservable: (a, o) => procs.execObservable(a, o), execModuleObservable: (m, a, o) => procs.execModuleObservable(m, a, o), exec: (a, o) => procs.exec(a, o), - execModule: (m, a, o) => procs.execModule(m, a, o) + execModule: (m, a, o) => procs.execModule(m, a, o), }; } diff --git a/src/client/common/process/pythonProcess.ts b/src/client/common/process/pythonProcess.ts index b6ce351ee318..6536019e10f7 100644 --- a/src/client/common/process/pythonProcess.ts +++ b/src/client/common/process/pythonProcess.ts @@ -18,7 +18,7 @@ class PythonProcessService { // from ProcessService: exec(file: string, args: string[], options: SpawnOptions): Promise>; execObservable(file: string, args: string[], options: SpawnOptions): ObservableExecutionResult; - } + }, ) {} public execObservable(args: string[], options: SpawnOptions): ObservableExecutionResult { @@ -30,7 +30,7 @@ class PythonProcessService { public execModuleObservable( moduleName: string, moduleArgs: string[], - options: SpawnOptions + options: SpawnOptions, ): ObservableExecutionResult { const args = internalPython.execModule(moduleName, moduleArgs); const opts: SpawnOptions = { ...options }; @@ -47,7 +47,7 @@ class PythonProcessService { public async execModule( moduleName: string, moduleArgs: string[], - options: SpawnOptions + options: SpawnOptions, ): Promise> { const args = internalPython.execModule(moduleName, moduleArgs); const opts: SpawnOptions = { ...options }; @@ -73,7 +73,7 @@ export function createPythonProcessService( getExecutionInfo(pythonArgs?: string[]): PythonExecInfo; getExecutionObservableInfo(pythonArgs?: string[]): PythonExecInfo; isModuleInstalled(moduleName: string): Promise; - } + }, ) { const deps = { // from PythonService: @@ -82,7 +82,7 @@ export function createPythonProcessService( getExecutionObservableInfo: (a?: string[]) => env.getExecutionObservableInfo(a), // from ProcessService: exec: async (f: string, a: string[], o: SpawnOptions) => procs.exec(f, a, o), - execObservable: (f: string, a: string[], o: SpawnOptions) => procs.execObservable(f, a, o) + execObservable: (f: string, a: string[], o: SpawnOptions) => procs.execObservable(f, a, o), }; return new PythonProcessService(deps); } diff --git a/src/client/common/process/pythonToolService.ts b/src/client/common/process/pythonToolService.ts index 9a596f2c5f13..10294854e7b0 100644 --- a/src/client/common/process/pythonToolService.ts +++ b/src/client/common/process/pythonToolService.ts @@ -11,7 +11,7 @@ import { IPythonExecutionFactory, IPythonToolExecutionService, ObservableExecutionResult, - SpawnOptions + SpawnOptions, } from './types'; @injectable() @@ -20,7 +20,7 @@ export class PythonToolExecutionService implements IPythonToolExecutionService { public async execObservable( executionInfo: ExecutionInfo, options: SpawnOptions, - resource: Uri + resource: Uri, ): Promise> { if (options.env) { throw new Error('Environment variables are not supported'); @@ -40,7 +40,7 @@ export class PythonToolExecutionService implements IPythonToolExecutionService { public async exec( executionInfo: ExecutionInfo, options: SpawnOptions, - resource: Uri + resource: Uri, ): Promise> { if (options.env) { throw new Error('Environment variables are not supported'); diff --git a/src/client/common/process/types.ts b/src/client/common/process/types.ts index b553b51b2f15..c0c37a21ca46 100644 --- a/src/client/common/process/types.ts +++ b/src/client/common/process/types.ts @@ -82,7 +82,7 @@ export interface IPythonExecutionFactory { createCondaExecutionService( pythonPath: string, processService?: IProcessService, - resource?: Uri + resource?: Uri, ): Promise; } export const IPythonExecutionService = Symbol('IPythonExecutionService'); @@ -116,7 +116,7 @@ export interface IPythonToolExecutionService { execObservable( executionInfo: ExecutionInfo, options: SpawnOptions, - resource: Uri + resource: Uri, ): Promise>; exec(executionInfo: ExecutionInfo, options: SpawnOptions, resource: Uri): Promise>; } diff --git a/src/client/common/serviceRegistry.ts b/src/client/common/serviceRegistry.ts index 5fdd57165c66..bfb29190eab2 100644 --- a/src/client/common/serviceRegistry.ts +++ b/src/client/common/serviceRegistry.ts @@ -33,7 +33,7 @@ import { ILanguageService, ITerminalManager, IVSCodeNotebook, - IWorkspaceService + IWorkspaceService, } from './application/types'; import { WorkspaceService } from './application/workspace'; import { AsyncDisposableRegistry } from './asyncDisposableRegistry'; @@ -47,7 +47,7 @@ import { FeatureDeprecationManager } from './featureDeprecationManager'; import { ExtensionInsidersDailyChannelRule, ExtensionInsidersOffChannelRule, - ExtensionInsidersWeeklyChannelRule + ExtensionInsidersWeeklyChannelRule, } from './insidersBuild/downloadChannelRules'; import { ExtensionChannelService } from './insidersBuild/downloadChannelService'; import { InsidersExtensionPrompt } from './insidersBuild/insidersExtensionPrompt'; @@ -56,7 +56,7 @@ import { ExtensionChannel, IExtensionChannelRule, IExtensionChannelService, - IInsiderExtensionPrompt + IInsiderExtensionPrompt, } from './insidersBuild/types'; import { ProductInstaller } from './installer/productInstaller'; import { InterpreterPathService } from './interpreterPathService'; @@ -95,7 +95,7 @@ import { ITerminalActivator, ITerminalHelper, ITerminalServiceFactory, - TerminalActivationProviders + TerminalActivationProviders, } from './terminal/types'; import { IAsyncDisposableRegistry, @@ -111,7 +111,7 @@ import { IPathUtils, IPersistentStateFactory, IRandom, - IsWindows + IsWindows, } from './types'; import { IMultiStepInputFactory, MultiStepInputFactory } from './utils/multiStepInput'; import { Random } from './utils/random'; @@ -134,7 +134,7 @@ export function registerTypes(serviceManager: IServiceManager) { serviceManager.addSingleton(IInstaller, ProductInstaller); serviceManager.addSingleton( IJupyterExtensionDependencyManager, - JupyterExtensionDependencyManager + JupyterExtensionDependencyManager, ); serviceManager.addSingleton(ICommandManager, CommandManager); serviceManager.addSingleton(IConfigurationService, ConfigurationService); @@ -153,7 +153,7 @@ export function registerTypes(serviceManager: IServiceManager) { serviceManager.addSingleton(ITerminalActivator, TerminalActivator); serviceManager.addSingleton( ITerminalActivationHandler, - PowershellTerminalActivationFailedHandler + PowershellTerminalActivationFailedHandler, ); serviceManager.addSingleton(ICryptoUtils, CryptoUtils); serviceManager.addSingleton(IExperimentsManager, ExperimentsManager); @@ -163,27 +163,27 @@ export function registerTypes(serviceManager: IServiceManager) { serviceManager.addSingleton( ITerminalActivationCommandProvider, Bash, - TerminalActivationProviders.bashCShellFish + TerminalActivationProviders.bashCShellFish, ); serviceManager.addSingleton( ITerminalActivationCommandProvider, CommandPromptAndPowerShell, - TerminalActivationProviders.commandPromptAndPowerShell + TerminalActivationProviders.commandPromptAndPowerShell, ); serviceManager.addSingleton( ITerminalActivationCommandProvider, PyEnvActivationCommandProvider, - TerminalActivationProviders.pyenv + TerminalActivationProviders.pyenv, ); serviceManager.addSingleton( ITerminalActivationCommandProvider, CondaActivationCommandProvider, - TerminalActivationProviders.conda + TerminalActivationProviders.conda, ); serviceManager.addSingleton( ITerminalActivationCommandProvider, PipEnvActivationCommandProvider, - TerminalActivationProviders.pipenv + TerminalActivationProviders.pipenv, ); serviceManager.addSingleton(IFeatureDeprecationManager, FeatureDeprecationManager); @@ -198,35 +198,35 @@ export function registerTypes(serviceManager: IServiceManager) { serviceManager.addSingleton(IInsiderExtensionPrompt, InsidersExtensionPrompt); serviceManager.addSingleton( IExtensionSingleActivationService, - InsidersExtensionService + InsidersExtensionService, ); serviceManager.addSingleton( IExtensionSingleActivationService, - ReloadVSCodeCommandHandler + ReloadVSCodeCommandHandler, ); serviceManager.addSingleton( IExtensionSingleActivationService, - DebuggerDataViewerExperimentEnabler + DebuggerDataViewerExperimentEnabler, ); serviceManager.addSingleton(IExtensionChannelService, ExtensionChannelService); serviceManager.addSingleton( IExtensionChannelRule, ExtensionInsidersOffChannelRule, - ExtensionChannel.off + ExtensionChannel.off, ); serviceManager.addSingleton( IExtensionChannelRule, ExtensionInsidersDailyChannelRule, - ExtensionChannel.daily + ExtensionChannel.daily, ); serviceManager.addSingleton( IExtensionChannelRule, ExtensionInsidersWeeklyChannelRule, - ExtensionChannel.weekly + ExtensionChannel.weekly, ); serviceManager.addSingleton( IExtensionSingleActivationService, - DebugSessionTelemetry + DebugSessionTelemetry, ); serviceManager.addSingleton(ICustomEditorService, CustomEditorService); serviceManager.addSingleton(IStartPage, StartPage, undefined, [IExtensionSingleActivationService]); diff --git a/src/client/common/startPage/codeCssGenerator.ts b/src/client/common/startPage/codeCssGenerator.ts index b4b6c2b2e4b0..e836ea9b2207 100644 --- a/src/client/common/startPage/codeCssGenerator.ts +++ b/src/client/common/startPage/codeCssGenerator.ts @@ -51,7 +51,7 @@ const DefaultCssVars: { [key: string]: string } = { --override-lineHighlightBorder: #282828; --override-peek-background: #001f33; } -` +`, }; // These colors below should match colors that come from either the Default Light+ theme or the Default Dark+ theme. @@ -74,7 +74,7 @@ const DefaultColors: { [key: string]: string } = { 'dark.variable': '#9CDCFE', 'dark.entity.name.type': '#4EC9B0', 'dark.support.function': '#DCDCAA', - 'dark.punctuation': '#1e1e1e' + 'dark.punctuation': '#1e1e1e', }; interface IApplyThemeArgs { @@ -97,7 +97,7 @@ export class CodeCssGenerator implements ICodeCssGenerator { constructor( @inject(IWorkspaceService) private workspaceService: IWorkspaceService, @inject(IThemeFinder) private themeFinder: IThemeFinder, - @inject(IFileSystem) private fs: IFileSystem + @inject(IFileSystem) private fs: IFileSystem, ) {} public generateThemeCss(isDark: boolean, theme: string): Promise { @@ -112,7 +112,7 @@ export class CodeCssGenerator implements ICodeCssGenerator { isDark: boolean, theme: string, defaultT: T, - applier: (args: IApplyThemeArgs) => T + applier: (args: IApplyThemeArgs) => T, ): Promise { let result = defaultT; try { @@ -138,7 +138,7 @@ export class CodeCssGenerator implements ICodeCssGenerator { fontFamily, fontSize, isDark: isDarkUpdated, - defaultStyle: LightTheme + defaultStyle: LightTheme, }); } else if (tokenColors === null && fontFamily && fontSize) { // No colors found. See if we can figure out what type of theme we have @@ -147,7 +147,7 @@ export class CodeCssGenerator implements ICodeCssGenerator { fontFamily, fontSize, isDark: isDarkUpdated, - defaultStyle: style + defaultStyle: style, }); } } @@ -180,7 +180,7 @@ export class CodeCssGenerator implements ICodeCssGenerator { tokenColors: JSONArray | null | undefined, scope: string, secondary: string, - defaultStyle: string | undefined + defaultStyle: string | undefined, ): { color: string; fontStyle: string } => { // Search through the scopes on the json object if (tokenColors) { @@ -221,7 +221,7 @@ export class CodeCssGenerator implements ICodeCssGenerator { args.tokenColors, 'entity.name.type', 'entity.name.type', - args.defaultStyle + args.defaultStyle, ); // Use these values to fill in our format string @@ -248,7 +248,7 @@ ${args.defaultStyle ? DefaultCssVars[args.defaultStyle] : ''} base: args.isDark ? 'vs-dark' : 'vs', inherit: false, rules: [], - colors: {} + colors: {}, }; // If we have token colors enumerate them and add them into the rules if (args.tokenColors && args.tokenColors.length) { @@ -279,13 +279,13 @@ ${args.defaultStyle ? DefaultCssVars[args.defaultStyle] : ''} token, foreground: settings.foreground, background: settings.background, - fontStyle: settings.fontStyle + fontStyle: settings.fontStyle, }); } else { result.rules.push({ token, background: settings.background, - fontStyle: settings.fontStyle + fontStyle: settings.fontStyle, }); } @@ -297,7 +297,7 @@ ${args.defaultStyle ? DefaultCssVars[args.defaultStyle] : ''} token: 'punctuation.definition.comment', foreground: settings.foreground, background: settings.background, - fontStyle: settings.fontStyle + fontStyle: settings.fontStyle, }); } @@ -308,7 +308,7 @@ ${args.defaultStyle ? DefaultCssVars[args.defaultStyle] : ''} token: 'punctuation.definition.string', foreground: settings.foreground, background: settings.background, - fontStyle: settings.fontStyle + fontStyle: settings.fontStyle, }); } } @@ -318,7 +318,7 @@ ${args.defaultStyle ? DefaultCssVars[args.defaultStyle] : ''} result.rules = result.rules.sort( (a: monacoEditor.editor.ITokenThemeRule, b: monacoEditor.editor.ITokenThemeRule) => - a.token.localeCompare(b.token) + a.token.localeCompare(b.token), ); } else { // Otherwise use our default values. @@ -329,11 +329,11 @@ ${args.defaultStyle ? DefaultCssVars[args.defaultStyle] : ''} // Special case. We need rules for the comment beginning and the string beginning result.rules.push({ token: 'punctuation.definition.comment', - foreground: DefaultColors[`${args.defaultStyle}.comment`] + foreground: DefaultColors[`${args.defaultStyle}.comment`], }); result.rules.push({ token: 'punctuation.definition.string', - foreground: DefaultColors[`${args.defaultStyle}.string`] + foreground: DefaultColors[`${args.defaultStyle}.string`], }); } } diff --git a/src/client/common/startPage/constants.ts b/src/client/common/startPage/constants.ts index 11d33a25c713..20d62d8e3a66 100644 --- a/src/client/common/startPage/constants.ts +++ b/src/client/common/startPage/constants.ts @@ -31,5 +31,5 @@ export enum Telemetry { StartPageOpenSampleNotebook = 'DATASCIENCE.STARTPAGE_OPEN_SAMPLE_NOTEBOOK', StartPageOpenFileBrowser = 'DATASCIENCE.STARTPAGE_OPEN_FILE_BROWSER', StartPageOpenFolder = 'DATASCIENCE.STARTPAGE_OPEN_FOLDER', - StartPageOpenWorkspace = 'DATASCIENCE.STARTPAGE_OPEN_WORKSPACE' + StartPageOpenWorkspace = 'DATASCIENCE.STARTPAGE_OPEN_WORKSPACE', } diff --git a/src/client/common/startPage/messages.ts b/src/client/common/startPage/messages.ts index 9f5372c493fc..66eba958f8ff 100644 --- a/src/client/common/startPage/messages.ts +++ b/src/client/common/startPage/messages.ts @@ -7,14 +7,14 @@ export enum CssMessages { GetCssRequest = 'get_css_request', GetCssResponse = 'get_css_response', GetMonacoThemeRequest = 'get_monaco_theme_request', - GetMonacoThemeResponse = 'get_monaco_theme_response' + GetMonacoThemeResponse = 'get_monaco_theme_response', } export enum SharedMessages { UpdateSettings = 'update_settings', Started = 'started', LocInit = 'loc_init', - StyleUpdate = 'style_update' + StyleUpdate = 'style_update', } export interface IGetCssRequest { diff --git a/src/client/common/startPage/startPage.ts b/src/client/common/startPage/startPage.ts index 81c970f28080..d9c753e2ac24 100644 --- a/src/client/common/startPage/startPage.ts +++ b/src/client/common/startPage/startPage.ts @@ -15,7 +15,7 @@ import { ICommandManager, IDocumentManager, IWebviewPanelProvider, - IWorkspaceService + IWorkspaceService, } from '../application/types'; import { IFileSystem } from '../platform/types'; import { IConfigurationService, IExtensionContext, Resource } from '../types'; @@ -50,7 +50,7 @@ export class StartPage extends WebviewPanelHost @inject(IDocumentManager) private readonly documentManager: IDocumentManager, @inject(IApplicationShell) private appShell: IApplicationShell, @inject(IExtensionContext) private readonly context: IExtensionContext, - @inject(IApplicationEnvironment) private appEnvironment: IApplicationEnvironment + @inject(IApplicationEnvironment) private appEnvironment: IApplicationEnvironment, ) { super( configuration, @@ -63,7 +63,7 @@ export class StartPage extends WebviewPanelHost [path.join(startPageDir, 'commons.initial.bundle.js'), path.join(startPageDir, 'startPage.js')], localize.StartPage.getStarted(), ViewColumn.One, - false + false, ); this.timer = new StopWatch(); } @@ -119,7 +119,7 @@ export class StartPage extends WebviewPanelHost case StartPageMessages.RequestShowAgainSetting: const settings = this.configuration.getSettings(); await this.postMessage(StartPageMessages.SendSetting, { - showAgainSetting: settings.showStartPage + showAgainSetting: settings.showStartPage, }); break; case StartPageMessages.OpenBlankNotebook: @@ -132,7 +132,7 @@ export class StartPage extends WebviewPanelHost await this.commandManager.executeCommand( 'jupyter.opennotebook', undefined, - CommandSource.commandPalette + CommandSource.commandPalette, ); } else { this.openSampleNotebook().ignoreErrors(); @@ -144,7 +144,7 @@ export class StartPage extends WebviewPanelHost const doc = await this.documentManager.openTextDocument({ language: 'python', - content: `print("${localize.StartPage.helloWorld()}")` + content: `print("${localize.StartPage.helloWorld()}")`, }); await this.documentManager.showTextDocument(doc, 1, true); break; @@ -154,7 +154,7 @@ export class StartPage extends WebviewPanelHost const doc2 = await this.documentManager.openTextDocument({ language: 'python', - content: `#%%\nprint("${localize.StartPage.helloWorld()}")` + content: `#%%\nprint("${localize.StartPage.helloWorld()}")`, }); await this.documentManager.showTextDocument(doc2, 1, true); await this.commandManager.executeCommand('jupyter.runallcells', Uri.parse('')); @@ -171,7 +171,7 @@ export class StartPage extends WebviewPanelHost await this.commandManager.executeCommand( 'workbench.action.quickOpen', - '>Create New Blank Jupyter Notebook' + '>Create New Blank Jupyter Notebook', ); break; case StartPageMessages.OpenSampleNotebook: @@ -186,9 +186,9 @@ export class StartPage extends WebviewPanelHost const uri = await this.appShell.showOpenDialog({ filters: { - Python: ['py', 'ipynb'] + Python: ['py', 'ipynb'], }, - canSelectMany: false + canSelectMany: false, }); if (uri) { const doc3 = await this.documentManager.openTextDocument(uri[0]); @@ -285,7 +285,7 @@ export class StartPage extends WebviewPanelHost const localizedFilePath = path.join( EXTENSION_ROOT_DIR, 'pythonFiles', - localize.StartPage.sampleNotebook() + ipynb + localize.StartPage.sampleNotebook() + ipynb, ); let sampleNotebookPath: string; @@ -298,7 +298,7 @@ export class StartPage extends WebviewPanelHost await this.commandManager.executeCommand( 'jupyter.opennotebook', Uri.file(sampleNotebookPath), - CommandSource.commandPalette + CommandSource.commandPalette, ); } diff --git a/src/client/common/startPage/startPageMessageListener.ts b/src/client/common/startPage/startPageMessageListener.ts index 642bfb609674..81e49232d043 100644 --- a/src/client/common/startPage/startPageMessageListener.ts +++ b/src/client/common/startPage/startPageMessageListener.ts @@ -14,7 +14,7 @@ export class StartPageMessageListener implements IWebviewPanelMessageListener { constructor( callback: (message: string, payload: any) => void, viewChanged: (panel: IWebviewPanel) => void, - disposed: () => void + disposed: () => void, ) { // Save our dispose callback so we remove our interactive window this.disposedCallback = disposed; diff --git a/src/client/common/startPage/themeFinder.ts b/src/client/common/startPage/themeFinder.ts index 36e9ba309b9a..c16a30bd5fba 100644 --- a/src/client/common/startPage/themeFinder.ts +++ b/src/client/common/startPage/themeFinder.ts @@ -31,7 +31,7 @@ export class ThemeFinder implements IThemeFinder { constructor( @inject(IExtensions) private extensions: IExtensions, @inject(ICurrentProcess) private currentProcess: ICurrentProcess, - @inject(IFileSystem) private fs: IFileSystem + @inject(IFileSystem) private fs: IFileSystem, ) {} public async findThemeRootJson(themeName: string): Promise { @@ -62,35 +62,35 @@ export class ThemeFinder implements IThemeFinder { const config: unknown = { comments: { lineComment: '#', - blockComment: ['"""', '"""'] + blockComment: ['"""', '"""'], }, brackets: [ ['{', '}'], ['[', ']'], - ['(', ')'] + ['(', ')'], ], autoClosingPairs: [ { open: '{', close: '}' }, { open: '[', close: ']' }, { open: '(', close: ')' }, { open: '"', close: '"', notIn: ['string'] }, - { open: "'", close: "'", notIn: ['string', 'comment'] } + { open: "'", close: "'", notIn: ['string', 'comment'] }, ], surroundingPairs: [ { open: '{', close: '}' }, { open: '[', close: ']' }, { open: '(', close: ')' }, { open: '"', close: '"' }, - { open: "'", close: "'" } + { open: "'", close: "'" }, ], folding: { offSide: true, markers: { start: new RegExp('^\\s*#region\\b'), - end: new RegExp('^\\s*#endregion\\b') - } + end: new RegExp('^\\s*#endregion\\b'), + }, }, - ...getLanguageConfiguration() + ...getLanguageConfiguration(), }; return config as LanguageConfiguration; diff --git a/src/client/common/startPage/webviewHost.ts b/src/client/common/startPage/webviewHost.ts index 297964824855..864d6767aeeb 100644 --- a/src/client/common/startPage/webviewHost.ts +++ b/src/client/common/startPage/webviewHost.ts @@ -37,14 +37,14 @@ export abstract class WebviewHost implements IDisposable { @unmanaged() private cssGenerator: ICodeCssGenerator, @unmanaged() protected themeFinder: IThemeFinder, @unmanaged() protected workspaceService: IWorkspaceService, - @unmanaged() protected readonly useCustomEditorApi: boolean + @unmanaged() protected readonly useCustomEditorApi: boolean, ) { // Listen for settings changes from vscode. this._disposables.push(this.workspaceService.onDidChangeConfiguration(this.onPossibleSettingsChange, this)); // Listen for settings changes this._disposables.push( - this.configService.getSettings(undefined).onDidChange(this.onSettingsChanged.bind(this)) + this.configService.getSettings(undefined).onDidChange(this.onSettingsChanged.bind(this)), ); } @@ -140,7 +140,7 @@ export abstract class WebviewHost implements IDisposable { return this.postMessageInternal(CssMessages.GetCssResponse, { css, theme: theme, - knownDark: isDark + knownDark: isDark, }); } diff --git a/src/client/common/startPage/webviewPanelHost.ts b/src/client/common/startPage/webviewPanelHost.ts index 69c3affecf24..d7f126c1a145 100644 --- a/src/client/common/startPage/webviewPanelHost.ts +++ b/src/client/common/startPage/webviewPanelHost.ts @@ -12,7 +12,7 @@ import { IWebviewPanel, IWebviewPanelMessageListener, IWebviewPanelProvider, - IWorkspaceService + IWorkspaceService, } from '../application/types'; import { traceInfo } from '../logger'; import { createDeferred } from '../utils/async'; @@ -50,13 +50,13 @@ export abstract class WebviewPanelHost extends WebviewHost i messageListenerCtor: ( callback: (message: string, payload: {}) => void, viewChanged: (panel: IWebviewPanel) => void, - disposed: () => void + disposed: () => void, ) => IWebviewPanelMessageListener, @unmanaged() private rootPath: string, @unmanaged() private scripts: string[], @unmanaged() private _title: string, @unmanaged() private viewColumn: ViewColumn, - @unmanaged() protected readonly useCustomEditorApi: boolean + @unmanaged() protected readonly useCustomEditorApi: boolean, ) { super(configService, cssGenerator, themeFinder, workspaceService, useCustomEditorApi); @@ -64,7 +64,7 @@ export abstract class WebviewPanelHost extends WebviewHost i this.messageListener = messageListenerCtor( this.onMessage.bind(this), this.webPanelViewStateChanged.bind(this), - this.dispose.bind(this) + this.dispose.bind(this), ); } @@ -165,7 +165,7 @@ export abstract class WebviewPanelHost extends WebviewHost i settings, cwd, webViewPanel, - additionalPaths: workspaceFolder ? [workspaceFolder.fsPath] : [] + additionalPaths: workspaceFolder ? [workspaceFolder.fsPath] : [], }); // Set our webview after load diff --git a/src/client/common/terminal/activator/base.ts b/src/client/common/terminal/activator/base.ts index 65e060892bb3..93ee13ccaaf0 100644 --- a/src/client/common/terminal/activator/base.ts +++ b/src/client/common/terminal/activator/base.ts @@ -12,7 +12,7 @@ export class BaseTerminalActivator implements ITerminalActivator { constructor(private readonly helper: ITerminalHelper) {} public async activateEnvironmentInTerminal( terminal: Terminal, - options?: TerminalActivationOptions + options?: TerminalActivationOptions, ): Promise { if (this.activatedTerminals.has(terminal)) { return this.activatedTerminals.get(terminal)!; @@ -24,7 +24,7 @@ export class BaseTerminalActivator implements ITerminalActivator { const activationCommands = await this.helper.getEnvironmentActivationCommands( terminalShellType, options?.resource, - options?.interpreter + options?.interpreter, ); let activated = false; if (activationCommands) { diff --git a/src/client/common/terminal/activator/index.ts b/src/client/common/terminal/activator/index.ts index b7b8beb147a6..ffe77fb82625 100644 --- a/src/client/common/terminal/activator/index.ts +++ b/src/client/common/terminal/activator/index.ts @@ -15,13 +15,13 @@ export class TerminalActivator implements ITerminalActivator { constructor( @inject(ITerminalHelper) readonly helper: ITerminalHelper, @multiInject(ITerminalActivationHandler) private readonly handlers: ITerminalActivationHandler[], - @inject(IConfigurationService) private readonly configurationService: IConfigurationService + @inject(IConfigurationService) private readonly configurationService: IConfigurationService, ) { this.initialize(); } public async activateEnvironmentInTerminal( terminal: Terminal, - options?: TerminalActivationOptions + options?: TerminalActivationOptions, ): Promise { const settings = this.configurationService.getSettings(options?.resource); const activateEnvironment = settings.terminal.activateEnvironment; @@ -33,7 +33,7 @@ export class TerminalActivator implements ITerminalActivator { this.handlers.forEach((handler) => handler .handleActivation(terminal, options?.resource, options?.preserveFocus === true, activated) - .ignoreErrors() + .ignoreErrors(), ); return activated; } diff --git a/src/client/common/terminal/activator/powershellFailedHandler.ts b/src/client/common/terminal/activator/powershellFailedHandler.ts index cdb758ebea54..d580ed4d38bf 100644 --- a/src/client/common/terminal/activator/powershellFailedHandler.ts +++ b/src/client/common/terminal/activator/powershellFailedHandler.ts @@ -7,7 +7,7 @@ import { inject, injectable, named } from 'inversify'; import { Terminal } from 'vscode'; import { PowerShellActivationHackDiagnosticsServiceId, - PowershellActivationNotAvailableDiagnostic + PowershellActivationNotAvailableDiagnostic, } from '../../../application/diagnostics/checks/powerShellActivation'; import { IDiagnosticsService } from '../../../application/diagnostics/types'; import { IPlatformService } from '../../platform/types'; @@ -21,7 +21,7 @@ export class PowershellTerminalActivationFailedHandler implements ITerminalActiv @inject(IPlatformService) private readonly platformService: IPlatformService, @inject(IDiagnosticsService) @named(PowerShellActivationHackDiagnosticsServiceId) - private readonly diagnosticService: IDiagnosticsService + private readonly diagnosticService: IDiagnosticsService, ) {} public async handleActivation(terminal: Terminal, resource: Resource, _preserveFocus: boolean, activated: boolean) { if (activated || !this.platformService.isWindows) { @@ -34,7 +34,7 @@ export class PowershellTerminalActivationFailedHandler implements ITerminalActiv // Check if we can activate in Command Prompt. const activationCommands = await this.helper.getEnvironmentActivationCommands( TerminalShellType.commandPrompt, - resource + resource, ); if (!activationCommands || !Array.isArray(activationCommands) || activationCommands.length === 0) { return; diff --git a/src/client/common/terminal/commandPrompt.ts b/src/client/common/terminal/commandPrompt.ts index 3d83e854e116..4a44557c52a7 100644 --- a/src/client/common/terminal/commandPrompt.ts +++ b/src/client/common/terminal/commandPrompt.ts @@ -19,7 +19,7 @@ export function getCommandPromptLocation(currentProcess: ICurrentProcess) { } export async function useCommandPromptAsDefaultShell( currentProcess: ICurrentProcess, - configService: IConfigurationService + configService: IConfigurationService, ) { const cmdPromptLocation = getCommandPromptLocation(currentProcess); await configService.updateSectionSetting( @@ -27,6 +27,6 @@ export async function useCommandPromptAsDefaultShell( 'integrated.shell.windows', cmdPromptLocation, undefined, - ConfigurationTarget.Global + ConfigurationTarget.Global, ); } diff --git a/src/client/common/terminal/environmentActivationProviders/baseActivationProvider.ts b/src/client/common/terminal/environmentActivationProviders/baseActivationProvider.ts index 215e114f00eb..cc7bdf1363c0 100644 --- a/src/client/common/terminal/environmentActivationProviders/baseActivationProvider.ts +++ b/src/client/common/terminal/environmentActivationProviders/baseActivationProvider.ts @@ -17,7 +17,7 @@ export abstract class BaseActivationCommandProvider implements ITerminalActivati public abstract isShellSupported(targetShell: TerminalShellType): boolean; public getActivationCommands( resource: Uri | undefined, - targetShell: TerminalShellType + targetShell: TerminalShellType, ): Promise { const pythonPath = this.serviceContainer.get(IConfigurationService).getSettings(resource) .pythonPath; @@ -25,7 +25,7 @@ export abstract class BaseActivationCommandProvider implements ITerminalActivati } public abstract getActivationCommandsForInterpreter( pythonPath: string, - targetShell: TerminalShellType + targetShell: TerminalShellType, ): Promise; } @@ -49,7 +49,7 @@ export abstract class VenvBaseActivationCommandProvider extends BaseActivationCo path.dirname, path.join, // Bind "this"! - (n: string) => fs.fileExists(n) + (n: string) => fs.fileExists(n), ); return findScript(pythonPath); } diff --git a/src/client/common/terminal/environmentActivationProviders/bash.ts b/src/client/common/terminal/environmentActivationProviders/bash.ts index b0379ae97c7e..83a4c9bc353c 100644 --- a/src/client/common/terminal/environmentActivationProviders/bash.ts +++ b/src/client/common/terminal/environmentActivationProviders/bash.ts @@ -18,7 +18,7 @@ const SCRIPTS: ActivationScripts = ({ [TerminalShellType.tcshell]: ['activate.csh'], [TerminalShellType.cshell]: ['activate.csh'], // Group 3 - [TerminalShellType.fish]: ['activate.fish'] + [TerminalShellType.fish]: ['activate.fish'], } as unknown) as ActivationScripts; export function getAllScripts(): string[] { @@ -40,7 +40,7 @@ export class Bash extends VenvBaseActivationCommandProvider { public async getActivationCommandsForInterpreter( pythonPath: string, - targetShell: TerminalShellType + targetShell: TerminalShellType, ): Promise { const scriptFile = await this.findScriptFile(pythonPath, targetShell); if (!scriptFile) { diff --git a/src/client/common/terminal/environmentActivationProviders/commandPrompt.ts b/src/client/common/terminal/environmentActivationProviders/commandPrompt.ts index dc8f51ba8aa6..b5695524a5ae 100644 --- a/src/client/common/terminal/environmentActivationProviders/commandPrompt.ts +++ b/src/client/common/terminal/environmentActivationProviders/commandPrompt.ts @@ -14,7 +14,7 @@ const SCRIPTS: ActivationScripts = ({ [TerminalShellType.commandPrompt]: ['activate.bat', 'Activate.ps1'], // Group 2 [TerminalShellType.powershell]: ['Activate.ps1', 'activate.bat'], - [TerminalShellType.powershellCore]: ['Activate.ps1', 'activate.bat'] + [TerminalShellType.powershellCore]: ['Activate.ps1', 'activate.bat'], } as unknown) as ActivationScripts; export function getAllScripts(pathJoin: (...p: string[]) => string): string[] { @@ -27,7 +27,7 @@ export function getAllScripts(pathJoin: (...p: string[]) => string): string[] { name, // We also add scripts in subdirs. pathJoin('Scripts', name), - pathJoin('scripts', name) + pathJoin('scripts', name), ); } } @@ -49,7 +49,7 @@ export class CommandPromptAndPowerShell extends VenvBaseActivationCommandProvide name, // We also add scripts in subdirs. path.join('Scripts', name), - path.join('scripts', name) + path.join('scripts', name), ); } this.scripts[shell] = scripts; @@ -58,7 +58,7 @@ export class CommandPromptAndPowerShell extends VenvBaseActivationCommandProvide public async getActivationCommandsForInterpreter( pythonPath: string, - targetShell: TerminalShellType + targetShell: TerminalShellType, ): Promise { const scriptFile = await this.findScriptFile(pythonPath, targetShell); if (!scriptFile) { diff --git a/src/client/common/terminal/environmentActivationProviders/condaActivationProvider.ts b/src/client/common/terminal/environmentActivationProviders/condaActivationProvider.ts index 3f4b5cfaa809..3c51e107f2a2 100644 --- a/src/client/common/terminal/environmentActivationProviders/condaActivationProvider.ts +++ b/src/client/common/terminal/environmentActivationProviders/condaActivationProvider.ts @@ -25,7 +25,7 @@ export class CondaActivationCommandProvider implements ITerminalActivationComman constructor( @inject(ICondaService) private readonly condaService: ICondaService, @inject(IPlatformService) private platform: IPlatformService, - @inject(IConfigurationService) private configService: IConfigurationService + @inject(IConfigurationService) private configService: IConfigurationService, ) {} /** @@ -40,7 +40,7 @@ export class CondaActivationCommandProvider implements ITerminalActivationComman */ public getActivationCommands( resource: Uri | undefined, - targetShell: TerminalShellType + targetShell: TerminalShellType, ): Promise { const pythonPath = this.configService.getSettings(resource).pythonPath; return this.getActivationCommandsForInterpreter(pythonPath, targetShell); @@ -52,7 +52,7 @@ export class CondaActivationCommandProvider implements ITerminalActivationComman */ public async getActivationCommandsForInterpreter( pythonPath: string, - targetShell: TerminalShellType + targetShell: TerminalShellType, ): Promise { const envInfo = await this.condaService.getCondaEnvironment(pythonPath); if (!envInfo) { diff --git a/src/client/common/terminal/environmentActivationProviders/pipEnvActivationProvider.ts b/src/client/common/terminal/environmentActivationProviders/pipEnvActivationProvider.ts index 3e7a90ce7603..60af6ec869bc 100644 --- a/src/client/common/terminal/environmentActivationProviders/pipEnvActivationProvider.ts +++ b/src/client/common/terminal/environmentActivationProviders/pipEnvActivationProvider.ts @@ -10,7 +10,7 @@ import { IInterpreterLocatorService, IInterpreterService, IPipEnvService, - PIPENV_SERVICE + PIPENV_SERVICE, } from '../../../interpreter/contracts'; import { EnvironmentType } from '../../../pythonEnvironments/info'; import { IWorkspaceService } from '../../application/types'; @@ -25,7 +25,7 @@ export class PipEnvActivationCommandProvider implements ITerminalActivationComma @named(PIPENV_SERVICE) private readonly pipenvService: IPipEnvService, @inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService, - @inject(IFileSystem) private readonly fs: IFileSystem + @inject(IFileSystem) private readonly fs: IFileSystem, ) {} public isShellSupported(_targetShell: TerminalShellType): boolean { @@ -52,7 +52,7 @@ export class PipEnvActivationCommandProvider implements ITerminalActivationComma public async getActivationCommandsForInterpreter( pythonPath: string, - _targetShell: TerminalShellType + _targetShell: TerminalShellType, ): Promise { const interpreter = await this.interpreterService.getInterpreterDetails(pythonPath); if (!interpreter || interpreter.envType !== EnvironmentType.Pipenv) { diff --git a/src/client/common/terminal/environmentActivationProviders/pyenvActivationProvider.ts b/src/client/common/terminal/environmentActivationProviders/pyenvActivationProvider.ts index d458a10938b6..44fe5bcfd75e 100644 --- a/src/client/common/terminal/environmentActivationProviders/pyenvActivationProvider.ts +++ b/src/client/common/terminal/environmentActivationProviders/pyenvActivationProvider.ts @@ -31,7 +31,7 @@ export class PyEnvActivationCommandProvider implements ITerminalActivationComman public async getActivationCommandsForInterpreter( pythonPath: string, - _targetShell: TerminalShellType + _targetShell: TerminalShellType, ): Promise { const interpreter = await this.serviceContainer .get(IInterpreterService) diff --git a/src/client/common/terminal/factory.ts b/src/client/common/terminal/factory.ts index 2a9e74f624ab..12a47072f1f8 100644 --- a/src/client/common/terminal/factory.ts +++ b/src/client/common/terminal/factory.ts @@ -20,7 +20,7 @@ export class TerminalServiceFactory implements ITerminalServiceFactory { constructor( @inject(IServiceContainer) private serviceContainer: IServiceContainer, @inject(IFileSystem) private fs: IFileSystem, - @inject(IInterpreterService) private interpreterService: IInterpreterService + @inject(IInterpreterService) private interpreterService: IInterpreterService, ) { this.terminalServices = new Map(); } @@ -39,7 +39,7 @@ export class TerminalServiceFactory implements ITerminalServiceFactory { hideFromUser, interpreter, resource, - title + title, }; const id = this.getTerminalId(terminalTitle, resource, interpreter); if (!this.terminalServices.has(id)) { @@ -52,7 +52,7 @@ export class TerminalServiceFactory implements ITerminalServiceFactory { this.fs, this.interpreterService, this.terminalServices.get(id)!, - interpreter + interpreter, ); } public createTerminalService(resource?: Uri, title?: string): ITerminalService { diff --git a/src/client/common/terminal/helper.ts b/src/client/common/terminal/helper.ts index 7d22bf75b8a5..731c48975b60 100644 --- a/src/client/common/terminal/helper.ts +++ b/src/client/common/terminal/helper.ts @@ -19,7 +19,7 @@ import { ITerminalActivationCommandProvider, ITerminalHelper, TerminalActivationProviders, - TerminalShellType + TerminalShellType, } from './types'; @injectable() @@ -46,7 +46,7 @@ export class TerminalHelper implements ITerminalHelper { @inject(ITerminalActivationCommandProvider) @named(TerminalActivationProviders.pipenv) private readonly pipenv: ITerminalActivationCommandProvider, - @multiInject(IShellDetector) shellDetectors: IShellDetector[] + @multiInject(IShellDetector) shellDetectors: IShellDetector[], ) { this.shellDetector = new ShellDetector(this.platform, shellDetectors); } @@ -69,7 +69,7 @@ export class TerminalHelper implements ITerminalHelper { public async getEnvironmentActivationCommands( terminalShellType: TerminalShellType, resource?: Uri, - interpreter?: PythonEnvironment + interpreter?: PythonEnvironment, ): Promise { const providers = [this.pipenv, this.pyenv, this.bashCShellFish, this.commandPromptAndPowerShell]; const promise = this.getActivationCommands(resource || undefined, interpreter, terminalShellType, providers); @@ -77,14 +77,14 @@ export class TerminalHelper implements ITerminalHelper { terminalShellType, EventName.PYTHON_INTERPRETER_ACTIVATION_FOR_TERMINAL, interpreter, - promise + promise, ).ignoreErrors(); return promise; } public async getEnvironmentActivationShellCommands( resource: Resource, shell: TerminalShellType, - interpreter?: PythonEnvironment + interpreter?: PythonEnvironment, ): Promise { if (this.platform.osType === OSType.Unknown) { return; @@ -95,7 +95,7 @@ export class TerminalHelper implements ITerminalHelper { shell, EventName.PYTHON_INTERPRETER_ACTIVATION_FOR_RUNNING_CODE, interpreter, - promise + promise, ).ignoreErrors(); return promise; } @@ -104,7 +104,7 @@ export class TerminalHelper implements ITerminalHelper { terminalShellType: TerminalShellType, eventName: EventName, interpreter: PythonEnvironment | undefined, - promise: Promise + promise: Promise, ): Promise { let hasCommands = false; let failed = false; @@ -125,7 +125,7 @@ export class TerminalHelper implements ITerminalHelper { resource: Resource, interpreter: PythonEnvironment | undefined, terminalShellType: TerminalShellType, - providers: ITerminalActivationCommandProvider[] + providers: ITerminalActivationCommandProvider[], ): Promise { const settings = this.configurationService.getSettings(resource); diff --git a/src/client/common/terminal/service.ts b/src/client/common/terminal/service.ts index dd9bb04074e3..70d2f67fb273 100644 --- a/src/client/common/terminal/service.ts +++ b/src/client/common/terminal/service.ts @@ -15,7 +15,7 @@ import { ITerminalHelper, ITerminalService, TerminalCreationOptions, - TerminalShellType + TerminalShellType, } from './types'; @injectable() @@ -31,7 +31,7 @@ export class TerminalService implements ITerminalService, Disposable { } constructor( @inject(IServiceContainer) private serviceContainer: IServiceContainer, - private readonly options?: TerminalCreationOptions + private readonly options?: TerminalCreationOptions, ) { const disposableRegistry = this.serviceContainer.get(IDisposableRegistry); disposableRegistry.push(this); @@ -74,7 +74,7 @@ export class TerminalService implements ITerminalService, Disposable { this.terminal = this.terminalManager.createTerminal({ name: this.options?.title || 'Python', env: this.options?.env, - hideFromUser: this.options?.hideFromUser + hideFromUser: this.options?.hideFromUser, }); // Sometimes the terminal takes some time to start up before it can start accepting input. @@ -84,7 +84,7 @@ export class TerminalService implements ITerminalService, Disposable { resource: this.options?.resource, preserveFocus, interpreter: this.options?.interpreter, - hideFromUser: this.options?.hideFromUser + hideFromUser: this.options?.hideFromUser, }); if (!this.options?.hideFromUser) { @@ -114,7 +114,7 @@ export class TerminalService implements ITerminalService, Disposable { captureTelemetry(EventName.TERMINAL_CREATE, { terminal: this.terminalShellType, pythonVersion, - interpreterType + interpreterType, }); } } diff --git a/src/client/common/terminal/shellDetector.ts b/src/client/common/terminal/shellDetector.ts index 9a911a26bc0b..e1eeac26dc4e 100644 --- a/src/client/common/terminal/shellDetector.ts +++ b/src/client/common/terminal/shellDetector.ts @@ -17,14 +17,14 @@ const defaultOSShells = { [OSType.Linux]: TerminalShellType.bash, [OSType.OSX]: TerminalShellType.bash, [OSType.Windows]: TerminalShellType.commandPrompt, - [OSType.Unknown]: TerminalShellType.other + [OSType.Unknown]: TerminalShellType.other, }; @injectable() export class ShellDetector { constructor( @inject(IPlatformService) private readonly platform: IPlatformService, - @multiInject(IShellDetector) private readonly shellDetectors: IShellDetector[] + @multiInject(IShellDetector) private readonly shellDetectors: IShellDetector[], ) {} /** * Logic is as follows: @@ -45,7 +45,7 @@ export class ShellDetector { shellIdentificationSource: 'default', terminalProvided: !!terminal, hasCustomShell: undefined, - hasShellInEnv: undefined + hasShellInEnv: undefined, }; // Sort in order of priority and then identify the shell. @@ -54,7 +54,7 @@ export class ShellDetector { for (const detector of shellDetectors) { shell = detector.identify(telemetryProperties, terminal); traceVerbose( - `${detector}. Shell identified as ${shell} ${terminal ? `(Terminal name is ${terminal.name})` : ''}` + `${detector}. Shell identified as ${shell} ${terminal ? `(Terminal name is ${terminal.name})` : ''}`, ); if (shell && shell !== TerminalShellType.other) { break; diff --git a/src/client/common/terminal/shellDetectors/baseShellDetector.ts b/src/client/common/terminal/shellDetectors/baseShellDetector.ts index 04c534dedf06..3a9ecb717c55 100644 --- a/src/client/common/terminal/shellDetectors/baseShellDetector.ts +++ b/src/client/common/terminal/shellDetectors/baseShellDetector.ts @@ -53,7 +53,7 @@ export abstract class BaseShellDetector implements IShellDetector { constructor(@unmanaged() public readonly priority: number) {} public abstract identify( telemetryProperties: ShellIdentificationTelemetry, - terminal?: Terminal + terminal?: Terminal, ): TerminalShellType | undefined; public identifyShellFromShellPath(shellPath: string): TerminalShellType { const shell = Array.from(detectableShells.keys()).reduce((matchedShell, shellToDetect) => { diff --git a/src/client/common/terminal/shellDetectors/settingsShellDetector.ts b/src/client/common/terminal/shellDetectors/settingsShellDetector.ts index 5fb315cc1c2c..f750408b49d6 100644 --- a/src/client/common/terminal/shellDetectors/settingsShellDetector.ts +++ b/src/client/common/terminal/shellDetectors/settingsShellDetector.ts @@ -23,7 +23,7 @@ import { BaseShellDetector } from './baseShellDetector'; export class SettingsShellDetector extends BaseShellDetector { constructor( @inject(IWorkspaceService) private readonly workspace: IWorkspaceService, - @inject(IPlatformService) private readonly platform: IPlatformService + @inject(IPlatformService) private readonly platform: IPlatformService, ) { super(2); } @@ -51,7 +51,7 @@ export class SettingsShellDetector extends BaseShellDetector { } public identify( telemetryProperties: ShellIdentificationTelemetry, - _terminal?: Terminal + _terminal?: Terminal, ): TerminalShellType | undefined { const shellPath = this.getTerminalShellPath(); telemetryProperties.hasCustomShell = !!shellPath; diff --git a/src/client/common/terminal/shellDetectors/terminalNameShellDetector.ts b/src/client/common/terminal/shellDetectors/terminalNameShellDetector.ts index 34ca634d3936..134ff4c65114 100644 --- a/src/client/common/terminal/shellDetectors/terminalNameShellDetector.ts +++ b/src/client/common/terminal/shellDetectors/terminalNameShellDetector.ts @@ -23,7 +23,7 @@ export class TerminalNameShellDetector extends BaseShellDetector { } public identify( telemetryProperties: ShellIdentificationTelemetry, - terminal?: Terminal + terminal?: Terminal, ): TerminalShellType | undefined { if (!terminal) { return; diff --git a/src/client/common/terminal/shellDetectors/userEnvironmentShellDetector.ts b/src/client/common/terminal/shellDetectors/userEnvironmentShellDetector.ts index 3f655da212ca..83ad5e25f662 100644 --- a/src/client/common/terminal/shellDetectors/userEnvironmentShellDetector.ts +++ b/src/client/common/terminal/shellDetectors/userEnvironmentShellDetector.ts @@ -23,7 +23,7 @@ import { BaseShellDetector } from './baseShellDetector'; export class UserEnvironmentShellDetector extends BaseShellDetector { constructor( @inject(ICurrentProcess) private readonly currentProcess: ICurrentProcess, - @inject(IPlatformService) private readonly platform: IPlatformService + @inject(IPlatformService) private readonly platform: IPlatformService, ) { super(1); } @@ -32,7 +32,7 @@ export class UserEnvironmentShellDetector extends BaseShellDetector { } public identify( telemetryProperties: ShellIdentificationTelemetry, - _terminal?: Terminal + _terminal?: Terminal, ): TerminalShellType | undefined { const shellPath = this.getDefaultPlatformShell(); telemetryProperties.hasShellInEnv = !!shellPath; diff --git a/src/client/common/terminal/shellDetectors/vscEnvironmentShellDetector.ts b/src/client/common/terminal/shellDetectors/vscEnvironmentShellDetector.ts index e39197fbea7b..606919869a0d 100644 --- a/src/client/common/terminal/shellDetectors/vscEnvironmentShellDetector.ts +++ b/src/client/common/terminal/shellDetectors/vscEnvironmentShellDetector.ts @@ -23,7 +23,7 @@ export class VSCEnvironmentShellDetector extends BaseShellDetector { } public identify( telemetryProperties: ShellIdentificationTelemetry, - _terminal?: Terminal + _terminal?: Terminal, ): TerminalShellType | undefined { if (!this.appEnv.shell) { return; diff --git a/src/client/common/terminal/syncTerminalService.ts b/src/client/common/terminal/syncTerminalService.ts index 53e6231be95d..33327845bd27 100644 --- a/src/client/common/terminal/syncTerminalService.ts +++ b/src/client/common/terminal/syncTerminalService.ts @@ -20,7 +20,7 @@ enum State { notStarted = 0, started = 1, completed = 2, - errored = 4 + errored = 4, } class ExecutionState implements Disposable { @@ -30,7 +30,7 @@ class ExecutionState implements Disposable { constructor( public readonly lockFile: string, private readonly fs: IFileSystem, - private readonly command: string[] + private readonly command: string[], ) { this.registerStateUpdate(); this._completed.promise.finally(() => this.dispose()).ignoreErrors(); @@ -56,9 +56,9 @@ class ExecutionState implements Disposable { this._completed.reject( new Error( `Command failed with errors, check the terminal for details. Command: ${this.command.join( - ' ' - )}\n${errorContents}` - ) + ' ', + )}\n${errorContents}`, + ), ); } else if (state & State.completed) { this._completed.resolve(); @@ -67,7 +67,7 @@ class ExecutionState implements Disposable { this.disposable = { // tslint:disable-next-line: no-any - dispose: () => clearInterval(timeout as any) + dispose: () => clearInterval(timeout as any), }; } private async getLockFileState(file: string): Promise { @@ -108,7 +108,7 @@ export class SynchronousTerminalService implements ITerminalService, Disposable @inject(IFileSystem) private readonly fs: IFileSystem, @inject(IInterpreterService) private readonly interpreter: IInterpreterService, public readonly terminalService: TerminalService, - private readonly pythonInterpreter?: PythonEnvironment + private readonly pythonInterpreter?: PythonEnvironment, ) {} public dispose() { this.terminalService.dispose(); @@ -129,7 +129,7 @@ export class SynchronousTerminalService implements ITerminalService, Disposable command: string, args: string[], cancel?: CancellationToken, - swallowExceptions: boolean = true + swallowExceptions: boolean = true, ): Promise { if (!cancel) { return this.terminalService.sendCommand(command, args); diff --git a/src/client/common/terminal/types.ts b/src/client/common/terminal/types.ts index 487827ffb4db..386b67309637 100644 --- a/src/client/common/terminal/types.ts +++ b/src/client/common/terminal/types.ts @@ -13,7 +13,7 @@ export enum TerminalActivationProviders { commandPromptAndPowerShell = 'commandPromptAndPowerShell', pyenv = 'pyenv', conda = 'conda', - pipenv = 'pipenv' + pipenv = 'pipenv', } export enum TerminalShellType { powershell = 'powershell', @@ -28,7 +28,7 @@ export enum TerminalShellType { tcshell = 'tshell', wsl = 'wsl', xonsh = 'xonsh', - other = 'other' + other = 'other', } export interface ITerminalService extends IDisposable { @@ -47,7 +47,7 @@ export interface ITerminalService extends IDisposable { command: string, args: string[], cancel?: CancellationToken, - swallowExceptions?: boolean + swallowExceptions?: boolean, ): Promise; sendText(text: string): Promise; show(preserveFocus?: boolean): Promise; @@ -117,12 +117,12 @@ export interface ITerminalHelper { getEnvironmentActivationCommands( terminalShellType: TerminalShellType, resource?: Uri, - interpreter?: PythonEnvironment + interpreter?: PythonEnvironment, ): Promise; getEnvironmentActivationShellCommands( resource: Resource, shell: TerminalShellType, - interpreter?: PythonEnvironment + interpreter?: PythonEnvironment, ): Promise; } @@ -149,7 +149,7 @@ export interface ITerminalActivationCommandProvider { getActivationCommands(resource: Uri | undefined, targetShell: TerminalShellType): Promise; getActivationCommandsForInterpreter( pythonPath: string, - targetShell: TerminalShellType + targetShell: TerminalShellType, ): Promise; } @@ -159,7 +159,7 @@ export interface ITerminalActivationHandler { terminal: Terminal, resource: Uri | undefined, preserveFocus: boolean, - activated: boolean + activated: boolean, ): Promise; } diff --git a/src/client/common/types.ts b/src/client/common/types.ts index 6293c7a33b3f..727a5d0447cd 100644 --- a/src/client/common/types.ts +++ b/src/client/common/types.ts @@ -15,7 +15,7 @@ import { ExtensionContext, OutputChannel, Uri, - WorkspaceEdit + WorkspaceEdit, } from 'vscode'; import { LanguageServerType } from '../activation/types'; import { LogLevel } from '../logging/levels'; @@ -69,7 +69,7 @@ export type ExecutionInfo = { export enum InstallerResponse { Installed, Disabled, - Ignore + Ignore, } export enum ProductType { @@ -79,7 +79,7 @@ export enum ProductType { RefactoringLibrary = 'RefactoringLibrary', WorkspaceSymbols = 'WorkspaceSymbols', DataScience = 'DataScience', - TensorBoard = 'TensorBoard' + TensorBoard = 'TensorBoard', } export enum Product { @@ -106,12 +106,12 @@ export enum Product { kernelspec = 21, nbconvert = 22, pandas = 23, - tensorboard = 24 + tensorboard = 24, } export enum ModuleNamePurpose { install = 1, - run = 2 + run = 2, } export const IInstaller = Symbol('IInstaller'); @@ -120,7 +120,7 @@ export interface IInstaller { promptToInstall( product: Product, resource?: InterpreterUri, - cancel?: CancellationToken + cancel?: CancellationToken, ): Promise; install(product: Product, resource?: InterpreterUri, cancel?: CancellationToken): Promise; isInstalled(product: Product, resource?: InterpreterUri): Promise; @@ -321,7 +321,7 @@ export interface IExperiments { export enum AnalysisSettingsLogLevel { Information = 'Information', Error = 'Error', - Warning = 'Warning' + Warning = 'Warning', } export type LanguageServerDownloadChannels = 'stable' | 'beta' | 'daily'; @@ -353,7 +353,7 @@ export interface IConfigurationService { setting: string, value?: {}, resource?: Uri, - configTarget?: ConfigurationTarget + configTarget?: ConfigurationTarget, ): Promise; } @@ -521,7 +521,7 @@ export interface ICryptoUtils { createHash( data: string, hashFormat: E, - algorithm?: 'SHA512' | 'SHA256' | 'FNV' + algorithm?: 'SHA512' | 'SHA256' | 'FNV', ): IHashFormat[E]; } diff --git a/src/client/common/utils/async.ts b/src/client/common/utils/async.ts index 73b30b444c96..1f9cb91e7a21 100644 --- a/src/client/common/utils/async.ts +++ b/src/client/common/utils/async.ts @@ -155,7 +155,7 @@ export const NEVER: Promise = new Promise(() => {}); */ export async function* chain( iterators: AsyncIterator[], - onError?: (err: Error, index: number) => Promise + onError?: (err: Error, index: number) => Promise, // Ultimately we may also want to support cancellation. ): IAsyncIterableIterator { const promises = iterators.map(getNext); @@ -196,7 +196,7 @@ export async function* chain( export async function* mapToIterator( items: T[], func: (item: T) => Promise, - race = true + race = true, ): IAsyncIterableIterator { if (race) { const iterators = items.map((item) => { diff --git a/src/client/common/utils/backgroundLoop.ts b/src/client/common/utils/backgroundLoop.ts index e4e1b4a07e0a..ff61c4041c93 100644 --- a/src/client/common/utils/backgroundLoop.ts +++ b/src/client/common/utils/backgroundLoop.ts @@ -41,14 +41,14 @@ export class BackgroundRequestLooper implements IDisposable { constructor( opts: { runDefault?: RunFunc | null; - } = {} + } = {}, ) { this.opts = { runDefault: opts.runDefault ?? (async () => { throw Error('no default operation provided'); - }) + }), }; } @@ -166,7 +166,7 @@ export class BackgroundRequestLooper implements IDisposable { // [RunFunc, "done" promise, NotifyFunc] run ?? this.opts.runDefault, running.promise, - () => running.resolve() + () => running.resolve(), ]; this.queue.push(reqID); if (this.queue.length === 1) { @@ -188,7 +188,7 @@ export class BackgroundRequestLooper implements IDisposable { // These are the competing operations. // Note that the losers keep running in the background. this.done.promise.then(() => 0), - this.waitUntilReady.promise.then(() => 1) + this.waitUntilReady.promise.then(() => 1), ]; return Promise.race(promises); }; diff --git a/src/client/common/utils/cacheUtils.ts b/src/client/common/utils/cacheUtils.ts index 2f6895b4e5a8..ac4c63f34abb 100644 --- a/src/client/common/utils/cacheUtils.ts +++ b/src/client/common/utils/cacheUtils.ts @@ -31,7 +31,7 @@ const resourceSpecificCacheStores = new Map>(); function getCacheKey( resource: Resource, vscode: VSCodeType = require('vscode'), - serviceContainer: IServiceContainer | undefined + serviceContainer: IServiceContainer | undefined, ) { const section = vscode.workspace.getConfiguration('python', vscode.Uri.file(__filename)); if (!section) { @@ -78,7 +78,7 @@ function getCacheKey( function getCacheStore( resource: Resource, vscode: VSCodeType = require('vscode'), - serviceContainer: IServiceContainer | undefined + serviceContainer: IServiceContainer | undefined, ) { const key = getCacheKey(resource, vscode, serviceContainer); if (!resourceSpecificCacheStores.has(key)) { @@ -138,7 +138,7 @@ export class InMemoryCache { public set data(value: T | undefined) { this.store.set(this.cacheKey, { expiry: this.calculateExpiry(), - value + value, }); } public clear() { @@ -177,7 +177,7 @@ export class InMemoryInterpreterSpecificCache extends InMemoryCache { expiryDurationMs: number, args: [Uri | undefined, ...any[]], private readonly serviceContainer: IServiceContainer | undefined, - private readonly vscode: VSCodeType = require('vscode') + private readonly vscode: VSCodeType = require('vscode'), ) { super(expiryDurationMs, getCacheKeyFromFunctionArgs(keyPrefix, args.slice(1))); this.resource = args[0]; diff --git a/src/client/common/utils/decorators.ts b/src/client/common/utils/decorators.ts index 2c9362d329f7..77584631ec3e 100644 --- a/src/client/common/utils/decorators.ts +++ b/src/client/common/utils/decorators.ts @@ -77,7 +77,7 @@ export function makeDebounceDecorator(wait?: number) { return originalMethod.apply(this, arguments as any); }, wait, - options + options, ); (descriptor as any).value = debounced; }; @@ -133,7 +133,7 @@ export function clearCachedResourceSpecificIngterpreterData( key: string, resource: Resource, serviceContainer: IServiceContainer, - vscode: VSCodeType = require('vscode') + vscode: VSCodeType = require('vscode'), ) { const cacheStore = new InMemoryInterpreterSpecificCache(key, 0, [resource], serviceContainer, vscode); cacheStore.clear(); @@ -145,7 +145,7 @@ export function cache(expiryDurationMs: number) { return function ( target: Object, propertyName: string, - descriptor: TypedPropertyDescriptor + descriptor: TypedPropertyDescriptor, ) { const originalMethod = descriptor.value!; const className = 'constructor' in target && target.constructor.name ? target.constructor.name : ''; @@ -163,7 +163,7 @@ export function cache(expiryDurationMs: number) { const promise = originalMethod.apply(this, args) as Promise; promise .then((result) => - cacheStoreForMethods.set(key, { data: result, expiry: Date.now() + expiryDurationMs }) + cacheStoreForMethods.set(key, { data: result, expiry: Date.now() + expiryDurationMs }), ) .ignoreErrors(); return promise; @@ -245,7 +245,7 @@ export function trace(log: (c: CallInfo, t: TraceInfo) => void) { const call = { kind: 'Class', name: _ && _.constructor ? _.constructor.name : '', - args + args, }; // tslint:disable-next-line:no-this-assignment no-invalid-this const scope = this; @@ -253,7 +253,7 @@ export function trace(log: (c: CallInfo, t: TraceInfo) => void) { // "log()" (t) => log(call, t), // "run()" - () => originalMethod.apply(scope, args) + () => originalMethod.apply(scope, args), ); }; diff --git a/src/client/common/utils/icons.ts b/src/client/common/utils/icons.ts index 6b0a8175c6d5..71f71898ae9f 100644 --- a/src/client/common/utils/icons.ts +++ b/src/client/common/utils/icons.ts @@ -13,6 +13,6 @@ const lightIconsPath = path.join(EXTENSION_ROOT_DIR, 'resources', 'light'); export function getIcon(fileName: string): { light: Uri; dark: Uri } { return { dark: Uri.file(path.join(darkIconsPath, fileName)), - light: Uri.file(path.join(lightIconsPath, fileName)) + light: Uri.file(path.join(lightIconsPath, fileName)), }; } diff --git a/src/client/common/utils/localize.ts b/src/client/common/utils/localize.ts index 3d54498e5bfb..955fce4807f9 100644 --- a/src/client/common/utils/localize.ts +++ b/src/client/common/utils/localize.ts @@ -11,58 +11,58 @@ import { FileSystem } from '../platform/fileSystem'; export namespace Diagnostics { export const warnSourceMaps = localize( 'diagnostics.warnSourceMaps', - 'Source map support is enabled in the Python Extension, this will adversely impact performance of the extension.' + 'Source map support is enabled in the Python Extension, this will adversely impact performance of the extension.', ); export const disableSourceMaps = localize('diagnostics.disableSourceMaps', 'Disable Source Map Support'); export const warnBeforeEnablingSourceMaps = localize( 'diagnostics.warnBeforeEnablingSourceMaps', - 'Enabling source map support in the Python Extension will adversely impact performance of the extension.' + 'Enabling source map support in the Python Extension will adversely impact performance of the extension.', ); export const enableSourceMapsAndReloadVSC = localize( 'diagnostics.enableSourceMapsAndReloadVSC', - 'Enable and reload Window.' + 'Enable and reload Window.', ); export const lsNotSupported = localize( 'diagnostics.lsNotSupported', - 'Your operating system does not meet the minimum requirements of the Python Language Server. Reverting to the alternative autocompletion provider, Jedi.' + 'Your operating system does not meet the minimum requirements of the Python Language Server. Reverting to the alternative autocompletion provider, Jedi.', ); export const upgradeCodeRunner = localize( 'diagnostics.upgradeCodeRunner', - 'Please update the Code Runner extension for it to be compatible with the Python extension.' + 'Please update the Code Runner extension for it to be compatible with the Python extension.', ); export const removedPythonPathFromSettings = localize( 'diagnostics.removedPythonPathFromSettings', - 'We removed the "python.pythonPath" setting from your settings.json file as the setting is no longer used by the Python extension. You can get the path of your selected interpreter in the Python output channel. [Learn more](https://aka.ms/AA7jfor).' + 'We removed the "python.pythonPath" setting from your settings.json file as the setting is no longer used by the Python extension. You can get the path of your selected interpreter in the Python output channel. [Learn more](https://aka.ms/AA7jfor).', ); export const invalidPythonPathInDebuggerSettings = localize( 'diagnostics.invalidPythonPathInDebuggerSettings', - 'You need to select a Python interpreter before you start debugging.\n\nTip: click on "Select Python Interpreter" in the status bar.' + 'You need to select a Python interpreter before you start debugging.\n\nTip: click on "Select Python Interpreter" in the status bar.', ); export const invalidPythonPathInDebuggerLaunch = localize( 'diagnostics.invalidPythonPathInDebuggerLaunch', - 'The Python path in your debug configuration is invalid.' + 'The Python path in your debug configuration is invalid.', ); export const invalidDebuggerTypeDiagnostic = localize( 'diagnostics.invalidDebuggerTypeDiagnostic', - 'Your launch.json file needs to be updated to change the "pythonExperimental" debug configurations to use the "python" debugger type, otherwise Python debugging may not work. Would you like to automatically update your launch.json file now?' + 'Your launch.json file needs to be updated to change the "pythonExperimental" debug configurations to use the "python" debugger type, otherwise Python debugging may not work. Would you like to automatically update your launch.json file now?', ); export const consoleTypeDiagnostic = localize( 'diagnostics.consoleTypeDiagnostic', - 'Your launch.json file needs to be updated to change the console type string from "none" to "internalConsole", otherwise Python debugging may not work. Would you like to automatically update your launch.json file now?' + 'Your launch.json file needs to be updated to change the console type string from "none" to "internalConsole", otherwise Python debugging may not work. Would you like to automatically update your launch.json file now?', ); export const justMyCodeDiagnostic = localize( 'diagnostics.justMyCodeDiagnostic', - 'Configuration "debugStdLib" in launch.json is no longer supported. It\'s recommended to replace it with "justMyCode", which is the exact opposite of using "debugStdLib". Would you like to automatically update your launch.json file to do that?' + 'Configuration "debugStdLib" in launch.json is no longer supported. It\'s recommended to replace it with "justMyCode", which is the exact opposite of using "debugStdLib". Would you like to automatically update your launch.json file to do that?', ); export const yesUpdateLaunch = localize('diagnostics.yesUpdateLaunch', 'Yes, update launch.json'); export const invalidTestSettings = localize( 'diagnostics.invalidTestSettings', - 'Your settings needs to be updated to change the setting "python.unitTest." to "python.testing.", otherwise testing Python code using the extension may not work. Would you like to automatically update your settings now?' + 'Your settings needs to be updated to change the setting "python.unitTest." to "python.testing.", otherwise testing Python code using the extension may not work. Would you like to automatically update your settings now?', ); export const updateSettings = localize('diagnostics.updateSettings', 'Yes, update settings'); export const checkIsort5UpgradeGuide = localize( 'diagnostics.checkIsort5UpgradeGuide', - 'We found outdated configuration for sorting imports in this workspace. Check the [isort upgrade guide](https://aka.ms/AA9j5x4) to update your settings.' + 'We found outdated configuration for sorting imports in this workspace. Check the [isort upgrade guide](https://aka.ms/AA9j5x4) to update your settings.', ); } @@ -98,7 +98,7 @@ export namespace AttachProcess { export const attachTitle = localize('AttachProcess.attachTitle', 'Attach to process'); export const selectProcessPlaceholder = localize( 'AttachProcess.selectProcessPlaceholder', - 'Select the process to attach to' + 'Select the process to attach to', ); export const noProcessSelected = localize('AttachProcess.noProcessSelected', 'No process selected'); export const refreshList = localize('AttachProcess.refreshList', 'Refresh process list'); @@ -107,76 +107,76 @@ export namespace AttachProcess { export namespace Pylance { export const proposePylanceMessage = localize( 'Pylance.proposePylanceMessage', - 'Try out a new faster, feature-rich language server for Python by Microsoft, Pylance! Install the extension now.' + 'Try out a new faster, feature-rich language server for Python by Microsoft, Pylance! Install the extension now.', ); export const tryItNow = localize('Pylance.tryItNow', 'Try it now'); export const remindMeLater = localize('Pylance.remindMeLater', 'Remind me later'); export const installPylanceMessage = localize( 'Pylance.installPylanceMessage', - 'Pylance extension is not installed. Click Yes to open Pylance installation page.' + 'Pylance extension is not installed. Click Yes to open Pylance installation page.', ); export const pylanceNotInstalledMessage = localize( 'Pylance.pylanceNotInstalledMessage', - 'Pylance extension is not installed.' + 'Pylance extension is not installed.', ); export const pylanceInstalledReloadPromptMessage = localize( 'Pylance.pylanceInstalledReloadPromptMessage', - 'Pylance extension is now installed. Reload window to activate?' + 'Pylance extension is now installed. Reload window to activate?', ); } export namespace Jupyter { export const jupyterExtensionRequired = localize( 'Jupyter.extensionRequired', - 'The Jupyter extension is required to perform that task. Click Yes to open the Jupyter extension installation page.' + 'The Jupyter extension is required to perform that task. Click Yes to open the Jupyter extension installation page.', ); } export namespace TensorBoard { export const useCurrentWorkingDirectoryDetail = localize( 'TensorBoard.useCurrentWorkingDirectoryDetail', - 'TensorBoard will search for tfevent files in all subdirectories of the current working directory' + 'TensorBoard will search for tfevent files in all subdirectories of the current working directory', ); export const useCurrentWorkingDirectory = localize( 'TensorBoard.useCurrentWorkingDirectory', - 'Use current working directory' + 'Use current working directory', ); export const currentDirectory = localize('TensorBoard.currentDirectory', 'Current: {0}'); export const logDirectoryPrompt = localize( 'TensorBoard.logDirectoryPrompt', - 'Select a log directory to start TensorBoard with' + 'Select a log directory to start TensorBoard with', ); export const progressMessage = localize('TensorBoard.progressMessage', 'Starting TensorBoard session...'); export const failedToStartSessionError = localize( 'TensorBoard.failedToStartSessionError', - 'We failed to start a TensorBoard session due to the following error: {0}' + 'We failed to start a TensorBoard session due to the following error: {0}', ); export const nativeTensorBoardPrompt = localize( 'TensorBoard.nativeTensorBoardPrompt', - 'VS Code now has integrated TensorBoard support. Would you like to launch TensorBoard? (Tip: Launch TensorBoard anytime by opening the command palette and searching for "Launch TensorBoard".)' + 'VS Code now has integrated TensorBoard support. Would you like to launch TensorBoard? (Tip: Launch TensorBoard anytime by opening the command palette and searching for "Launch TensorBoard".)', ); export const selectAFolder = localize('TensorBoard.selectAFolder', 'Select a folder'); export const selectAFolderDetail = localize( 'TensorBoard.selectAFolderDetail', - 'Select a log directory containing tfevent files' + 'Select a log directory containing tfevent files', ); export const selectAnotherFolder = localize('TensorBoard.selectAnotherFolder', 'Select another folder'); export const selectAnotherFolderDetail = localize( 'TensorBoard.selectAnotherFolderDetail', - 'Use the file explorer to select another folder' + 'Use the file explorer to select another folder', ); export const installPrompt = localize( 'TensorBoard.installPrompt', - 'The package TensorBoard is required to launch a TensorBoard session. Would you like to install it?' + 'The package TensorBoard is required to launch a TensorBoard session. Would you like to install it?', ); export const launchNativeTensorBoardSessionCodeLens = localize( 'TensorBoard.launchNativeTensorBoardSessionCodeLens', - '▶ Launch TensorBoard Session' + '▶ Launch TensorBoard Session', ); export const launchNativeTensorBoardSessionCodeAction = localize( 'TensorBoard.launchNativeTensorBoardSessionCodeAction', - 'Launch TensorBoard session' + 'Launch TensorBoard session', ); } @@ -184,47 +184,47 @@ export namespace LanguageService { export const startingJedi = localize('LanguageService.startingJedi', 'Starting Jedi Python language engine.'); export const startingMicrosoft = localize( 'LanguageService.startingMicrosoft', - 'Starting Microsoft Python language server.' + 'Starting Microsoft Python language server.', ); export const startingPylance = localize('LanguageService.startingPylance', 'Starting Pylance language server.'); export const startingNone = localize( 'LanguageService.startingNone', - 'Editor support is inactive since language server is set to None.' + 'Editor support is inactive since language server is set to None.', ); export const reloadAfterLanguageServerChange = localize( 'LanguageService.reloadAfterLanguageServerChange', - 'Please reload the window switching between language servers.' + 'Please reload the window switching between language servers.', ); export const lsFailedToStart = localize( 'LanguageService.lsFailedToStart', - 'We encountered an issue starting the language server. Reverting to Jedi language engine. Check the Python output panel for details.' + 'We encountered an issue starting the language server. Reverting to Jedi language engine. Check the Python output panel for details.', ); export const lsFailedToDownload = localize( 'LanguageService.lsFailedToDownload', - 'We encountered an issue downloading the language server. Reverting to Jedi language engine. Check the Python output panel for details.' + 'We encountered an issue downloading the language server. Reverting to Jedi language engine. Check the Python output panel for details.', ); export const lsFailedToExtract = localize( 'LanguageService.lsFailedToExtract', - 'We encountered an issue extracting the language server. Reverting to Jedi language engine. Check the Python output panel for details.' + 'We encountered an issue extracting the language server. Reverting to Jedi language engine. Check the Python output panel for details.', ); export const downloadFailedOutputMessage = localize( 'LanguageService.downloadFailedOutputMessage', - 'Language server download failed.' + 'Language server download failed.', ); export const extractionFailedOutputMessage = localize( 'LanguageService.extractionFailedOutputMessage', - 'Language server extraction failed.' + 'Language server extraction failed.', ); export const extractionCompletedOutputMessage = localize( 'LanguageService.extractionCompletedOutputMessage', - 'Language server download complete.' + 'Language server download complete.', ); export const extractionDoneOutputMessage = localize('LanguageService.extractionDoneOutputMessage', 'done.'); export const reloadVSCodeIfSeachPathHasChanged = localize( 'LanguageService.reloadVSCodeIfSeachPathHasChanged', - 'Search paths have changed for this Python interpreter. Please reload the extension to ensure that the IntelliSense works correctly.' + 'Search paths have changed for this Python interpreter. Please reload the extension to ensure that the IntelliSense works correctly.', ); } @@ -240,20 +240,20 @@ export namespace Interpreters { export const refreshing = localize('Interpreters.RefreshingInterpreters', 'Refreshing Python Interpreters'); export const condaInheritEnvMessage = localize( 'Interpreters.condaInheritEnvMessage', - 'We noticed you\'re using a conda environment. If you are experiencing issues with this environment in the integrated terminal, we recommend that you let the Python extension change "terminal.integrated.inheritEnv" to false in your user settings.' + 'We noticed you\'re using a conda environment. If you are experiencing issues with this environment in the integrated terminal, we recommend that you let the Python extension change "terminal.integrated.inheritEnv" to false in your user settings.', ); export const unsafeInterpreterMessage = localize( 'Interpreters.unsafeInterpreterMessage', - 'We found a Python environment in this workspace. Do you want to select it to start up the features in the Python extension? Only accept if you trust this environment.' + 'We found a Python environment in this workspace. Do you want to select it to start up the features in the Python extension? Only accept if you trust this environment.', ); export const environmentPromptMessage = localize( 'Interpreters.environmentPromptMessage', - 'We noticed a new virtual environment has been created. Do you want to select it for the workspace folder?' + 'We noticed a new virtual environment has been created. Do you want to select it for the workspace folder?', ); export const entireWorkspace = localize('Interpreters.entireWorkspace', 'Entire workspace'); export const selectInterpreterTip = localize( 'Interpreters.selectInterpreterTip', - 'Tip: you can change the Python interpreter used by the Python extension by clicking on the Python version in the status bar' + 'Tip: you can change the Python interpreter used by the Python extension by clicking on the Python version in the status bar', ); export const pythonInterpreterPath = localize('Interpreters.pythonInterpreterPath', 'Python interpreter path: {0}'); } @@ -261,21 +261,21 @@ export namespace Interpreters { export namespace InterpreterQuickPickList { export const quickPickListPlaceholder = localize( 'InterpreterQuickPickList.quickPickListPlaceholder', - 'Current: {0}' + 'Current: {0}', ); export const enterPath = { detail: localize('InterpreterQuickPickList.enterPath.detail', 'Enter path or find an existing interpreter'), label: localize('InterpreterQuickPickList.enterPath.label', 'Enter interpreter path...'), - placeholder: localize('InterpreterQuickPickList.enterPath.placeholder', 'Enter path to a Python interpreter.') + placeholder: localize('InterpreterQuickPickList.enterPath.placeholder', 'Enter path to a Python interpreter.'), }; export const browsePath = { label: localize('InterpreterQuickPickList.browsePath.label', 'Find...'), detail: localize( 'InterpreterQuickPickList.browsePath.detail', - 'Browse your file system to find a Python interpreter.' + 'Browse your file system to find a Python interpreter.', ), openButtonLabel: localize('python.command.python.setInterpreter.title', 'Select Interpreter'), - title: localize('InterpreterQuickPickList.browsePath.title', 'Select Python interpreter') + title: localize('InterpreterQuickPickList.browsePath.title', 'Select Python interpreter'), }; } export namespace ExtensionChannels { @@ -283,31 +283,31 @@ export namespace ExtensionChannels { export const yesDaily = localize('ExtensionChannels.yesDaily', 'Yes, daily'); export const promptMessage = localize( 'ExtensionChannels.promptMessage', - 'We noticed you are using Visual Studio Code Insiders. Would you like to use the Insiders build of the Python extension?' + 'We noticed you are using Visual Studio Code Insiders. Would you like to use the Insiders build of the Python extension?', ); export const reloadToUseInsidersMessage = localize( 'ExtensionChannels.reloadToUseInsidersMessage', - 'Please reload Visual Studio Code to use the insiders build of the Python extension.' + 'Please reload Visual Studio Code to use the insiders build of the Python extension.', ); export const downloadCompletedOutputMessage = localize( 'ExtensionChannels.downloadCompletedOutputMessage', - 'Insiders build download complete.' + 'Insiders build download complete.', ); export const startingDownloadOutputMessage = localize( 'ExtensionChannels.startingDownloadOutputMessage', - 'Starting download for Insiders build.' + 'Starting download for Insiders build.', ); export const downloadingInsidersMessage = localize( 'ExtensionChannels.downloadingInsidersMessage', - 'Downloading Insiders Extension... ' + 'Downloading Insiders Extension... ', ); export const installingInsidersMessage = localize( 'ExtensionChannels.installingInsidersMessage', - 'Installing Insiders build of extension... ' + 'Installing Insiders build of extension... ', ); export const installingStableMessage = localize( 'ExtensionChannels.installingStableMessage', - 'Installing Stable build of extension... ' + 'Installing Stable build of extension... ', ); export const installationCompleteMessage = localize('ExtensionChannels.installationCompleteMessage', 'complete.'); } @@ -325,11 +325,11 @@ export namespace Linters { export const enableLinter = localize('Linter.enableLinter', 'Enable {0}'); export const enablePylint = localize( 'Linter.enablePylint', - 'You have a pylintrc file in your workspace. Do you want to enable pylint?' + 'You have a pylintrc file in your workspace. Do you want to enable pylint?', ); export const replaceWithSelectedLinter = localize( 'Linter.replaceWithSelectedLinter', - "Multiple linters are enabled in settings. Replace with '{0}'?" + "Multiple linters are enabled in settings. Replace with '{0}'?", ); export const installMessage = localize('Linter.install', 'Install a linter to get error reporting.'); @@ -341,27 +341,27 @@ export namespace Linters { export namespace Installer { export const noCondaOrPipInstaller = localize( 'Installer.noCondaOrPipInstaller', - 'There is no Conda or Pip installer available in the selected environment.' + 'There is no Conda or Pip installer available in the selected environment.', ); export const noPipInstaller = localize( 'Installer.noPipInstaller', - 'There is no Pip installer available in the selected environment.' + 'There is no Pip installer available in the selected environment.', ); export const searchForHelp = localize('Installer.searchForHelp', 'Search for help'); export const couldNotInstallLibrary = localize( 'Installer.couldNotInstallLibrary', - 'Could not install {0}. If pip is not available, please use the package manager of your choice to manually install this library into your Python environment.' + 'Could not install {0}. If pip is not available, please use the package manager of your choice to manually install this library into your Python environment.', ); export const dataScienceInstallPrompt = localize( 'Installer.dataScienceInstallPrompt', - 'Data Science library {0} is not installed. Install?' + 'Data Science library {0} is not installed. Install?', ); } export namespace ExtensionSurveyBanner { export const bannerMessage = localize( 'ExtensionSurveyBanner.bannerMessage', - 'Can you please take 2 minutes to tell us how the Python extension is working for you?' + 'Can you please take 2 minutes to tell us how the Python extension is working for you?', ); export const bannerLabelYes = localize('ExtensionSurveyBanner.bannerLabelYes', 'Yes, take survey now'); export const bannerLabelNo = localize('ExtensionSurveyBanner.bannerLabelNo', 'No, thanks'); @@ -378,29 +378,29 @@ export namespace StartPage { export const createJupyterNotebook = localize('StartPage.createJupyterNotebook', 'Create a Jupyter Notebook'); export const notebookDescription = localize( 'StartPage.notebookDescription', - '- Run "" in the Command Palette (
Shift + Command + P
)
- Explore our to learn about notebook features' + '- Run "" in the Command Palette (
Shift + Command + P
)
- Explore our to learn about notebook features', ); export const createAPythonFile = localize('StartPage.createAPythonFile', 'Create a Python File'); export const pythonFileDescription = localize( 'StartPage.pythonFileDescription', - '- Create a with a .py extension' + '- Create a with a .py extension', ); export const openInteractiveWindow = localize( 'StartPage.openInteractiveWindow', - 'Use the Interactive Window to develop Python Scripts' + 'Use the Interactive Window to develop Python Scripts', ); export const interactiveWindowDesc = localize( 'StartPage.interactiveWindowDesc', - '- You can create cells on a Python file by typing "#%%"
- Use "
Shift + Enter
" to run a cell, the output will be shown in the interactive window' + '- You can create cells on a Python file by typing "#%%"
- Use "
Shift + Enter
" to run a cell, the output will be shown in the interactive window', ); export const releaseNotes = localize( 'StartPage.releaseNotes', - 'Take a look at our Release Notes to learn more about the latest features.' + 'Take a look at our Release Notes to learn more about the latest features.', ); export const tutorialAndDoc = localize( 'StartPage.tutorialAndDoc', - 'Explore more features in our Tutorials or check Documentation for tips and troubleshooting.' + 'Explore more features in our Tutorials or check Documentation for tips and troubleshooting.', ); export const dontShowAgain = localize('StartPage.dontShowAgain', "Don't show this page again"); export const helloWorld = localize('StartPage.helloWorld', 'Hello world'); @@ -410,139 +410,139 @@ export namespace StartPage { export const openFolder = localize('StartPage.openFolder', 'Open a Folder or Workspace'); export const folderDesc = localize( 'StartPage.folderDesc', - '- Open a
- Open a ' + '- Open a
- Open a ', ); export const badWebPanelFormatString = localize( 'StartPage.badWebPanelFormatString', - '

{0} is not a valid file name

' + '

{0} is not a valid file name

', ); } export namespace DebugConfigStrings { export const selectConfiguration = { title: localize('debug.selectConfigurationTitle'), - placeholder: localize('debug.selectConfigurationPlaceholder') + placeholder: localize('debug.selectConfigurationPlaceholder'), }; export const launchJsonCompletions = { label: localize('debug.launchJsonConfigurationsCompletionLabel'), - description: localize('debug.launchJsonConfigurationsCompletionDescription') + description: localize('debug.launchJsonConfigurationsCompletionDescription'), }; export namespace file { export const snippet = { - name: localize('python.snippet.launch.standard.label') + name: localize('python.snippet.launch.standard.label'), }; // tslint:disable-next-line:no-shadowed-variable export const selectConfiguration = { label: localize('debug.debugFileConfigurationLabel'), - description: localize('debug.debugFileConfigurationDescription') + description: localize('debug.debugFileConfigurationDescription'), }; } export namespace module { export const snippet = { name: localize('python.snippet.launch.module.label'), - default: localize('python.snippet.launch.module.default') + default: localize('python.snippet.launch.module.default'), }; // tslint:disable-next-line:no-shadowed-variable export const selectConfiguration = { label: localize('debug.debugModuleConfigurationLabel'), - description: localize('debug.debugModuleConfigurationDescription') + description: localize('debug.debugModuleConfigurationDescription'), }; export const enterModule = { title: localize('debug.moduleEnterModuleTitle'), prompt: localize('debug.moduleEnterModulePrompt'), default: localize('debug.moduleEnterModuleDefault'), - invalid: localize('debug.moduleEnterModuleInvalidNameError') + invalid: localize('debug.moduleEnterModuleInvalidNameError'), }; } export namespace attach { export const snippet = { - name: localize('python.snippet.launch.attach.label') + name: localize('python.snippet.launch.attach.label'), }; // tslint:disable-next-line:no-shadowed-variable export const selectConfiguration = { label: localize('debug.remoteAttachConfigurationLabel'), - description: localize('debug.remoteAttachConfigurationDescription') + description: localize('debug.remoteAttachConfigurationDescription'), }; export const enterRemoteHost = { title: localize('debug.attachRemoteHostTitle'), prompt: localize('debug.attachRemoteHostPrompt'), - invalid: localize('debug.attachRemoteHostValidationError') + invalid: localize('debug.attachRemoteHostValidationError'), }; export const enterRemotePort = { title: localize('debug.attachRemotePortTitle'), prompt: localize('debug.attachRemotePortPrompt'), - invalid: localize('debug.attachRemotePortValidationError') + invalid: localize('debug.attachRemotePortValidationError'), }; } export namespace attachPid { export const snippet = { - name: localize('python.snippet.launch.attachpid.label') + name: localize('python.snippet.launch.attachpid.label'), }; // tslint:disable-next-line:no-shadowed-variable export const selectConfiguration = { label: localize('debug.attachPidConfigurationLabel'), - description: localize('debug.attachPidConfigurationDescription') + description: localize('debug.attachPidConfigurationDescription'), }; } export namespace django { export const snippet = { - name: localize('python.snippet.launch.django.label') + name: localize('python.snippet.launch.django.label'), }; // tslint:disable-next-line:no-shadowed-variable export const selectConfiguration = { label: localize('debug.debugDjangoConfigurationLabel'), - description: localize('debug.debugDjangoConfigurationDescription') + description: localize('debug.debugDjangoConfigurationDescription'), }; export const enterManagePyPath = { title: localize('debug.djangoEnterManagePyPathTitle'), prompt: localize('debug.djangoEnterManagePyPathPrompt'), - invalid: localize('debug.djangoEnterManagePyPathInvalidFilePathError') + invalid: localize('debug.djangoEnterManagePyPathInvalidFilePathError'), }; } export namespace fastapi { export const snippet = { - name: localize('python.snippet.launch.fastapi.label') + name: localize('python.snippet.launch.fastapi.label'), }; // tslint:disable-next-line:no-shadowed-variable export const selectConfiguration = { label: localize('debug.debugFastAPIConfigurationLabel'), - description: localize('debug.debugFastAPIConfigurationDescription') + description: localize('debug.debugFastAPIConfigurationDescription'), }; export const enterAppPathOrNamePath = { title: localize('debug.fastapiEnterAppPathOrNamePathTitle'), prompt: localize('debug.fastapiEnterAppPathOrNamePathPrompt'), - invalid: localize('debug.fastapiEnterAppPathOrNamePathInvalidNameError') + invalid: localize('debug.fastapiEnterAppPathOrNamePathInvalidNameError'), }; } export namespace flask { export const snippet = { - name: localize('python.snippet.launch.flask.label') + name: localize('python.snippet.launch.flask.label'), }; // tslint:disable-next-line:no-shadowed-variable export const selectConfiguration = { label: localize('debug.debugFlaskConfigurationLabel'), - description: localize('debug.debugFlaskConfigurationDescription') + description: localize('debug.debugFlaskConfigurationDescription'), }; export const enterAppPathOrNamePath = { title: localize('debug.flaskEnterAppPathOrNamePathTitle'), prompt: localize('debug.flaskEnterAppPathOrNamePathPrompt'), - invalid: localize('debug.flaskEnterAppPathOrNamePathInvalidNameError') + invalid: localize('debug.flaskEnterAppPathOrNamePathInvalidNameError'), }; } export namespace pyramid { export const snippet = { - name: localize('python.snippet.launch.pyramid.label') + name: localize('python.snippet.launch.pyramid.label'), }; // tslint:disable-next-line:no-shadowed-variable export const selectConfiguration = { label: localize('debug.debugPyramidConfigurationLabel'), - description: localize('debug.debugPyramidConfigurationDescription') + description: localize('debug.debugPyramidConfigurationDescription'), }; export const enterDevelopmentIniPath = { title: localize('debug.pyramidEnterDevelopmentIniPathTitle'), prompt: localize('debug.pyramidEnterDevelopmentIniPathPrompt'), - invalid: localize('debug.pyramidEnterDevelopmentIniPathInvalidFilePathError') + invalid: localize('debug.pyramidEnterDevelopmentIniPathInvalidFilePathError'), }; } } @@ -558,7 +558,7 @@ export namespace Testing { export namespace OutdatedDebugger { export const outdatedDebuggerMessage = localize( 'OutdatedDebugger.updateDebuggerMessage', - 'We noticed you are attaching to ptvsd (Python debugger), which was deprecated on May 1st, 2020. Please switch to [debugpy](https://aka.ms/migrateToDebugpy).' + 'We noticed you are attaching to ptvsd (Python debugger), which was deprecated on May 1st, 2020. Please switch to [debugpy](https://aka.ms/migrateToDebugpy).', ); } diff --git a/src/client/common/utils/misc.ts b/src/client/common/utils/misc.ts index 0a1186b6da0a..630a4accb0c2 100644 --- a/src/client/common/utils/misc.ts +++ b/src/client/common/utils/misc.ts @@ -32,7 +32,7 @@ export function using(disposable: T, func: (obj: T) => vo export async function usingAsync( disposable: T, - func: (obj: T) => Promise + func: (obj: T) => Promise, ): Promise { try { return await func(disposable); @@ -145,7 +145,7 @@ export function getURIFilter( checkParent?: boolean; checkChild?: boolean; checkExact?: boolean; - } = { checkExact: true } + } = { checkExact: true }, ): (u: Uri) => boolean { let uriPath = uri.path; while (uri.path.endsWith('/')) { diff --git a/src/client/common/utils/multiStepInput.ts b/src/client/common/utils/multiStepInput.ts index 03e68155e86a..abe0635f4e8f 100644 --- a/src/client/common/utils/multiStepInput.ts +++ b/src/client/common/utils/multiStepInput.ts @@ -61,7 +61,7 @@ export interface IMultiStepInput { activeItem, placeholder, buttons, - shouldResume + shouldResume, }: P): Promise>; showInputBox

({ title, @@ -71,7 +71,7 @@ export interface IMultiStepInput { prompt, validate, buttons, - shouldResume + shouldResume, }: P): Promise>; } @@ -94,7 +94,7 @@ export class MultiStepInput implements IMultiStepInput { shouldResume, matchOnDescription, matchOnDetail, - acceptFilterBoxTextAsSelection + acceptFilterBoxTextAsSelection, }: P): Promise> { const disposables: Disposable[] = []; try { @@ -126,16 +126,18 @@ export class MultiStepInput implements IMultiStepInput { input.onDidHide(() => { (async () => { reject( - shouldResume && (await shouldResume()) ? InputFlowAction.resume : InputFlowAction.cancel + shouldResume && (await shouldResume()) + ? InputFlowAction.resume + : InputFlowAction.cancel, ); })().catch(reject); - }) + }), ); if (acceptFilterBoxTextAsSelection) { disposables.push( input.onDidAccept(() => { resolve(input.value); - }) + }), ); } if (this.current) { @@ -158,7 +160,7 @@ export class MultiStepInput implements IMultiStepInput { validate, password, buttons, - shouldResume + shouldResume, }: P): Promise> { const disposables: Disposable[] = []; try { @@ -202,10 +204,12 @@ export class MultiStepInput implements IMultiStepInput { input.onDidHide(() => { (async () => { reject( - shouldResume && (await shouldResume()) ? InputFlowAction.resume : InputFlowAction.cancel + shouldResume && (await shouldResume()) + ? InputFlowAction.resume + : InputFlowAction.cancel, ); })().catch(reject); - }) + }), ); if (this.current) { this.current.dispose(); diff --git a/src/client/common/utils/platform.ts b/src/client/common/utils/platform.ts index 90a21a03830e..4d42b1d3ff6a 100644 --- a/src/client/common/utils/platform.ts +++ b/src/client/common/utils/platform.ts @@ -8,13 +8,13 @@ import { EnvironmentVariables } from '../variables/types'; export enum Architecture { Unknown = 1, x86 = 2, - x64 = 3 + x64 = 3, } export enum OSType { Unknown = 'Unknown', Windows = 'Windows', OSX = 'OSX', - Linux = 'Linux' + Linux = 'Linux', } // Return the OS type for the given platform string. @@ -33,7 +33,7 @@ export function getOSType(platform: string = process.platform): OSType { const architectures: Record = { x86: Architecture.x86, // 32-bit x64: Architecture.x64, // 64-bit - '': Architecture.Unknown + '': Architecture.Unknown, }; /** diff --git a/src/client/common/utils/resourceLifecycle.ts b/src/client/common/utils/resourceLifecycle.ts index 6aa136d4c9e8..76790fe5f954 100644 --- a/src/client/common/utils/resourceLifecycle.ts +++ b/src/client/common/utils/resourceLifecycle.ts @@ -30,7 +30,7 @@ export async function disposeAll(disposables: IDisposable[]): Promise { } catch (err) { logWarning(`dispose() #${index} failed (${err})`); } - }) + }), ); } diff --git a/src/client/common/utils/sysTypes.ts b/src/client/common/utils/sysTypes.ts index 90503ad9e63e..e750a1b789d9 100644 --- a/src/client/common/utils/sysTypes.ts +++ b/src/client/common/utils/sysTypes.ts @@ -12,7 +12,7 @@ const _typeof = { string: 'string', undefined: 'undefined', object: 'object', - function: 'function' + function: 'function', }; /** diff --git a/src/client/common/utils/version.ts b/src/client/common/utils/version.ts index 830ebc668f78..df2368ecfe90 100644 --- a/src/client/common/utils/version.ts +++ b/src/client/common/utils/version.ts @@ -76,8 +76,8 @@ export const EMPTY_VERSION: RawBasicVersionInfo = { unnormalized: { major: undefined, minor: undefined, - micro: undefined - } + micro: undefined, + }, }; /** @@ -213,7 +213,7 @@ export function parseBasicVersionInfo(verStr: string // This is effectively normalized. version: ({ major, minor, micro } as unknown) as T, before: before || '', - after: after || '' + after: after || '', }; } diff --git a/src/client/common/utils/workerPool.ts b/src/client/common/utils/workerPool.ts index 3847647f2ee1..e825568f3339 100644 --- a/src/client/common/utils/workerPool.ts +++ b/src/client/common/utils/workerPool.ts @@ -27,7 +27,7 @@ interface IWorkItem { export enum QueuePosition { Back, - Front + Front, } export interface IWorkerPool extends IWorker { @@ -47,7 +47,7 @@ class Worker implements IWorker { private readonly next: NextFunc, private readonly workFunc: WorkFunc, private readonly postResult: PostResult, - private readonly name: string + private readonly name: string, ) {} public stop() { this.stopProcessing = true; @@ -139,7 +139,7 @@ class WorkerPool implements IWorkerPool { public constructor( private readonly workerFunc: WorkFunc, private readonly numWorkers: number = 2, - private readonly name: string = 'Worker' + private readonly name: string = 'Worker', ) {} public addToQueue(item: T, position?: QueuePosition): Promise { @@ -179,8 +179,8 @@ class WorkerPool implements IWorkerPool { (workItem: IWorkItem) => this.workerFunc(workItem.item), (workItem: IWorkItem, result?: R, error?: Error) => this.queue.completed(workItem, result, error), - `${this.name} ${num}` - ) + `${this.name} ${num}`, + ), ); num = num - 1; } @@ -233,7 +233,7 @@ class WorkerPool implements IWorkerPool { }, stop: () => { reject(); - } + }, }); }); } @@ -242,7 +242,7 @@ class WorkerPool implements IWorkerPool { export function createRunningWorkerPool( workerFunc: WorkFunc, numWorkers?: number, - name?: string + name?: string, ): WorkerPool { const pool = new WorkerPool(workerFunc, numWorkers, name); pool.start(); diff --git a/src/client/common/variables/environment.ts b/src/client/common/variables/environment.ts index 63f7896d5423..a36bfcbf5469 100644 --- a/src/client/common/variables/environment.ts +++ b/src/client/common/variables/environment.ts @@ -15,12 +15,12 @@ export class EnvironmentVariablesService implements IEnvironmentVariablesService constructor( // We only use a small portion of either of these interfaces. @inject(IPathUtils) private readonly pathUtils: IPathUtils, - @inject(IFileSystem) private readonly fs: IFileSystem + @inject(IFileSystem) private readonly fs: IFileSystem, ) {} public async parseFile( filePath?: string, - baseVars?: EnvironmentVariables + baseVars?: EnvironmentVariables, ): Promise { if (!filePath || !(await this.fs.fileExists(filePath))) { return; @@ -130,7 +130,7 @@ function substituteEnvVars( value: string, localVars: EnvironmentVariables, globalVars: EnvironmentVariables, - missing = '' + missing = '', ): string { // Substitution here is inspired a little by dotenv-expand: // https://github.com/motdotla/dotenv-expand/blob/master/lib/main.js diff --git a/src/client/common/variables/environmentVariablesProvider.ts b/src/client/common/variables/environmentVariablesProvider.ts index fd083b10e88f..ab4b76ca1a6e 100644 --- a/src/client/common/variables/environmentVariablesProvider.ts +++ b/src/client/common/variables/environmentVariablesProvider.ts @@ -28,7 +28,7 @@ export class EnvironmentVariablesProvider implements IEnvironmentVariablesProvid @inject(IConfigurationService) private readonly configurationService: IConfigurationService, @inject(ICurrentProcess) private process: ICurrentProcess, @inject(IServiceContainer) private serviceContainer: IServiceContainer, - @optional() private cacheDuration: number = CACHE_DURATION + @optional() private cacheDuration: number = CACHE_DURATION, ) { disposableRegistry.push(this); this.changeEventEmitter = new EventEmitter(); @@ -55,7 +55,7 @@ export class EnvironmentVariablesProvider implements IEnvironmentVariablesProvid 'getEnvironmentVariables', this.cacheDuration, [resource], - this.serviceContainer + this.serviceContainer, ); if (cacheStore.hasData) { traceVerbose(`Cached data exists getEnvironmentVariables, ${resource ? resource.fsPath : ''}`); @@ -125,12 +125,12 @@ export class EnvironmentVariablesProvider implements IEnvironmentVariablesProvid clearCachedResourceSpecificIngterpreterData( 'getEnvironmentVariables', workspaceFolderUri, - this.serviceContainer + this.serviceContainer, ); clearCachedResourceSpecificIngterpreterData( 'CustomEnvironmentVariables', workspaceFolderUri, - this.serviceContainer + this.serviceContainer, ); this.changeEventEmitter.fire(workspaceFolderUri); } diff --git a/src/client/common/variables/serviceRegistry.ts b/src/client/common/variables/serviceRegistry.ts index 3a98c3cbfea4..db4f620ab6a7 100644 --- a/src/client/common/variables/serviceRegistry.ts +++ b/src/client/common/variables/serviceRegistry.ts @@ -9,10 +9,10 @@ import { IEnvironmentVariablesProvider, IEnvironmentVariablesService } from './t export function registerTypes(serviceManager: IServiceManager) { serviceManager.addSingleton( IEnvironmentVariablesService, - EnvironmentVariablesService + EnvironmentVariablesService, ); serviceManager.addSingleton( IEnvironmentVariablesProvider, - EnvironmentVariablesProvider + EnvironmentVariablesProvider, ); } diff --git a/src/client/common/variables/sysTypes.ts b/src/client/common/variables/sysTypes.ts index 10bd2b776b17..bcf98e3ea20b 100644 --- a/src/client/common/variables/sysTypes.ts +++ b/src/client/common/variables/sysTypes.ts @@ -33,7 +33,7 @@ export function validateConstraint(arg: any, constraint: TypeConstraint): void { return; } throw new Error( - 'argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true' + 'argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true', ); } } diff --git a/src/client/common/variables/systemVariables.ts b/src/client/common/variables/systemVariables.ts index 74b307dafb78..9f9d8c595243 100644 --- a/src/client/common/variables/systemVariables.ts +++ b/src/client/common/variables/systemVariables.ts @@ -59,7 +59,7 @@ abstract class AbstractSystemVariables implements ISystemVariables { } private __resolveLiteral( - values: IStringDictionary | string[]> + values: IStringDictionary | string[]>, ): IStringDictionary | string[]> { const result: IStringDictionary | string[]> = Object.create(null); Object.keys(values).forEach((key) => { @@ -105,7 +105,7 @@ export class SystemVariables extends AbstractSystemVariables { file: Uri | undefined, rootFolder: string | undefined, workspace?: IWorkspaceService, - documentManager?: IDocumentManager + documentManager?: IDocumentManager, ) { super(); const workspaceFolder = workspace && file ? workspace.getWorkspaceFolder(file) : undefined; @@ -117,8 +117,8 @@ export class SystemVariables extends AbstractSystemVariables { this._selectedText = documentManager.activeTextEditor.document.getText( new Range( documentManager.activeTextEditor.selection.start, - documentManager.activeTextEditor.selection.end - ) + documentManager.activeTextEditor.selection.end, + ), ); } this._execPath = process.execPath; diff --git a/src/client/debugger/extension/adapter/activator.ts b/src/client/debugger/extension/adapter/activator.ts index be64226946c5..c7618c7ee146 100644 --- a/src/client/debugger/extension/adapter/activator.ts +++ b/src/client/debugger/extension/adapter/activator.ts @@ -20,19 +20,19 @@ export class DebugAdapterActivator implements IExtensionSingleActivationService @inject(IOutdatedDebuggerPromptFactory) private debuggerPromptFactory: IOutdatedDebuggerPromptFactory, @inject(IDisposableRegistry) private readonly disposables: IDisposableRegistry, @inject(IAttachProcessProviderFactory) - private readonly attachProcessProviderFactory: IAttachProcessProviderFactory + private readonly attachProcessProviderFactory: IAttachProcessProviderFactory, ) {} public async activate(): Promise { this.attachProcessProviderFactory.registerCommands(); this.disposables.push( - this.debugService.registerDebugAdapterTrackerFactory(DebuggerTypeName, this.debugSessionLoggingFactory) + this.debugService.registerDebugAdapterTrackerFactory(DebuggerTypeName, this.debugSessionLoggingFactory), ); this.disposables.push( - this.debugService.registerDebugAdapterTrackerFactory(DebuggerTypeName, this.debuggerPromptFactory) + this.debugService.registerDebugAdapterTrackerFactory(DebuggerTypeName, this.debuggerPromptFactory), ); this.disposables.push( - this.debugService.registerDebugAdapterDescriptorFactory(DebuggerTypeName, this.descriptorFactory) + this.debugService.registerDebugAdapterDescriptorFactory(DebuggerTypeName, this.descriptorFactory), ); } } diff --git a/src/client/debugger/extension/adapter/factory.ts b/src/client/debugger/extension/adapter/factory.ts index 58149bdf9e91..d5fc32fedf7e 100644 --- a/src/client/debugger/extension/adapter/factory.ts +++ b/src/client/debugger/extension/adapter/factory.ts @@ -10,7 +10,7 @@ import { DebugAdapterExecutable, DebugAdapterServer, DebugSession, - WorkspaceFolder + WorkspaceFolder, } from 'vscode'; import { IApplicationShell } from '../../../common/application/types'; import { traceVerbose } from '../../../common/logger'; @@ -25,12 +25,12 @@ import { IDebugAdapterDescriptorFactory } from '../types'; export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFactory { constructor( @inject(IInterpreterService) private readonly interpreterService: IInterpreterService, - @inject(IApplicationShell) private readonly appShell: IApplicationShell + @inject(IApplicationShell) private readonly appShell: IApplicationShell, ) {} public async createDebugAdapterDescriptor( session: DebugSession, - _executable: DebugAdapterExecutable | undefined + _executable: DebugAdapterExecutable | undefined, ): Promise { const configuration = session.configuration as LaunchRequestArguments | AttachRequestArguments; @@ -75,7 +75,7 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac 'lib', 'python', 'debugpy', - 'adapter' + 'adapter', ); sendTelemetryEvent(EventName.DEBUG_ADAPTER_USING_WHEELS_PATH, undefined, { usingWheels: true }); @@ -99,7 +99,7 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac */ private async getDebugAdapterPython( configuration: LaunchRequestArguments | AttachRequestArguments, - workspaceFolder?: WorkspaceFolder + workspaceFolder?: WorkspaceFolder, ): Promise { if (configuration.debugAdapterPython !== undefined) { return configuration.debugAdapterPython; @@ -135,7 +135,7 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac private async notifySelectInterpreter() { await this.appShell.showErrorMessage( // tslint:disable-next-line: messages-must-be-localized - 'Please install Python or select a Python Interpreter to use the debugger.' + 'Please install Python or select a Python Interpreter to use the debugger.', ); } } diff --git a/src/client/debugger/extension/adapter/logging.ts b/src/client/debugger/extension/adapter/logging.ts index fdba79ca0b4c..907b895170c6 100644 --- a/src/client/debugger/extension/adapter/logging.ts +++ b/src/client/debugger/extension/adapter/logging.ts @@ -9,7 +9,7 @@ import { DebugAdapterTrackerFactory, DebugConfiguration, DebugSession, - ProviderResult + ProviderResult, } from 'vscode'; import { DebugProtocol } from 'vscode-debugprotocol'; diff --git a/src/client/debugger/extension/adapter/outdatedDebuggerPrompt.ts b/src/client/debugger/extension/adapter/outdatedDebuggerPrompt.ts index b9aa0d14542b..a492dd85a33b 100644 --- a/src/client/debugger/extension/adapter/outdatedDebuggerPrompt.ts +++ b/src/client/debugger/extension/adapter/outdatedDebuggerPrompt.ts @@ -17,7 +17,7 @@ class OutdatedDebuggerPrompt implements DebugAdapterTracker { constructor( private promptCheck: IPromptShowState, private appShell: IApplicationShell, - private browserService: IBrowserService + private browserService: IBrowserService, ) {} public onDidSendMessage(message: DebugProtocol.ProtocolMessage) { @@ -73,7 +73,7 @@ export class OutdatedDebuggerPromptFactory implements DebugAdapterTrackerFactory private readonly promptCheck: OutdatedDebuggerPromptState; constructor( @inject(IApplicationShell) private readonly appShell: IApplicationShell, - @inject(IBrowserService) private browserService: IBrowserService + @inject(IBrowserService) private browserService: IBrowserService, ) { this.promptCheck = new OutdatedDebuggerPromptState(); } diff --git a/src/client/debugger/extension/attachQuickPick/factory.ts b/src/client/debugger/extension/attachQuickPick/factory.ts index f36c45183965..627962106e88 100644 --- a/src/client/debugger/extension/attachQuickPick/factory.ts +++ b/src/client/debugger/extension/attachQuickPick/factory.ts @@ -20,7 +20,7 @@ export class AttachProcessProviderFactory implements IAttachProcessProviderFacto @inject(ICommandManager) private readonly commandManager: ICommandManager, @inject(IPlatformService) private readonly platformService: IPlatformService, @inject(IProcessServiceFactory) private readonly processServiceFactory: IProcessServiceFactory, - @inject(IDisposableRegistry) private readonly disposableRegistry: IDisposableRegistry + @inject(IDisposableRegistry) private readonly disposableRegistry: IDisposableRegistry, ) {} public registerCommands() { @@ -29,7 +29,7 @@ export class AttachProcessProviderFactory implements IAttachProcessProviderFacto const disposable = this.commandManager.registerCommand( Commands.PickLocalProcess, () => picker.showQuickPick(), - this + this, ); this.disposableRegistry.push(disposable); } diff --git a/src/client/debugger/extension/attachQuickPick/picker.ts b/src/client/debugger/extension/attachQuickPick/picker.ts index db1d4a8a8a74..ca782a110877 100644 --- a/src/client/debugger/extension/attachQuickPick/picker.ts +++ b/src/client/debugger/extension/attachQuickPick/picker.ts @@ -14,7 +14,7 @@ import { IAttachItem, IAttachPicker, IAttachProcessProvider, REFRESH_BUTTON_ICON export class AttachPicker implements IAttachPicker { constructor( @inject(IApplicationShell) private readonly applicationShell: IApplicationShell, - private readonly attachItemsProvider: IAttachProcessProvider + private readonly attachItemsProvider: IAttachProcessProvider, ) {} public showQuickPick(): Promise { @@ -23,7 +23,7 @@ export class AttachPicker implements IAttachPicker { const refreshButton = { iconPath: getIcon(REFRESH_BUTTON_ICON), - tooltip: AttachProcess.refreshList() + tooltip: AttachProcess.refreshList(), }; const quickPick = this.applicationShell.createQuickPick(); @@ -43,7 +43,7 @@ export class AttachPicker implements IAttachPicker { quickPick.items = attachItems; }, this, - disposables + disposables, ); quickPick.onDidAccept( @@ -60,7 +60,7 @@ export class AttachPicker implements IAttachPicker { resolve(selectedId); }, undefined, - disposables + disposables, ); quickPick.onDidHide( @@ -71,7 +71,7 @@ export class AttachPicker implements IAttachPicker { reject(new Error(AttachProcess.noProcessSelected())); }, undefined, - disposables + disposables, ); quickPick.show(); diff --git a/src/client/debugger/extension/attachQuickPick/provider.ts b/src/client/debugger/extension/attachQuickPick/provider.ts index fbeb3eee34ac..ad6ccafee530 100644 --- a/src/client/debugger/extension/attachQuickPick/provider.ts +++ b/src/client/debugger/extension/attachQuickPick/provider.ts @@ -15,7 +15,7 @@ import { WmicProcessParser } from './wmicProcessParser'; export class AttachProcessProvider implements IAttachProcessProvider { constructor( @inject(IPlatformService) private readonly platformService: IPlatformService, - @inject(IProcessServiceFactory) private readonly processServiceFactory: IProcessServiceFactory + @inject(IProcessServiceFactory) private readonly processServiceFactory: IProcessServiceFactory, ) {} public getAttachItems(): Promise { @@ -23,7 +23,7 @@ export class AttachProcessProvider implements IAttachProcessProvider { processEntries.sort( ( { processName: aprocessName, commandLine: aCommandLine }, - { processName: bProcessName, commandLine: bCommandLine } + { processName: bProcessName, commandLine: bCommandLine }, ) => { const compare = (aString: string, bString: string): number => { // localeCompare is significantly slower than < and > (2000 ms vs 80 ms for 10,000 elements) @@ -53,7 +53,7 @@ export class AttachProcessProvider implements IAttachProcessProvider { } return compare(aprocessName, bProcessName); - } + }, ); return processEntries; diff --git a/src/client/debugger/extension/attachQuickPick/psProcessParser.ts b/src/client/debugger/extension/attachQuickPick/psProcessParser.ts index e5ab6f404a74..843369bd00c7 100644 --- a/src/client/debugger/extension/attachQuickPick/psProcessParser.ts +++ b/src/client/debugger/extension/attachQuickPick/psProcessParser.ts @@ -40,11 +40,11 @@ export namespace PsProcessParser { // Since 'args' contains the full path to the executable, even if truncated, searching will work as desired. export const psLinuxCommand: ProcessListCommand = { command: 'ps', - args: ['axww', '-o', `pid=,comm=${commColumnTitle},args=`] + args: ['axww', '-o', `pid=,comm=${commColumnTitle},args=`], }; export const psDarwinCommand: ProcessListCommand = { command: 'ps', - args: ['axww', '-o', `pid=,comm=${commColumnTitle},args=`, '-c'] + args: ['axww', '-o', `pid=,comm=${commColumnTitle},args=`, '-c'], }; export function parseProcesses(processes: string): IAttachItem[] { @@ -94,7 +94,7 @@ export namespace PsProcessParser { detail: cmdline, id: pid, processName: executable, - commandLine: cmdline + commandLine: cmdline, }; } } diff --git a/src/client/debugger/extension/attachQuickPick/wmicProcessParser.ts b/src/client/debugger/extension/attachQuickPick/wmicProcessParser.ts index d7da2b98ace3..e1faed50fc2e 100644 --- a/src/client/debugger/extension/attachQuickPick/wmicProcessParser.ts +++ b/src/client/debugger/extension/attachQuickPick/wmicProcessParser.ts @@ -15,7 +15,7 @@ export namespace WmicProcessParser { detail: '', id: '', processName: '', - commandLine: '' + commandLine: '', }; // Perf numbers on Win10: @@ -27,7 +27,7 @@ export namespace WmicProcessParser { // | 1308 | 1132 | export const wmicCommand: ProcessListCommand = { command: 'wmic', - args: ['process', 'get', 'Name,ProcessId,CommandLine', '/FORMAT:list'] + args: ['process', 'get', 'Name,ProcessId,CommandLine', '/FORMAT:list'], }; export function parseProcesses(processes: string): IAttachItem[] { diff --git a/src/client/debugger/extension/banner.ts b/src/client/debugger/extension/banner.ts index 56e372df1d7e..a025d06082b7 100644 --- a/src/client/debugger/extension/banner.ts +++ b/src/client/debugger/extension/banner.ts @@ -19,7 +19,7 @@ export enum PersistentStateKeys { ShowBanner = 'ShowBanner', DebuggerLaunchCounter = 'DebuggerLaunchCounter', DebuggerLaunchThresholdCounter = 'DebuggerLaunchThresholdCounter', - UserSelected = 'DebuggerUserSelected' + UserSelected = 'DebuggerUserSelected', } @injectable() @@ -128,7 +128,7 @@ export class DebuggerBanner implements IDebuggerBanner { private async passedThreshold(): Promise { const [threshold, debuggerCounter] = await Promise.all([ this.getDebuggerLaunchThresholdCounter(), - this.getGetDebuggerLaunchCounter() + this.getGetDebuggerLaunchCounter(), ]); return debuggerCounter >= threshold; } diff --git a/src/client/debugger/extension/configuration/debugConfigurationService.ts b/src/client/debugger/extension/configuration/debugConfigurationService.ts index f44cf42885d0..ce946b7abb41 100644 --- a/src/client/debugger/extension/configuration/debugConfigurationService.ts +++ b/src/client/debugger/extension/configuration/debugConfigurationService.ts @@ -10,7 +10,7 @@ import { IMultiStepInput, IMultiStepInputFactory, InputStep, - IQuickPickParameters + IQuickPickParameters, } from '../../../common/utils/multiStepInput'; import { AttachRequestArguments, DebugConfigurationArguments, LaunchRequestArguments } from '../../types'; import { DebugConfigurationState, DebugConfigurationType, IDebugConfigurationService } from '../types'; @@ -27,12 +27,12 @@ export class PythonDebugConfigurationService implements IDebugConfigurationServi private readonly launchResolver: IDebugConfigurationResolver, @inject(IDebugConfigurationProviderFactory) private readonly providerFactory: IDebugConfigurationProviderFactory, - @inject(IMultiStepInputFactory) private readonly multiStepFactory: IMultiStepInputFactory + @inject(IMultiStepInputFactory) private readonly multiStepFactory: IMultiStepInputFactory, ) {} public async provideDebugConfigurations( folder: WorkspaceFolder | undefined, - token?: CancellationToken + token?: CancellationToken, ): Promise { const config: Partial = {}; const state = { config, folder, token }; @@ -51,13 +51,13 @@ export class PythonDebugConfigurationService implements IDebugConfigurationServi public async resolveDebugConfiguration( folder: WorkspaceFolder | undefined, debugConfiguration: DebugConfiguration, - token?: CancellationToken + token?: CancellationToken, ): Promise { if (debugConfiguration.request === 'attach') { return this.attachResolver.resolveDebugConfiguration( folder, debugConfiguration as AttachRequestArguments, - token + token, ); } else if (debugConfiguration.request === 'test') { throw Error("Please use the command 'Python: Debug Unit Tests'"); @@ -74,7 +74,7 @@ export class PythonDebugConfigurationService implements IDebugConfigurationServi return this.launchResolver.resolveDebugConfiguration( folder, debugConfiguration as LaunchRequestArguments, - token + token, ); } } @@ -82,7 +82,7 @@ export class PythonDebugConfigurationService implements IDebugConfigurationServi public async resolveDebugConfigurationWithSubstitutedVariables( folder: WorkspaceFolder | undefined, debugConfiguration: DebugConfiguration, - token?: CancellationToken + token?: CancellationToken, ): Promise { function resolve(resolver: IDebugConfigurationResolver) { return resolver.resolveDebugConfigurationWithSubstitutedVariables(folder, debugConfiguration as T, token); @@ -92,50 +92,50 @@ export class PythonDebugConfigurationService implements IDebugConfigurationServi protected async pickDebugConfiguration( input: IMultiStepInput, - state: DebugConfigurationState + state: DebugConfigurationState, ): Promise | void> { type DebugConfigurationQuickPickItem = QuickPickItem & { type: DebugConfigurationType }; const items: DebugConfigurationQuickPickItem[] = [ { label: DebugConfigStrings.file.selectConfiguration.label(), type: DebugConfigurationType.launchFile, - description: DebugConfigStrings.file.selectConfiguration.description() + description: DebugConfigStrings.file.selectConfiguration.description(), }, { label: DebugConfigStrings.module.selectConfiguration.label(), type: DebugConfigurationType.launchModule, - description: DebugConfigStrings.module.selectConfiguration.description() + description: DebugConfigStrings.module.selectConfiguration.description(), }, { label: DebugConfigStrings.attach.selectConfiguration.label(), type: DebugConfigurationType.remoteAttach, - description: DebugConfigStrings.attach.selectConfiguration.description() + description: DebugConfigStrings.attach.selectConfiguration.description(), }, { label: DebugConfigStrings.attachPid.selectConfiguration.label(), type: DebugConfigurationType.pidAttach, - description: DebugConfigStrings.attachPid.selectConfiguration.description() + description: DebugConfigStrings.attachPid.selectConfiguration.description(), }, { label: DebugConfigStrings.django.selectConfiguration.label(), type: DebugConfigurationType.launchDjango, - description: DebugConfigStrings.django.selectConfiguration.description() + description: DebugConfigStrings.django.selectConfiguration.description(), }, { label: DebugConfigStrings.fastapi.selectConfiguration.label(), type: DebugConfigurationType.launchFastAPI, - description: DebugConfigStrings.fastapi.selectConfiguration.description() + description: DebugConfigStrings.fastapi.selectConfiguration.description(), }, { label: DebugConfigStrings.flask.selectConfiguration.label(), type: DebugConfigurationType.launchFlask, - description: DebugConfigStrings.flask.selectConfiguration.description() + description: DebugConfigStrings.flask.selectConfiguration.description(), }, { label: DebugConfigStrings.pyramid.selectConfiguration.label(), type: DebugConfigurationType.launchPyramid, - description: DebugConfigStrings.pyramid.selectConfiguration.description() - } + description: DebugConfigStrings.pyramid.selectConfiguration.description(), + }, ]; state.config = {}; const pick = await input.showQuickPick< @@ -145,7 +145,7 @@ export class PythonDebugConfigurationService implements IDebugConfigurationServi title: DebugConfigStrings.selectConfiguration.title(), placeholder: DebugConfigStrings.selectConfiguration.placeholder(), activeItem: items[0], - items: items + items: items, }); if (pick) { const provider = this.providerFactory.create(pick.type); diff --git a/src/client/debugger/extension/configuration/launch.json/completionProvider.ts b/src/client/debugger/extension/configuration/launch.json/completionProvider.ts index 16d5c14608c8..73f062184670 100644 --- a/src/client/debugger/extension/configuration/launch.json/completionProvider.ts +++ b/src/client/debugger/extension/configuration/launch.json/completionProvider.ts @@ -13,7 +13,7 @@ import { CompletionItemProvider, Position, SnippetString, - TextDocument + TextDocument, } from 'vscode'; import { IExtensionSingleActivationService } from '../../../../activation/types'; import { ILanguageService } from '../../../../common/application/types'; @@ -23,27 +23,27 @@ import { DebugConfigStrings } from '../../../../common/utils/localize'; const configurationNodeName = 'configurations'; enum JsonLanguages { json = 'json', - jsonWithComments = 'jsonc' + jsonWithComments = 'jsonc', } @injectable() export class LaunchJsonCompletionProvider implements CompletionItemProvider, IExtensionSingleActivationService { constructor( @inject(ILanguageService) private readonly languageService: ILanguageService, - @inject(IDisposableRegistry) private readonly disposableRegistry: IDisposableRegistry + @inject(IDisposableRegistry) private readonly disposableRegistry: IDisposableRegistry, ) {} public async activate(): Promise { this.disposableRegistry.push( - this.languageService.registerCompletionItemProvider({ language: JsonLanguages.json }, this) + this.languageService.registerCompletionItemProvider({ language: JsonLanguages.json }, this), ); this.disposableRegistry.push( - this.languageService.registerCompletionItemProvider({ language: JsonLanguages.jsonWithComments }, this) + this.languageService.registerCompletionItemProvider({ language: JsonLanguages.jsonWithComments }, this), ); } public async provideCompletionItems( document: TextDocument, position: Position, - token: CancellationToken + token: CancellationToken, ): Promise { if (!this.canProvideCompletions(document, position)) { return []; @@ -54,15 +54,15 @@ export class LaunchJsonCompletionProvider implements CompletionItemProvider, IEx command: { command: 'python.SelectAndInsertDebugConfiguration', title: DebugConfigStrings.launchJsonCompletions.description(), - arguments: [document, position, token] + arguments: [document, position, token], }, documentation: DebugConfigStrings.launchJsonCompletions.description(), sortText: 'AAAA', preselect: true, kind: CompletionItemKind.Enum, label: DebugConfigStrings.launchJsonCompletions.label(), - insertText: new SnippetString() - } + insertText: new SnippetString(), + }, ]; } public canProvideCompletions(document: TextDocument, position: Position) { diff --git a/src/client/debugger/extension/configuration/launch.json/interpreterPathCommand.ts b/src/client/debugger/extension/configuration/launch.json/interpreterPathCommand.ts index 6ba5ce3a9942..d74d7779c8ff 100644 --- a/src/client/debugger/extension/configuration/launch.json/interpreterPathCommand.ts +++ b/src/client/debugger/extension/configuration/launch.json/interpreterPathCommand.ts @@ -15,14 +15,14 @@ export class InterpreterPathCommand implements IExtensionSingleActivationService constructor( @inject(ICommandManager) private readonly commandManager: ICommandManager, @inject(IConfigurationService) private readonly configurationService: IConfigurationService, - @inject(IDisposableRegistry) private readonly disposables: IDisposable[] + @inject(IDisposableRegistry) private readonly disposables: IDisposable[], ) {} public async activate() { this.disposables.push( this.commandManager.registerCommand(Commands.GetSelectedInterpreterPath, (args) => { return this._getSelectedInterpreterPath(args); - }) + }), ); } diff --git a/src/client/debugger/extension/configuration/launch.json/updaterService.ts b/src/client/debugger/extension/configuration/launch.json/updaterService.ts index 199cd0ecffa1..bd91ca2f20c0 100644 --- a/src/client/debugger/extension/configuration/launch.json/updaterService.ts +++ b/src/client/debugger/extension/configuration/launch.json/updaterService.ts @@ -22,13 +22,13 @@ export class LaunchJsonUpdaterServiceHelper { private readonly commandManager: ICommandManager, private readonly workspace: IWorkspaceService, private readonly documentManager: IDocumentManager, - private readonly configurationProvider: IDebugConfigurationService + private readonly configurationProvider: IDebugConfigurationService, ) {} @captureTelemetry(EventName.DEBUGGER_CONFIGURATION_PROMPTS_IN_LAUNCH_JSON) public async selectAndInsertDebugConfig( document: TextDocument, position: Position, - token: CancellationToken + token: CancellationToken, ): Promise { if (this.documentManager.activeTextEditor && this.documentManager.activeTextEditor.document === document) { const folder = this.workspace.getWorkspaceFolder(document.uri); @@ -52,7 +52,7 @@ export class LaunchJsonUpdaterServiceHelper { public async insertDebugConfiguration( document: TextDocument, position: Position, - config: DebugConfiguration + config: DebugConfiguration, ): Promise { const cursorPosition = this.getCursorPositionInConfigurationsArray(document, position); if (!cursorPosition) { @@ -77,7 +77,7 @@ export class LaunchJsonUpdaterServiceHelper { public getTextForInsertion( config: DebugConfiguration, cursorPosition: PositionOfCursor, - commaPosition?: PositionOfComma + commaPosition?: PositionOfComma, ) { const json = JSON.stringify(config); if (cursorPosition === 'AfterItem') { @@ -91,7 +91,7 @@ export class LaunchJsonUpdaterServiceHelper { } public getCursorPositionInConfigurationsArray( document: TextDocument, - position: Position + position: Position, ): PositionOfCursor | undefined { if (this.isConfigurationArrayEmpty(document)) { return 'InsideEmptyArray'; @@ -151,21 +151,21 @@ export class LaunchJsonUpdaterService implements IExtensionSingleActivationServi @inject(IDisposableRegistry) private readonly disposableRegistry: IDisposableRegistry, @inject(IWorkspaceService) private readonly workspace: IWorkspaceService, @inject(IDocumentManager) private readonly documentManager: IDocumentManager, - @inject(IDebugConfigurationService) private readonly configurationProvider: IDebugConfigurationService + @inject(IDebugConfigurationService) private readonly configurationProvider: IDebugConfigurationService, ) {} public async activate(): Promise { const handler = new LaunchJsonUpdaterServiceHelper( this.commandManager, this.workspace, this.documentManager, - this.configurationProvider + this.configurationProvider, ); this.disposableRegistry.push( this.commandManager.registerCommand( 'python.SelectAndInsertDebugConfiguration', handler.selectAndInsertDebugConfig, - handler - ) + handler, + ), ); } } diff --git a/src/client/debugger/extension/configuration/providers/djangoLaunch.ts b/src/client/debugger/extension/configuration/providers/djangoLaunch.ts index 78839f495750..e0caef2f9918 100644 --- a/src/client/debugger/extension/configuration/providers/djangoLaunch.ts +++ b/src/client/debugger/extension/configuration/providers/djangoLaunch.ts @@ -26,7 +26,7 @@ export class DjangoLaunchDebugConfigurationProvider implements IDebugConfigurati constructor( @inject(IFileSystem) private fs: IFileSystem, @inject(IWorkspaceService) private readonly workspace: IWorkspaceService, - @inject(IPathUtils) private pathUtils: IPathUtils + @inject(IPathUtils) private pathUtils: IPathUtils, ) {} public async buildConfiguration(input: MultiStepInput, state: DebugConfigurationState) { const program = await this.getManagePyPath(state.folder); @@ -38,14 +38,14 @@ export class DjangoLaunchDebugConfigurationProvider implements IDebugConfigurati request: 'launch', program: program || defaultProgram, args: ['runserver'], - django: true + django: true, }; if (!program) { const selectedProgram = await input.showInputBox({ title: DebugConfigStrings.django.enterManagePyPath.title(), value: defaultProgram, prompt: DebugConfigStrings.django.enterManagePyPath.prompt(), - validate: (value) => this.validateManagePy(state.folder, defaultProgram, value) + validate: (value) => this.validateManagePy(state.folder, defaultProgram, value), }); if (selectedProgram) { manuallyEnteredAValue = true; @@ -56,14 +56,14 @@ export class DjangoLaunchDebugConfigurationProvider implements IDebugConfigurati sendTelemetryEvent(EventName.DEBUGGER_CONFIGURATION_PROMPTS, undefined, { configurationType: DebugConfigurationType.launchDjango, autoDetectedDjangoManagePyPath: !!program, - manuallyEnteredAValue + manuallyEnteredAValue, }); Object.assign(state.config, config); } public async validateManagePy( folder: WorkspaceFolder | undefined, defaultValue: string, - selected?: string + selected?: string, ): Promise { const error = DebugConfigStrings.django.enterManagePyPath.invalid(); if (!selected || selected.trim().length === 0) { diff --git a/src/client/debugger/extension/configuration/providers/fastapiLaunch.ts b/src/client/debugger/extension/configuration/providers/fastapiLaunch.ts index 67a91513c773..ddf5ebfb5b04 100644 --- a/src/client/debugger/extension/configuration/providers/fastapiLaunch.ts +++ b/src/client/debugger/extension/configuration/providers/fastapiLaunch.ts @@ -30,7 +30,7 @@ export class FastAPILaunchDebugConfigurationProvider implements IDebugConfigurat request: 'launch', module: 'uvicorn', args: ['main:app'], - jinja: true + jinja: true, }; if (!application) { @@ -42,8 +42,8 @@ export class FastAPILaunchDebugConfigurationProvider implements IDebugConfigurat Promise.resolve( value && value.trim().length > 0 ? undefined - : DebugConfigStrings.fastapi.enterAppPathOrNamePath.invalid() - ) + : DebugConfigStrings.fastapi.enterAppPathOrNamePath.invalid(), + ), }); if (selectedPath) { manuallyEnteredAValue = true; @@ -54,7 +54,7 @@ export class FastAPILaunchDebugConfigurationProvider implements IDebugConfigurat sendTelemetryEvent(EventName.DEBUGGER_CONFIGURATION_PROMPTS, undefined, { configurationType: DebugConfigurationType.launchFastAPI, autoDetectedFastAPIMainPyPath: !!application, - manuallyEnteredAValue + manuallyEnteredAValue, }); Object.assign(state.config, config); } diff --git a/src/client/debugger/extension/configuration/providers/fileLaunch.ts b/src/client/debugger/extension/configuration/providers/fileLaunch.ts index 1762709e4554..d6a488038c67 100644 --- a/src/client/debugger/extension/configuration/providers/fileLaunch.ts +++ b/src/client/debugger/extension/configuration/providers/fileLaunch.ts @@ -17,7 +17,7 @@ export class FileLaunchDebugConfigurationProvider implements IDebugConfiguration @captureTelemetry( EventName.DEBUGGER_CONFIGURATION_PROMPTS, { configurationType: DebugConfigurationType.launchFile }, - false + false, ) public async buildConfiguration(_input: MultiStepInput, state: DebugConfigurationState) { const config: Partial = { @@ -26,7 +26,7 @@ export class FileLaunchDebugConfigurationProvider implements IDebugConfiguration request: 'launch', // tslint:disable-next-line:no-invalid-template-strings program: '${file}', - console: 'integratedTerminal' + console: 'integratedTerminal', }; Object.assign(state.config, config); } diff --git a/src/client/debugger/extension/configuration/providers/flaskLaunch.ts b/src/client/debugger/extension/configuration/providers/flaskLaunch.ts index 7ac3ad6455ff..47e145098484 100644 --- a/src/client/debugger/extension/configuration/providers/flaskLaunch.ts +++ b/src/client/debugger/extension/configuration/providers/flaskLaunch.ts @@ -32,10 +32,10 @@ export class FlaskLaunchDebugConfigurationProvider implements IDebugConfiguratio env: { FLASK_APP: application || 'app.py', FLASK_ENV: 'development', - FLASK_DEBUG: '0' + FLASK_DEBUG: '0', }, args: ['run', '--no-debugger'], - jinja: true + jinja: true, }; if (!application) { @@ -47,8 +47,8 @@ export class FlaskLaunchDebugConfigurationProvider implements IDebugConfiguratio Promise.resolve( value && value.trim().length > 0 ? undefined - : DebugConfigStrings.flask.enterAppPathOrNamePath.invalid() - ) + : DebugConfigStrings.flask.enterAppPathOrNamePath.invalid(), + ), }); if (selectedApp) { manuallyEnteredAValue = true; @@ -59,7 +59,7 @@ export class FlaskLaunchDebugConfigurationProvider implements IDebugConfiguratio sendTelemetryEvent(EventName.DEBUGGER_CONFIGURATION_PROMPTS, undefined, { configurationType: DebugConfigurationType.launchFlask, autoDetectedFlaskAppPyPath: !!application, - manuallyEnteredAValue + manuallyEnteredAValue, }); Object.assign(state.config, config); } diff --git a/src/client/debugger/extension/configuration/providers/moduleLaunch.ts b/src/client/debugger/extension/configuration/providers/moduleLaunch.ts index e2d6db959d7d..702de673654f 100644 --- a/src/client/debugger/extension/configuration/providers/moduleLaunch.ts +++ b/src/client/debugger/extension/configuration/providers/moduleLaunch.ts @@ -20,7 +20,7 @@ export class ModuleLaunchDebugConfigurationProvider implements IDebugConfigurati name: DebugConfigStrings.module.snippet.name(), type: DebuggerTypeName, request: 'launch', - module: DebugConfigStrings.module.snippet.default() + module: DebugConfigStrings.module.snippet.default(), }; const selectedModule = await input.showInputBox({ title: DebugConfigStrings.module.enterModule.title(), @@ -28,8 +28,8 @@ export class ModuleLaunchDebugConfigurationProvider implements IDebugConfigurati prompt: DebugConfigStrings.module.enterModule.prompt(), validate: (value) => Promise.resolve( - value && value.trim().length > 0 ? undefined : DebugConfigStrings.module.enterModule.invalid() - ) + value && value.trim().length > 0 ? undefined : DebugConfigStrings.module.enterModule.invalid(), + ), }); if (selectedModule) { manuallyEnteredAValue = true; @@ -38,7 +38,7 @@ export class ModuleLaunchDebugConfigurationProvider implements IDebugConfigurati sendTelemetryEvent(EventName.DEBUGGER_CONFIGURATION_PROMPTS, undefined, { configurationType: DebugConfigurationType.launchModule, - manuallyEnteredAValue + manuallyEnteredAValue, }); Object.assign(state.config, config); } diff --git a/src/client/debugger/extension/configuration/providers/pidAttach.ts b/src/client/debugger/extension/configuration/providers/pidAttach.ts index fe95e82b654c..e31aa0daf7a9 100644 --- a/src/client/debugger/extension/configuration/providers/pidAttach.ts +++ b/src/client/debugger/extension/configuration/providers/pidAttach.ts @@ -17,7 +17,7 @@ export class PidAttachDebugConfigurationProvider implements IDebugConfigurationP @captureTelemetry( EventName.DEBUGGER_CONFIGURATION_PROMPTS, { configurationType: DebugConfigurationType.pidAttach }, - false + false, ) public async buildConfiguration(_input: MultiStepInput, state: DebugConfigurationState) { const config: Partial = { @@ -25,7 +25,7 @@ export class PidAttachDebugConfigurationProvider implements IDebugConfigurationP type: DebuggerTypeName, request: 'attach', // tslint:disable-next-line:no-invalid-template-strings - processId: '${command:pickProcess}' + processId: '${command:pickProcess}', }; Object.assign(state.config, config); } diff --git a/src/client/debugger/extension/configuration/providers/providerFactory.ts b/src/client/debugger/extension/configuration/providers/providerFactory.ts index afbfaa59c642..18f5a18a9ef4 100644 --- a/src/client/debugger/extension/configuration/providers/providerFactory.ts +++ b/src/client/debugger/extension/configuration/providers/providerFactory.ts @@ -34,7 +34,7 @@ export class DebugConfigurationProviderFactory implements IDebugConfigurationPro remoteAttachProvider: IDebugConfigurationProvider, @inject(IDebugConfigurationProvider) @named(DebugConfigurationType.pidAttach) - pidAttachProvider: IDebugConfigurationProvider + pidAttachProvider: IDebugConfigurationProvider, ) { this.providers = new Map(); this.providers.set(DebugConfigurationType.launchDjango, djangoProvider); diff --git a/src/client/debugger/extension/configuration/providers/pyramidLaunch.ts b/src/client/debugger/extension/configuration/providers/pyramidLaunch.ts index 9aab8b77c583..e1cdf7ae73c3 100644 --- a/src/client/debugger/extension/configuration/providers/pyramidLaunch.ts +++ b/src/client/debugger/extension/configuration/providers/pyramidLaunch.ts @@ -26,7 +26,7 @@ export class PyramidLaunchDebugConfigurationProvider implements IDebugConfigurat constructor( @inject(IFileSystem) private fs: IFileSystem, @inject(IWorkspaceService) private readonly workspace: IWorkspaceService, - @inject(IPathUtils) private pathUtils: IPathUtils + @inject(IPathUtils) private pathUtils: IPathUtils, ) {} public async buildConfiguration(input: MultiStepInput, state: DebugConfigurationState) { const iniPath = await this.getDevelopmentIniPath(state.folder); @@ -40,7 +40,7 @@ export class PyramidLaunchDebugConfigurationProvider implements IDebugConfigurat module: 'pyramid.scripts.pserve', args: [iniPath || defaultIni], pyramid: true, - jinja: true + jinja: true, }; if (!iniPath) { @@ -48,7 +48,7 @@ export class PyramidLaunchDebugConfigurationProvider implements IDebugConfigurat title: DebugConfigStrings.pyramid.enterDevelopmentIniPath.title(), value: defaultIni, prompt: DebugConfigStrings.pyramid.enterDevelopmentIniPath.prompt(), - validate: (value) => this.validateIniPath(state ? state.folder : undefined, defaultIni, value) + validate: (value) => this.validateIniPath(state ? state.folder : undefined, defaultIni, value), }); if (selectedIniPath) { manuallyEnteredAValue = true; @@ -59,14 +59,14 @@ export class PyramidLaunchDebugConfigurationProvider implements IDebugConfigurat sendTelemetryEvent(EventName.DEBUGGER_CONFIGURATION_PROMPTS, undefined, { configurationType: DebugConfigurationType.launchPyramid, autoDetectedPyramidIniPath: !!iniPath, - manuallyEnteredAValue + manuallyEnteredAValue, }); Object.assign(state.config, config); } public async validateIniPath( folder: WorkspaceFolder | undefined, defaultValue: string, - selected?: string + selected?: string, ): Promise { if (!folder) { return; diff --git a/src/client/debugger/extension/configuration/providers/remoteAttach.ts b/src/client/debugger/extension/configuration/providers/remoteAttach.ts index 51189093ebc2..3fc9e018b2a4 100644 --- a/src/client/debugger/extension/configuration/providers/remoteAttach.ts +++ b/src/client/debugger/extension/configuration/providers/remoteAttach.ts @@ -19,7 +19,7 @@ const defaultPort = 5678; export class RemoteAttachDebugConfigurationProvider implements IDebugConfigurationProvider { public async buildConfiguration( input: MultiStepInput, - state: DebugConfigurationState + state: DebugConfigurationState, ): Promise | void> { const config: Partial = { name: DebugConfigStrings.attach.snippet.name(), @@ -27,15 +27,15 @@ export class RemoteAttachDebugConfigurationProvider implements IDebugConfigurati request: 'attach', connect: { host: defaultHost, - port: defaultPort + port: defaultPort, }, pathMappings: [ { // tslint:disable-next-line:no-invalid-template-strings localRoot: '${workspaceFolder}', - remoteRoot: '.' - } - ] + remoteRoot: '.', + }, + ], }; const connect = config.connect!; @@ -47,8 +47,8 @@ export class RemoteAttachDebugConfigurationProvider implements IDebugConfigurati prompt: DebugConfigStrings.attach.enterRemoteHost.prompt(), validate: (value) => Promise.resolve( - value && value.trim().length > 0 ? undefined : DebugConfigStrings.attach.enterRemoteHost.invalid() - ) + value && value.trim().length > 0 ? undefined : DebugConfigStrings.attach.enterRemoteHost.invalid(), + ), }); if (!connect.host) { connect.host = defaultHost; @@ -56,7 +56,7 @@ export class RemoteAttachDebugConfigurationProvider implements IDebugConfigurati sendTelemetryEvent(EventName.DEBUGGER_CONFIGURATION_PROMPTS, undefined, { configurationType: DebugConfigurationType.remoteAttach, - manuallyEnteredAValue: connect.host !== defaultHost + manuallyEnteredAValue: connect.host !== defaultHost, }); Object.assign(state.config, config); return (_) => this.configurePort(input, state.config); @@ -64,7 +64,7 @@ export class RemoteAttachDebugConfigurationProvider implements IDebugConfigurati protected async configurePort( input: MultiStepInput, - config: Partial + config: Partial, ) { const connect = config.connect || (config.connect = {}); const port = await input.showInputBox({ @@ -77,8 +77,8 @@ export class RemoteAttachDebugConfigurationProvider implements IDebugConfigurati Promise.resolve( value && /^\d+$/.test(value.trim()) ? undefined - : DebugConfigStrings.attach.enterRemotePort.invalid() - ) + : DebugConfigStrings.attach.enterRemotePort.invalid(), + ), }); if (port && /^\d+$/.test(port.trim())) { connect.port = parseInt(port, 10); @@ -88,7 +88,7 @@ export class RemoteAttachDebugConfigurationProvider implements IDebugConfigurati } sendTelemetryEvent(EventName.DEBUGGER_CONFIGURATION_PROMPTS, undefined, { configurationType: DebugConfigurationType.remoteAttach, - manuallyEnteredAValue: connect.port !== defaultPort + manuallyEnteredAValue: connect.port !== defaultPort, }); } } diff --git a/src/client/debugger/extension/configuration/resolvers/attach.ts b/src/client/debugger/extension/configuration/resolvers/attach.ts index 2a641502d865..0d271430e542 100644 --- a/src/client/debugger/extension/configuration/resolvers/attach.ts +++ b/src/client/debugger/extension/configuration/resolvers/attach.ts @@ -17,7 +17,7 @@ export class AttachConfigurationResolver extends BaseConfigurationResolver { const workspaceFolder = this.getWorkspaceFolder(folder); @@ -34,7 +34,7 @@ export class AttachConfigurationResolver extends BaseConfigurationResolver dbgConfig.debugOptions!.indexOf(item) === pos + (item, pos) => dbgConfig.debugOptions!.indexOf(item) === pos, ); } return debugConfiguration; @@ -43,7 +43,7 @@ export class AttachConfigurationResolver extends BaseConfigurationResolver { if (!Array.isArray(debugConfiguration.debugOptions)) { debugConfiguration.debugOptions = []; @@ -103,7 +103,7 @@ export class AttachConfigurationResolver extends BaseConfigurationResolver protected readonly workspaceService: IWorkspaceService, protected readonly documentManager: IDocumentManager, protected readonly platformService: IPlatformService, - protected readonly configurationService: IConfigurationService + protected readonly configurationService: IConfigurationService, ) {} // This is a legacy hook used solely for backwards-compatible manual substitution @@ -43,7 +43,7 @@ export abstract class BaseConfigurationResolver public async resolveDebugConfiguration( _folder: WorkspaceFolder | undefined, debugConfiguration: DebugConfiguration, - _token?: CancellationToken + _token?: CancellationToken, ): Promise { return debugConfiguration as T; } @@ -51,7 +51,7 @@ export abstract class BaseConfigurationResolver public abstract resolveDebugConfigurationWithSubstitutedVariables( folder: WorkspaceFolder | undefined, debugConfiguration: DebugConfiguration, - token?: CancellationToken + token?: CancellationToken, ): Promise; protected getWorkspaceFolder(folder: WorkspaceFolder | undefined): Uri | undefined { @@ -85,7 +85,7 @@ export abstract class BaseConfigurationResolver protected resolveAndUpdatePaths( workspaceFolder: Uri | undefined, - debugConfiguration: LaunchRequestArguments + debugConfiguration: LaunchRequestArguments, ): void { this.resolveAndUpdateEnvFilePath(workspaceFolder, debugConfiguration); this.resolveAndUpdatePythonPath(workspaceFolder, debugConfiguration); @@ -93,7 +93,7 @@ export abstract class BaseConfigurationResolver protected resolveAndUpdateEnvFilePath( workspaceFolder: Uri | undefined, - debugConfiguration: LaunchRequestArguments + debugConfiguration: LaunchRequestArguments, ): void { if (!debugConfiguration) { return; @@ -101,7 +101,7 @@ export abstract class BaseConfigurationResolver if (debugConfiguration.envFile && (workspaceFolder || debugConfiguration.cwd)) { const systemVariables = new SystemVariables( undefined, - (workspaceFolder ? workspaceFolder.fsPath : undefined) || debugConfiguration.cwd + (workspaceFolder ? workspaceFolder.fsPath : undefined) || debugConfiguration.cwd, ); debugConfiguration.envFile = systemVariables.resolveAny(debugConfiguration.envFile); } @@ -109,7 +109,7 @@ export abstract class BaseConfigurationResolver protected resolveAndUpdatePythonPath( workspaceFolder: Uri | undefined, - debugConfiguration: LaunchRequestArguments + debugConfiguration: LaunchRequestArguments, ): void { if (!debugConfiguration) { return; @@ -138,7 +138,7 @@ export abstract class BaseConfigurationResolver protected fixUpPathMappings( pathMappings: PathMapping[], defaultLocalRoot?: string, - defaultRemoteRoot?: string + defaultRemoteRoot?: string, ): PathMapping[] { if (!defaultLocalRoot) { return []; @@ -151,8 +151,8 @@ export abstract class BaseConfigurationResolver pathMappings = [ { localRoot: defaultLocalRoot, - remoteRoot: defaultRemoteRoot - } + remoteRoot: defaultRemoteRoot, + }, ]; } else { // Expand ${workspaceFolder} variable first if necessary. @@ -160,7 +160,7 @@ export abstract class BaseConfigurationResolver pathMappings = pathMappings.map(({ localRoot: mappedLocalRoot, remoteRoot }) => ({ localRoot: systemVariables.resolveAny(mappedLocalRoot), // TODO: Apply to remoteRoot too? - remoteRoot + remoteRoot, })); } @@ -190,7 +190,7 @@ export abstract class BaseConfigurationResolver protected sendTelemetry( trigger: 'launch' | 'attach' | 'test', - debugConfiguration: Partial + debugConfiguration: Partial, ) { const name = debugConfiguration.name || ''; const moduleName = debugConfiguration.module || ''; @@ -213,7 +213,7 @@ export abstract class BaseConfigurationResolver watson: name.toLowerCase().indexOf('watson') >= 0, pyspark: name.toLowerCase().indexOf('pyspark') >= 0, gevent: name.toLowerCase().indexOf('gevent') >= 0, - scrapy: moduleName.toLowerCase() === 'scrapy' + scrapy: moduleName.toLowerCase() === 'scrapy', }; sendTelemetryEvent(EventName.DEBUGGER, undefined, telemetryProps); } diff --git a/src/client/debugger/extension/configuration/resolvers/helper.ts b/src/client/debugger/extension/configuration/resolvers/helper.ts index a779f5e5e843..f43232dff1b4 100644 --- a/src/client/debugger/extension/configuration/resolvers/helper.ts +++ b/src/client/debugger/extension/configuration/resolvers/helper.ts @@ -18,7 +18,7 @@ export class DebugEnvironmentVariablesHelper implements IDebugEnvironmentVariabl constructor( @inject(IEnvironmentVariablesService) private envParser: IEnvironmentVariablesService, @inject(IPathUtils) private pathUtils: IPathUtils, - @inject(ICurrentProcess) private process: ICurrentProcess + @inject(ICurrentProcess) private process: ICurrentProcess, ) {} public async getEnvironmentVariables(args: LaunchRequestArguments): Promise { const pathVariableName = this.pathUtils.getPathVariableName(); diff --git a/src/client/debugger/extension/configuration/resolvers/launch.ts b/src/client/debugger/extension/configuration/resolvers/launch.ts index a24eadb62866..e2ca5cc504a3 100644 --- a/src/client/debugger/extension/configuration/resolvers/launch.ts +++ b/src/client/debugger/extension/configuration/resolvers/launch.ts @@ -26,7 +26,7 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver { if ( debugConfiguration.name === undefined && @@ -59,7 +59,7 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver { const workspaceFolder = this.getWorkspaceFolder(folder); await this.provideLaunchDefaults(workspaceFolder, debugConfiguration); @@ -71,7 +71,7 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver debugConfiguration.debugOptions!.indexOf(item) === pos + (item, pos) => debugConfiguration.debugOptions!.indexOf(item) === pos, ); } return debugConfiguration; @@ -80,7 +80,7 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver { if (debugConfiguration.python === undefined) { debugConfiguration.python = debugConfiguration.pythonPath; @@ -171,7 +171,7 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver 0) { pathMappings = this.fixUpPathMappings( pathMappings || [], - workspaceFolder ? workspaceFolder.fsPath : '' + workspaceFolder ? workspaceFolder.fsPath : '', ); } debugConfiguration.pathMappings = pathMappings.length > 0 ? pathMappings : undefined; @@ -181,13 +181,13 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver { const diagnosticService = this.invalidPythonPathInDebuggerService; for (const executable of [ debugConfiguration.python, debugConfiguration.debugAdapterPython, - debugConfiguration.debugLauncherPython + debugConfiguration.debugLauncherPython, ]) { const source = executable === debugConfiguration.pythonPath ? this.pythonPathSource : PythonPathSource.launchJson; diff --git a/src/client/debugger/extension/configuration/types.ts b/src/client/debugger/extension/configuration/types.ts index 947074f08292..1a5e01d877ba 100644 --- a/src/client/debugger/extension/configuration/types.ts +++ b/src/client/debugger/extension/configuration/types.ts @@ -11,13 +11,13 @@ export interface IDebugConfigurationResolver { resolveDebugConfiguration( folder: WorkspaceFolder | undefined, debugConfiguration: T, - token?: CancellationToken + token?: CancellationToken, ): Promise; resolveDebugConfigurationWithSubstitutedVariables( folder: WorkspaceFolder | undefined, debugConfiguration: T, - token?: CancellationToken + token?: CancellationToken, ): Promise; } diff --git a/src/client/debugger/extension/hooks/childProcessAttachHandler.ts b/src/client/debugger/extension/hooks/childProcessAttachHandler.ts index 7656ac9f527d..6851e54a8723 100644 --- a/src/client/debugger/extension/hooks/childProcessAttachHandler.ts +++ b/src/client/debugger/extension/hooks/childProcessAttachHandler.ts @@ -20,7 +20,7 @@ import { IChildProcessAttachService, IDebugSessionEventHandlers } from './types' @injectable() export class ChildProcessAttachEventHandler implements IDebugSessionEventHandlers { constructor( - @inject(IChildProcessAttachService) private readonly childProcessAttachService: IChildProcessAttachService + @inject(IChildProcessAttachService) private readonly childProcessAttachService: IChildProcessAttachService, ) {} @swallowExceptions('Handle child process launch') diff --git a/src/client/debugger/extension/hooks/childProcessAttachService.ts b/src/client/debugger/extension/hooks/childProcessAttachService.ts index c7771b845340..3d1f385d9114 100644 --- a/src/client/debugger/extension/hooks/childProcessAttachService.ts +++ b/src/client/debugger/extension/hooks/childProcessAttachService.ts @@ -24,7 +24,7 @@ export class ChildProcessAttachService implements IChildProcessAttachService { constructor( @inject(IApplicationShell) private readonly appShell: IApplicationShell, @inject(IDebugService) private readonly debugService: IDebugService, - @inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService + @inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService, ) {} @captureTelemetry(EventName.DEBUGGER_ATTACH_TO_CHILD_PROCESS) @@ -39,7 +39,7 @@ export class ChildProcessAttachService implements IChildProcessAttachService { } private getRelatedWorkspaceFolder( - config: AttachRequestArguments & DebugConfiguration + config: AttachRequestArguments & DebugConfiguration, ): WorkspaceFolder | undefined { const workspaceFolder = config.workspaceFolder; if (!this.workspaceService.hasWorkspaceFolders || !workspaceFolder) { diff --git a/src/client/debugger/extension/hooks/constants.ts b/src/client/debugger/extension/hooks/constants.ts index b2a2e0a8ec52..3bd0b657281e 100644 --- a/src/client/debugger/extension/hooks/constants.ts +++ b/src/client/debugger/extension/hooks/constants.ts @@ -6,5 +6,5 @@ export enum DebuggerEvents { // Event sent by PTVSD when a child process is launched and ready to be attached to for multi-proc debugging. PtvsdAttachToSubprocess = 'ptvsd_attach', - DebugpyAttachToSubprocess = 'debugpyAttach' + DebugpyAttachToSubprocess = 'debugpyAttach', } diff --git a/src/client/debugger/extension/hooks/eventHandlerDispatcher.ts b/src/client/debugger/extension/hooks/eventHandlerDispatcher.ts index 3aac7df6663f..7b1dd1516abd 100644 --- a/src/client/debugger/extension/hooks/eventHandlerDispatcher.ts +++ b/src/client/debugger/extension/hooks/eventHandlerDispatcher.ts @@ -12,22 +12,22 @@ export class DebugSessionEventDispatcher { constructor( @multiInject(IDebugSessionEventHandlers) private readonly eventHandlers: IDebugSessionEventHandlers[], @inject(IDebugService) private readonly debugService: IDebugService, - @inject(IDisposableRegistry) private readonly disposables: IDisposableRegistry + @inject(IDisposableRegistry) private readonly disposables: IDisposableRegistry, ) {} public registerEventHandlers() { this.disposables.push( this.debugService.onDidReceiveDebugSessionCustomEvent((e) => { this.eventHandlers.forEach((handler) => - handler.handleCustomEvent ? handler.handleCustomEvent(e).ignoreErrors() : undefined + handler.handleCustomEvent ? handler.handleCustomEvent(e).ignoreErrors() : undefined, ); - }) + }), ); this.disposables.push( this.debugService.onDidTerminateDebugSession((e) => { this.eventHandlers.forEach((handler) => - handler.handleTerminateEvent ? handler.handleTerminateEvent(e).ignoreErrors() : undefined + handler.handleTerminateEvent ? handler.handleTerminateEvent(e).ignoreErrors() : undefined, ); - }) + }), ); } } diff --git a/src/client/debugger/extension/serviceRegistry.ts b/src/client/debugger/extension/serviceRegistry.ts index 5ac7ea8565ce..62d887b3e5b4 100644 --- a/src/client/debugger/extension/serviceRegistry.ts +++ b/src/client/debugger/extension/serviceRegistry.ts @@ -40,25 +40,25 @@ import { IDebugConfigurationService, IDebuggerBanner, IDebugSessionLoggingFactory, - IOutdatedDebuggerPromptFactory + IOutdatedDebuggerPromptFactory, } from './types'; export function registerTypes(serviceManager: IServiceManager) { serviceManager.addSingleton( IExtensionSingleActivationService, - LaunchJsonCompletionProvider + LaunchJsonCompletionProvider, ); serviceManager.addSingleton( IExtensionSingleActivationService, - InterpreterPathCommand + InterpreterPathCommand, ); serviceManager.addSingleton( IExtensionSingleActivationService, - LaunchJsonUpdaterService + LaunchJsonUpdaterService, ); serviceManager.addSingleton( IDebugConfigurationService, - PythonDebugConfigurationService + PythonDebugConfigurationService, ); serviceManager.addSingleton(IDebuggerBanner, DebuggerBanner); serviceManager.addSingleton(IChildProcessAttachService, ChildProcessAttachService); @@ -66,76 +66,76 @@ export function registerTypes(serviceManager: IServiceManager) { serviceManager.addSingleton>( IDebugConfigurationResolver, LaunchConfigurationResolver, - 'launch' + 'launch', ); serviceManager.addSingleton>( IDebugConfigurationResolver, AttachConfigurationResolver, - 'attach' + 'attach', ); serviceManager.addSingleton( IDebugConfigurationProviderFactory, - DebugConfigurationProviderFactory + DebugConfigurationProviderFactory, ); serviceManager.addSingleton( IDebugConfigurationProvider, FileLaunchDebugConfigurationProvider, - DebugConfigurationType.launchFile + DebugConfigurationType.launchFile, ); serviceManager.addSingleton( IDebugConfigurationProvider, DjangoLaunchDebugConfigurationProvider, - DebugConfigurationType.launchDjango + DebugConfigurationType.launchDjango, ); serviceManager.addSingleton( IDebugConfigurationProvider, FastAPILaunchDebugConfigurationProvider, - DebugConfigurationType.launchFastAPI + DebugConfigurationType.launchFastAPI, ); serviceManager.addSingleton( IDebugConfigurationProvider, FlaskLaunchDebugConfigurationProvider, - DebugConfigurationType.launchFlask + DebugConfigurationType.launchFlask, ); serviceManager.addSingleton( IDebugConfigurationProvider, RemoteAttachDebugConfigurationProvider, - DebugConfigurationType.remoteAttach + DebugConfigurationType.remoteAttach, ); serviceManager.addSingleton( IDebugConfigurationProvider, ModuleLaunchDebugConfigurationProvider, - DebugConfigurationType.launchModule + DebugConfigurationType.launchModule, ); serviceManager.addSingleton( IDebugConfigurationProvider, PyramidLaunchDebugConfigurationProvider, - DebugConfigurationType.launchPyramid + DebugConfigurationType.launchPyramid, ); serviceManager.addSingleton( IDebugConfigurationProvider, PidAttachDebugConfigurationProvider, - DebugConfigurationType.pidAttach + DebugConfigurationType.pidAttach, ); serviceManager.addSingleton( IDebugEnvironmentVariablesService, - DebugEnvironmentVariablesHelper + DebugEnvironmentVariablesHelper, ); serviceManager.addSingleton( IExtensionSingleActivationService, - DebugAdapterActivator + DebugAdapterActivator, ); serviceManager.addSingleton( IDebugAdapterDescriptorFactory, - DebugAdapterDescriptorFactory + DebugAdapterDescriptorFactory, ); serviceManager.addSingleton(IDebugSessionLoggingFactory, DebugSessionLoggingFactory); serviceManager.addSingleton( IOutdatedDebuggerPromptFactory, - OutdatedDebuggerPromptFactory + OutdatedDebuggerPromptFactory, ); serviceManager.addSingleton( IAttachProcessProviderFactory, - AttachProcessProviderFactory + AttachProcessProviderFactory, ); } diff --git a/src/client/debugger/extension/types.ts b/src/client/debugger/extension/types.ts index a455194e78b6..0ac54205689a 100644 --- a/src/client/debugger/extension/types.ts +++ b/src/client/debugger/extension/types.ts @@ -10,7 +10,7 @@ import { DebugAdapterTrackerFactory, DebugConfigurationProvider, Disposable, - WorkspaceFolder + WorkspaceFolder, } from 'vscode'; import { InputStep, MultiStepInput } from '../../common/utils/multiStepInput'; @@ -32,7 +32,7 @@ export type DebugConfigurationState = { export interface IDebugConfigurationProvider { buildConfiguration( input: MultiStepInput, - state: DebugConfigurationState + state: DebugConfigurationState, ): Promise | void>; } @@ -44,12 +44,12 @@ export enum DebugConfigurationType { launchFlask = 'launchFlask', launchModule = 'launchModule', launchPyramid = 'launchPyramid', - pidAttach = 'pidAttach' + pidAttach = 'pidAttach', } export enum PythonPathSource { launchJson = 'launch.json', - settingsJson = 'settings.json' + settingsJson = 'settings.json', } export const IDebugAdapterDescriptorFactory = Symbol('IDebugAdapterDescriptorFactory'); diff --git a/src/client/debugger/types.ts b/src/client/debugger/types.ts index eb6e9b19ab9e..93773821c7e3 100644 --- a/src/client/debugger/types.ts +++ b/src/client/debugger/types.ts @@ -19,7 +19,7 @@ export enum DebugOptions { UnixClient = 'UnixClient', StopOnEntry = 'StopOnEntry', ShowReturnValue = 'ShowReturnValue', - SubProcess = 'Multiprocess' + SubProcess = 'Multiprocess', } export type PathMapping = { diff --git a/src/client/extension.ts b/src/client/extension.ts index b9f8a03c2c47..fada0fd0e9c8 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -90,7 +90,7 @@ export function deactivate(): Thenable { async function activateUnsafe( context: IExtensionContext, startupStopWatch: StopWatch, - startupDurations: Record + startupDurations: Record, ): Promise<[IExtensionApi, Promise, IServiceContainer]> { const activationDeferred = createDeferred(); displayProgress(activationDeferred.promise); @@ -133,7 +133,7 @@ function displayProgress(promise: Promise) { async function handleError(ex: Error, startupDurations: Record) { notifyUser( - "Extension activation failed, run the 'Developer: Toggle Developer Tools' command for more information." + "Extension activation failed, run the 'Developer: Toggle Developer Tools' command for more information.", ); traceError('extension activation failed', ex); await sendErrorTelemetry(ex, startupDurations, activatedServiceContainer); diff --git a/src/client/extensionActivation.ts b/src/client/extensionActivation.ts index f84c200a3f6f..0b7b17128b65 100644 --- a/src/client/extensionActivation.ts +++ b/src/client/extensionActivation.ts @@ -11,7 +11,7 @@ import { registerTypes as activationRegisterTypes } from './activation/serviceRe import { IExtensionActivationManager, IExtensionSingleActivationService, - ILanguageServerExtension + ILanguageServerExtension, } from './activation/types'; import { registerTypes as appRegisterTypes } from './application/serviceRegistry'; import { IApplicationDiagnostics } from './application/types'; @@ -30,7 +30,7 @@ import { IDisposableRegistry, IExperimentsManager, IFeatureDeprecationManager, - IOutputChannel + IOutputChannel, } from './common/types'; import { OutputChannelNames } from './common/utils/localize'; import { noop } from './common/utils/misc'; @@ -45,7 +45,7 @@ import { IComponentAdapter, IInterpreterLocatorProgressHandler, IInterpreterLocatorProgressService, - IInterpreterService + IInterpreterService, } from './interpreter/contracts'; import { registerTypes as interpretersRegisterTypes } from './interpreter/serviceRegistry'; import { getLanguageConfiguration } from './language/languageConfiguration'; @@ -77,7 +77,7 @@ import { Components } from './extensionInit'; export async function activateComponents( // `ext` is passed to any extra activation funcs. ext: ExtensionState, - _components: Components + _components: Components, ): Promise { // Note that each activation returns a promise that resolves // when that activation completes. However, it might have started @@ -97,7 +97,7 @@ export async function activateComponents( // If we need to activate, we need to use the adapter: // https://github.com/microsoft/vscode-python/issues/14984 // These will go away eventually. - activateLegacy(ext) + activateLegacy(ext), ]; return Promise.all(promises); } @@ -236,8 +236,8 @@ async function activateLegacy(ext: ExtensionState): Promise { context.subscriptions.push( languages.registerCodeActionsProvider(PYTHON, new PythonCodeActionProvider(), { - providedCodeActionKinds: [CodeActionKind.SourceOrganizeImports] - }) + providedCodeActionKinds: [CodeActionKind.SourceOrganizeImports], + }), ); serviceContainer.getAll(IDebugConfigurationService).forEach((debugConfigProvider) => { diff --git a/src/client/extensionInit.ts b/src/client/extensionInit.ts index a29a7b9abf51..775fdc9f0997 100644 --- a/src/client/extensionInit.ts +++ b/src/client/extensionInit.ts @@ -24,7 +24,7 @@ import { PythonEnvironments } from './pythonEnvironments/api'; export function initializeGlobals( // This is stored in ExtensionState. - context: IExtensionContext + context: IExtensionContext, ): ExtensionState { const cont = new Container(); const serviceManager = new ServiceManager(cont); @@ -42,7 +42,7 @@ export function initializeGlobals( return { context, disposables, - legacyIOC: { serviceManager, serviceContainer } + legacyIOC: { serviceManager, serviceContainer }, }; } @@ -70,6 +70,6 @@ export function initializeComponents(ext: ExtensionState): Components { // We will be factoring them out of activateLegacy(). return { - pythonEnvs + pythonEnvs, }; } diff --git a/src/client/formatters/autoPep8Formatter.ts b/src/client/formatters/autoPep8Formatter.ts index e086e37f549b..164b08b7fbd6 100644 --- a/src/client/formatters/autoPep8Formatter.ts +++ b/src/client/formatters/autoPep8Formatter.ts @@ -16,7 +16,7 @@ export class AutoPep8Formatter extends BaseFormatter { document: vscode.TextDocument, options: vscode.FormattingOptions, token: vscode.CancellationToken, - range?: vscode.Range + range?: vscode.Range, ): Thenable { const stopWatch = new StopWatch(); const settings = this.serviceContainer @@ -30,14 +30,14 @@ export class AutoPep8Formatter extends BaseFormatter { if (formatSelection) { // tslint:disable-next-line:no-non-null-assertion autoPep8Args.push( - ...['--line-range', (range!.start.line + 1).toString(), (range!.end.line + 1).toString()] + ...['--line-range', (range!.start.line + 1).toString(), (range!.end.line + 1).toString()], ); } const promise = super.provideDocumentFormattingEdits(document, options, token, autoPep8Args); sendTelemetryWhenDone(EventName.FORMAT, promise, stopWatch, { tool: 'autopep8', hasCustomArgs, - formatSelection + formatSelection, }); return promise; } diff --git a/src/client/formatters/baseFormatter.ts b/src/client/formatters/baseFormatter.ts index 435a5503337c..80ded83a3172 100644 --- a/src/client/formatters/baseFormatter.ts +++ b/src/client/formatters/baseFormatter.ts @@ -28,7 +28,7 @@ export abstract class BaseFormatter { document: vscode.TextDocument, options: vscode.FormattingOptions, token: vscode.CancellationToken, - range?: vscode.Range + range?: vscode.Range, ): Thenable; protected getDocumentPath(document: vscode.TextDocument, fallbackPath: string) { if (path.basename(document.uri.fsPath) === document.uri.fsPath) { @@ -52,7 +52,7 @@ export abstract class BaseFormatter { _options: vscode.FormattingOptions, token: vscode.CancellationToken, args: string[], - cwd?: string + cwd?: string, ): Promise { if (typeof cwd !== 'string' || cwd.length === 0) { cwd = this.getWorkspaceUri(document).fsPath; @@ -71,7 +71,7 @@ export abstract class BaseFormatter { const executionInfo = this.helper.getExecutionInfo(this.product, args, document.uri); executionInfo.args.push(tempFile); const pythonToolsExecutionService = this.serviceContainer.get( - IPythonToolExecutionService + IPythonToolExecutionService, ); const promise = pythonToolsExecutionService .exec(executionInfo, { cwd, throwOnStdErr: false, token }, document.uri) diff --git a/src/client/formatters/blackFormatter.ts b/src/client/formatters/blackFormatter.ts index 819e11668f8b..ddfef8fc57ca 100644 --- a/src/client/formatters/blackFormatter.ts +++ b/src/client/formatters/blackFormatter.ts @@ -24,7 +24,7 @@ export class BlackFormatter extends BaseFormatter { document: vscode.TextDocument, options: vscode.FormattingOptions, token: vscode.CancellationToken, - range?: vscode.Range + range?: vscode.Range, ): Promise { const stopWatch = new StopWatch(); const settings = this.serviceContainer diff --git a/src/client/formatters/dummyFormatter.ts b/src/client/formatters/dummyFormatter.ts index b82496a5f1b0..b4fdba9fbc0f 100644 --- a/src/client/formatters/dummyFormatter.ts +++ b/src/client/formatters/dummyFormatter.ts @@ -12,7 +12,7 @@ export class DummyFormatter extends BaseFormatter { _document: vscode.TextDocument, _options: vscode.FormattingOptions, _token: vscode.CancellationToken, - _range?: vscode.Range + _range?: vscode.Range, ): Thenable { return Promise.resolve([]); } diff --git a/src/client/formatters/helper.ts b/src/client/formatters/helper.ts index 3c09be283815..ac305b51e785 100644 --- a/src/client/formatters/helper.ts +++ b/src/client/formatters/helper.ts @@ -28,7 +28,7 @@ export class FormatterHelper implements IFormatterHelper { const id = this.translateToId(formatter); return { argsName: `${id}Args` as keyof IFormattingSettings, - pathName: `${id}Path` as keyof IFormattingSettings + pathName: `${id}Path` as keyof IFormattingSettings, }; } public getExecutionInfo(formatter: Product, customArgs: string[], resource?: Uri): ExecutionInfo { diff --git a/src/client/formatters/lineFormatter.ts b/src/client/formatters/lineFormatter.ts index e6a3bb6f1728..fce84f9fd0a5 100644 --- a/src/client/formatters/lineFormatter.ts +++ b/src/client/formatters/lineFormatter.ts @@ -33,7 +33,7 @@ const keywordsWithSpaceBeforeBrace = [ 'return', 'while', 'with', - 'yield' + 'yield', ]; export class LineFormatter { diff --git a/src/client/formatters/yapfFormatter.ts b/src/client/formatters/yapfFormatter.ts index 8c8b24adf03c..b3e17b88edf4 100644 --- a/src/client/formatters/yapfFormatter.ts +++ b/src/client/formatters/yapfFormatter.ts @@ -15,7 +15,7 @@ export class YapfFormatter extends BaseFormatter { document: vscode.TextDocument, options: vscode.FormattingOptions, token: vscode.CancellationToken, - range?: vscode.Range + range?: vscode.Range, ): Thenable { const stopWatch = new StopWatch(); const settings = this.serviceContainer diff --git a/src/client/interpreter/activation/preWarmVariables.ts b/src/client/interpreter/activation/preWarmVariables.ts index 1532b152eaab..301404716e65 100644 --- a/src/client/interpreter/activation/preWarmVariables.ts +++ b/src/client/interpreter/activation/preWarmVariables.ts @@ -13,11 +13,11 @@ import { IEnvironmentActivationService } from './types'; export class PreWarmActivatedEnvironmentVariables implements IExtensionSingleActivationService { constructor( @inject(IEnvironmentActivationService) private readonly activationService: IEnvironmentActivationService, - @inject(IInterpreterService) private readonly interpreterService: IInterpreterService + @inject(IInterpreterService) private readonly interpreterService: IInterpreterService, ) {} public async activate(): Promise { this.interpreterService.onDidChangeInterpreter(() => - this.activationService.getActivatedEnvironmentVariables(undefined).ignoreErrors() + this.activationService.getActivatedEnvironmentVariables(undefined).ignoreErrors(), ); this.activationService.getActivatedEnvironmentVariables(undefined).ignoreErrors(); } diff --git a/src/client/interpreter/activation/service.ts b/src/client/interpreter/activation/service.ts index e8355ee14ee3..d1fe199e5d35 100644 --- a/src/client/interpreter/activation/service.ts +++ b/src/client/interpreter/activation/service.ts @@ -32,12 +32,12 @@ const defaultShells = { [OSType.Windows]: { shell: 'cmd', shellType: TerminalShellType.commandPrompt }, [OSType.OSX]: { shell: 'bash', shellType: TerminalShellType.bash }, [OSType.Linux]: { shell: 'bash', shellType: TerminalShellType.bash }, - [OSType.Unknown]: undefined + [OSType.Unknown]: undefined, }; const condaRetryMessages = [ 'The process cannot access the file because it is being used by another process', - 'The directory is not empty' + 'The directory is not empty', ]; /** @@ -99,18 +99,18 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi @inject(ICurrentProcess) private currentProcess: ICurrentProcess, @inject(IWorkspaceService) private workspace: IWorkspaceService, @inject(IInterpreterService) private interpreterService: IInterpreterService, - @inject(IEnvironmentVariablesProvider) private readonly envVarsService: IEnvironmentVariablesProvider + @inject(IEnvironmentVariablesProvider) private readonly envVarsService: IEnvironmentVariablesProvider, ) { this.envVarsService.onDidEnvironmentVariablesChange( () => this.activatedEnvVariablesCache.clear(), this, - this.disposables + this.disposables, ); this.interpreterService.onDidChangeInterpreter( () => this.activatedEnvVariablesCache.clear(), this, - this.disposables + this.disposables, ); } @@ -122,7 +122,7 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi public async getActivatedEnvironmentVariables( resource: Resource, interpreter?: PythonEnvironment, - allowExceptions?: boolean + allowExceptions?: boolean, ): Promise { // Cache key = resource + interpreter. const workspaceKey = this.workspace.getWorkspaceFolderIdentifier(resource); @@ -145,7 +145,7 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi public async getActivatedEnvironmentVariablesImpl( resource: Resource, interpreter?: PythonEnvironment, - allowExceptions?: boolean + allowExceptions?: boolean, ): Promise { const shellInfo = defaultShells[this.platform.osType]; if (!shellInfo) { @@ -156,7 +156,7 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi const activationCommands = await this.helper.getEnvironmentActivationShellCommands( resource, shellInfo.shellType, - interpreter + interpreter, ); traceVerbose(`Activation Commands received ${activationCommands} for shell ${shellInfo.shell}`); if (!activationCommands || !Array.isArray(activationCommands) || activationCommands.length === 0) { @@ -202,7 +202,7 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi shell: shellInfo.shell, timeout: getEnvironmentTimeout, maxBuffer: 1000 * 1000, - throwOnStdErr: false + throwOnStdErr: false, }); if (result.stderr && result.stderr.length > 0) { throw new Error(`StdErr from ShellExec, ${result.stderr} for ${command}`); @@ -234,7 +234,7 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi traceError('getActivatedEnvironmentVariables', e); sendTelemetryEvent(EventName.ACTIVATE_ENV_TO_GET_ENV_VARS_FAILED, undefined, { isPossiblyCondaEnv, - terminal: shellInfo.shellType + terminal: shellInfo.shellType, }); // Some callers want this to bubble out, others don't diff --git a/src/client/interpreter/activation/terminalEnvironmentActivationService.ts b/src/client/interpreter/activation/terminalEnvironmentActivationService.ts index a29c005d6369..8b6e037b7203 100644 --- a/src/client/interpreter/activation/terminalEnvironmentActivationService.ts +++ b/src/client/interpreter/activation/terminalEnvironmentActivationService.ts @@ -32,18 +32,18 @@ export class TerminalEnvironmentActivationService implements IEnvironmentActivat constructor( @inject(ITerminalServiceFactory) private readonly terminalFactory: ITerminalServiceFactory, @inject(IFileSystem) private readonly fs: IFileSystem, - @inject(IEnvironmentVariablesProvider) private readonly envVarsProvider: IEnvironmentVariablesProvider + @inject(IEnvironmentVariablesProvider) private readonly envVarsProvider: IEnvironmentVariablesProvider, ) {} @traceDecorators.verbose('getActivatedEnvironmentVariables', LogOptions.Arguments) @captureTelemetry( EventName.PYTHON_INTERPRETER_ACTIVATION_ENVIRONMENT_VARIABLES, { failed: false, activatedInTerminal: true }, - true + true, ) public async getActivatedEnvironmentVariables( resource: Resource, interpreter?: PythonEnvironment | undefined, - _allowExceptions?: boolean | undefined + _allowExceptions?: boolean | undefined, ): Promise { const env = (await this.envVarsProvider.getCustomEnvironmentVariables(resource)) as | { [key: string]: string | null } @@ -53,7 +53,7 @@ export class TerminalEnvironmentActivationService implements IEnvironmentActivat hideFromUser: true, interpreter, resource, - title: `${interpreter?.displayName}${new Date().getTime()}` + title: `${interpreter?.displayName}${new Date().getTime()}`, }); const command = interpreter?.path || 'python'; diff --git a/src/client/interpreter/activation/types.ts b/src/client/interpreter/activation/types.ts index e8ae94e3f284..51383b026b0b 100644 --- a/src/client/interpreter/activation/types.ts +++ b/src/client/interpreter/activation/types.ts @@ -11,6 +11,6 @@ export interface IEnvironmentActivationService { getActivatedEnvironmentVariables( resource: Resource, interpreter?: PythonEnvironment, - allowExceptions?: boolean + allowExceptions?: boolean, ): Promise; } diff --git a/src/client/interpreter/activation/wrapperEnvironmentActivationService.ts b/src/client/interpreter/activation/wrapperEnvironmentActivationService.ts index 6bf4230ece33..ccb2cada81af 100644 --- a/src/client/interpreter/activation/wrapperEnvironmentActivationService.ts +++ b/src/client/interpreter/activation/wrapperEnvironmentActivationService.ts @@ -14,7 +14,7 @@ import { IDisposableRegistry, IExperimentsManager, IExtensionContext, - Resource + Resource, } from '../../common/types'; import { createDeferredFromPromise } from '../../common/utils/async'; import { IEnvironmentVariablesProvider } from '../../common/variables/types'; @@ -48,36 +48,36 @@ export class WrapperEnvironmentActivationService implements IEnvironmentActivati @inject(IFileSystem) private readonly fs: IFileSystem, @inject(ICryptoUtils) private readonly crypto: ICryptoUtils, - @inject(IDisposableRegistry) disposables: IDisposableRegistry + @inject(IDisposableRegistry) disposables: IDisposableRegistry, ) { // Environment variables rely on custom variables defined by the user in `.env` files. disposables.push( - envVarsProvider.onDidEnvironmentVariablesChange(() => this.cachePerResourceAndInterpreter.clear()) + envVarsProvider.onDidEnvironmentVariablesChange(() => this.cachePerResourceAndInterpreter.clear()), ); } @captureTelemetry( EventName.PYTHON_INTERPRETER_ACTIVATION_ENVIRONMENT_VARIABLES, { failed: false, activatedByWrapper: true }, - true + true, ) public async getActivatedEnvironmentVariables( resource: Resource, interpreter?: PythonEnvironment | undefined, - allowExceptions?: boolean | undefined + allowExceptions?: boolean | undefined, ): Promise { let key: string; [key, interpreter] = await Promise.all([ this.getCacheKey(resource, interpreter), - interpreter || (await this.interpreterService.getActiveInterpreter(undefined)) + interpreter || (await this.interpreterService.getActiveInterpreter(undefined)), ]); const procCacheKey = `Process${key}`; const terminalCacheKey = `Terminal${key}`; const procEnvVarsPromise = this.cacheCallback(procCacheKey, () => - this.getActivatedEnvVarsFromProc(resource, interpreter, allowExceptions) + this.getActivatedEnvVarsFromProc(resource, interpreter, allowExceptions), ); const terminalEnvVarsPromise = this.cacheCallback(terminalCacheKey, () => - this.getActivatedEnvVarsFromTerminal(procEnvVarsPromise, resource, interpreter, allowExceptions) + this.getActivatedEnvVarsFromTerminal(procEnvVarsPromise, resource, interpreter, allowExceptions), ); const procEnvVars = createDeferredFromPromise(procEnvVarsPromise); @@ -102,7 +102,7 @@ export class WrapperEnvironmentActivationService implements IEnvironmentActivati */ private async cacheCallback( cacheKey: string, - implementation: () => Promise + implementation: () => Promise, ): Promise { const contents = await this.getDataCachedInFile(cacheKey); if (contents) { @@ -160,7 +160,7 @@ export class WrapperEnvironmentActivationService implements IEnvironmentActivati private async getActivatedEnvVarsFromProc( resource: Resource, interpreter?: PythonEnvironment, - allowExceptions?: boolean + allowExceptions?: boolean, ): Promise { return this.procActivation.getActivatedEnvironmentVariables(resource, interpreter, allowExceptions); } @@ -172,7 +172,7 @@ export class WrapperEnvironmentActivationService implements IEnvironmentActivati fallback: Promise, resource: Resource, interpreter?: PythonEnvironment, - allowExceptions?: boolean + allowExceptions?: boolean, ): Promise { if (!this.experiment.inExperiment(UseTerminalToGetActivatedEnvVars.experiment)) { return fallback; @@ -208,7 +208,7 @@ export class WrapperEnvironmentActivationService implements IEnvironmentActivati return this.crypto.createHash( `${customEnvVariables}${interpreter?.path}${interpreter?.version?.raw}`, 'string', - 'SHA256' + 'SHA256', ); } } diff --git a/src/client/interpreter/autoSelection/index.ts b/src/client/interpreter/autoSelection/index.ts index a9ca7e1b4b25..9df489263a23 100644 --- a/src/client/interpreter/autoSelection/index.ts +++ b/src/client/interpreter/autoSelection/index.ts @@ -20,7 +20,7 @@ import { IInterpreterAutoSelectionRule, IInterpreterAutoSelectionService, IInterpreterAutoSeletionProxyService, - IInterpreterSecurityService + IInterpreterSecurityService, } from './types'; const preferredGlobalInterpreter = 'preferredGlobalPyInterpreter'; @@ -57,7 +57,7 @@ export class InterpreterAutoSelectionService implements IInterpreterAutoSelectio workspaceInterpreter: IInterpreterAutoSelectionRule, @inject(IInterpreterAutoSeletionProxyService) proxy: IInterpreterAutoSeletionProxyService, @inject(IInterpreterHelper) private readonly interpreterHelper: IInterpreterHelper, - @inject(IInterpreterSecurityService) private readonly interpreterSecurityService: IInterpreterSecurityService + @inject(IInterpreterSecurityService) private readonly interpreterSecurityService: IInterpreterSecurityService, ) { // It is possible we area always opening the same workspace folder, but we still need to determine and cache // the best available interpreters based on other rules (cache for furture use). @@ -68,8 +68,8 @@ export class InterpreterAutoSelectionService implements IInterpreterAutoSelectio systemInterpreter, cachedPaths, userDefinedInterpreter, - workspaceInterpreter - ] + workspaceInterpreter, + ], ); proxy.registerInstance!(this); // Rules are as follows in order diff --git a/src/client/interpreter/autoSelection/interpreterSecurity/interpreterEvaluation.ts b/src/client/interpreter/autoSelection/interpreterSecurity/interpreterEvaluation.ts index 0a0ba074e3d1..31e6073207fd 100644 --- a/src/client/interpreter/autoSelection/interpreterSecurity/interpreterEvaluation.ts +++ b/src/client/interpreter/autoSelection/interpreterSecurity/interpreterEvaluation.ts @@ -21,7 +21,7 @@ const telemetrySelections: ['Yes', 'No', 'Learn more', 'Do not show again'] = [ 'Yes', 'No', 'Learn more', - 'Do not show again' + 'Do not show again', ]; @injectable() @@ -30,7 +30,7 @@ export class InterpreterEvaluation implements IInterpreterEvaluation { @inject(IApplicationShell) private readonly appShell: IApplicationShell, @inject(IBrowserService) private browserService: IBrowserService, @inject(IInterpreterHelper) private readonly interpreterHelper: IInterpreterHelper, - @inject(IInterpreterSecurityStorage) private readonly interpreterSecurityStorage: IInterpreterSecurityStorage + @inject(IInterpreterSecurityStorage) private readonly interpreterSecurityStorage: IInterpreterSecurityStorage, ) {} public async evaluateIfInterpreterIsSafe(interpreter: PythonEnvironment, resource: Resource): Promise { @@ -62,7 +62,7 @@ export class InterpreterEvaluation implements IInterpreterEvaluation { public async _inferValueUsingPrompt(activeWorkspaceUri: Uri): Promise { const areInterpretersInWorkspaceSafe = this.interpreterSecurityStorage.hasUserApprovedWorkspaceInterpreters( - activeWorkspaceUri + activeWorkspaceUri, ); await this.interpreterSecurityStorage.storeKeyForWorkspace(activeWorkspaceUri); let selection = await this.showPromptAndGetSelection(); @@ -83,10 +83,10 @@ export class InterpreterEvaluation implements IInterpreterEvaluation { private async showPromptAndGetSelection(): Promise { const selection = await this.appShell.showInformationMessage( Interpreters.unsafeInterpreterMessage(), - ...prompts + ...prompts, ); sendTelemetryEvent(EventName.UNSAFE_INTERPRETER_PROMPT, undefined, { - selection: selection ? telemetrySelections[prompts.indexOf(selection)] : undefined + selection: selection ? telemetrySelections[prompts.indexOf(selection)] : undefined, }); return selection; } diff --git a/src/client/interpreter/autoSelection/interpreterSecurity/interpreterSecurityService.ts b/src/client/interpreter/autoSelection/interpreterSecurity/interpreterSecurityService.ts index 72f09e347f7b..ed7d0321aa2f 100644 --- a/src/client/interpreter/autoSelection/interpreterSecurity/interpreterSecurityService.ts +++ b/src/client/interpreter/autoSelection/interpreterSecurity/interpreterSecurityService.ts @@ -14,7 +14,7 @@ export class InterpreterSecurityService implements IInterpreterSecurityService { public _didSafeInterpretersChange = new EventEmitter(); constructor( @inject(IInterpreterSecurityStorage) private readonly interpreterSecurityStorage: IInterpreterSecurityStorage, - @inject(IInterpreterEvaluation) private readonly interpreterEvaluation: IInterpreterEvaluation + @inject(IInterpreterEvaluation) private readonly interpreterEvaluation: IInterpreterEvaluation, ) {} public isSafe(interpreter: PythonEnvironment, resource?: Resource): boolean | undefined { @@ -41,7 +41,7 @@ export class InterpreterSecurityService implements IInterpreterSecurityService { } else { await this.interpreterSecurityStorage.unsafeInterpreters.updateValue([ interpreter.path, - ...unsafeInterpreters + ...unsafeInterpreters, ]); } this._didSafeInterpretersChange.fire(); diff --git a/src/client/interpreter/autoSelection/interpreterSecurity/interpreterSecurityStorage.ts b/src/client/interpreter/autoSelection/interpreterSecurity/interpreterSecurityStorage.ts index f75317a859cb..fb0d9343cc6f 100644 --- a/src/client/interpreter/autoSelection/interpreterSecurity/interpreterSecurityStorage.ts +++ b/src/client/interpreter/autoSelection/interpreterSecurity/interpreterSecurityStorage.ts @@ -12,7 +12,7 @@ import { flaggedWorkspacesKeysStorageKey, safeInterpretersKey, unsafeInterpreterPromptKey, - unsafeInterpretersKey + unsafeInterpretersKey, } from '../constants'; import { IInterpreterSecurityStorage } from '../types'; @@ -36,30 +36,30 @@ export class InterpreterSecurityStorage implements IInterpreterSecurityStorage { @inject(IPersistentStateFactory) private readonly persistentStateFactory: IPersistentStateFactory, @inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService, @inject(ICommandManager) private readonly commandManager: ICommandManager, - @inject(IDisposableRegistry) private readonly disposables: IDisposable[] + @inject(IDisposableRegistry) private readonly disposables: IDisposable[], ) { this._unsafeInterpreterPromptEnabled = this.persistentStateFactory.createGlobalPersistentState( unsafeInterpreterPromptKey, - true + true, ); this._unsafeInterpreters = this.persistentStateFactory.createGlobalPersistentState( unsafeInterpretersKey, - [] + [], ); this._safeInterpreters = this.persistentStateFactory.createGlobalPersistentState( safeInterpretersKey, - [] + [], ); this.flaggedWorkspacesKeysStorage = this.persistentStateFactory.createGlobalPersistentState( flaggedWorkspacesKeysStorageKey, - [] + [], ); } public hasUserApprovedWorkspaceInterpreters(resource: Uri): IPersistentState { return this.persistentStateFactory.createGlobalPersistentState( this._getKeyForWorkspace(resource), - undefined + undefined, ); } @@ -67,8 +67,8 @@ export class InterpreterSecurityStorage implements IInterpreterSecurityStorage { this.disposables.push( this.commandManager.registerCommand( Commands.ResetInterpreterSecurityStorage, - this.resetInterpreterSecurityStorage.bind(this) - ) + this.resetInterpreterSecurityStorage.bind(this), + ), ); } diff --git a/src/client/interpreter/autoSelection/proxy.ts b/src/client/interpreter/autoSelection/proxy.ts index 7fef629f1463..606f7b688b5f 100644 --- a/src/client/interpreter/autoSelection/proxy.ts +++ b/src/client/interpreter/autoSelection/proxy.ts @@ -17,7 +17,7 @@ export class InterpreterAutoSeletionProxyService implements IInterpreterAutoSele public registerInstance(instance: IInterpreterAutoSeletionProxyService): void { this.instance = instance; this.disposables.push( - this.instance.onDidChangeAutoSelectedInterpreter(() => this.didAutoSelectedInterpreterEmitter.fire()) + this.instance.onDidChangeAutoSelectedInterpreter(() => this.didAutoSelectedInterpreterEmitter.fire()), ); } public get onDidChangeAutoSelectedInterpreter(): Event { diff --git a/src/client/interpreter/autoSelection/rules/baseRule.ts b/src/client/interpreter/autoSelection/rules/baseRule.ts index 5edae0a6c3e4..e6337786cb45 100644 --- a/src/client/interpreter/autoSelection/rules/baseRule.ts +++ b/src/client/interpreter/autoSelection/rules/baseRule.ts @@ -17,7 +17,7 @@ import { AutoSelectionRule, IInterpreterAutoSelectionRule, IInterpreterAutoSelec export enum NextAction { runNextRule = 'runNextRule', - exit = 'exit' + exit = 'exit', } @injectable() @@ -27,11 +27,11 @@ export abstract class BaseRuleService implements IInterpreterAutoSelectionRule { constructor( @unmanaged() protected readonly ruleName: AutoSelectionRule, @inject(IFileSystem) private readonly fs: IFileSystem, - @inject(IPersistentStateFactory) stateFactory: IPersistentStateFactory + @inject(IPersistentStateFactory) stateFactory: IPersistentStateFactory, ) { this.stateStore = stateFactory.createGlobalPersistentState( `InterpreterAutoSeletionRule-${this.ruleName}`, - undefined + undefined, ); } public setNextRule(rule: IInterpreterAutoSelectionRule): void { @@ -47,7 +47,7 @@ export abstract class BaseRuleService implements IInterpreterAutoSelectionRule { sendTelemetryEvent( EventName.PYTHON_INTERPRETER_AUTO_SELECTION, { elapsedTime: stopWatch.elapsedTime }, - { rule: this.ruleName, identified } + { rule: this.ruleName, identified }, ); if (action === NextAction.runNextRule) { await this.next(resource, manager); @@ -60,12 +60,12 @@ export abstract class BaseRuleService implements IInterpreterAutoSelectionRule { } protected abstract onAutoSelectInterpreter( resource: Resource, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise; @traceDecorators.verbose('setGlobalInterpreter') protected async setGlobalInterpreter( interpreter?: PythonEnvironment, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise { await this.cacheSelectedInterpreter(undefined, interpreter); if (!interpreter || !manager || !interpreter.version) { @@ -93,7 +93,7 @@ export abstract class BaseRuleService implements IInterpreterAutoSelectionRule { sendTelemetryEvent( EventName.PYTHON_INTERPRETER_AUTO_SELECTION, {}, - { rule: this.ruleName, interpreterMissing: true } + { rule: this.ruleName, interpreterMissing: true }, ); await this.cacheSelectedInterpreter(resource, undefined); } diff --git a/src/client/interpreter/autoSelection/rules/cached.ts b/src/client/interpreter/autoSelection/rules/cached.ts index 134a53203051..e611a373ae9e 100644 --- a/src/client/interpreter/autoSelection/rules/cached.ts +++ b/src/client/interpreter/autoSelection/rules/cached.ts @@ -26,14 +26,14 @@ export class CachedInterpretersAutoSelectionRule extends BaseRuleService { currentPathInterpreter: IInterpreterAutoSelectionRule, @inject(IInterpreterAutoSelectionRule) @named(AutoSelectionRule.windowsRegistry) - winRegInterpreter: IInterpreterAutoSelectionRule + winRegInterpreter: IInterpreterAutoSelectionRule, ) { super(AutoSelectionRule.cachedInterpreters, fs, stateFactory); this.rules = [systemInterpreter, currentPathInterpreter, winRegInterpreter]; } protected async onAutoSelectInterpreter( resource: Resource, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise { const cachedInterpreters = this.rules .map((item) => item.getPreviouslyAutoSelectedInterpreter(resource)) @@ -43,7 +43,7 @@ export class CachedInterpretersAutoSelectionRule extends BaseRuleService { traceVerbose( `Selected Interpreter from ${this.ruleName}, ${ bestInterpreter ? JSON.stringify(bestInterpreter) : 'Nothing Selected' - }` + }`, ); return (await this.setGlobalInterpreter(bestInterpreter, manager)) ? NextAction.exit : NextAction.runNextRule; } diff --git a/src/client/interpreter/autoSelection/rules/currentPath.ts b/src/client/interpreter/autoSelection/rules/currentPath.ts index a45f9cbbc98b..3d6a8dc594a9 100644 --- a/src/client/interpreter/autoSelection/rules/currentPath.ts +++ b/src/client/interpreter/autoSelection/rules/currentPath.ts @@ -19,20 +19,20 @@ export class CurrentPathInterpretersAutoSelectionRule extends BaseRuleService { @inject(IPersistentStateFactory) stateFactory: IPersistentStateFactory, @inject(IInterpreterLocatorService) @named(CURRENT_PATH_SERVICE) - private readonly currentPathInterpreterLocator: IInterpreterLocatorService + private readonly currentPathInterpreterLocator: IInterpreterLocatorService, ) { super(AutoSelectionRule.currentPath, fs, stateFactory); } protected async onAutoSelectInterpreter( resource: Resource, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise { const interpreters = await this.currentPathInterpreterLocator.getInterpreters(resource); const bestInterpreter = this.helper.getBestInterpreter(interpreters); traceVerbose( `Selected Interpreter from ${this.ruleName}, ${ bestInterpreter ? JSON.stringify(bestInterpreter) : 'Nothing Selected' - }` + }`, ); return (await this.setGlobalInterpreter(bestInterpreter, manager)) ? NextAction.exit : NextAction.runNextRule; } diff --git a/src/client/interpreter/autoSelection/rules/settings.ts b/src/client/interpreter/autoSelection/rules/settings.ts index eae85e915ca2..9a00549f384d 100644 --- a/src/client/interpreter/autoSelection/rules/settings.ts +++ b/src/client/interpreter/autoSelection/rules/settings.ts @@ -18,13 +18,13 @@ export class SettingsInterpretersAutoSelectionRule extends BaseRuleService { @inject(IPersistentStateFactory) stateFactory: IPersistentStateFactory, @inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService, @inject(IExperimentsManager) private readonly experiments: IExperimentsManager, - @inject(IInterpreterPathService) private readonly interpreterPathService: IInterpreterPathService + @inject(IInterpreterPathService) private readonly interpreterPathService: IInterpreterPathService, ) { super(AutoSelectionRule.settings, fs, stateFactory); } protected async onAutoSelectInterpreter( _resource: Resource, - _manager?: IInterpreterAutoSelectionService + _manager?: IInterpreterAutoSelectionService, ): Promise { // tslint:disable-next-line:no-any const pythonConfig = this.workspaceService.getConfiguration('python', null as any)!; diff --git a/src/client/interpreter/autoSelection/rules/system.ts b/src/client/interpreter/autoSelection/rules/system.ts index 00be6177cdff..ed11420fe279 100644 --- a/src/client/interpreter/autoSelection/rules/system.ts +++ b/src/client/interpreter/autoSelection/rules/system.ts @@ -18,13 +18,13 @@ export class SystemWideInterpretersAutoSelectionRule extends BaseRuleService { @inject(IFileSystem) fs: IFileSystem, @inject(IInterpreterHelper) private readonly helper: IInterpreterHelper, @inject(IPersistentStateFactory) stateFactory: IPersistentStateFactory, - @inject(IInterpreterService) private readonly interpreterService: IInterpreterService + @inject(IInterpreterService) private readonly interpreterService: IInterpreterService, ) { super(AutoSelectionRule.systemWide, fs, stateFactory); } protected async onAutoSelectInterpreter( resource: Resource, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise { const interpreters = await this.interpreterService.getInterpreters(resource); // Exclude non-local interpreters. @@ -32,13 +32,13 @@ export class SystemWideInterpretersAutoSelectionRule extends BaseRuleService { (int) => int.envType !== EnvironmentType.VirtualEnv && int.envType !== EnvironmentType.Venv && - int.envType !== EnvironmentType.Pipenv + int.envType !== EnvironmentType.Pipenv, ); const bestInterpreter = this.helper.getBestInterpreter(filteredInterpreters); traceVerbose( `Selected Interpreter from ${this.ruleName}, ${ bestInterpreter ? JSON.stringify(bestInterpreter) : 'Nothing Selected' - }` + }`, ); return (await this.setGlobalInterpreter(bestInterpreter, manager)) ? NextAction.exit : NextAction.runNextRule; } diff --git a/src/client/interpreter/autoSelection/rules/winRegistry.ts b/src/client/interpreter/autoSelection/rules/winRegistry.ts index 2442e52eaf24..00676372495b 100644 --- a/src/client/interpreter/autoSelection/rules/winRegistry.ts +++ b/src/client/interpreter/autoSelection/rules/winRegistry.ts @@ -21,13 +21,13 @@ export class WindowsRegistryInterpretersAutoSelectionRule extends BaseRuleServic @inject(IPlatformService) private readonly platform: IPlatformService, @inject(IInterpreterLocatorService) @named(WINDOWS_REGISTRY_SERVICE) - private winRegInterpreterLocator: IInterpreterLocatorService + private winRegInterpreterLocator: IInterpreterLocatorService, ) { super(AutoSelectionRule.windowsRegistry, fs, stateFactory); } protected async onAutoSelectInterpreter( resource: Resource, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise { if (this.platform.osType !== OSType.Windows) { return NextAction.runNextRule; @@ -37,7 +37,7 @@ export class WindowsRegistryInterpretersAutoSelectionRule extends BaseRuleServic traceVerbose( `Selected Interpreter from ${this.ruleName}, ${ bestInterpreter ? JSON.stringify(bestInterpreter) : 'Nothing Selected' - }` + }`, ); return (await this.setGlobalInterpreter(bestInterpreter, manager)) ? NextAction.exit : NextAction.runNextRule; } diff --git a/src/client/interpreter/autoSelection/rules/workspaceEnv.ts b/src/client/interpreter/autoSelection/rules/workspaceEnv.ts index 99b2b1f91a2e..81465e9e2837 100644 --- a/src/client/interpreter/autoSelection/rules/workspaceEnv.ts +++ b/src/client/interpreter/autoSelection/rules/workspaceEnv.ts @@ -29,13 +29,13 @@ export class WorkspaceVirtualEnvInterpretersAutoSelectionRule extends BaseRuleSe @named(WORKSPACE_VIRTUAL_ENV_SERVICE) private readonly workspaceVirtualEnvInterpreterLocator: IInterpreterLocatorService, @inject(IExperimentsManager) private readonly experiments: IExperimentsManager, - @inject(IInterpreterPathService) private readonly interpreterPathService: IInterpreterPathService + @inject(IInterpreterPathService) private readonly interpreterPathService: IInterpreterPathService, ) { super(AutoSelectionRule.workspaceVirtualEnvs, fs, stateFactory); } protected async onAutoSelectInterpreter( resource: Resource, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise { const workspacePath = this.helper.getActiveWorkspaceUri(resource); if (!workspacePath) { @@ -52,7 +52,7 @@ export class WorkspaceVirtualEnvInterpretersAutoSelectionRule extends BaseRuleSe return NextAction.runNextRule; } const virtualEnvPromise = createDeferredFromPromise( - this.getWorkspaceVirtualEnvInterpreters(workspacePath.folderUri) + this.getWorkspaceVirtualEnvInterpreters(workspacePath.folderUri), ); const interpreters = await virtualEnvPromise.promise; @@ -69,7 +69,7 @@ export class WorkspaceVirtualEnvInterpretersAutoSelectionRule extends BaseRuleSe traceVerbose( `Selected Interpreter from ${this.ruleName}, ${ bestInterpreter ? JSON.stringify(bestInterpreter) : 'Nothing Selected' - }` + }`, ); return NextAction.runNextRule; } @@ -83,7 +83,7 @@ export class WorkspaceVirtualEnvInterpretersAutoSelectionRule extends BaseRuleSe } // Now check virtual environments under the workspace root const interpreters = await this.workspaceVirtualEnvInterpreterLocator.getInterpreters(resource, { - ignoreCache: true + ignoreCache: true, }); const workspacePath = this.platform.osType === OSType.Windows diff --git a/src/client/interpreter/autoSelection/types.ts b/src/client/interpreter/autoSelection/types.ts index 03b952ece6f0..bc3e2473e559 100644 --- a/src/client/interpreter/autoSelection/types.ts +++ b/src/client/interpreter/autoSelection/types.ts @@ -41,7 +41,7 @@ export enum AutoSelectionRule { settings = 'settings', cachedInterpreters = 'cachedInterpreters', systemWide = 'system', - windowsRegistry = 'windowsRegistry' + windowsRegistry = 'windowsRegistry', } export const IInterpreterAutoSelectionRule = Symbol('IInterpreterAutoSelectionRule'); diff --git a/src/client/interpreter/configuration/interpreterSelector/commands/base.ts b/src/client/interpreter/configuration/interpreterSelector/commands/base.ts index d47bcab9aff5..e4defaadf20c 100644 --- a/src/client/interpreter/configuration/interpreterSelector/commands/base.ts +++ b/src/client/interpreter/configuration/interpreterSelector/commands/base.ts @@ -19,7 +19,7 @@ export abstract class BaseInterpreterSelectorCommand implements IExtensionSingle @unmanaged() protected readonly pythonPathUpdaterService: IPythonPathUpdaterServiceManager, @unmanaged() protected readonly commandManager: ICommandManager, @unmanaged() protected readonly applicationShell: IApplicationShell, - @unmanaged() protected readonly workspaceService: IWorkspaceService + @unmanaged() protected readonly workspaceService: IWorkspaceService, ) { this.disposables.push(this); } @@ -43,13 +43,13 @@ export abstract class BaseInterpreterSelectorCommand implements IExtensionSingle ) { return { folderUri: undefined, - configTarget: ConfigurationTarget.Global + configTarget: ConfigurationTarget.Global, }; } if (!this.workspaceService.workspaceFile && this.workspaceService.workspaceFolders.length === 1) { return { folderUri: this.workspaceService.workspaceFolders[0].uri, - configTarget: ConfigurationTarget.WorkspaceFolder + configTarget: ConfigurationTarget.WorkspaceFolder, }; } @@ -60,16 +60,16 @@ export abstract class BaseInterpreterSelectorCommand implements IExtensionSingle ...this.workspaceService.workspaceFolders.map((w) => ({ label: w.name, description: path.dirname(w.uri.fsPath), - uri: w.uri + uri: w.uri, })), { label: Interpreters.entireWorkspace(), - uri: this.workspaceService.workspaceFolders[0].uri - } + uri: this.workspaceService.workspaceFolders[0].uri, + }, ]; const selection = await this.applicationShell.showQuickPick(quickPickItems, { - placeHolder: 'Select the workspace to set the interpreter' + placeHolder: 'Select the workspace to set the interpreter', }); return selection diff --git a/src/client/interpreter/configuration/interpreterSelector/commands/resetInterpreter.ts b/src/client/interpreter/configuration/interpreterSelector/commands/resetInterpreter.ts index b605b15389be..7864a3133bf8 100644 --- a/src/client/interpreter/configuration/interpreterSelector/commands/resetInterpreter.ts +++ b/src/client/interpreter/configuration/interpreterSelector/commands/resetInterpreter.ts @@ -15,14 +15,14 @@ export class ResetInterpreterCommand extends BaseInterpreterSelectorCommand { @inject(IPythonPathUpdaterServiceManager) pythonPathUpdaterService: IPythonPathUpdaterServiceManager, @inject(ICommandManager) commandManager: ICommandManager, @inject(IApplicationShell) applicationShell: IApplicationShell, - @inject(IWorkspaceService) workspaceService: IWorkspaceService + @inject(IWorkspaceService) workspaceService: IWorkspaceService, ) { super(pythonPathUpdaterService, commandManager, applicationShell, workspaceService); } public async activate() { this.disposables.push( - this.commandManager.registerCommand(Commands.ClearWorkspaceInterpreter, this.resetInterpreter.bind(this)) + this.commandManager.registerCommand(Commands.ClearWorkspaceInterpreter, this.resetInterpreter.bind(this)), ); } diff --git a/src/client/interpreter/configuration/interpreterSelector/commands/setInterpreter.ts b/src/client/interpreter/configuration/interpreterSelector/commands/setInterpreter.ts index 6eca20465b84..8387e5230f38 100644 --- a/src/client/interpreter/configuration/interpreterSelector/commands/setInterpreter.ts +++ b/src/client/interpreter/configuration/interpreterSelector/commands/setInterpreter.ts @@ -14,7 +14,7 @@ import { IMultiStepInput, IMultiStepInputFactory, InputStep, - IQuickPickParameters + IQuickPickParameters, } from '../../../../common/utils/multiStepInput'; import { captureTelemetry, sendTelemetryEvent } from '../../../../telemetry'; import { EventName } from '../../../../telemetry/constants'; @@ -34,31 +34,31 @@ export class SetInterpreterCommand extends BaseInterpreterSelectorCommand { @inject(IMultiStepInputFactory) private readonly multiStepFactory: IMultiStepInputFactory, @inject(IPlatformService) private readonly platformService: IPlatformService, @inject(IInterpreterSelector) private readonly interpreterSelector: IInterpreterSelector, - @inject(IWorkspaceService) workspaceService: IWorkspaceService + @inject(IWorkspaceService) workspaceService: IWorkspaceService, ) { super(pythonPathUpdaterService, commandManager, applicationShell, workspaceService); } public async activate() { this.disposables.push( - this.commandManager.registerCommand(Commands.Set_Interpreter, this.setInterpreter.bind(this)) + this.commandManager.registerCommand(Commands.Set_Interpreter, this.setInterpreter.bind(this)), ); } public async _pickInterpreter( input: IMultiStepInput, - state: InterpreterStateArgs + state: InterpreterStateArgs, ): Promise> { const interpreterSuggestions = await this.interpreterSelector.getSuggestions(state.workspace); const enterInterpreterPathSuggestion = { label: InterpreterQuickPickList.enterPath.label(), detail: InterpreterQuickPickList.enterPath.detail(), - alwaysShow: true + alwaysShow: true, }; const suggestions = [enterInterpreterPathSuggestion, ...interpreterSuggestions]; const currentPythonPath = this.pathUtils.getDisplayName( this.configurationService.getSettings(state.workspace).pythonPath, - state.workspace ? state.workspace.fsPath : undefined + state.workspace ? state.workspace.fsPath : undefined, ); state.path = undefined; @@ -70,7 +70,7 @@ export class SetInterpreterCommand extends BaseInterpreterSelectorCommand { items: suggestions, activeItem: suggestions[1], matchOnDetail: true, - matchOnDescription: true + matchOnDescription: true, }); if (selection === undefined) { @@ -85,19 +85,19 @@ export class SetInterpreterCommand extends BaseInterpreterSelectorCommand { @captureTelemetry(EventName.SELECT_INTERPRETER_ENTER_BUTTON) public async _enterOrBrowseInterpreterPath( input: IMultiStepInput, - state: InterpreterStateArgs + state: InterpreterStateArgs, ): Promise> { const items: QuickPickItem[] = [ { label: InterpreterQuickPickList.browsePath.label(), - detail: InterpreterQuickPickList.browsePath.detail() - } + detail: InterpreterQuickPickList.browsePath.detail(), + }, ]; const selection = await input.showQuickPick({ placeholder: InterpreterQuickPickList.enterPath.placeholder(), items, - acceptFilterBoxTextAsSelection: true + acceptFilterBoxTextAsSelection: true, }); if (typeof selection === 'string') { @@ -113,7 +113,7 @@ export class SetInterpreterCommand extends BaseInterpreterSelectorCommand { filters: this.platformService.isWindows ? filtersObject : undefined, openLabel: InterpreterQuickPickList.browsePath.openButtonLabel(), canSelectMany: false, - title: InterpreterQuickPickList.browsePath.title() + title: InterpreterQuickPickList.browsePath.title(), }); if (uris && uris.length > 0) { state.path = uris[0].fsPath; diff --git a/src/client/interpreter/configuration/interpreterSelector/commands/setShebangInterpreter.ts b/src/client/interpreter/configuration/interpreterSelector/commands/setShebangInterpreter.ts index e3e63b299f83..72d5b65ced8a 100644 --- a/src/client/interpreter/configuration/interpreterSelector/commands/setShebangInterpreter.ts +++ b/src/client/interpreter/configuration/interpreterSelector/commands/setShebangInterpreter.ts @@ -9,7 +9,7 @@ import { IApplicationShell, ICommandManager, IDocumentManager, - IWorkspaceService + IWorkspaceService, } from '../../../../common/application/types'; import { Commands } from '../../../../common/constants'; import { IShebangCodeLensProvider } from '../../../contracts'; @@ -24,21 +24,21 @@ export class SetShebangInterpreterCommand extends BaseInterpreterSelectorCommand @inject(IPythonPathUpdaterServiceManager) pythonPathUpdaterService: IPythonPathUpdaterServiceManager, @inject(IShebangCodeLensProvider) private readonly shebangCodeLensProvider: IShebangCodeLensProvider, @inject(ICommandManager) commandManager: ICommandManager, - @inject(ICommandManager) applicationShell: IApplicationShell + @inject(ICommandManager) applicationShell: IApplicationShell, ) { super(pythonPathUpdaterService, commandManager, applicationShell, workspaceService); } public async activate() { this.disposables.push( - this.commandManager.registerCommand(Commands.Set_ShebangInterpreter, this.setShebangInterpreter.bind(this)) + this.commandManager.registerCommand(Commands.Set_ShebangInterpreter, this.setShebangInterpreter.bind(this)), ); } protected async setShebangInterpreter(): Promise { const shebang = await this.shebangCodeLensProvider.detectShebang( this.documentManager.activeTextEditor!.document, - true + true, ); if (!shebang) { return; @@ -48,7 +48,7 @@ export class SetShebangInterpreterCommand extends BaseInterpreterSelectorCommand !Array.isArray(this.workspaceService.workspaceFolders) || this.workspaceService.workspaceFolders.length === 0; const workspaceFolder = this.workspaceService.getWorkspaceFolder( - this.documentManager.activeTextEditor!.document.uri + this.documentManager.activeTextEditor!.document.uri, ); const isWorkspaceChange = Array.isArray(this.workspaceService.workspaceFolders) && @@ -64,7 +64,7 @@ export class SetShebangInterpreterCommand extends BaseInterpreterSelectorCommand shebang, ConfigurationTarget.Workspace, 'shebang', - this.workspaceService.workspaceFolders![0].uri + this.workspaceService.workspaceFolders![0].uri, ); return; } @@ -73,7 +73,7 @@ export class SetShebangInterpreterCommand extends BaseInterpreterSelectorCommand shebang, ConfigurationTarget.WorkspaceFolder, 'shebang', - workspaceFolder.uri + workspaceFolder.uri, ); } } diff --git a/src/client/interpreter/configuration/interpreterSelector/interpreterSelector.ts b/src/client/interpreter/configuration/interpreterSelector/interpreterSelector.ts index e8f9a7356e31..5595163e0485 100644 --- a/src/client/interpreter/configuration/interpreterSelector/interpreterSelector.ts +++ b/src/client/interpreter/configuration/interpreterSelector/interpreterSelector.ts @@ -21,7 +21,7 @@ export class InterpreterSelector implements IInterpreterSelector { @inject(IInterpreterComparer) private readonly interpreterComparer: IInterpreterComparer, @inject(IExperimentsManager) private readonly experimentsManager: IExperimentsManager, @inject(IInterpreterSecurityService) private readonly interpreterSecurityService: IInterpreterSecurityService, - @inject(IPathUtils) private readonly pathUtils: IPathUtils + @inject(IPathUtils) private readonly pathUtils: IPathUtils, ) {} public dispose() { this.disposables.forEach((disposable) => disposable.dispose()); @@ -41,7 +41,7 @@ export class InterpreterSelector implements IInterpreterSelector { protected async suggestionToQuickPickItem( suggestion: PythonEnvironment, - workspaceUri?: Uri + workspaceUri?: Uri, ): Promise { const detail = this.pathUtils.getDisplayName(suggestion.path, workspaceUri ? workspaceUri.fsPath : undefined); const cachedPrefix = suggestion.cachedEntry ? '(cached) ' : ''; @@ -50,7 +50,7 @@ export class InterpreterSelector implements IInterpreterSelector { label: suggestion.displayName!, detail: `${cachedPrefix}${detail}`, path: suggestion.path, - interpreter: suggestion + interpreter: suggestion, }; } } diff --git a/src/client/interpreter/configuration/pythonPathUpdaterService.ts b/src/client/interpreter/configuration/pythonPathUpdaterService.ts index 8ad4a38f3155..575af5d67d8b 100644 --- a/src/client/interpreter/configuration/pythonPathUpdaterService.ts +++ b/src/client/interpreter/configuration/pythonPathUpdaterService.ts @@ -19,7 +19,7 @@ export class PythonPathUpdaterService implements IPythonPathUpdaterServiceManage private readonly executionFactory: IPythonExecutionFactory; constructor(@inject(IServiceContainer) serviceContainer: IServiceContainer) { this.pythonPathSettingsUpdaterFactory = serviceContainer.get( - IPythonPathUpdaterServiceFactory + IPythonPathUpdaterServiceFactory, ); this.interpreterVersionService = serviceContainer.get(IInterpreterVersionService); this.executionFactory = serviceContainer.get(IPythonExecutionFactory); @@ -28,7 +28,7 @@ export class PythonPathUpdaterService implements IPythonPathUpdaterServiceManage pythonPath: string | undefined, configTarget: ConfigurationTarget, trigger: 'ui' | 'shebang' | 'load', - wkspace?: Uri + wkspace?: Uri, ): Promise { const stopWatch = new StopWatch(); const pythonPathUpdater = this.getPythonUpdaterService(configTarget, wkspace); @@ -44,18 +44,18 @@ export class PythonPathUpdaterService implements IPythonPathUpdaterServiceManage } // do not wait for this to complete this.sendTelemetry(stopWatch.elapsedTime, failed, trigger, pythonPath).catch((ex) => - traceError('Python Extension: sendTelemetry', ex) + traceError('Python Extension: sendTelemetry', ex), ); } private async sendTelemetry( duration: number, failed: boolean, trigger: 'ui' | 'shebang' | 'load', - pythonPath: string | undefined + pythonPath: string | undefined, ) { const telemetryProperties: PythonInterpreterTelemetry = { failed, - trigger + trigger, }; if (!failed && pythonPath) { const processService = await this.executionFactory.create({ pythonPath }); diff --git a/src/client/interpreter/configuration/pythonPathUpdaterServiceFactory.ts b/src/client/interpreter/configuration/pythonPathUpdaterServiceFactory.ts index aecf7beeb5b6..e7014a4479d8 100644 --- a/src/client/interpreter/configuration/pythonPathUpdaterServiceFactory.ts +++ b/src/client/interpreter/configuration/pythonPathUpdaterServiceFactory.ts @@ -25,7 +25,7 @@ export class PythonPathUpdaterServiceFactory implements IPythonPathUpdaterServic return new GlobalPythonPathUpdaterService( this.inDeprecatePythonPathExperiment, this.workspaceService, - this.interpreterPathService + this.interpreterPathService, ); } public getWorkspacePythonPathConfigurationService(wkspace: Uri): IPythonPathUpdaterService { @@ -33,7 +33,7 @@ export class PythonPathUpdaterServiceFactory implements IPythonPathUpdaterServic wkspace, this.inDeprecatePythonPathExperiment, this.workspaceService, - this.interpreterPathService + this.interpreterPathService, ); } public getWorkspaceFolderPythonPathConfigurationService(workspaceFolder: Uri): IPythonPathUpdaterService { @@ -41,7 +41,7 @@ export class PythonPathUpdaterServiceFactory implements IPythonPathUpdaterServic workspaceFolder, this.inDeprecatePythonPathExperiment, this.workspaceService, - this.interpreterPathService + this.interpreterPathService, ); } } diff --git a/src/client/interpreter/configuration/services/globalUpdaterService.ts b/src/client/interpreter/configuration/services/globalUpdaterService.ts index 39a1c1731019..9070feaf7c87 100644 --- a/src/client/interpreter/configuration/services/globalUpdaterService.ts +++ b/src/client/interpreter/configuration/services/globalUpdaterService.ts @@ -7,7 +7,7 @@ export class GlobalPythonPathUpdaterService implements IPythonPathUpdaterService constructor( private readonly inDeprecatePythonPathExperiment: boolean, private readonly workspaceService: IWorkspaceService, - private readonly interpreterPathService: IInterpreterPathService + private readonly interpreterPathService: IInterpreterPathService, ) {} public async updatePythonPath(pythonPath: string | undefined): Promise { const pythonConfig = this.workspaceService.getConfiguration('python'); diff --git a/src/client/interpreter/configuration/services/workspaceFolderUpdaterService.ts b/src/client/interpreter/configuration/services/workspaceFolderUpdaterService.ts index 3e7888bab2b3..b932f2abf1fa 100644 --- a/src/client/interpreter/configuration/services/workspaceFolderUpdaterService.ts +++ b/src/client/interpreter/configuration/services/workspaceFolderUpdaterService.ts @@ -9,7 +9,7 @@ export class WorkspaceFolderPythonPathUpdaterService implements IPythonPathUpdat private workspaceFolder: Uri, private readonly inDeprecatePythonPathExperiment: boolean, private readonly workspaceService: IWorkspaceService, - private readonly interpreterPathService: IInterpreterPathService + private readonly interpreterPathService: IInterpreterPathService, ) {} public async updatePythonPath(pythonPath: string | undefined): Promise { const pythonConfig = this.workspaceService.getConfiguration('python', this.workspaceFolder); @@ -27,7 +27,7 @@ export class WorkspaceFolderPythonPathUpdaterService implements IPythonPathUpdat await this.interpreterPathService.update( this.workspaceFolder, ConfigurationTarget.WorkspaceFolder, - pythonPath + pythonPath, ); } else { await pythonConfig.update('pythonPath', pythonPath, ConfigurationTarget.WorkspaceFolder); diff --git a/src/client/interpreter/configuration/services/workspaceUpdaterService.ts b/src/client/interpreter/configuration/services/workspaceUpdaterService.ts index 198eaf5f59cb..3cd3270a0caf 100644 --- a/src/client/interpreter/configuration/services/workspaceUpdaterService.ts +++ b/src/client/interpreter/configuration/services/workspaceUpdaterService.ts @@ -9,7 +9,7 @@ export class WorkspacePythonPathUpdaterService implements IPythonPathUpdaterServ private workspace: Uri, private readonly inDeprecatePythonPathExperiment: boolean, private readonly workspaceService: IWorkspaceService, - private readonly interpreterPathService: IInterpreterPathService + private readonly interpreterPathService: IInterpreterPathService, ) {} public async updatePythonPath(pythonPath: string | undefined): Promise { const pythonConfig = this.workspaceService.getConfiguration('python', this.workspace); diff --git a/src/client/interpreter/configuration/types.ts b/src/client/interpreter/configuration/types.ts index 4d5c7ad36a51..060ad09ddbf4 100644 --- a/src/client/interpreter/configuration/types.ts +++ b/src/client/interpreter/configuration/types.ts @@ -19,7 +19,7 @@ export interface IPythonPathUpdaterServiceManager { pythonPath: string | undefined, configTarget: ConfigurationTarget, trigger: 'ui' | 'shebang' | 'load', - wkspace?: Uri + wkspace?: Uri, ): Promise; } diff --git a/src/client/interpreter/display/index.ts b/src/client/interpreter/display/index.ts index 8750a51cfbd8..4c93675e0986 100644 --- a/src/client/interpreter/display/index.ts +++ b/src/client/interpreter/display/index.ts @@ -12,7 +12,7 @@ import { IInterpreterDisplay, IInterpreterHelper, IInterpreterService, - IInterpreterStatusbarVisibilityFilter + IInterpreterStatusbarVisibilityFilter, } from '../contracts'; /** @@ -42,7 +42,7 @@ export class InterpreterDisplay implements IInterpreterDisplay { constructor( @inject(IServiceContainer) private readonly serviceContainer: IServiceContainer, @multiInject(IInterpreterStatusbarVisibilityFilter) - private readonly visibilityFilters: IInterpreterStatusbarVisibilityFilter[] + private readonly visibilityFilters: IInterpreterStatusbarVisibilityFilter[], ) { this.helper = serviceContainer.get(IInterpreterHelper); this.workspaceService = serviceContainer.get(IWorkspaceService); @@ -60,7 +60,7 @@ export class InterpreterDisplay implements IInterpreterDisplay { this.interpreterService.onDidChangeInterpreterInformation( this.onDidChangeInterpreterInformation, this, - disposableRegistry + disposableRegistry, ); this.visibilityFilters .filter((item) => item.changed) @@ -93,8 +93,8 @@ export class InterpreterDisplay implements IInterpreterDisplay { const output = this.serviceContainer.get(IOutputChannel, STANDARD_OUTPUT_CHANNEL); output.appendLine( Interpreters.pythonInterpreterPath().format( - this.pathUtils.getDisplayName(interpreter.path, workspaceFolder?.fsPath) - ) + this.pathUtils.getDisplayName(interpreter.path, workspaceFolder?.fsPath), + ), ); this.interpreterPath = interpreter.path; } diff --git a/src/client/interpreter/display/interpreterSelectionTip.ts b/src/client/interpreter/display/interpreterSelectionTip.ts index 2d0eb0747b3a..7988f741af85 100644 --- a/src/client/interpreter/display/interpreterSelectionTip.ts +++ b/src/client/interpreter/display/interpreterSelectionTip.ts @@ -16,7 +16,7 @@ import { EventName } from '../../telemetry/constants'; enum NotificationType { Tip, Survey, - NoPrompt + NoPrompt, } @injectable() @@ -29,7 +29,7 @@ export class InterpreterSelectionTip implements IExtensionSingleActivationServic @inject(IApplicationShell) private readonly shell: IApplicationShell, @inject(IPersistentStateFactory) factory: IPersistentStateFactory, @inject(IExperimentService) private readonly experiments: IExperimentService, - @inject(IBrowserService) private browserService: IBrowserService + @inject(IBrowserService) private browserService: IBrowserService, ) { this.storage = factory.createGlobalPersistentState('InterpreterSelectionTip', false); this.notificationType = NotificationType.NoPrompt; @@ -45,12 +45,12 @@ export class InterpreterSelectionTip implements IExtensionSingleActivationServic if (await this.experiments.inExperiment(SurveyAndInterpreterTipNotification.surveyExperiment)) { this.notificationType = NotificationType.Survey; this.notificationContent = await this.experiments.getExperimentValue( - SurveyAndInterpreterTipNotification.surveyExperiment + SurveyAndInterpreterTipNotification.surveyExperiment, ); } else if (await this.experiments.inExperiment(SurveyAndInterpreterTipNotification.tipExperiment)) { this.notificationType = NotificationType.Tip; this.notificationContent = await this.experiments.getExperimentValue( - SurveyAndInterpreterTipNotification.tipExperiment + SurveyAndInterpreterTipNotification.tipExperiment, ); } @@ -71,7 +71,7 @@ export class InterpreterSelectionTip implements IExtensionSingleActivationServic const selection = await this.shell.showInformationMessage( this.notificationContent!, Common.bannerLabelYes(), - Common.bannerLabelNo() + Common.bannerLabelNo(), ); if (selection === Common.bannerLabelYes()) { diff --git a/src/client/interpreter/display/progressDisplay.ts b/src/client/interpreter/display/progressDisplay.ts index ac7cccd1f002..e0dafd2f2512 100644 --- a/src/client/interpreter/display/progressDisplay.ts +++ b/src/client/interpreter/display/progressDisplay.ts @@ -13,7 +13,7 @@ import { Common, Interpreters } from '../../common/utils/localize'; import { IComponentAdapter, IInterpreterLocatorProgressHandler, - IInterpreterLocatorProgressService + IInterpreterLocatorProgressService, } from '../contracts'; // The parts of IComponentAdapter used here. @@ -30,7 +30,7 @@ export class InterpreterLocatorProgressStatubarHandler implements IInterpreterLo @inject(IInterpreterLocatorProgressService) private readonly progressService: IInterpreterLocatorProgressService, @inject(IDisposableRegistry) private readonly disposables: Disposable[], - @inject(IComponentAdapter) private readonly pyenvs: IComponent + @inject(IComponentAdapter) private readonly pyenvs: IComponent, ) {} public register() { const onRefreshing = this.pyenvs.onRefreshing ?? this.progressService.onRefreshing; @@ -54,7 +54,7 @@ export class InterpreterLocatorProgressStatubarHandler implements IInterpreterLo private createProgress() { const progressOptions: ProgressOptions = { location: ProgressLocation.Window, - title: this.isFirstTimeLoadingInterpreters ? Common.loadingExtension() : Interpreters.refreshing() + title: this.isFirstTimeLoadingInterpreters ? Common.loadingExtension() : Interpreters.refreshing(), }; this.isFirstTimeLoadingInterpreters = false; this.shell.withProgress(progressOptions, () => { diff --git a/src/client/interpreter/display/shebangCodeLensProvider.ts b/src/client/interpreter/display/shebangCodeLensProvider.ts index 8737981c8369..55ebd2ab8a7e 100644 --- a/src/client/interpreter/display/shebangCodeLensProvider.ts +++ b/src/client/interpreter/display/shebangCodeLensProvider.ts @@ -14,14 +14,14 @@ export class ShebangCodeLensProvider implements IShebangCodeLensProvider { @inject(IProcessServiceFactory) private readonly processServiceFactory: IProcessServiceFactory, @inject(IConfigurationService) private readonly configurationService: IConfigurationService, @inject(IPlatformService) private readonly platformService: IPlatformService, - @inject(IWorkspaceService) workspaceService: IWorkspaceService + @inject(IWorkspaceService) workspaceService: IWorkspaceService, ) { // tslint:disable-next-line:no-any this.onDidChangeCodeLenses = (workspaceService.onDidChangeConfiguration as any) as Event; } public async detectShebang( document: TextDocument, - resolveShebangAsInterpreter: boolean = false + resolveShebangAsInterpreter: boolean = false, ): Promise { const firstLine = document.lineAt(0); if (firstLine.isEmptyOrWhitespace) { @@ -78,7 +78,7 @@ export class ShebangCodeLensProvider implements IShebangCodeLensProvider { const cmd: Command = { command: 'python.setShebangInterpreter', - title: 'Set as interpreter' + title: 'Set as interpreter', }; return [new CodeLens(shebangRange, cmd)]; diff --git a/src/client/interpreter/helpers.ts b/src/client/interpreter/helpers.ts index 9cd829952b0d..a09531949f42 100644 --- a/src/client/interpreter/helpers.ts +++ b/src/client/interpreter/helpers.ts @@ -13,7 +13,7 @@ import { getEnvironmentTypeName, InterpreterInformation, PythonEnvironment, - sortInterpreters + sortInterpreters, } from '../pythonEnvironments/info'; import { IComponentAdapter, IInterpreterHelper, WorkspacePythonPath } from './contracts'; import { IInterpreterHashProviderFactory } from './locators/types'; @@ -51,7 +51,7 @@ export class InterpreterHelper implements IInterpreterHelper { constructor( @inject(IServiceContainer) private serviceContainer: IServiceContainer, @inject(InterpeterHashProviderFactory) private readonly hashProviderFactory: IInterpreterHashProviderFactory, - @inject(IComponentAdapter) private readonly pyenvs: IComponent + @inject(IComponentAdapter) private readonly pyenvs: IComponent, ) { this.persistentFactory = this.serviceContainer.get(IPersistentStateFactory); } @@ -95,7 +95,7 @@ export class InterpreterHelper implements IInterpreterHelper { const store = this.persistentFactory.createGlobalPersistentState( `${pythonPath}.v3`, undefined, - EXPITY_DURATION + EXPITY_DURATION, ); if (store.value && fileHash && store.value.fileHash === fileHash) { return store.value; @@ -113,7 +113,7 @@ export class InterpreterHelper implements IInterpreterHelper { } const details = { ...info, - fileHash + fileHash, }; await store.updateValue(details); return details; diff --git a/src/client/interpreter/interpreterService.ts b/src/client/interpreter/interpreterService.ts index 1ac389bdfc6a..1fa44956b3c1 100644 --- a/src/client/interpreter/interpreterService.ts +++ b/src/client/interpreter/interpreterService.ts @@ -16,7 +16,7 @@ import { IInterpreterPathService, IPersistentState, IPersistentStateFactory, - Resource + Resource, } from '../common/types'; import { sleep } from '../common/utils/async'; import { IServiceContainer } from '../ioc/types'; @@ -31,7 +31,7 @@ import { IInterpreterHelper, IInterpreterLocatorService, IInterpreterService, - INTERPRETER_LOCATOR_SERVICE + INTERPRETER_LOCATOR_SERVICE, } from './contracts'; import { IInterpreterHashProviderFactory } from './locators/types'; import { IVirtualEnvironmentManager } from './virtualEnvs/types'; @@ -75,11 +75,11 @@ export class InterpreterService implements Disposable, IInterpreterService { constructor( @inject(IServiceContainer) private serviceContainer: IServiceContainer, @inject(InterpeterHashProviderFactory) private readonly hashProviderFactory: IInterpreterHashProviderFactory, - @inject(IComponentAdapter) private readonly pyenvs: IComponent + @inject(IComponentAdapter) private readonly pyenvs: IComponent, ) { this.locator = serviceContainer.get( IInterpreterLocatorService, - INTERPRETER_LOCATOR_SERVICE + INTERPRETER_LOCATOR_SERVICE, ); this.persistentStateFactory = this.serviceContainer.get(IPersistentStateFactory); this.configService = this.serviceContainer.get(IConfigurationService); @@ -97,8 +97,8 @@ export class InterpreterService implements Disposable, IInterpreterService { const documentManager = this.serviceContainer.get(IDocumentManager); disposables.push( documentManager.onDidChangeActiveTextEditor((e) => - e && e.document ? this.refresh(e.document.uri) : undefined - ) + e && e.document ? this.refresh(e.document.uri) : undefined, + ), ); const workspaceService = this.serviceContainer.get(IWorkspaceService); const pySettings = this.configService.getSettings(); @@ -107,7 +107,7 @@ export class InterpreterService implements Disposable, IInterpreterService { disposables.push( this.interpreterPathService.onDidChange((i) => { this._onConfigChanged(i.uri); - }) + }), ); } else { const workspacesUris: (Uri | undefined)[] = workspaceService.hasWorkspaceFolders @@ -115,7 +115,7 @@ export class InterpreterService implements Disposable, IInterpreterService { : [undefined]; const disposable = workspaceService.onDidChangeConfiguration((e) => { const workspaceUriIndex = workspacesUris.findIndex((uri) => - e.affectsConfiguration('python.pythonPath', uri) + e.affectsConfiguration('python.pythonPath', uri), ); const workspaceUri = workspaceUriIndex === -1 ? undefined : workspacesUris[workspaceUriIndex]; this._onConfigChanged(workspaceUri); @@ -145,7 +145,7 @@ export class InterpreterService implements Disposable, IInterpreterService { if (!item.cachedEntry) { this.updateCachedInterpreterInformation(item, resource).ignoreErrors(); } - }) + }), ); return environments; } @@ -257,7 +257,7 @@ export class InterpreterService implements Disposable, IInterpreterService { const store = this.persistentStateFactory.createGlobalPersistentState<{ hash: string; displayName: string }>( `${info.path}.interpreter.displayName.v7`, undefined, - EXPITY_DURATION + EXPITY_DURATION, ); if (store.value && store.value.hash === interpreterHash && store.value.displayName) { this.inMemoryCacheOfDisplayNames.set(info.path!, store.value.displayName); @@ -275,7 +275,7 @@ export class InterpreterService implements Disposable, IInterpreterService { return displayName; } public async getInterpreterCache( - pythonPath: string + pythonPath: string, ): Promise> { const fileHash = (pythonPath ? await this.getInterepreterFileHash(pythonPath).catch(() => '') : '') || ''; const store = this.persistentStateFactory.createGlobalPersistentState<{ @@ -355,7 +355,7 @@ export class InterpreterService implements Disposable, IInterpreterService { const virtualEnvManager = this.serviceContainer.get(IVirtualEnvironmentManager); const [info, type] = await Promise.all([ interpreterHelper.getInterpreterInformation(pythonPath), - virtualEnvManager.getEnvironmentType(pythonPath) + virtualEnvManager.getEnvironmentType(pythonPath), ]); if (!info) { return; @@ -363,7 +363,7 @@ export class InterpreterService implements Disposable, IInterpreterService { const details: Partial = { ...(info as PythonEnvironment), path: pythonPath, - envType: type + envType: type, }; const envName = @@ -372,7 +372,7 @@ export class InterpreterService implements Disposable, IInterpreterService { : await virtualEnvManager.getEnvironmentName(pythonPath, resource); const pthonInfo = { ...(details as PythonEnvironment), - envName + envName, }; pthonInfo.displayName = await this.getDisplayName(pthonInfo, resource); return pthonInfo; diff --git a/src/client/interpreter/interpreterVersion.ts b/src/client/interpreter/interpreterVersion.ts index 47d551a94122..3cf9da609c54 100644 --- a/src/client/interpreter/interpreterVersion.ts +++ b/src/client/interpreter/interpreterVersion.ts @@ -14,7 +14,7 @@ export class InterpreterVersionService implements IInterpreterVersionService { public async getVersion(pythonPath: string, defaultValue: string): Promise { const processService = await this.processServiceFactory.create(); return getPythonVersion(pythonPath, defaultValue, (cmd, args) => - processService.exec(cmd, args, { mergeStdOutErr: true }) + processService.exec(cmd, args, { mergeStdOutErr: true }), ); } diff --git a/src/client/interpreter/serviceRegistry.ts b/src/client/interpreter/serviceRegistry.ts index 3ba92d220e1a..5d15df5576c4 100644 --- a/src/client/interpreter/serviceRegistry.ts +++ b/src/client/interpreter/serviceRegistry.ts @@ -27,7 +27,7 @@ import { IInterpreterAutoSeletionProxyService, IInterpreterEvaluation, IInterpreterSecurityService, - IInterpreterSecurityStorage + IInterpreterSecurityStorage, } from './autoSelection/types'; import { InterpreterComparer } from './configuration/interpreterComparer'; import { ResetInterpreterCommand } from './configuration/interpreterSelector/commands/resetInterpreter'; @@ -40,7 +40,7 @@ import { IInterpreterComparer, IInterpreterSelector, IPythonPathUpdaterServiceFactory, - IPythonPathUpdaterServiceManager + IPythonPathUpdaterServiceManager, } from './configuration/types'; import { IInterpreterDisplay, @@ -49,7 +49,7 @@ import { IInterpreterService, IInterpreterStatusbarVisibilityFilter, IInterpreterVersionService, - IShebangCodeLensProvider + IShebangCodeLensProvider, } from './contracts'; import { AlwaysDisplayStatusBar, InterpreterDisplay } from './display'; import { InterpreterSelectionTip } from './display/interpreterSelectionTip'; @@ -73,19 +73,19 @@ import { VirtualEnvironmentPrompt } from './virtualEnvs/virtualEnvPrompt'; export function registerInterpreterTypes(serviceManager: IServiceManager) { serviceManager.addSingleton( IExtensionSingleActivationService, - InterpreterSecurityStorage + InterpreterSecurityStorage, ); serviceManager.addSingleton( IExtensionSingleActivationService, - SetInterpreterCommand + SetInterpreterCommand, ); serviceManager.addSingleton( IExtensionSingleActivationService, - ResetInterpreterCommand + ResetInterpreterCommand, ); serviceManager.addSingleton( IExtensionSingleActivationService, - SetShebangInterpreterCommand + SetShebangInterpreterCommand, ); serviceManager.addSingleton(IInterpreterEvaluation, InterpreterEvaluation); serviceManager.addSingleton(IInterpreterSecurityStorage, InterpreterSecurityStorage); @@ -95,7 +95,7 @@ export function registerInterpreterTypes(serviceManager: IServiceManager) { serviceManager.addSingleton(IExtensionActivationService, VirtualEnvironmentPrompt); serviceManager.addSingleton( IExtensionSingleActivationService, - InterpreterSelectionTip + InterpreterSelectionTip, ); serviceManager.addSingleton(IInterpreterVersionService, InterpreterVersionService); @@ -105,11 +105,11 @@ export function registerInterpreterTypes(serviceManager: IServiceManager) { serviceManager.addSingleton( IPythonPathUpdaterServiceFactory, - PythonPathUpdaterServiceFactory + PythonPathUpdaterServiceFactory, ); serviceManager.addSingleton( IPythonPathUpdaterServiceManager, - PythonPathUpdaterService + PythonPathUpdaterService, ); serviceManager.addSingleton(IInterpreterSelector, InterpreterSelector); @@ -120,53 +120,53 @@ export function registerInterpreterTypes(serviceManager: IServiceManager) { serviceManager.addSingleton( IInterpreterLocatorProgressHandler, - InterpreterLocatorProgressStatubarHandler + InterpreterLocatorProgressStatubarHandler, ); serviceManager.addSingleton( IInterpreterAutoSelectionRule, CurrentPathInterpretersAutoSelectionRule, - AutoSelectionRule.currentPath + AutoSelectionRule.currentPath, ); serviceManager.addSingleton( IInterpreterAutoSelectionRule, SystemWideInterpretersAutoSelectionRule, - AutoSelectionRule.systemWide + AutoSelectionRule.systemWide, ); serviceManager.addSingleton( IInterpreterAutoSelectionRule, WindowsRegistryInterpretersAutoSelectionRule, - AutoSelectionRule.windowsRegistry + AutoSelectionRule.windowsRegistry, ); serviceManager.addSingleton( IInterpreterAutoSelectionRule, WorkspaceVirtualEnvInterpretersAutoSelectionRule, - AutoSelectionRule.workspaceVirtualEnvs + AutoSelectionRule.workspaceVirtualEnvs, ); serviceManager.addSingleton( IInterpreterAutoSelectionRule, CachedInterpretersAutoSelectionRule, - AutoSelectionRule.cachedInterpreters + AutoSelectionRule.cachedInterpreters, ); serviceManager.addSingleton( IInterpreterAutoSelectionRule, SettingsInterpretersAutoSelectionRule, - AutoSelectionRule.settings + AutoSelectionRule.settings, ); serviceManager.addSingleton( IInterpreterAutoSelectionService, - InterpreterAutoSelectionService + InterpreterAutoSelectionService, ); serviceManager.addSingleton(IExtensionActivationService, CondaInheritEnvPrompt); serviceManager.addSingleton( IExtensionSingleActivationService, - PreWarmActivatedEnvironmentVariables + PreWarmActivatedEnvironmentVariables, ); serviceManager.addSingleton( IInterpreterStatusbarVisibilityFilter, - AlwaysDisplayStatusBar + AlwaysDisplayStatusBar, ); } @@ -174,18 +174,18 @@ export function registerTypes(serviceManager: IServiceManager) { registerInterpreterTypes(serviceManager); serviceManager.addSingleton( IInterpreterAutoSeletionProxyService, - InterpreterAutoSeletionProxyService + InterpreterAutoSeletionProxyService, ); serviceManager.addSingleton( EnvironmentActivationService, - EnvironmentActivationService + EnvironmentActivationService, ); serviceManager.addSingleton( TerminalEnvironmentActivationService, - TerminalEnvironmentActivationService + TerminalEnvironmentActivationService, ); serviceManager.addSingleton( IEnvironmentActivationService, - EnvironmentActivationService + EnvironmentActivationService, ); } diff --git a/src/client/interpreter/virtualEnvs/condaInheritEnvPrompt.ts b/src/client/interpreter/virtualEnvs/condaInheritEnvPrompt.ts index a3fdac906e39..5bde0e33e6d0 100644 --- a/src/client/interpreter/virtualEnvs/condaInheritEnvPrompt.ts +++ b/src/client/interpreter/virtualEnvs/condaInheritEnvPrompt.ts @@ -25,7 +25,7 @@ export class CondaInheritEnvPrompt implements IExtensionActivationService { @inject(IApplicationShell) private readonly appShell: IApplicationShell, @inject(IPersistentStateFactory) private readonly persistentStateFactory: IPersistentStateFactory, @inject(IPlatformService) private readonly platformService: IPlatformService, - @optional() public hasPromptBeenShownInCurrentSession: boolean = false + @optional() public hasPromptBeenShownInCurrentSession: boolean = false, ) {} public async activate(resource: Uri): Promise { @@ -45,7 +45,7 @@ export class CondaInheritEnvPrompt implements IExtensionActivationService { public async promptAndUpdate() { const notificationPromptEnabled = this.persistentStateFactory.createGlobalPersistentState( condaInheritEnvPromptKey, - true + true, ); if (!notificationPromptEnabled.value) { return; @@ -54,7 +54,7 @@ export class CondaInheritEnvPrompt implements IExtensionActivationService { const telemetrySelections: ['Yes', 'No', 'More Info'] = ['Yes', 'No', 'More Info']; const selection = await this.appShell.showInformationMessage(Interpreters.condaInheritEnvMessage(), ...prompts); sendTelemetryEvent(EventName.CONDA_INHERIT_ENV_PROMPT, undefined, { - selection: selection ? telemetrySelections[prompts.indexOf(selection)] : undefined + selection: selection ? telemetrySelections[prompts.indexOf(selection)] : undefined, }); if (!selection) { return; @@ -87,7 +87,7 @@ export class CondaInheritEnvPrompt implements IExtensionActivationService { .inspect('integrated.inheritEnv'); if (!setting) { traceError( - 'WorkspaceConfiguration.inspect returns `undefined` for setting `terminal.integrated.inheritEnv`' + 'WorkspaceConfiguration.inspect returns `undefined` for setting `terminal.integrated.inheritEnv`', ); return false; } diff --git a/src/client/interpreter/virtualEnvs/index.ts b/src/client/interpreter/virtualEnvs/index.ts index 0886b1df99a4..5c59a19de4ec 100644 --- a/src/client/interpreter/virtualEnvs/index.ts +++ b/src/client/interpreter/virtualEnvs/index.ts @@ -28,7 +28,7 @@ export class VirtualEnvironmentManager implements IVirtualEnvironmentManager { this.fs = serviceContainer.get(IFileSystem); this.pipEnvService = serviceContainer.get( IInterpreterLocatorService, - PIPENV_SERVICE + PIPENV_SERVICE, ) as IPipEnvService; this.workspaceService = serviceContainer.get(IWorkspaceService); } @@ -39,7 +39,7 @@ export class VirtualEnvironmentManager implements IVirtualEnvironmentManager { path.dirname, path.basename, // We use a closure on "this". - (d: string, p: string) => this.pipEnvService.isRelatedPipEnvironment(d, p) + (d: string, p: string) => this.pipEnvService.isRelatedPipEnvironment(d, p), ); return (await subenvs.getName(pythonPath, finders)) || ''; } @@ -64,7 +64,7 @@ export class VirtualEnvironmentManager implements IVirtualEnvironmentManager { async (c: string, a: string[]) => { const processService = await this.processServiceFactory.create(resource); return processService.exec(c, a); - } + }, ); return (await subenvs.getType(pythonPath, finders)) || EnvironmentType.Unknown; } @@ -74,7 +74,7 @@ export class VirtualEnvironmentManager implements IVirtualEnvironmentManager { path.dirname, path.join, // We use a closure on "this". - (n: string) => this.fs.fileExists(n) + (n: string) => this.fs.fileExists(n), ); return (await find(pythonPath)) === EnvironmentType.Venv; } @@ -92,7 +92,7 @@ export class VirtualEnvironmentManager implements IVirtualEnvironmentManager { async (c: string, a: string[]) => { const processService = await this.processServiceFactory.create(resource); return processService.exec(c, a); - } + }, ); return (await find(pythonPath)) === EnvironmentType.Pyenv; } @@ -101,7 +101,7 @@ export class VirtualEnvironmentManager implements IVirtualEnvironmentManager { const find = subenvs.getPipenvTypeFinder( () => this.getWorkspaceRoot(resource), // We use a closure on "this". - (d: string, p: string) => this.pipEnvService.isRelatedPipEnvironment(d, p) + (d: string, p: string) => this.pipEnvService.isRelatedPipEnvironment(d, p), ); return (await find(pythonPath)) === EnvironmentType.Pipenv; } @@ -118,7 +118,7 @@ export class VirtualEnvironmentManager implements IVirtualEnvironmentManager { async (c: string, a: string[]) => { const processService = await this.processServiceFactory.create(resource); return processService.exec(c, a); - } + }, ); return find(); } @@ -131,7 +131,7 @@ export class VirtualEnvironmentManager implements IVirtualEnvironmentManager { path.dirname, path.join, // We use a closure on "this". - (n: string) => this.fs.fileExists(n) + (n: string) => this.fs.fileExists(n), ); return (await find(pythonPath)) === EnvironmentType.VirtualEnv; } diff --git a/src/client/interpreter/virtualEnvs/virtualEnvPrompt.ts b/src/client/interpreter/virtualEnvs/virtualEnvPrompt.ts index c1056cadab6d..bbd1ef0b1262 100644 --- a/src/client/interpreter/virtualEnvs/virtualEnvPrompt.ts +++ b/src/client/interpreter/virtualEnvs/virtualEnvPrompt.ts @@ -17,7 +17,7 @@ import { IInterpreterHelper, IInterpreterLocatorService, IInterpreterWatcherBuilder, - WORKSPACE_VIRTUAL_ENV_SERVICE + WORKSPACE_VIRTUAL_ENV_SERVICE, } from '../contracts'; const doNotDisplayPromptStateKey = 'MESSAGE_KEY_FOR_VIRTUAL_ENV'; @@ -33,7 +33,7 @@ export class VirtualEnvironmentPrompt implements IExtensionActivationService { @named(WORKSPACE_VIRTUAL_ENV_SERVICE) private readonly locator: IInterpreterLocatorService, @inject(IDisposableRegistry) private readonly disposableRegistry: Disposable[], - @inject(IApplicationShell) private readonly appShell: IApplicationShell + @inject(IApplicationShell) private readonly appShell: IApplicationShell, ) {} public async activate(resource: Uri): Promise { @@ -43,7 +43,7 @@ export class VirtualEnvironmentPrompt implements IExtensionActivationService { this.handleNewEnvironment(resource).ignoreErrors(); }, this, - this.disposableRegistry + this.disposableRegistry, ); } @@ -61,7 +61,7 @@ export class VirtualEnvironmentPrompt implements IExtensionActivationService { protected async notifyUser(interpreter: PythonEnvironment, resource: Uri): Promise { const notificationPromptEnabled = this.persistentStateFactory.createWorkspacePersistentState( doNotDisplayPromptStateKey, - true + true, ); if (!notificationPromptEnabled.value) { return; @@ -70,10 +70,10 @@ export class VirtualEnvironmentPrompt implements IExtensionActivationService { const telemetrySelections: ['Yes', 'No', 'Ignore'] = ['Yes', 'No', 'Ignore']; const selection = await this.appShell.showInformationMessage( Interpreters.environmentPromptMessage(), - ...prompts + ...prompts, ); sendTelemetryEvent(EventName.PYTHON_INTERPRETER_ACTIVATE_ENVIRONMENT_PROMPT, undefined, { - selection: selection ? telemetrySelections[prompts.indexOf(selection)] : undefined + selection: selection ? telemetrySelections[prompts.indexOf(selection)] : undefined, }); if (!selection) { return; @@ -83,7 +83,7 @@ export class VirtualEnvironmentPrompt implements IExtensionActivationService { interpreter.path, ConfigurationTarget.WorkspaceFolder, 'ui', - resource + resource, ); } else if (selection === prompts[2]) { await notificationPromptEnabled.updateValue(false); diff --git a/src/client/ioc/container.ts b/src/client/ioc/container.ts index 07db6f95bca2..e689aa5cc925 100644 --- a/src/client/ioc/container.ts +++ b/src/client/ioc/container.ts @@ -24,7 +24,7 @@ export class ServiceContainer implements IServiceContainer { } public getAll( serviceIdentifier: string | symbol | Newable | Abstract, - name?: string | number | symbol | undefined + name?: string | number | symbol | undefined, ): T[] { return name ? this.container.getAllNamed(serviceIdentifier, name) @@ -32,7 +32,7 @@ export class ServiceContainer implements IServiceContainer { } public tryGet( serviceIdentifier: interfaces.ServiceIdentifier, - name?: string | number | symbol | undefined + name?: string | number | symbol | undefined, ): T | undefined { try { return name diff --git a/src/client/ioc/serviceManager.ts b/src/client/ioc/serviceManager.ts index 837308dff514..674dc2d2ac35 100644 --- a/src/client/ioc/serviceManager.ts +++ b/src/client/ioc/serviceManager.ts @@ -14,7 +14,7 @@ export class ServiceManager implements IServiceManager { // tslint:disable-next-line:no-any constructor: new (...args: any[]) => T, name?: string | number | symbol | undefined, - bindings?: symbol[] + bindings?: symbol[], ): void { if (name) { this.container.bind(serviceIdentifier).to(constructor).whenTargetNamed(name); @@ -30,7 +30,7 @@ export class ServiceManager implements IServiceManager { } public addFactory( factoryIdentifier: interfaces.ServiceIdentifier>, - factoryMethod: interfaces.FactoryCreator + factoryMethod: interfaces.FactoryCreator, ): void { this.container.bind>(factoryIdentifier).toFactory(factoryMethod); } @@ -44,7 +44,7 @@ export class ServiceManager implements IServiceManager { // tslint:disable-next-line:no-any constructor: new (...args: any[]) => T, name?: string | number | symbol | undefined, - bindings?: symbol[] + bindings?: symbol[], ): void { if (name) { this.container.bind(serviceIdentifier).to(constructor).inSingletonScope().whenTargetNamed(name); @@ -62,7 +62,7 @@ export class ServiceManager implements IServiceManager { public addSingletonInstance( serviceIdentifier: identifier, instance: T, - name?: string | number | symbol | undefined + name?: string | number | symbol | undefined, ): void { if (name) { this.container.bind(serviceIdentifier).toConstantValue(instance).whenTargetNamed(name); @@ -91,7 +91,7 @@ export class ServiceManager implements IServiceManager { public rebind( serviceIdentifier: interfaces.ServiceIdentifier, constructor: ClassType, - name?: string | number | symbol + name?: string | number | symbol, ): void { if (name) { this.container.rebind(serviceIdentifier).to(constructor).whenTargetNamed(name); @@ -103,7 +103,7 @@ export class ServiceManager implements IServiceManager { public rebindSingleton( serviceIdentifier: interfaces.ServiceIdentifier, constructor: ClassType, - name?: string | number | symbol + name?: string | number | symbol, ): void { if (name) { this.container.rebind(serviceIdentifier).to(constructor).inSingletonScope().whenTargetNamed(name); @@ -115,7 +115,7 @@ export class ServiceManager implements IServiceManager { public rebindInstance( serviceIdentifier: interfaces.ServiceIdentifier, instance: T, - name?: string | number | symbol + name?: string | number | symbol, ): void { if (name) { this.container.rebind(serviceIdentifier).toConstantValue(instance).whenTargetNamed(name); diff --git a/src/client/ioc/types.ts b/src/client/ioc/types.ts index 079fca02e5bd..ae916d4182ea 100644 --- a/src/client/ioc/types.ts +++ b/src/client/ioc/types.ts @@ -31,22 +31,22 @@ export interface IServiceManager extends IDisposable { serviceIdentifier: interfaces.ServiceIdentifier, constructor: ClassType, name?: string | number | symbol | undefined, - bindings?: symbol[] + bindings?: symbol[], ): void; addSingleton( serviceIdentifier: interfaces.ServiceIdentifier, constructor: ClassType, name?: string | number | symbol, - bindings?: symbol[] + bindings?: symbol[], ): void; addSingletonInstance( serviceIdentifier: interfaces.ServiceIdentifier, instance: T, - name?: string | number | symbol + name?: string | number | symbol, ): void; addFactory( factoryIdentifier: interfaces.ServiceIdentifier>, - factoryMethod: interfaces.FactoryCreator + factoryMethod: interfaces.FactoryCreator, ): void; addBinding(from: interfaces.ServiceIdentifier, to: interfaces.ServiceIdentifier): void; get(serviceIdentifier: interfaces.ServiceIdentifier, name?: string | number | symbol): T; @@ -55,17 +55,17 @@ export interface IServiceManager extends IDisposable { rebind( serviceIdentifier: interfaces.ServiceIdentifier, constructor: ClassType, - name?: string | number | symbol + name?: string | number | symbol, ): void; rebindSingleton( serviceIdentifier: interfaces.ServiceIdentifier, constructor: ClassType, - name?: string | number | symbol + name?: string | number | symbol, ): void; rebindInstance( serviceIdentifier: interfaces.ServiceIdentifier, instance: T, - name?: string | number | symbol + name?: string | number | symbol, ): void; } diff --git a/src/client/jupyter/jupyterExtensionDependencyManager.ts b/src/client/jupyter/jupyterExtensionDependencyManager.ts index 29717e4ceefc..c6b163f3bcde 100644 --- a/src/client/jupyter/jupyterExtensionDependencyManager.ts +++ b/src/client/jupyter/jupyterExtensionDependencyManager.ts @@ -2,7 +2,7 @@ import { inject, injectable } from 'inversify'; import { IApplicationEnvironment, IApplicationShell, - IJupyterExtensionDependencyManager + IJupyterExtensionDependencyManager, } from '../common/application/types'; import { JUPYTER_EXTENSION_ID } from '../common/constants'; import { IExtensions } from '../common/types'; @@ -13,7 +13,7 @@ export class JupyterExtensionDependencyManager implements IJupyterExtensionDepen constructor( @inject(IExtensions) private extensions: IExtensions, @inject(IApplicationShell) private appShell: IApplicationShell, - @inject(IApplicationEnvironment) private appEnv: IApplicationEnvironment + @inject(IApplicationEnvironment) private appEnv: IApplicationEnvironment, ) {} public get isJupyterExtensionInstalled() { diff --git a/src/client/jupyter/jupyterIntegration.ts b/src/client/jupyter/jupyterIntegration.ts index 5cf8f778fe94..f1343f96ec6b 100644 --- a/src/client/jupyter/jupyterIntegration.ts +++ b/src/client/jupyter/jupyterIntegration.ts @@ -19,7 +19,7 @@ import { IMemento, InstallerResponse, Product, - Resource + Resource, } from '../common/types'; import { isResource } from '../common/utils/misc'; import { getDebugpyPackagePath } from '../debugger/extension/adapter/remoteLaunchers'; @@ -46,7 +46,7 @@ enum JupyterProductToInstall { notebook = 'notebook', kernelspec = 'kernelspec', nbconvert = 'nbconvert', - pandas = 'pandas' + pandas = 'pandas', } const ProductMapping: { [key in JupyterProductToInstall]: Product } = { @@ -55,7 +55,7 @@ const ProductMapping: { [key in JupyterProductToInstall]: Product } = { [JupyterProductToInstall.kernelspec]: Product.kernelspec, [JupyterProductToInstall.nbconvert]: Product.nbconvert, [JupyterProductToInstall.notebook]: Product.notebook, - [JupyterProductToInstall.pandas]: Product.pandas + [JupyterProductToInstall.pandas]: Product.pandas, }; type PythonApiForJupyterExtension = { @@ -82,7 +82,7 @@ type PythonApiForJupyterExtension = { getActivatedEnvironmentVariables( resource: Resource, interpreter?: PythonEnvironment, - allowExceptions?: boolean + allowExceptions?: boolean, ): Promise; isWindowsStoreInterpreter(pythonPath: string): Promise; /** @@ -95,7 +95,7 @@ type PythonApiForJupyterExtension = { install( product: JupyterProductToInstall, resource?: InterpreterUri, - cancel?: CancellationToken + cancel?: CancellationToken, ): Promise; /** * Returns path to where `debugpy` is. In python extension this is `/pythonFiles/lib/python`. @@ -143,7 +143,7 @@ export class JupyterExtensionIntegration { @inject(IInstaller) private readonly installer: IInstaller, @inject(IEnvironmentActivationService) private readonly envActivation: IEnvironmentActivationService, @inject(ILanguageServerCache) private readonly languageServerCache: ILanguageServerCache, - @inject(IMemento) @named(GLOBAL_MEMENTO) private globalState: Memento + @inject(IMemento) @named(GLOBAL_MEMENTO) private globalState: Memento, ) {} public registerApi(jupyterExtensionApi: JupyterExtensionApi) { @@ -157,7 +157,7 @@ export class JupyterExtensionIntegration { getActivatedEnvironmentVariables: async ( resource: Resource, interpreter?: PythonEnvironment, - allowExceptions?: boolean + allowExceptions?: boolean, ) => this.envActivation.getActivatedEnvironmentVariables(resource, interpreter, allowExceptions), isWindowsStoreInterpreter: async (pythonPath: string): Promise => this.windowsStoreInterpreter.isWindowsStoreInterpreter(pythonPath), @@ -166,7 +166,7 @@ export class JupyterExtensionIntegration { install: async ( product: JupyterProductToInstall, resource?: InterpreterUri, - cancel?: CancellationToken + cancel?: CancellationToken, ): Promise => this.installer.install(ProductMapping[product], resource, cancel), getDebuggerPath: async () => dirname(getDebugpyPackagePath()), getInterpreterPathSelectedForJupyterServer: () => @@ -181,11 +181,11 @@ export class JupyterExtensionIntegration { return { connection: client.connection, capabilities: client.capabilities, - dispose: client.dispose + dispose: client.dispose, }; } return undefined; - } + }, }); } diff --git a/src/client/jupyter/languageserver/notebookConverter.ts b/src/client/jupyter/languageserver/notebookConverter.ts index 40e66dda9ada..37e4a431d14a 100644 --- a/src/client/jupyter/languageserver/notebookConverter.ts +++ b/src/client/jupyter/languageserver/notebookConverter.ts @@ -26,7 +26,7 @@ import { TextDocumentContentChangeEvent, TextEdit, Uri, - WorkspaceEdit + WorkspaceEdit, } from 'vscode'; import { NotebookCell, NotebookConcatTextDocument, NotebookDocument } from 'vscode-proposed'; import { IVSCodeNotebook } from '../../common/application/types'; @@ -54,7 +54,7 @@ export class NotebookConverter implements Disposable { private api: IVSCodeNotebook, private fs: IFileSystem, private cellSelector: DocumentSelector, - private notebookFilter: RegExp + private notebookFilter: RegExp, ) { this.disposables.push(api.onDidOpenNotebookDocument(this.onDidOpenNotebook.bind(this))); this.disposables.push(api.onDidCloseNotebookDocument(this.onDidCloseNotebook.bind(this))); @@ -163,7 +163,7 @@ export class NotebookConverter implements Disposable { } list.push({ ...e, - range: location.range + range: location.range, }); }); }); @@ -191,8 +191,8 @@ export class NotebookConverter implements Disposable { return { document: this.toOutgoingDocument(cellEvent.document), contentChanges: cellEvent.contentChanges.map( - this.toOutgoingContentChangeEvent.bind(this, cellEvent.document) - ) + this.toOutgoingContentChangeEvent.bind(this, cellEvent.document), + ), }; } @@ -224,7 +224,7 @@ export class NotebookConverter implements Disposable { public toOutgoingContext(cell: TextDocument, context: CodeActionContext): CodeActionContext { return { ...context, - diagnostics: context.diagnostics.map(this.toOutgoingDiagnostic.bind(this, cell)) + diagnostics: context.diagnostics.map(this.toOutgoingDiagnostic.bind(this, cell)), }; } @@ -232,7 +232,7 @@ export class NotebookConverter implements Disposable { if (hover && hover.range) { return { ...hover, - range: this.toIncomingRange(cell, hover.range) + range: this.toIncomingRange(cell, hover.range), }; } return hover; @@ -240,7 +240,7 @@ export class NotebookConverter implements Disposable { public toIncomingCompletions( cell: TextDocument, - completions: CompletionItem[] | CompletionList | null | undefined + completions: CompletionItem[] | CompletionList | null | undefined, ) { if (completions) { if (Array.isArray(completions)) { @@ -248,7 +248,7 @@ export class NotebookConverter implements Disposable { } return { ...completions, - items: completions.items.map(this.toIncomingCompletion.bind(this, cell)) + items: completions.items.map(this.toIncomingCompletion.bind(this, cell)), }; } return completions; @@ -256,7 +256,7 @@ export class NotebookConverter implements Disposable { public toIncomingLocations( cell: TextDocument, - location: Location | Location[] | LocationLink[] | null | undefined + location: Location | Location[] | LocationLink[] | null | undefined, ) { if (Array.isArray(location)) { // tslint:disable-next-line: no-any @@ -272,7 +272,7 @@ export class NotebookConverter implements Disposable { if (highlight) { return highlight.map((h) => ({ ...h, - range: this.toIncomingRange(cell, h.range) + range: this.toIncomingRange(cell, h.range), })); } return highlight; @@ -291,7 +291,7 @@ export class NotebookConverter implements Disposable { public toIncomingSymbolFromSymbolInformation(cell: TextDocument, symbol: SymbolInformation): SymbolInformation { return { ...symbol, - location: this.toIncomingLocation(cell, symbol.location.range) + location: this.toIncomingLocation(cell, symbol.location.range), }; } @@ -301,7 +301,7 @@ export class NotebookConverter implements Disposable { range: this.toIncomingRange(cell, diagnostic.range), relatedInformation: diagnostic.relatedInformation ? diagnostic.relatedInformation.map(this.toIncomingRelatedInformation.bind(this, cell)) - : undefined + : undefined, }; } @@ -321,7 +321,7 @@ export class NotebookConverter implements Disposable { if (Array.isArray(lenses)) { return lenses.map((c) => ({ ...c, - range: this.toIncomingRange(cell, c.range) + range: this.toIncomingRange(cell, c.range), })); } return lenses; @@ -331,7 +331,7 @@ export class NotebookConverter implements Disposable { if (Array.isArray(edits)) { return edits.map((e) => ({ ...e, - range: this.toIncomingRange(cell, e.range) + range: this.toIncomingRange(cell, e.range), })); } return edits; @@ -346,7 +346,7 @@ export class NotebookConverter implements Disposable { placeholder: string; } | null - | undefined + | undefined, ) { if (rangeOrRename) { if (rangeOrRename instanceof Range) { @@ -354,7 +354,7 @@ export class NotebookConverter implements Disposable { } return { ...rangeOrRename, - range: this.toIncomingLocation(cell, rangeOrRename.range).range + range: this.toIncomingLocation(cell, rangeOrRename.range).range, }; } return rangeOrRename; @@ -368,7 +368,7 @@ export class NotebookConverter implements Disposable { return { ...l, range: location.range, - target: l.target ? location.uri : undefined + target: l.target ? location.uri : undefined, }; }); } @@ -458,13 +458,13 @@ export class NotebookConverter implements Disposable { range: this.toOutgoingRange(cell, diagnostic.range), relatedInformation: diagnostic.relatedInformation ? diagnostic.relatedInformation.map(this.toOutgoingRelatedInformation.bind(this, cell)) - : undefined + : undefined, }; } private toOutgoingRelatedInformation( cell: TextDocument, - relatedInformation: DiagnosticRelatedInformation + relatedInformation: DiagnosticRelatedInformation, ): DiagnosticRelatedInformation { const outgoingDoc = this.toOutgoingDocument(cell); return { @@ -472,20 +472,20 @@ export class NotebookConverter implements Disposable { location: relatedInformation.location.uri === outgoingDoc.uri ? this.toOutgoingLocation(cell, relatedInformation.location) - : relatedInformation.location + : relatedInformation.location, }; } private toOutgoingLocation(cell: TextDocument, location: Location): Location { return { uri: this.toOutgoingDocument(cell).uri, - range: this.toOutgoingRange(cell, location.range) + range: this.toOutgoingRange(cell, location.range), }; } private toIncomingRelatedInformation( cell: TextDocument | Uri, - relatedInformation: DiagnosticRelatedInformation + relatedInformation: DiagnosticRelatedInformation, ): DiagnosticRelatedInformation { const outgoingUri = this.toOutgoingUri(cell); return { @@ -493,7 +493,7 @@ export class NotebookConverter implements Disposable { location: relatedInformation.location.uri === outgoingUri ? this.toIncomingLocationFromLink(cell, relatedInformation.location) - : relatedInformation.location + : relatedInformation.location, }; } @@ -502,7 +502,7 @@ export class NotebookConverter implements Disposable { ...docSymbol, range: this.toIncomingRange(cell, docSymbol.range), selectionRange: this.toIncomingRange(cell, docSymbol.selectionRange), - children: docSymbol.children.map(this.toIncomingSymbolFromDocumentSymbol.bind(this, cell)) + children: docSymbol.children.map(this.toIncomingSymbolFromDocumentSymbol.bind(this, cell)), }; } @@ -511,7 +511,7 @@ export class NotebookConverter implements Disposable { const locationNorm = location; const uri = this.toIncomingUri( locationLink.targetUri || locationNorm.uri, - locationLink.targetRange ? locationLink.targetRange : locationNorm.range + locationLink.targetRange ? locationLink.targetRange : locationNorm.range, ); return { originSelectionRange: locationLink.originSelectionRange @@ -523,7 +523,7 @@ export class NotebookConverter implements Disposable { : this.toIncomingRange(uri, locationNorm.range), targetSelectionRange: locationLink.targetSelectionRange ? this.toIncomingRange(uri, locationLink.targetSelectionRange) - : undefined + : undefined, }; } @@ -541,15 +541,15 @@ export class NotebookConverter implements Disposable { if (item.range instanceof Range) { return { ...item, - range: this.toIncomingRange(cell, item.range) + range: this.toIncomingRange(cell, item.range), }; } return { ...item, range: { inserting: this.toIncomingRange(cell, item.range.inserting), - replacing: this.toIncomingRange(cell, item.range.replacing) - } + replacing: this.toIncomingRange(cell, item.range.replacing), + }, }; } return item; @@ -563,12 +563,12 @@ export class NotebookConverter implements Disposable { const endLoc = concatDocument.locationAt(range.end); return { uri: startLoc.uri, - range: new Range(startLoc.range.start, endLoc.range.end) + range: new Range(startLoc.range.start, endLoc.range.end), }; } return { uri, - range + range, }; } @@ -577,7 +577,7 @@ export class NotebookConverter implements Disposable { range: this.toOutgoingRange(cell, ev.range), rangeLength: ev.rangeLength, rangeOffset: this.toOutgoingOffset(cell, ev.rangeOffset), - text: ev.text + text: ev.text, }; } diff --git a/src/client/jupyter/languageserver/notebookMiddlewareAddon.ts b/src/client/jupyter/languageserver/notebookMiddlewareAddon.ts index 1be63bda7a1b..2900356dd770 100644 --- a/src/client/jupyter/languageserver/notebookMiddlewareAddon.ts +++ b/src/client/jupyter/languageserver/notebookMiddlewareAddon.ts @@ -31,7 +31,7 @@ import { TextDocumentWillSaveEvent, TextEdit, Uri, - WorkspaceEdit + WorkspaceEdit, } from 'vscode'; import { DidChangeTextDocumentNotification, @@ -56,7 +56,7 @@ import { ProvideWorkspaceSymbolsSignature, ResolveCodeLensSignature, ResolveCompletionItemSignature, - ResolveDocumentLinkSignature + ResolveDocumentLinkSignature, } from 'vscode-languageclient/node'; import { ProvideDeclarationSignature } from 'vscode-languageclient/lib/common/declaration'; @@ -81,7 +81,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { private readonly getClient: () => LanguageClient | undefined, fs: IFileSystem, cellSelector: DocumentSelector, - notebookFileRegex: RegExp + notebookFileRegex: RegExp, ) { this.converter = new NotebookConverter(notebookApi, fs, cellSelector, notebookFileRegex); } @@ -156,7 +156,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { // eslint-disable-next-line class-methods-use-this public willSaveWaitUntil( event: TextDocumentWillSaveEvent, - next: (ev: TextDocumentWillSaveEvent) => Thenable + next: (ev: TextDocumentWillSaveEvent) => Thenable, ) { return next(event); } @@ -166,7 +166,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { position: Position, context: CompletionContext, token: CancellationToken, - next: ProvideCompletionItemsSignature + next: ProvideCompletionItemsSignature, ) { if (isNotebookCell(document.uri)) { const newDoc = this.converter.toOutgoingDocument(document); @@ -184,7 +184,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { document: TextDocument, position: Position, token: CancellationToken, - next: ProvideHoverSignature + next: ProvideHoverSignature, ) { if (isNotebookCell(document.uri)) { const newDoc = this.converter.toOutgoingDocument(document); @@ -202,7 +202,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { public resolveCompletionItem( item: CompletionItem, token: CancellationToken, - next: ResolveCompletionItemSignature + next: ResolveCompletionItemSignature, ): ProviderResult { // Range should have already been remapped. // tslint:disable-next-line: no-suspicious-comment @@ -216,7 +216,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { position: Position, context: SignatureHelpContext, token: CancellationToken, - next: ProvideSignatureHelpSignature + next: ProvideSignatureHelpSignature, ): ProviderResult { if (isNotebookCell(document.uri)) { const newDoc = this.converter.toOutgoingDocument(document); @@ -230,7 +230,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { document: TextDocument, position: Position, token: CancellationToken, - next: ProvideDefinitionSignature + next: ProvideDefinitionSignature, ): ProviderResult { if (isNotebookCell(document.uri)) { const newDoc = this.converter.toOutgoingDocument(document); @@ -251,7 +251,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { includeDeclaration: boolean; }, token: CancellationToken, - next: ProvideReferencesSignature + next: ProvideReferencesSignature, ): ProviderResult { if (isNotebookCell(document.uri)) { const newDoc = this.converter.toOutgoingDocument(document); @@ -269,7 +269,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { document: TextDocument, position: Position, token: CancellationToken, - next: ProvideDocumentHighlightsSignature + next: ProvideDocumentHighlightsSignature, ): ProviderResult { if (isNotebookCell(document.uri)) { const newDoc = this.converter.toOutgoingDocument(document); @@ -286,7 +286,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { public provideDocumentSymbols( document: TextDocument, token: CancellationToken, - next: ProvideDocumentSymbolsSignature + next: ProvideDocumentSymbolsSignature, ): ProviderResult { if (isNotebookCell(document.uri)) { const newDoc = this.converter.toOutgoingDocument(document); @@ -302,7 +302,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { public provideWorkspaceSymbols( query: string, token: CancellationToken, - next: ProvideWorkspaceSymbolsSignature + next: ProvideWorkspaceSymbolsSignature, ): ProviderResult { const result = next(query, token); if (isThenable(result)) { @@ -317,7 +317,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { range: Range, context: CodeActionContext, token: CancellationToken, - next: ProvideCodeActionsSignature + next: ProvideCodeActionsSignature, ): ProviderResult<(Command | CodeAction)[]> { if (isNotebookCell(document.uri)) { traceInfo('provideCodeActions not currently supported for notebooks'); @@ -330,7 +330,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { public provideCodeLenses( document: TextDocument, token: CancellationToken, - next: ProvideCodeLensesSignature + next: ProvideCodeLensesSignature, ): ProviderResult { if (isNotebookCell(document.uri)) { traceInfo('provideCodeLenses not currently supported for notebooks'); @@ -343,7 +343,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { public resolveCodeLens( codeLens: CodeLens, token: CancellationToken, - next: ResolveCodeLensSignature + next: ResolveCodeLensSignature, ): ProviderResult { // Range should have already been remapped. // tslint:disable-next-line: no-suspicious-comment @@ -357,7 +357,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { document: TextDocument, options: FormattingOptions, token: CancellationToken, - next: ProvideDocumentFormattingEditsSignature + next: ProvideDocumentFormattingEditsSignature, ): ProviderResult { if (isNotebookCell(document.uri)) { traceInfo('provideDocumentFormattingEdits not currently supported for notebooks'); @@ -372,7 +372,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { range: Range, options: FormattingOptions, token: CancellationToken, - next: ProvideDocumentRangeFormattingEditsSignature + next: ProvideDocumentRangeFormattingEditsSignature, ): ProviderResult { if (isNotebookCell(document.uri)) { traceInfo('provideDocumentRangeFormattingEdits not currently supported for notebooks'); @@ -388,7 +388,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { ch: string, options: FormattingOptions, token: CancellationToken, - next: ProvideOnTypeFormattingEditsSignature + next: ProvideOnTypeFormattingEditsSignature, ): ProviderResult { if (isNotebookCell(document.uri)) { traceInfo('provideOnTypeFormattingEdits not currently supported for notebooks'); @@ -403,7 +403,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { position: Position, newName: string, token: CancellationToken, - next: ProvideRenameEditsSignature + next: ProvideRenameEditsSignature, ): ProviderResult { if (isNotebookCell(document.uri)) { traceInfo('provideRenameEdits not currently supported for notebooks'); @@ -417,7 +417,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { document: TextDocument, position: Position, token: CancellationToken, - next: PrepareRenameSignature + next: PrepareRenameSignature, ): ProviderResult< | Range | { @@ -436,7 +436,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { public provideDocumentLinks( document: TextDocument, token: CancellationToken, - next: ProvideDocumentLinksSignature + next: ProvideDocumentLinksSignature, ): ProviderResult { if (isNotebookCell(document.uri)) { traceInfo('provideDocumentLinks not currently supported for notebooks'); @@ -449,7 +449,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { public resolveDocumentLink( link: DocumentLink, token: CancellationToken, - next: ResolveDocumentLinkSignature + next: ResolveDocumentLinkSignature, ): ProviderResult { // Range should have already been remapped. // tslint:disable-next-line: no-suspicious-comment @@ -463,7 +463,7 @@ export class NotebookMiddlewareAddon implements Middleware, Disposable { document: TextDocument, position: VPosition, token: CancellationToken, - next: ProvideDeclarationSignature + next: ProvideDeclarationSignature, ): ProviderResult { if (isNotebookCell(document.uri)) { traceInfo('provideDeclaration not currently supported for notebooks'); diff --git a/src/client/jupyter/types.ts b/src/client/jupyter/types.ts index 0ec6263eb9c5..e9985ee8fffe 100644 --- a/src/client/jupyter/types.ts +++ b/src/client/jupyter/types.ts @@ -39,7 +39,7 @@ export interface IDataViewerDataProvider { export enum ColumnType { String = 'string', Number = 'number', - Bool = 'bool' + Bool = 'bool', } // tslint:disable-next-line: no-any diff --git a/src/client/language/braceCounter.ts b/src/client/language/braceCounter.ts index 30d91b537544..08f0e355bba9 100644 --- a/src/client/language/braceCounter.ts +++ b/src/client/language/braceCounter.ts @@ -30,7 +30,7 @@ export class BraceCounter { private readonly bracePairs: BracePair[] = [ new BracePair(TokenType.OpenBrace, TokenType.CloseBrace), new BracePair(TokenType.OpenBracket, TokenType.CloseBracket), - new BracePair(TokenType.OpenCurly, TokenType.CloseCurly) + new BracePair(TokenType.OpenCurly, TokenType.CloseCurly), ]; private braceStacks: Stack[] = [new Stack(), new Stack(), new Stack()]; diff --git a/src/client/language/iterableTextRange.ts b/src/client/language/iterableTextRange.ts index c69c62132e73..586ed9bcfc78 100644 --- a/src/client/language/iterableTextRange.ts +++ b/src/client/language/iterableTextRange.ts @@ -15,16 +15,16 @@ export class IterableTextRange implements Iterable { if (index < this.textRangeCollection.count - 1) { return { done: false, - value: this.textRangeCollection.getItemAt((index += 1)) + value: this.textRangeCollection.getItemAt((index += 1)), }; } else { return { done: true, // tslint:disable-next-line:no-any - value: undefined as any + value: undefined as any, }; } - } + }, }; } } diff --git a/src/client/language/languageConfiguration.ts b/src/client/language/languageConfiguration.ts index 9e80d3a3b704..1e884d1d118b 100644 --- a/src/client/language/languageConfiguration.ts +++ b/src/client/language/languageConfiguration.ts @@ -21,8 +21,8 @@ export function getLanguageConfiguration(): LanguageConfiguration { $ `), action: { - indentAction: IndentAction.Indent - } + indentAction: IndentAction.Indent, + }, }, // continue comments { @@ -30,8 +30,8 @@ export function getLanguageConfiguration(): LanguageConfiguration { afterText: /.+$/, action: { indentAction: IndentAction.None, - appendText: '# ' - } + appendText: '# ', + }, }, // indent on enter (block-beginning statements) { @@ -74,8 +74,8 @@ export function getLanguageConfiguration(): LanguageConfiguration { $ `), action: { - indentAction: IndentAction.Indent - } + indentAction: IndentAction.Indent, + }, }, // outdent on enter (block-ending statements) { @@ -103,12 +103,12 @@ export function getLanguageConfiguration(): LanguageConfiguration { $ `), action: { - indentAction: IndentAction.Outdent - } - } + indentAction: IndentAction.Outdent, + }, + }, // Note that we do not currently have an auto-dedent // solution for "elif", "else", "except", and "finally". // We had one but had to remove it (see issue #6886). - ] + ], }; } diff --git a/src/client/language/tokenizer.ts b/src/client/language/tokenizer.ts index f51ceaa350c7..2a43db9e1e5f 100644 --- a/src/client/language/tokenizer.ts +++ b/src/client/language/tokenizer.ts @@ -14,7 +14,7 @@ import { ITokenizer, TextRange, TokenizerMode, - TokenType + TokenType, } from './types'; enum QuoteType { @@ -22,7 +22,7 @@ enum QuoteType { Single, Double, TripleSingle, - TripleDouble + TripleDouble, } class Token extends TextRange implements IToken { diff --git a/src/client/language/types.ts b/src/client/language/types.ts index 51618039a3d4..0b64a73c5290 100644 --- a/src/client/language/types.ts +++ b/src/client/language/types.ts @@ -87,7 +87,7 @@ export enum TokenType { OpenBracket, CloseBracket, OpenCurly, - CloseCurly + CloseCurly, } export interface IToken extends ITextRange { @@ -96,7 +96,7 @@ export interface IToken extends ITextRange { export enum TokenizerMode { CommentsAndStrings, - Full + Full, } export interface ITokenizer { diff --git a/src/client/language/unicode.ts b/src/client/language/unicode.ts index 9b3ca0b15b25..eb01c8014a21 100644 --- a/src/client/language/unicode.ts +++ b/src/client/language/unicode.ts @@ -15,7 +15,7 @@ export enum UnicodeCategory { NonSpacingMark, SpacingCombiningMark, DecimalDigitNumber, - ConnectorPunctuation + ConnectorPunctuation, } export function getUnicodeCategory(ch: number): UnicodeCategory { diff --git a/src/client/languageServices/jediProxyFactory.ts b/src/client/languageServices/jediProxyFactory.ts index 9a491ecf3889..0a5caf79fd5c 100644 --- a/src/client/languageServices/jediProxyFactory.ts +++ b/src/client/languageServices/jediProxyFactory.ts @@ -11,7 +11,7 @@ export class JediFactory implements Disposable { constructor( private interpreter: PythonEnvironment | undefined, // This is passed through to JediProxy(). - private serviceContainer: IServiceContainer + private serviceContainer: IServiceContainer, ) { this.disposables = []; this.jediProxyHandlers = new Map>(); diff --git a/src/client/languageServices/proposeLanguageServerBanner.ts b/src/client/languageServices/proposeLanguageServerBanner.ts index e397748394ef..adea87c3d475 100644 --- a/src/client/languageServices/proposeLanguageServerBanner.ts +++ b/src/client/languageServices/proposeLanguageServerBanner.ts @@ -14,7 +14,7 @@ import { IExperimentService, IExtensions, IPersistentStateFactory, - IPythonExtensionBanner + IPythonExtensionBanner, } from '../common/types'; import { Common, Pylance } from '../common/utils/localize'; import { sendTelemetryEvent } from '../telemetry'; @@ -26,7 +26,7 @@ export function getPylanceExtensionUri(appEnv: IApplicationEnvironment): string // persistent state names, exported to make use of in testing export enum ProposeLSStateKeys { - ShowBanner = 'TryPylanceBanner' + ShowBanner = 'TryPylanceBanner', } /* @@ -46,7 +46,7 @@ export class ProposePylanceBanner implements IPythonExtensionBanner { @inject(IPersistentStateFactory) private persistentState: IPersistentStateFactory, @inject(IConfigurationService) private configuration: IConfigurationService, @inject(IExperimentService) private experiments: IExperimentService, - @inject(IExtensions) readonly extensions: IExtensions + @inject(IExtensions) readonly extensions: IExtensions, ) {} public get enabled(): boolean { @@ -67,7 +67,7 @@ export class ProposePylanceBanner implements IPythonExtensionBanner { message, Pylance.tryItNow(), Common.bannerLabelNo(), - Pylance.remindMeLater() + Pylance.remindMeLater(), ); let userAction: string; diff --git a/src/client/linters/bandit.ts b/src/client/linters/bandit.ts index 137d95d48275..920c996b3052 100644 --- a/src/client/linters/bandit.ts +++ b/src/client/linters/bandit.ts @@ -13,7 +13,7 @@ import { ILintMessage, LintMessageSeverity } from './types'; const severityMapping: Record = { LOW: LintMessageSeverity.Information, MEDIUM: LintMessageSeverity.Warning, - HIGH: LintMessageSeverity.Error + HIGH: LintMessageSeverity.Error, }; export class Bandit extends BaseLinter { @@ -26,7 +26,7 @@ export class Bandit extends BaseLinter { const messages = await this.run( ['-f', 'custom', '--msg-template', '{line},0,{severity},{test_id}:{msg}', '-n', '-1', document.uri.fsPath], document, - cancellation + cancellation, ); messages.forEach((msg) => { diff --git a/src/client/linters/baseLinter.ts b/src/client/linters/baseLinter.ts index 3799e31660b3..d8c2eb1578c5 100644 --- a/src/client/linters/baseLinter.ts +++ b/src/client/linters/baseLinter.ts @@ -42,7 +42,7 @@ export function parseLine( line: string, regex: string, linterID: LinterId, - colOffset: number = 0 + colOffset: number = 0, ): ILintMessage | undefined { const match = matchNamedRegEx(line, regex)!; if (!match) { @@ -60,7 +60,7 @@ export function parseLine( column: isNaN(match.column) || match.column <= 0 ? 0 : match.column - colOffset, line: match.line, type: match.type, - provider: linterID + provider: linterID, }; } @@ -80,7 +80,7 @@ export abstract class BaseLinter implements ILinter { product: Product, protected readonly outputChannel: vscode.OutputChannel, protected readonly serviceContainer: IServiceContainer, - protected readonly columnOffset = 0 + protected readonly columnOffset = 0, ) { this._info = serviceContainer.get(ILinterManager).getLinterInfo(product); this.errorHandler = new ErrorHandler(this.info.product, outputChannel, serviceContainer); @@ -105,7 +105,7 @@ export abstract class BaseLinter implements ILinter { } protected abstract runLinter( document: vscode.TextDocument, - cancellation: vscode.CancellationToken + cancellation: vscode.CancellationToken, ): Promise; // tslint:disable-next-line:no-any @@ -136,7 +136,7 @@ export abstract class BaseLinter implements ILinter { args: string[], document: vscode.TextDocument, cancellation: vscode.CancellationToken, - regEx: string = REGEX + regEx: string = REGEX, ): Promise { if (!this.info.isEnabled(document.uri)) { return []; @@ -144,13 +144,13 @@ export abstract class BaseLinter implements ILinter { const executionInfo = this.info.getExecutionInfo(args, document.uri); const cwd = this.getWorkspaceRootPath(document); const pythonToolsExecutionService = this.serviceContainer.get( - IPythonToolExecutionService + IPythonToolExecutionService, ); try { const result = await pythonToolsExecutionService.exec( executionInfo, { cwd, token: cancellation, mergeStdOutErr: false }, - document.uri + document.uri, ); this.displayLinterResultHeader(result.stdout); return await this.parseMessages(result.stdout, document, cancellation, regEx); @@ -164,7 +164,7 @@ export abstract class BaseLinter implements ILinter { output: string, _document: vscode.TextDocument, _token: vscode.CancellationToken, - regEx: string + regEx: string, ) { const outputLines = output.splitLines({ removeEmptyEntries: false, trim: false }); return this.parseLines(outputLines, regEx); diff --git a/src/client/linters/constants.ts b/src/client/linters/constants.ts index 3f1bfa3f5dcc..27b7c80db7f4 100644 --- a/src/client/linters/constants.ts +++ b/src/client/linters/constants.ts @@ -15,5 +15,5 @@ export const LINTERID_BY_PRODUCT = new Map([ [Product.pycodestyle, LinterId.PyCodeStyle], [Product.prospector, LinterId.Prospector], [Product.pydocstyle, LinterId.PyDocStyle], - [Product.pylama, LinterId.PyLama] + [Product.pylama, LinterId.PyLama], ]); diff --git a/src/client/linters/errorHandlers/baseErrorHandler.ts b/src/client/linters/errorHandlers/baseErrorHandler.ts index 7ef13f4e615c..67fcacb35b56 100644 --- a/src/client/linters/errorHandlers/baseErrorHandler.ts +++ b/src/client/linters/errorHandlers/baseErrorHandler.ts @@ -14,7 +14,7 @@ export abstract class BaseErrorHandler implements IErrorHandler { constructor( protected product: Product, protected outputChannel: OutputChannel, - protected serviceContainer: IServiceContainer + protected serviceContainer: IServiceContainer, ) { this.installer = this.serviceContainer.get(IInstaller); } diff --git a/src/client/linters/flake8.ts b/src/client/linters/flake8.ts index 5d2cd0d4e6c1..71456d9e0eb2 100644 --- a/src/client/linters/flake8.ts +++ b/src/client/linters/flake8.ts @@ -16,7 +16,7 @@ export class Flake8 extends BaseLinter { const messages = await this.run( ['--format=%(row)d,%(col)d,%(code).1s,%(code)s:%(text)s', document.uri.fsPath], document, - cancellation + cancellation, ); messages.forEach((msg) => { msg.severity = this.parseMessagesSeverity(msg.type, this.pythonSettings.linting.flake8CategorySeverity); diff --git a/src/client/linters/linterAvailability.ts b/src/client/linters/linterAvailability.ts index 834a86284610..2f60096ea00e 100644 --- a/src/client/linters/linterAvailability.ts +++ b/src/client/linters/linterAvailability.ts @@ -24,7 +24,7 @@ export class AvailableLinterActivator implements IAvailableLinterActivator { @inject(IFileSystem) private fs: IFileSystem, @inject(IWorkspaceService) private workspaceService: IWorkspaceService, @inject(IConfigurationService) private configService: IConfigurationService, - @inject(IPersistentStateFactory) private persistentStateFactory: IPersistentStateFactory + @inject(IPersistentStateFactory) private persistentStateFactory: IPersistentStateFactory, ) {} /** @@ -67,7 +67,7 @@ export class AvailableLinterActivator implements IAvailableLinterActivator { public async promptToConfigureAvailableLinter(linterInfo: ILinterInfo): Promise { const notificationPromptEnabled = this.persistentStateFactory.createWorkspacePersistentState( doNotDisplayPromptStateKey, - true + true, ); if (!notificationPromptEnabled.value) { return false; @@ -77,11 +77,11 @@ export class AvailableLinterActivator implements IAvailableLinterActivator { const telemetrySelections: ['enable', 'ignore', 'disablePrompt'] = ['enable', 'ignore', 'disablePrompt']; const pick = await this.appShell.showInformationMessage( Linters.enablePylint().format(linterInfo.id), - ...optButtons + ...optButtons, ); sendTelemetryEvent(EventName.CONFIGURE_AVAILABLE_LINTER_PROMPT, undefined, { tool: linterInfo.id, - action: pick ? telemetrySelections[optButtons.indexOf(pick)] : undefined + action: pick ? telemetrySelections[optButtons.indexOf(pick)] : undefined, }); if (pick === optButtons[0]) { await linterInfo.enableAsync(true); diff --git a/src/client/linters/linterCommands.ts b/src/client/linters/linterCommands.ts index 3f7f11dcc206..e93ca15f3197 100644 --- a/src/client/linters/linterCommands.ts +++ b/src/client/linters/linterCommands.ts @@ -54,7 +54,7 @@ export class LinterCommands implements IDisposable { const quickPickOptions: QuickPickOptions = { matchOnDetail: true, matchOnDescription: true, - placeHolder: `current: ${current}` + placeHolder: `current: ${current}`, }; const selection = await this.appShell.showQuickPick(linterList, quickPickOptions); @@ -68,7 +68,7 @@ export class LinterCommands implements IDisposable { const response = await this.appShell.showWarningMessage( Linters.replaceWithSelectedLinter().format(selection), 'Yes', - 'No' + 'No', ); if (response !== 'Yes') { return; @@ -87,7 +87,7 @@ export class LinterCommands implements IDisposable { const quickPickOptions: QuickPickOptions = { matchOnDetail: true, matchOnDescription: true, - placeHolder: `current: ${current}` + placeHolder: `current: ${current}`, }; const selection = await this.appShell.showQuickPick(options, quickPickOptions); diff --git a/src/client/linters/linterInfo.ts b/src/client/linters/linterInfo.ts index 307afe4c0cc2..67a36f0434d3 100644 --- a/src/client/linters/linterInfo.ts +++ b/src/client/linters/linterInfo.ts @@ -19,7 +19,7 @@ export class LinterInfo implements ILinterInfo { product: Product, id: LinterId, protected configService: IConfigurationService, - configFileNames: string[] = [] + configFileNames: string[] = [], ) { this._product = product; this._id = id; @@ -81,7 +81,7 @@ export class PylintLinterInfo extends LinterInfo { constructor( configService: IConfigurationService, private readonly workspaceService: IWorkspaceService, - configFileNames: string[] = [] + configFileNames: string[] = [], ) { super(Product.pylint, LinterId.PyLint, configService, configFileNames); } diff --git a/src/client/linters/linterManager.ts b/src/client/linters/linterManager.ts index a9dd8e1c9c70..9bfba890094d 100644 --- a/src/client/linters/linterManager.ts +++ b/src/client/linters/linterManager.ts @@ -38,7 +38,7 @@ export class LinterManager implements ILinterManager { constructor( @inject(IServiceContainer) private serviceContainer: IServiceContainer, - @inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService + @inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService, ) { this.configService = serviceContainer.get(IConfigurationService); // Note that we use unit tests to ensure all the linters are here. @@ -50,7 +50,7 @@ export class LinterManager implements ILinterManager { new LinterInfo(Product.pycodestyle, LinterId.PyCodeStyle, this.configService), new LinterInfo(Product.prospector, LinterId.Prospector, this.configService), new LinterInfo(Product.pydocstyle, LinterId.PyDocStyle, this.configService), - new LinterInfo(Product.pylama, LinterId.PyLama, this.configService) + new LinterInfo(Product.pylama, LinterId.PyLama, this.configService), ]; } @@ -111,7 +111,7 @@ export class LinterManager implements ILinterManager { product: Product, outputChannel: OutputChannel, serviceContainer: IServiceContainer, - resource?: Uri + resource?: Uri, ): Promise { if (!(await this.isLintingEnabled(true, resource))) { return new DisabledLinter(this.configService); diff --git a/src/client/linters/lintingEngine.ts b/src/client/linters/lintingEngine.ts index c9bf05ff8e74..00c7dab0ea08 100644 --- a/src/client/linters/lintingEngine.ts +++ b/src/client/linters/lintingEngine.ts @@ -97,7 +97,7 @@ export class LintingEngine implements ILintingEngine { info.product, this.outputChannel, this.serviceContainer, - document.uri + document.uri, ); const promise = linter.lint(document, cancelToken.token); this.sendLinterRunTelemetry(info, document.uri, promise, stopWatch, trigger); @@ -133,14 +133,14 @@ export class LintingEngine implements ILintingEngine { resource: vscode.Uri, promise: Promise, stopWatch: StopWatch, - trigger: LinterTrigger + trigger: LinterTrigger, ): void { const linterExecutablePathName = info.pathName(resource); const properties: LintingTelemetry = { tool: info.id, hasCustomArgs: info.linterArgs(resource).length > 0, trigger, - executableSpecified: linterExecutablePathName.length > 0 + executableSpecified: linterExecutablePathName.length > 0, }; sendTelemetryWhenDone(EventName.LINTING, promise, stopWatch, properties); } @@ -181,7 +181,7 @@ export class LintingEngine implements ILintingEngine { const settings = this.configurationService.getSettings(document.uri); // { dot: true } is important so dirs like `.venv` will be matched by globs const ignoreMinmatches = settings.linting.ignorePatterns.map( - (pattern) => new Minimatch(pattern, { dot: true }) + (pattern) => new Minimatch(pattern, { dot: true }), ); if (ignoreMinmatches.some((matcher) => matcher.match(document.fileName) || matcher.match(relativeFileName))) { return false; diff --git a/src/client/linters/prospector.ts b/src/client/linters/prospector.ts index 2341b49e155b..106f3bfe9104 100644 --- a/src/client/linters/prospector.ts +++ b/src/client/linters/prospector.ts @@ -55,7 +55,7 @@ export class Prospector extends BaseLinter { column: msg.location.character, line: lineNumber, type: msg.code, - provider: `${this.info.id} - ${msg.source}` + provider: `${this.info.id} - ${msg.source}`, }; }); } diff --git a/src/client/linters/pycodestyle.ts b/src/client/linters/pycodestyle.ts index 2d425ab29b18..0a7066df9cb2 100644 --- a/src/client/linters/pycodestyle.ts +++ b/src/client/linters/pycodestyle.ts @@ -16,12 +16,12 @@ export class Pycodestyle extends BaseLinter { const messages = await this.run( ['--format=%(row)d,%(col)d,%(code).1s,%(code)s:%(text)s', document.uri.fsPath], document, - cancellation + cancellation, ); messages.forEach((msg) => { msg.severity = this.parseMessagesSeverity( msg.type, - this.pythonSettings.linting.pycodestyleCategorySeverity + this.pythonSettings.linting.pycodestyleCategorySeverity, ); }); return messages; diff --git a/src/client/linters/pydocstyle.ts b/src/client/linters/pydocstyle.ts index 718e8b359b21..2e58de41a741 100644 --- a/src/client/linters/pydocstyle.ts +++ b/src/client/linters/pydocstyle.ts @@ -70,7 +70,7 @@ export class PyDocStyle extends BaseLinter { column: sourceStart, line: lineNumber, type: '', - provider: this.info.id + provider: this.info.id, } as ILintMessage; } catch (ex) { traceError(`Failed to parse pydocstyle line '${line}'`, ex); diff --git a/src/client/linters/pylint.ts b/src/client/linters/pylint.ts index cf3474427dd7..b0dc673ae5b0 100644 --- a/src/client/linters/pylint.ts +++ b/src/client/linters/pylint.ts @@ -43,7 +43,7 @@ export class Pylint extends BaseLinter { !(await Pylint.hasConfigurationFile( this.fileSystem, this.getWorkspaceRootPath(document), - this.platformService + this.platformService, )) ) { // Disable all checkers up front and then selectively add back in: @@ -70,14 +70,14 @@ export class Pylint extends BaseLinter { ',E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127' + ',E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137' + ',E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303' + - ',E1304,E1305,E1306,E1310,E1700,E1701' + ',E1304,E1305,E1306,E1310,E1700,E1701', ]; } const args = [ "--msg-template='{line},{column},{category},{symbol}:{msg}'", '--reports=n', '--output-format=text', - uri.fsPath + uri.fsPath, ]; const messages = await this.run(minArgs.concat(args), document, cancellation, REGEX); messages.forEach((msg) => { @@ -91,7 +91,7 @@ export class Pylint extends BaseLinter { public static async hasConfigurationFile( fs: IFileSystem, folder: string, - platformService: IPlatformService + platformService: IPlatformService, ): Promise { // https://pylint.readthedocs.io/en/latest/user_guide/run.html // https://github.com/PyCQA/pylint/blob/975e08148c0faa79958b459303c47be1a2e1500a/pylint/config.py @@ -153,7 +153,7 @@ export class Pylint extends BaseLinter { public static async hasConfigurationFileInWorkspace( fs: IFileSystem, folder: string, - root: string + root: string, ): Promise { // Search up from file location to the workspace root let current = folder; diff --git a/src/client/linters/types.ts b/src/client/linters/types.ts index 6dba6e9d15ac..fb6d1d44e1ca 100644 --- a/src/client/linters/types.ts +++ b/src/client/linters/types.ts @@ -19,7 +19,7 @@ export enum LinterId { PyDocStyle = 'pydocstyle', PyLama = 'pylama', PyLint = 'pylint', - Bandit = 'bandit' + Bandit = 'bandit', } export interface ILinterInfo { @@ -58,7 +58,7 @@ export interface ILinterManager { product: Product, outputChannel: vscode.OutputChannel, serviceContainer: IServiceContainer, - resource?: vscode.Uri + resource?: vscode.Uri, ): Promise; } @@ -75,7 +75,7 @@ export enum LintMessageSeverity { Hint, Error, Warning, - Information + Information, } export const ILintingEngine = Symbol('ILintingEngine'); diff --git a/src/client/logging/formatters.ts b/src/client/logging/formatters.ts index 488c4c91ccaf..48c09547d891 100644 --- a/src/client/logging/formatters.ts +++ b/src/client/logging/formatters.ts @@ -20,7 +20,7 @@ const formattedLogLevels: { [K in LogLevel]: string } = { [LogLevel.Warn]: 'Warn', [LogLevel.Info]: 'Info', [LogLevel.Debug]: 'Debug', - [LogLevel.Trace]: 'Trace' + [LogLevel.Trace]: 'Trace', }; // Return a consistent representation of the given log level. @@ -58,8 +58,8 @@ function getMinimalFormatter() { format.timestamp({ format: TIMESTAMP }), format.printf( // This relies on the timestamp formatter we added above: - ({ level, message, timestamp }) => formatMessage(level as LogLevelName, timestamp, message) - ) + ({ level, message, timestamp }) => formatMessage(level as LogLevelName, timestamp, message), + ), ); } @@ -72,8 +72,8 @@ function getLabeledFormatter(label_: string) { format.printf( // This relies on the label and timestamp formatters we added above: ({ level, message, label, timestamp }) => - formatLabeledMessage(level as LogLevelName, timestamp, label, message) - ) + formatLabeledMessage(level as LogLevelName, timestamp, label, message), + ), ); } diff --git a/src/client/logging/index.ts b/src/client/logging/index.ts index 861c98f38a41..2d0b23983d26 100644 --- a/src/client/logging/index.ts +++ b/src/client/logging/index.ts @@ -12,5 +12,5 @@ export { logVerbose, logWarning, traceDecorators, - tracing + tracing, } from './_global'; diff --git a/src/client/logging/levels.ts b/src/client/logging/levels.ts index c0982dd3c282..aeab61f27190 100644 --- a/src/client/logging/levels.ts +++ b/src/client/logging/levels.ts @@ -16,7 +16,7 @@ export enum LogLevel { Warn = 30, Info = 20, Debug = 10, - Trace = 5 + Trace = 5, } export type LogLevelName = 'ERROR' | 'WARNING' | 'INFORMATION' | 'DEBUG' | 'DEBUG-TRACE'; const logLevelMap: { [K in LogLevel]: LogLevelName } = { @@ -24,7 +24,7 @@ const logLevelMap: { [K in LogLevel]: LogLevelName } = { [LogLevel.Warn]: 'WARNING', [LogLevel.Info]: 'INFORMATION', [LogLevel.Debug]: 'DEBUG', - [LogLevel.Trace]: 'DEBUG-TRACE' + [LogLevel.Trace]: 'DEBUG-TRACE', }; // This can be used for winston.LoggerOptions.levels. export const configLevels: winston.config.AbstractConfigSetLevels = { @@ -32,7 +32,7 @@ export const configLevels: winston.config.AbstractConfigSetLevels = { WARNING: 1, INFORMATION: 2, DEBUG: 4, - 'DEBUG-TRACE': 5 + 'DEBUG-TRACE': 5, }; //====================== @@ -46,7 +46,7 @@ const npmLogLevelMap: { [K in LogLevel]: NPMLogLevelName } = { [LogLevel.Warn]: 'warn', [LogLevel.Info]: 'info', [LogLevel.Debug]: 'debug', - [LogLevel.Trace]: 'silly' + [LogLevel.Trace]: 'silly', }; //====================== @@ -56,7 +56,7 @@ const npmLogLevelMap: { [K in LogLevel]: NPMLogLevelName } = { export function resolveLevelName( level: LogLevel, // Default to configLevels. - levels?: winston.config.AbstractConfigSetLevels + levels?: winston.config.AbstractConfigSetLevels, ): string | undefined { if (levels === undefined) { return getLevelName(level); @@ -76,7 +76,7 @@ export function getLevelName(level: LogLevel): LogLevelName | undefined { export function resolveLevel( levelName: string, // Default to configLevels. - levels?: winston.config.AbstractConfigSetLevels + levels?: winston.config.AbstractConfigSetLevels, ): LogLevel | undefined { let levelMap: { [K in LogLevel]: string }; if (levels === undefined) { diff --git a/src/client/logging/logger.ts b/src/client/logging/logger.ts index ab5ba55cb519..897d6825ddb6 100644 --- a/src/client/logging/logger.ts +++ b/src/client/logging/logger.ts @@ -61,7 +61,7 @@ export function getPreDefinedConfiguration(): LoggerConfig { } if (process.env.VSC_PYTHON_LOG_FILE) { config.file = { - logfile: process.env.VSC_PYTHON_LOG_FILE + logfile: process.env.VSC_PYTHON_LOG_FILE, }; } return config; diff --git a/src/client/logging/trace.ts b/src/client/logging/trace.ts index 3191df5bd9d7..324641844dbc 100644 --- a/src/client/logging/trace.ts +++ b/src/client/logging/trace.ts @@ -13,7 +13,7 @@ import { argsToLogString, returnValueToLogString } from './util'; export enum TraceOptions { None = 0, Arguments = 1, - ReturnValue = 2 + ReturnValue = 2, } export function createTracingDecorator(loggers: ILogger[], logInfo: LogInfo) { @@ -51,7 +51,7 @@ function formatMessages(info: LogInfo, traced: TraceInfo, call?: CallInfo): stri messages.push( `${call.kind} name = ${call.name}`.trim(), `completed in ${traced.elapsed}ms`, - `has a ${traced.returnValue ? 'truthy' : 'falsy'} return value` + `has a ${traced.returnValue ? 'truthy' : 'falsy'} return value`, ); if ((info.opts & TraceOptions.Arguments) === TraceOptions.Arguments) { messages.push(argsToLogString(call.args)); diff --git a/src/client/logging/transports.ts b/src/client/logging/transports.ts index 2a8e83a5fa52..958e29e88d86 100644 --- a/src/client/logging/transports.ts +++ b/src/client/logging/transports.ts @@ -34,7 +34,7 @@ class ConsoleTransport extends Transport { [LogLevel.Warn]: console.warn, [LogLevel.Info]: console.info, [LogLevel.Debug]: console.debug, - [LogLevel.Trace]: console.trace + [LogLevel.Trace]: console.trace, }; private static defaultFunc = console.log; // tslint:enable:no-console @@ -45,7 +45,7 @@ class ConsoleTransport extends Transport { constructor( // tslint:disable-next-line:no-any options?: any, - private readonly levels?: winston.config.AbstractConfigSetLevels + private readonly levels?: winston.config.AbstractConfigSetLevels, ) { super(options); } @@ -74,7 +74,7 @@ class ConsoleTransport extends Transport { export function getConsoleTransport(formatter: logform.Format): Transport { return new ConsoleTransport({ // We minimize customization. - format: formatter + format: formatter, }); } @@ -97,7 +97,7 @@ class PythonOutputChannelTransport extends Transport { export function getPythonOutputChannelTransport(channel: OutputChannel, formatter: logform.Format) { return new PythonOutputChannelTransport(channel, { // We minimize customization. - format: formatter + format: formatter, }); } @@ -109,6 +109,6 @@ export function getFileTransport(logfile: string, formatter: logform.Format): Tr return new winston.transports.File({ format: formatter, filename: logfile, - handleExceptions: true + handleExceptions: true, }); } diff --git a/src/client/providers/codeActionProvider/launchJsonCodeActionProvider.ts b/src/client/providers/codeActionProvider/launchJsonCodeActionProvider.ts index 805614794bd7..de60c980d8bc 100644 --- a/src/client/providers/codeActionProvider/launchJsonCodeActionProvider.ts +++ b/src/client/providers/codeActionProvider/launchJsonCodeActionProvider.ts @@ -9,7 +9,7 @@ import { Diagnostic, Range, TextDocument, - WorkspaceEdit + WorkspaceEdit, } from 'vscode'; /** diff --git a/src/client/providers/codeActionProvider/main.ts b/src/client/providers/codeActionProvider/main.ts index 375c9986d949..ba9dc82588fb 100644 --- a/src/client/providers/codeActionProvider/main.ts +++ b/src/client/providers/codeActionProvider/main.ts @@ -16,12 +16,12 @@ export class CodeActionProviderService implements IExtensionSingleActivationServ const documentSelector: vscodeTypes.DocumentFilter = { scheme: 'file', language: 'jsonc', - pattern: '**/launch.json' + pattern: '**/launch.json', }; this.disposableRegistry.push( vscode.languages.registerCodeActionsProvider(documentSelector, new LaunchJsonCodeActionProvider(), { - providedCodeActionKinds: [vscode.CodeActionKind.QuickFix] - }) + providedCodeActionKinds: [vscode.CodeActionKind.QuickFix], + }), ); } } diff --git a/src/client/providers/codeActionProvider/pythonCodeActionProvider.ts b/src/client/providers/codeActionProvider/pythonCodeActionProvider.ts index d1c45dd8610e..4987a020e6cd 100644 --- a/src/client/providers/codeActionProvider/pythonCodeActionProvider.ts +++ b/src/client/providers/codeActionProvider/pythonCodeActionProvider.ts @@ -11,7 +11,7 @@ export class PythonCodeActionProvider implements vscode.CodeActionProvider { document: vscode.TextDocument, _range: vscode.Range, _context: vscode.CodeActionContext, - _token: vscode.CancellationToken + _token: vscode.CancellationToken, ): vscode.ProviderResult { if (isNotebookCell(document)) { return []; @@ -19,7 +19,7 @@ export class PythonCodeActionProvider implements vscode.CodeActionProvider { const sortImports = new vscode.CodeAction('Sort imports', vscode.CodeActionKind.SourceOrganizeImports); sortImports.command = { title: 'Sort imports', - command: 'python.sortImports' + command: 'python.sortImports', }; return [sortImports]; diff --git a/src/client/providers/completionProvider.ts b/src/client/providers/completionProvider.ts index 8426cff4ae6d..6ffd69e19985 100644 --- a/src/client/providers/completionProvider.ts +++ b/src/client/providers/completionProvider.ts @@ -22,7 +22,7 @@ export class PythonCompletionItemProvider implements vscode.CompletionItemProvid public async provideCompletionItems( document: vscode.TextDocument, position: vscode.Position, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { const items = await this.completionSource.getVsCodeCompletionItems(document, position, token); if (this.configService.isTestExecution()) { @@ -35,7 +35,7 @@ export class PythonCompletionItemProvider implements vscode.CompletionItemProvid public async resolveCompletionItem( item: vscode.CompletionItem, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { if (!item.documentation) { const itemInfos = await this.completionSource.getDocumentation(item, token); diff --git a/src/client/providers/completionSource.ts b/src/client/providers/completionSource.ts index e135ba18be7b..f7489166568c 100644 --- a/src/client/providers/completionSource.ts +++ b/src/client/providers/completionSource.ts @@ -30,7 +30,7 @@ export class CompletionSource { constructor( jediFactory: JediFactory, private serviceContainer: IServiceContainer, - private itemInfoSource: IItemInfoSource + private itemInfoSource: IItemInfoSource, ) { this.jediFactory = jediFactory; } @@ -38,7 +38,7 @@ export class CompletionSource { public async getVsCodeCompletionItems( document: vscode.TextDocument, position: vscode.Position, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { const result = await this.getCompletionResult(document, position, token); if (result === undefined) { @@ -49,7 +49,7 @@ export class CompletionSource { public async getDocumentation( completionItem: vscode.CompletionItem, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { const documentPosition = DocumentPosition.fromObject(completionItem); if (documentPosition === undefined) { @@ -76,7 +76,7 @@ export class CompletionSource { private async getCompletionResult( document: vscode.TextDocument, position: vscode.Position, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { if (position.character <= 0 || isPositionInsideStringOrComment(document, position)) { return undefined; @@ -91,7 +91,7 @@ export class CompletionSource { fileName: document.fileName, columnIndex: columnIndex, lineIndex: position.line, - source: source + source: source, }; return this.jediFactory.getJediProxyHandler(document.uri).sendCommand(cmd, token); @@ -100,7 +100,7 @@ export class CompletionSource { private toVsCodeCompletions( documentPosition: DocumentPosition, data: proxy.ICompletionResult, - resource: vscode.Uri + resource: vscode.Uri, ): vscode.CompletionItem[] { return data && data.items.length > 0 ? data.items.map((item) => this.toVsCodeCompletion(documentPosition, item, resource)) @@ -110,7 +110,7 @@ export class CompletionSource { private toVsCodeCompletion( documentPosition: DocumentPosition, item: proxy.IAutoCompleteItem, - resource: vscode.Uri + resource: vscode.Uri, ): vscode.CompletionItem { const completionItem = new vscode.CompletionItem(item.text); completionItem.kind = item.type; diff --git a/src/client/providers/definitionProvider.ts b/src/client/providers/definitionProvider.ts index 9b3d8f1a7ce6..29c639731e26 100644 --- a/src/client/providers/definitionProvider.ts +++ b/src/client/providers/definitionProvider.ts @@ -17,7 +17,7 @@ export class PythonDefinitionProvider implements vscode.DefinitionProvider { definition.range.startLine, definition.range.startColumn, definition.range.endLine, - definition.range.endColumn + definition.range.endColumn, ); return new vscode.Location(definitionResource, range); } @@ -26,7 +26,7 @@ export class PythonDefinitionProvider implements vscode.DefinitionProvider { public async provideDefinition( document: vscode.TextDocument, position: vscode.Position, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { const filename = document.fileName; if (document.lineAt(position.line).text.match(/^\s*\/\//)) { @@ -45,7 +45,7 @@ export class PythonDefinitionProvider implements vscode.DefinitionProvider { command: proxy.CommandType.Definitions, fileName: filename, columnIndex: columnIndex, - lineIndex: position.line + lineIndex: position.line, }; if (document.isDirty) { cmd.source = document.getText(); diff --git a/src/client/providers/docStringFoldingProvider.ts b/src/client/providers/docStringFoldingProvider.ts index 424b9b6a74ec..29f1ad9ad2cd 100644 --- a/src/client/providers/docStringFoldingProvider.ts +++ b/src/client/providers/docStringFoldingProvider.ts @@ -11,7 +11,7 @@ import { FoldingRangeProvider, ProviderResult, Range, - TextDocument + TextDocument, } from 'vscode'; import { IterableTextRange } from '../language/iterableTextRange'; import { IToken, TokenizerMode, TokenType } from '../language/types'; @@ -21,7 +21,7 @@ export class DocStringFoldingProvider implements FoldingRangeProvider { public provideFoldingRanges( document: TextDocument, _context: FoldingContext, - _token: CancellationToken + _token: CancellationToken, ): ProviderResult { return this.getFoldingRanges(document); } @@ -30,7 +30,7 @@ export class DocStringFoldingProvider implements FoldingRangeProvider { const tokenCollection = getDocumentTokens( document, document.lineAt(document.lineCount - 1).range.end, - TokenizerMode.CommentsAndStrings + TokenizerMode.CommentsAndStrings, ); const tokens = new IterableTextRange(tokenCollection); diff --git a/src/client/providers/formatProvider.ts b/src/client/providers/formatProvider.ts index cd4d8f3956c0..29da69dd1f43 100644 --- a/src/client/providers/formatProvider.ts +++ b/src/client/providers/formatProvider.ts @@ -42,14 +42,14 @@ export class PythonFormattingEditProvider this.config = serviceContainer.get(IConfigurationService); const interpreterService = serviceContainer.get(IInterpreterService); this.disposables.push( - this.documentManager.onDidSaveTextDocument(async (document) => this.onSaveDocument(document)) + this.documentManager.onDidSaveTextDocument(async (document) => this.onSaveDocument(document)), ); this.disposables.push( interpreterService.onDidChangeInterpreter(async () => { if (this.documentManager.activeTextEditor) { return this.onSaveDocument(this.documentManager.activeTextEditor.document); } - }) + }), ); } @@ -60,7 +60,7 @@ export class PythonFormattingEditProvider public provideDocumentFormattingEdits( document: vscode.TextDocument, options: vscode.FormattingOptions, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { return this.provideDocumentRangeFormattingEdits(document, undefined, options, token); } @@ -69,7 +69,7 @@ export class PythonFormattingEditProvider document: vscode.TextDocument, range: vscode.Range | undefined, options: vscode.FormattingOptions, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { // Workaround for https://github.com/Microsoft/vscode/issues/41194 // VSC rejects 'format on save' promise in 750 ms. Python formatting may take quite a bit longer. diff --git a/src/client/providers/hoverProvider.ts b/src/client/providers/hoverProvider.ts index 13a7ed7e205f..49f2d088ab73 100644 --- a/src/client/providers/hoverProvider.ts +++ b/src/client/providers/hoverProvider.ts @@ -17,7 +17,7 @@ export class PythonHoverProvider implements vscode.HoverProvider { public async provideHover( document: vscode.TextDocument, position: vscode.Position, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { const itemInfos = await this.itemInfoSource.getItemInfoFromDocument(document, position, token); if (itemInfos) { diff --git a/src/client/providers/importSortProvider.ts b/src/client/providers/importSortProvider.ts index c55b20fcc49f..4a227655d6a9 100644 --- a/src/client/providers/importSortProvider.ts +++ b/src/client/providers/importSortProvider.ts @@ -12,7 +12,7 @@ import { IDisposableRegistry, IEditorUtils, IOutputChannel, - IPersistentStateFactory + IPersistentStateFactory, } from '../common/types'; import { createDeferred, createDeferredFromPromise, Deferred } from '../common/utils/async'; import { Common, Diagnostics } from '../common/utils/localize'; @@ -69,7 +69,7 @@ export class SortImportsEditingProvider implements ISortImportsEditingProvider { public async _provideDocumentSortImportsEdits( uri: Uri, - token?: CancellationToken + token?: CancellationToken, ): Promise { const document = await this.documentManager.openTextDocument(uri); if (!document) { @@ -138,7 +138,7 @@ export class SortImportsEditingProvider implements ISortImportsEditingProvider { public async _showWarningAndOptionallyShowOutput() { const neverShowAgain = this.persistentStateFactory.createGlobalPersistentState( doNotDisplayPromptStateKey, - false + false, ); if (neverShowAgain.value) { return; @@ -146,7 +146,7 @@ export class SortImportsEditingProvider implements ISortImportsEditingProvider { const selection = await this.shell.showWarningMessage( Diagnostics.checkIsort5UpgradeGuide(), Common.openOutputPanel(), - Common.doNotShowAgain() + Common.doNotShowAgain(), ); if (selection === Common.openOutputPanel()) { this.output.show(true); @@ -158,7 +158,7 @@ export class SortImportsEditingProvider implements ISortImportsEditingProvider { private async getExecIsort( document: TextDocument, uri: Uri, - token?: CancellationToken + token?: CancellationToken, ): Promise<(documentText: string) => Promise> { const settings = this.configurationService.getSettings(uri); const _isort = settings.sortImports.path; @@ -174,7 +174,7 @@ export class SortImportsEditingProvider implements ISortImportsEditingProvider { const spawnOptions = { token, - cwd: path.dirname(uri.fsPath) + cwd: path.dirname(uri.fsPath), }; if (isort) { @@ -197,7 +197,7 @@ export class SortImportsEditingProvider implements ISortImportsEditingProvider { private async communicateWithIsortProcess( observableResult: ObservableExecutionResult, - inputText: string + inputText: string, ): Promise { // Configure our listening to the output from isort ... let outputBuffer = ''; @@ -219,7 +219,7 @@ export class SortImportsEditingProvider implements ISortImportsEditingProvider { }, complete: () => { isortOutput.resolve(outputBuffer); - } + }, }); // ... then send isort the document content ... diff --git a/src/client/providers/itemInfoSource.ts b/src/client/providers/itemInfoSource.ts index b7a38a65a884..f4801fe68d57 100644 --- a/src/client/providers/itemInfoSource.ts +++ b/src/client/providers/itemInfoSource.ts @@ -12,7 +12,7 @@ export class LanguageItemInfo { constructor( public tooltip: vscode.MarkdownString, public detail: string, - public signature: vscode.MarkdownString + public signature: vscode.MarkdownString, ) {} } @@ -22,12 +22,12 @@ export interface IItemInfoSource { fileName: string, range: vscode.Range, sourceText: string, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise; getItemInfoFromDocument( document: vscode.TextDocument, position: vscode.Position, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise; } @@ -40,7 +40,7 @@ export class ItemInfoSource implements IItemInfoSource { fileName: string, range: vscode.Range, sourceText: string, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { const result = await this.getHoverResultFromTextRange(documentUri, fileName, range, sourceText, token); if (!result || !result.items.length) { @@ -52,7 +52,7 @@ export class ItemInfoSource implements IItemInfoSource { public async getItemInfoFromDocument( document: vscode.TextDocument, position: vscode.Position, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { const range = document.getWordRangeAtPosition(position); if (!range || range.isEmpty) { @@ -69,7 +69,7 @@ export class ItemInfoSource implements IItemInfoSource { private async getHoverResultFromDocument( document: vscode.TextDocument, position: vscode.Position, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { if (position.character <= 0 || document.lineAt(position.line).text.match(/^\s*\/\//)) { return; @@ -84,13 +84,13 @@ export class ItemInfoSource implements IItemInfoSource { private async getHoverResultFromDocumentRange( document: vscode.TextDocument, range: vscode.Range, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { const cmd: proxy.ICommand = { command: proxy.CommandType.Hover, fileName: document.fileName, columnIndex: range.end.character, - lineIndex: range.end.line + lineIndex: range.end.line, }; if (document.isDirty) { cmd.source = document.getText(); @@ -103,14 +103,14 @@ export class ItemInfoSource implements IItemInfoSource { fileName: string, range: vscode.Range, sourceText: string, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { const cmd: proxy.ICommand = { command: proxy.CommandType.Hover, fileName: fileName, columnIndex: range.end.character, lineIndex: range.end.line, - source: sourceText + source: sourceText, }; return this.jediFactory.getJediProxyHandler(documentUri).sendCommand(cmd, token); } diff --git a/src/client/providers/jediProxy.ts b/src/client/providers/jediProxy.ts index 0841bc6fbf47..24d5ed3a30fd 100644 --- a/src/client/providers/jediProxy.ts +++ b/src/client/providers/jediProxy.ts @@ -122,7 +122,7 @@ export enum CommandType { Hover, Usages, Definitions, - Symbols + Symbols, } const commandNames = new Map(); @@ -176,7 +176,7 @@ export class JediProxy implements Disposable { public constructor( workspacePath: string, interpreter: PythonEnvironment | undefined, - private serviceContainer: IServiceContainer + private serviceContainer: IServiceContainer, ) { this.workspacePath = workspacePath; const configurationService = serviceContainer.get(IConfigurationService); @@ -307,13 +307,13 @@ export class JediProxy implements Disposable { mem_use: result.memory, limit: limit * 1024 * 1024, isUserDefinedLimit: limit !== 1024, - restart: restartJedi + restart: restartJedi, }; sendTelemetryEvent(EventName.JEDI_MEMORY, undefined, props); } if (restartJedi) { traceWarning( - `IntelliSense process memory consumption exceeded limit of ${limit} MB and process will be restarted.\nThe limit is controlled by the 'python.jediMemoryLimit' setting.` + `IntelliSense process memory consumption exceeded limit of ${limit} MB and process will be restarted.\nThe limit is controlled by the 'python.jediMemoryLimit' setting.`, ); await this.restartLanguageServer(); } @@ -473,11 +473,11 @@ export class JediProxy implements Disposable { }); } }, - (error) => this.handleError('subscription.error', `${error}`) + (error) => this.handleError('subscription.error', `${error}`), ); } private getCommandHandler( - command: CommandType + command: CommandType, ): undefined | ((command: IExecutionCommand, response: object) => void) { switch (command) { case CommandType.Completions: @@ -508,7 +508,7 @@ export class JediProxy implements Disposable { }); const completionResult: ICompletionResult = { items: results, - requestId: command.id + requestId: command.id, }; this.safeResolve(command, completionResult); } @@ -518,7 +518,7 @@ export class JediProxy implements Disposable { const defs = JediProxy.getProperty(response, 'results'); const defResult: IDefinitionResult = { requestId: command.id, - definitions: [] + definitions: [], }; if (defs.length > 0) { defResult.definitions = defs.map((def) => { @@ -534,8 +534,8 @@ export class JediProxy implements Disposable { startLine: def.range.start_line, startColumn: def.range.start_column, endLine: def.range.end_line, - endColumn: def.range.end_column - } + endColumn: def.range.end_column, + }, }; }); } @@ -553,9 +553,9 @@ export class JediProxy implements Disposable { description: def.description, signature: def.signature, docstring: def.docstring, - text: def.text + text: def.text, }; - }) + }), }; this.safeResolve(command, defResult); } @@ -566,7 +566,7 @@ export class JediProxy implements Disposable { defs = Array.isArray(defs) ? defs : []; const defResults: ISymbolResult = { requestId: command.id, - definitions: [] + definitions: [], }; defResults.definitions = defs.map((def) => { const originalType = def.type as string; @@ -581,8 +581,8 @@ export class JediProxy implements Disposable { startLine: def.range.start_line, startColumn: def.range.start_column, endLine: def.range.end_line, - endColumn: def.range.end_column - } + endColumn: def.range.end_column, + }, }; }); this.safeResolve(command, defResults); @@ -600,9 +600,9 @@ export class JediProxy implements Disposable { fileName: item.fileName, lineIndex: item.line - 1, moduleName: item.moduleName, - name: item.name + name: item.name, }; - }) + }), }; this.safeResolve(command, refResult); } @@ -613,7 +613,7 @@ export class JediProxy implements Disposable { // tslint:disable-next-line:no-object-literal-type-assertion this.safeResolve(command, { requestId: command.id, - definitions: defs + definitions: defs, }); } @@ -644,7 +644,7 @@ export class JediProxy implements Disposable { source: cmd.source, line: cmd.lineIndex, column: cmd.columnIndex, - config: this.getConfig() + config: this.getConfig(), }; if (cmd.command === CommandType.Symbols) { @@ -690,17 +690,17 @@ export class JediProxy implements Disposable { }) .catch(() => ''), // Python global site packages, as a fallback in case user hasn't installed them in custom environment. - this.getPathFromPython(internalPython.getUserSitePackages).catch(() => '') + this.getPathFromPython(internalPython.getUserSitePackages).catch(() => ''), ]; try { const pythonPaths = await this.getEnvironmentVariablesProvider() .getEnvironmentVariables(Uri.file(this.workspacePath)) .then((customEnvironmentVars) => - customEnvironmentVars ? JediProxy.getProperty(customEnvironmentVars, 'PYTHONPATH') : '' + customEnvironmentVars ? JediProxy.getProperty(customEnvironmentVars, 'PYTHONPATH') : '', ) .then((pythonPath) => - typeof pythonPath === 'string' && pythonPath.trim().length > 0 ? pythonPath.trim() : '' + typeof pythonPath === 'string' && pythonPath.trim().length > 0 ? pythonPath.trim() : '', ) .then((pythonPath) => pythonPath.split(path.delimiter).filter((item) => item.trim().length > 0)); const resolvedPaths = pythonPaths @@ -716,10 +716,10 @@ export class JediProxy implements Disposable { private getEnvironmentVariablesProvider() { if (!this.environmentVariablesProvider) { this.environmentVariablesProvider = this.serviceContainer.get( - IEnvironmentVariablesProvider + IEnvironmentVariablesProvider, ); this.environmentVariablesProvider.onDidEnvironmentVariablesChange( - this.environmentVariablesChangeHandler.bind(this) + this.environmentVariablesChangeHandler.bind(this), ); } return this.environmentVariablesProvider; @@ -753,13 +753,13 @@ export class JediProxy implements Disposable { useSnippets: false, caseInsensitiveCompletion: true, showDescriptions: true, - fuzzyMatcher: true + fuzzyMatcher: true, }; } private safeResolve( command: IExecutionCommand | undefined | null, - result: ICommandResult | PromiseLike | undefined + result: ICommandResult | PromiseLike | undefined, ): void { if (command && command.deferred) { command.deferred.resolve(result); diff --git a/src/client/providers/objectDefinitionProvider.ts b/src/client/providers/objectDefinitionProvider.ts index fa886cfe05ef..05e2cf62a27d 100644 --- a/src/client/providers/objectDefinitionProvider.ts +++ b/src/client/providers/objectDefinitionProvider.ts @@ -39,7 +39,7 @@ export class PythonObjectDefinitionProvider { }, getWordRangeAtPosition: (_position: vscode.Position) => range, isDirty: true, - getText: () => source + getText: () => source, }); const tokenSource = new vscode.CancellationTokenSource(); diff --git a/src/client/providers/providerUtilities.ts b/src/client/providers/providerUtilities.ts index 7a330b51eec0..e59b046940a9 100644 --- a/src/client/providers/providerUtilities.ts +++ b/src/client/providers/providerUtilities.ts @@ -8,7 +8,7 @@ import { ITextRangeCollection, IToken, TokenizerMode, TokenType } from '../langu export function getDocumentTokens( document: TextDocument, tokenizeTo: Position, - mode: TokenizerMode + mode: TokenizerMode, ): ITextRangeCollection { const text = document.getText(new Range(new Position(0, 0), tokenizeTo)); return new Tokenizer().tokenize(text, 0, text.length, mode); diff --git a/src/client/providers/referenceProvider.ts b/src/client/providers/referenceProvider.ts index 1a392dcb79d3..2372c5a1d280 100644 --- a/src/client/providers/referenceProvider.ts +++ b/src/client/providers/referenceProvider.ts @@ -43,7 +43,7 @@ export class PythonReferenceProvider implements vscode.ReferenceProvider { document: vscode.TextDocument, position: vscode.Position, _context: vscode.ReferenceContext, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { const filename = document.fileName; if (document.lineAt(position.line).text.match(/^\s*\/\//)) { @@ -62,7 +62,7 @@ export class PythonReferenceProvider implements vscode.ReferenceProvider { command: proxy.CommandType.Usages, fileName: filename, columnIndex: columnIndex, - lineIndex: position.line + lineIndex: position.line, }; if (document.isDirty) { diff --git a/src/client/providers/renameProvider.ts b/src/client/providers/renameProvider.ts index 86037f894c60..8a23a4443ee4 100644 --- a/src/client/providers/renameProvider.ts +++ b/src/client/providers/renameProvider.ts @@ -8,7 +8,7 @@ import { Uri, window, workspace, - WorkspaceEdit + WorkspaceEdit, } from 'vscode'; import { STANDARD_OUTPUT_CHANNEL } from '../common/constants'; import { getWorkspaceEditsFromPatch } from '../common/editor'; @@ -35,7 +35,7 @@ export class PythonRenameProvider implements RenameProvider { document: TextDocument, position: Position, newName: string, - _token: CancellationToken + _token: CancellationToken, ): ProviderResult { return workspace.saveAll(false).then(() => { return this.doRename(document, position, newName); diff --git a/src/client/providers/serviceRegistry.ts b/src/client/providers/serviceRegistry.ts index 66640455f08a..3df5f0751ff4 100644 --- a/src/client/providers/serviceRegistry.ts +++ b/src/client/providers/serviceRegistry.ts @@ -13,6 +13,6 @@ export function registerTypes(serviceManager: IServiceManager) { serviceManager.addSingleton(ISortImportsEditingProvider, SortImportsEditingProvider); serviceManager.addSingleton( IExtensionSingleActivationService, - CodeActionProviderService + CodeActionProviderService, ); } diff --git a/src/client/providers/signatureProvider.ts b/src/client/providers/signatureProvider.ts index df10f120b21a..5ec40a93327e 100644 --- a/src/client/providers/signatureProvider.ts +++ b/src/client/providers/signatureProvider.ts @@ -8,7 +8,7 @@ import { SignatureHelp, SignatureHelpProvider, SignatureInformation, - TextDocument + TextDocument, } from 'vscode'; import { JediFactory } from '../languageServices/jediProxyFactory'; import { captureTelemetry } from '../telemetry'; @@ -19,7 +19,7 @@ import { isPositionInsideStringOrComment } from './providerUtilities'; const DOCSTRING_PARAM_PATTERNS = [ '\\s*:type\\s*PARAMNAME:\\s*([^\\n, ]+)', // Sphinx '\\s*:param\\s*(\\w?)\\s*PARAMNAME:[^\\n]+', // Sphinx param with type - '\\s*@type\\s*PARAMNAME:\\s*([^\\n, ]+)' // Epydoc + '\\s*@type\\s*PARAMNAME:\\s*([^\\n, ]+)', // Epydoc ]; /** @@ -89,7 +89,7 @@ export class PythonSignatureProvider implements SignatureHelpProvider { const sig = { label, documentation, - parameters: [] + parameters: [], }; if (def.params && def.params.length) { @@ -100,7 +100,7 @@ export class PythonSignatureProvider implements SignatureHelpProvider { // tslint:disable-next-line:no-object-literal-type-assertion return { documentation: arg.docstring.length > 0 ? arg.docstring : arg.description, - label: arg.name.trim() + label: arg.name.trim(), }; }); } @@ -115,7 +115,7 @@ export class PythonSignatureProvider implements SignatureHelpProvider { public provideSignatureHelp( document: TextDocument, position: Position, - token: CancellationToken + token: CancellationToken, ): Thenable { // early exit if we're in a string or comment (or in an undefined position) if (position.character <= 0 || isPositionInsideStringOrComment(document, position)) { @@ -127,7 +127,7 @@ export class PythonSignatureProvider implements SignatureHelpProvider { fileName: document.fileName, columnIndex: position.character, lineIndex: position.line, - source: document.getText() + source: document.getText(), }; return this.jediFactory .getJediProxyHandler(document.uri) diff --git a/src/client/providers/simpleRefactorProvider.ts b/src/client/providers/simpleRefactorProvider.ts index 185c22522539..5a638935a447 100644 --- a/src/client/providers/simpleRefactorProvider.ts +++ b/src/client/providers/simpleRefactorProvider.ts @@ -19,7 +19,7 @@ let installer: IInstaller; export function activateSimplePythonRefactorProvider( context: vscode.ExtensionContext, outputChannel: vscode.OutputChannel, - serviceContainer: IServiceContainer + serviceContainer: IServiceContainer, ) { installer = serviceContainer.get(IInstaller); let disposable = vscode.commands.registerCommand(Commands.Refactor_Extract_Variable, () => { @@ -28,7 +28,7 @@ export function activateSimplePythonRefactorProvider( vscode.window.activeTextEditor!, vscode.window.activeTextEditor!.selection, outputChannel, - serviceContainer + serviceContainer, // tslint:disable-next-line:no-empty ).catch(() => {}); sendTelemetryWhenDone(EventName.REFACTOR_EXTRACT_VAR, promise, stopWatch); @@ -41,7 +41,7 @@ export function activateSimplePythonRefactorProvider( vscode.window.activeTextEditor!, vscode.window.activeTextEditor!.selection, outputChannel, - serviceContainer + serviceContainer, // tslint:disable-next-line:no-empty ).catch(() => {}); sendTelemetryWhenDone(EventName.REFACTOR_EXTRACT_FUNCTION, promise, stopWatch); @@ -54,7 +54,7 @@ export function extractVariable( textEditor: vscode.TextEditor, range: vscode.Range, outputChannel: vscode.OutputChannel, - serviceContainer: IServiceContainer + serviceContainer: IServiceContainer, // tslint:disable-next-line:no-any ): Promise { let workspaceFolder = vscode.workspace.getWorkspaceFolder(textEditor.document.uri); @@ -79,7 +79,7 @@ export function extractVariable( newName, textEditor.document.uri.fsPath, range, - textEditor.options + textEditor.options, ) .then((response) => { return response.results[0].diff; @@ -94,7 +94,7 @@ export function extractMethod( textEditor: vscode.TextEditor, range: vscode.Range, outputChannel: vscode.OutputChannel, - serviceContainer: IServiceContainer + serviceContainer: IServiceContainer, // tslint:disable-next-line:no-any ): Promise { let workspaceFolder = vscode.workspace.getWorkspaceFolder(textEditor.document.uri); @@ -119,7 +119,7 @@ export function extractMethod( newName, textEditor.document.uri.fsPath, range, - textEditor.options + textEditor.options, ) .then((response) => { return response.results[0].diff; @@ -151,7 +151,7 @@ function extractName( textEditor: vscode.TextEditor, newName: string, renameResponse: Promise, - outputChannel: vscode.OutputChannel + outputChannel: vscode.OutputChannel, // tslint:disable-next-line:no-any ): Promise { let changeStartsAtLine = -1; @@ -188,12 +188,12 @@ function extractName( textEditor.selections = [ new vscode.Selection( newWordPosition, - new vscode.Position(newWordPosition.line, newWordPosition.character + newName.length) - ) + new vscode.Position(newWordPosition.line, newWordPosition.character + newName.length), + ), ]; textEditor.revealRange( new vscode.Range(textEditor.selection.start, textEditor.selection.end), - vscode.TextEditorRevealType.Default + vscode.TextEditorRevealType.Default, ); } return newWordPosition; diff --git a/src/client/providers/symbolProvider.ts b/src/client/providers/symbolProvider.ts index 150e4a90be35..3ab349a58d6b 100644 --- a/src/client/providers/symbolProvider.ts +++ b/src/client/providers/symbolProvider.ts @@ -10,7 +10,7 @@ import { SymbolInformation, SymbolKind, TextDocument, - Uri + Uri, } from 'vscode'; import { LanguageClient } from 'vscode-languageclient/node'; import { IFileSystem } from '../common/platform/types'; @@ -28,7 +28,7 @@ function flattenSymbolTree(tree: DocumentSymbol, uri: Uri, containerName: string tree.range.start.line, tree.range.start.character, tree.range.end.line, - tree.range.end.character + tree.range.end.character, ); // For whatever reason, the values of VS Code's SymbolKind enum // are off-by-one relative to the LSP: @@ -41,7 +41,7 @@ function flattenSymbolTree(tree: DocumentSymbol, uri: Uri, containerName: string // tslint:disable-next-line:no-any (SymbolKind as any)[(SymbolKind as any)[kind]], containerName, - new Location(uri, range) + new Location(uri, range), ); flattened.push(info); @@ -69,7 +69,7 @@ export class LanguageServerSymbolProvider implements DocumentSymbolProvider { public async provideDocumentSymbols( document: TextDocument, - token: CancellationToken + token: CancellationToken, ): Promise { const uri = document.uri; const args = { textDocument: { uri: uri.toString() } }; @@ -96,7 +96,7 @@ export class JediSymbolProvider implements DocumentSymbolProvider { public constructor( serviceContainer: IServiceContainer, private jediFactory: JediFactory, - private readonly debounceTimeoutMs = 500 + private readonly debounceTimeoutMs = 500, ) { this.debounceRequest = new Map }>(); this.fs = serviceContainer.get(IFileSystem); @@ -109,7 +109,7 @@ export class JediSymbolProvider implements DocumentSymbolProvider { private provideDocumentSymbolsThrottled( document: TextDocument, - token: CancellationToken + token: CancellationToken, ): Thenable { const key = `${document.uri.fsPath}`; if (this.debounceRequest.has(key)) { @@ -130,7 +130,7 @@ export class JediSymbolProvider implements DocumentSymbolProvider { command: proxy.CommandType.Symbols, fileName: filename, columnIndex: 0, - lineIndex: 0 + lineIndex: 0, }; if (document.isDirty) { @@ -168,7 +168,7 @@ export class JediSymbolProvider implements DocumentSymbolProvider { sym.range.startLine, sym.range.startColumn, sym.range.endLine, - sym.range.endColumn + sym.range.endColumn, ); const uri = Uri.file(sym.fileName); const location = new Location(uri, range); diff --git a/src/client/providers/terminalProvider.ts b/src/client/providers/terminalProvider.ts index 15f1241d88ce..d5a051f51c21 100644 --- a/src/client/providers/terminalProvider.ts +++ b/src/client/providers/terminalProvider.ts @@ -32,7 +32,7 @@ export class TerminalProvider implements Disposable { await terminalActivator.activateEnvironmentInTerminal(currentTerminal, { preserveFocus: true }); } sendTelemetryEvent(EventName.ACTIVATE_ENV_IN_CURRENT_TERMINAL, undefined, { - isTerminalVisible: !hideFromUser + isTerminalVisible: !hideFromUser, }); } } diff --git a/src/client/pythonEnvironments/api.ts b/src/client/pythonEnvironments/api.ts index 984661a73852..f8b22a99a9c5 100644 --- a/src/client/pythonEnvironments/api.ts +++ b/src/client/pythonEnvironments/api.ts @@ -4,9 +4,7 @@ import { Event } from 'vscode'; import { Disposables, IDisposable } from '../common/utils/resourceLifecycle'; import { PythonEnvInfo } from './base/info'; -import { - ILocator, IPythonEnvsIterator, PythonLocatorQuery, -} from './base/locator'; +import { ILocator, IPythonEnvsIterator, PythonLocatorQuery } from './base/locator'; import { GetLocatorFunc, LazyWrappingLocator } from './base/locators/common/wrappingLocator'; import { PythonEnvsChangedEvent } from './base/watcher'; diff --git a/src/client/pythonEnvironments/base/envsCache.ts b/src/client/pythonEnvironments/base/envsCache.ts index 7eac01df4736..043a5bfc7a1b 100644 --- a/src/client/pythonEnvironments/base/envsCache.ts +++ b/src/client/pythonEnvironments/base/envsCache.ts @@ -6,11 +6,7 @@ import { cloneDeep } from 'lodash'; import { PythonEnvInfo } from './info'; -import { - areSameEnv, - getEnvExecutable, - haveSameExecutables, -} from './info/env'; +import { areSameEnv, getEnvExecutable, haveSameExecutables } from './info/env'; /** * A simple in-memory store of Python envs. @@ -55,9 +51,7 @@ export class PythonEnvsCache { /** * Find the matching env in the cache, if any. */ - public lookUp( - query: string | Partial, - ): PythonEnvInfo | undefined { + public lookUp(query: string | Partial): PythonEnvInfo | undefined { const executable = getEnvExecutable(query); if (executable === '') { return undefined; diff --git a/src/client/pythonEnvironments/base/info/env.ts b/src/client/pythonEnvironments/base/info/env.ts index eb26752a87f0..bb166e5854d1 100644 --- a/src/client/pythonEnvironments/base/info/env.ts +++ b/src/client/pythonEnvironments/base/info/env.ts @@ -7,20 +7,9 @@ import { normalizeFilename } from '../../../common/utils/filesystem'; import { Architecture } from '../../../common/utils/platform'; import { arePathsSame } from '../../common/externalDependencies'; import { parseVersionFromExecutable } from './executable'; -import { - areEqualVersions, - areEquivalentVersions, - isVersionEmpty, -} from './pythonVersion'; - -import { - FileInfo, - PythonDistroInfo, - PythonEnvInfo, - PythonEnvKind, - PythonReleaseLevel, - PythonVersion, -} from '.'; +import { areEqualVersions, areEquivalentVersions, isVersionEmpty } from './pythonVersion'; + +import { FileInfo, PythonDistroInfo, PythonEnvInfo, PythonEnvKind, PythonReleaseLevel, PythonVersion } from '.'; /** * Create a new info object with all values empty. @@ -34,7 +23,7 @@ export function buildEnvInfo(init?: { version?: PythonVersion; org?: string; arch?: Architecture; - fileInfo?: {ctime:number, mtime:number} + fileInfo?: { ctime: number; mtime: number }; }): PythonEnvInfo { const env = { name: '', @@ -76,7 +65,7 @@ export function buildEnvInfo(init?: { export function copyEnvInfo( env: PythonEnvInfo, updates?: { - kind?: PythonEnvKind, + kind?: PythonEnvKind; }, ): PythonEnvInfo { // We don't care whether or not extra/hidden properties @@ -88,12 +77,15 @@ export function copyEnvInfo( return copied; } -function updateEnv(env: PythonEnvInfo, updates: { - kind?: PythonEnvKind; - executable?: string; - location?: string; - version?: PythonVersion; -}): void { +function updateEnv( + env: PythonEnvInfo, + updates: { + kind?: PythonEnvKind; + executable?: string; + location?: string; + version?: PythonVersion; + }, +): void { if (updates.kind !== undefined) { env.kind = updates.kind; } @@ -112,9 +104,7 @@ function updateEnv(env: PythonEnvInfo, updates: { * Determine the corresponding Python executable filename, if any. */ export function getEnvExecutable(env: string | Partial): string { - const executable = typeof env === 'string' - ? env - : env.executable?.filename || ''; + const executable = typeof env === 'string' ? env : env.executable?.filename || ''; if (executable === '') { return ''; } @@ -224,9 +214,7 @@ export async function getMaxDerivedEnvInfo(minimal: PythonEnvInfo): Promise, -): (env: PythonEnvInfo) => boolean { +export function getEnvMatcher(query: string | Partial): (env: PythonEnvInfo) => boolean { const executable = getEnvExecutable(query); if (executable === '') { // We could throw an exception error, but skipping it is fine. @@ -241,10 +229,7 @@ export function getEnvMatcher( /** * Decide if the two sets of executables for the given envs are the same. */ -export function haveSameExecutables( - envs1: PythonEnvInfo[], - envs2: PythonEnvInfo[], -): boolean { +export function haveSameExecutables(envs1: PythonEnvInfo[], envs2: PythonEnvInfo[]): boolean { if (envs1.length !== envs2.length) { return false; } @@ -291,8 +276,8 @@ export function areSameEnv( const rightVersion = typeof right === 'string' ? undefined : right.version; if (leftVersion && rightVersion) { if ( - areEqualVersions(leftVersion, rightVersion) - || (allowPartialMatch && areEquivalentVersions(leftVersion, rightVersion)) + areEqualVersions(leftVersion, rightVersion) || + (allowPartialMatch && areEquivalentVersions(leftVersion, rightVersion)) ) { return true; } diff --git a/src/client/pythonEnvironments/base/info/index.ts b/src/client/pythonEnvironments/base/info/index.ts index c88321b3392b..ebeead8147d3 100644 --- a/src/client/pythonEnvironments/base/info/index.ts +++ b/src/client/pythonEnvironments/base/info/index.ts @@ -25,7 +25,7 @@ export enum PythonEnvKind { VirtualEnvWrapper = 'virt-virtualenvwrapper', Pipenv = 'virt-pipenv', Conda = 'virt-conda', - OtherVirtual = 'virt-other' + OtherVirtual = 'virt-other', } /** @@ -81,7 +81,7 @@ export enum PythonReleaseLevel { Alpha = 'alpha', Beta = 'beta', Candidate = 'candidate', - Final = 'final' + Final = 'final', } /** @@ -157,7 +157,7 @@ export type PythonEnvInfo = _PythonEnvInfo & { * Note this object is immutable. So if it is assigned to another object, the properties of the other object * also cannot be modified by reference. For eg. `otherVersionObject.major = 3` won't work. */ -export const UNKNOWN_PYTHON_VERSION:PythonVersion = { +export const UNKNOWN_PYTHON_VERSION: PythonVersion = { major: -1, minor: -1, micro: -1, diff --git a/src/client/pythonEnvironments/base/info/interpreter.ts b/src/client/pythonEnvironments/base/info/interpreter.ts index 16d82d3280b5..8c436b6329ae 100644 --- a/src/client/pythonEnvironments/base/info/interpreter.ts +++ b/src/client/pythonEnvironments/base/info/interpreter.ts @@ -2,7 +2,10 @@ // Licensed under the MIT License. import { PythonExecutableInfo, PythonVersion } from '.'; -import { interpreterInfo as getInterpreterInfoCommand, InterpreterInfoJson } from '../../../common/process/internal/scripts'; +import { + interpreterInfo as getInterpreterInfoCommand, + InterpreterInfoJson, +} from '../../../common/process/internal/scripts'; import { Architecture } from '../../../common/utils/platform'; import { copyPythonExecInfo, PythonExecInfo } from '../../exec'; import { parseVersion } from './pythonVersion'; diff --git a/src/client/pythonEnvironments/base/info/pythonVersion.ts b/src/client/pythonEnvironments/base/info/pythonVersion.ts index 98ee4db0451a..7d6bcac3d5c6 100644 --- a/src/client/pythonEnvironments/base/info/pythonVersion.ts +++ b/src/client/pythonEnvironments/base/info/pythonVersion.ts @@ -3,20 +3,11 @@ import * as path from 'path'; import { traceError } from '../../../common/logger'; -import { - EMPTY_VERSION, - isVersionInfoEmpty, - parseBasicVersionInfo, -} from '../../../common/utils/version'; - -import { - PythonReleaseLevel, - PythonVersion, - PythonVersionRelease, - UNKNOWN_PYTHON_VERSION, -} from '.'; - -export function getPythonVersionFromPath(exe:string): PythonVersion { +import { EMPTY_VERSION, isVersionInfoEmpty, parseBasicVersionInfo } from '../../../common/utils/version'; + +import { PythonReleaseLevel, PythonVersion, PythonVersionRelease, UNKNOWN_PYTHON_VERSION } from '.'; + +export function getPythonVersionFromPath(exe: string): PythonVersion { let version = UNKNOWN_PYTHON_VERSION; try { version = parseVersion(path.basename(exe)); @@ -146,7 +137,7 @@ export function isVersionEmpty(version: PythonVersion): boolean { * @param {PythonVersion} right * @returns {boolean} */ -export function areEqualVersions(left: PythonVersion, right:PythonVersion): boolean { +export function areEqualVersions(left: PythonVersion, right: PythonVersion): boolean { return left === right; } @@ -158,15 +149,12 @@ export function areEqualVersions(left: PythonVersion, right:PythonVersion): bool * @param {PythonVersion} right * @returns {boolean} */ -export function areEquivalentVersions(left: PythonVersion, right:PythonVersion): boolean { +export function areEquivalentVersions(left: PythonVersion, right: PythonVersion): boolean { if (left.major === 2 && right.major === 2) { // We are going to assume that if the major version is 2 then the version is 2.7 return true; } // In the case of 3.* if major and minor match we assume that they are equivalent versions - return ( - left.major === right.major - && left.minor === right.minor - ); + return left.major === right.major && left.minor === right.minor; } diff --git a/src/client/pythonEnvironments/base/locator.ts b/src/client/pythonEnvironments/base/locator.ts index 2942f8ab1dae..67f28b7a67a4 100644 --- a/src/client/pythonEnvironments/base/locator.ts +++ b/src/client/pythonEnvironments/base/locator.ts @@ -7,12 +7,7 @@ import { Event, Uri } from 'vscode'; import { IAsyncIterableIterator, iterEmpty } from '../../common/utils/async'; import { PythonEnvInfo, PythonEnvKind } from './info'; -import { - BasicPythonEnvsChangedEvent, - IPythonEnvsWatcher, - PythonEnvsChangedEvent, - PythonEnvsWatcher, -} from './watcher'; +import { BasicPythonEnvsChangedEvent, IPythonEnvsWatcher, PythonEnvsChangedEvent, PythonEnvsWatcher } from './watcher'; /** * A single update to a previously provided Python env object. @@ -181,8 +176,7 @@ interface IEmitter { * should be used. Only in low-level cases should you consider using * `BasicPythonEnvsChangedEvent`. */ -abstract class LocatorBase -implements ILocator { +abstract class LocatorBase implements ILocator { public readonly onChanged: Event; protected readonly emitter: IEmitter; diff --git a/src/client/pythonEnvironments/base/locatorUtils.ts b/src/client/pythonEnvironments/base/locatorUtils.ts index 499b9da1d0c7..c2b0875338ea 100644 --- a/src/client/pythonEnvironments/base/locatorUtils.ts +++ b/src/client/pythonEnvironments/base/locatorUtils.ts @@ -7,19 +7,13 @@ import { getURIFilter } from '../../common/utils/misc'; import { IDisposable } from '../../common/utils/resourceLifecycle'; import { PythonEnvInfo } from './info'; import { getEnvMatcher, getMaxDerivedEnvInfo } from './info/env'; -import { - IPythonEnvsIterator, - PythonEnvUpdatedEvent, - PythonLocatorQuery, -} from './locator'; +import { IPythonEnvsIterator, PythonEnvUpdatedEvent, PythonLocatorQuery } from './locator'; /** * Create a filter function to match the given query. */ export function getQueryFilter(query: PythonLocatorQuery): (env: PythonEnvInfo) => boolean { - const kinds = (query.kinds !== undefined && query.kinds.length > 0) - ? query.kinds - : undefined; + const kinds = query.kinds !== undefined && query.kinds.length > 0 ? query.kinds : undefined; let includeNonRooted = true; if (query.searchLocations !== undefined) { if (query.searchLocations.includeNonRooted !== undefined) { @@ -67,10 +61,12 @@ function getSearchLocationFilters(query: PythonLocatorQuery): ((u: Uri) => boole if (query.searchLocations.roots.length === 0) { return []; } - return query.searchLocations.roots.map((loc) => getURIFilter(loc, { - checkParent: true, - checkExact: true, - })); + return query.searchLocations.roots.map((loc) => + getURIFilter(loc, { + checkParent: true, + checkExact: true, + }), + ); } /** @@ -128,7 +124,7 @@ export async function getEnvs(iterator: IPythonEnvsIterator): Promise, notify: (event: PythonEnvUpdatedEvent | null) => void, - getUpdate: ((env: PythonEnvInfo) => Promise) = getMaxDerivedEnvInfo, + getUpdate: (env: PythonEnvInfo) => Promise = getMaxDerivedEnvInfo, ): IPythonEnvsIterator { let done = false; let numRemaining = 0; @@ -152,8 +148,7 @@ export async function* iterAndUpdateEnvs( // Get the full info the in background and send updates. numRemaining += 1; - doUpdate(env, index) - .ignoreErrors(); + doUpdate(env, index).ignoreErrors(); } done = true; if (numRemaining === 0) { diff --git a/src/client/pythonEnvironments/base/locators.ts b/src/client/pythonEnvironments/base/locators.ts index a8442ad5332e..41844c3fea21 100644 --- a/src/client/pythonEnvironments/base/locators.ts +++ b/src/client/pythonEnvironments/base/locators.ts @@ -4,12 +4,7 @@ import { EventEmitter } from 'vscode'; import { chain } from '../../common/utils/async'; import { PythonEnvInfo } from './info'; -import { - ILocator, - IPythonEnvsIterator, - PythonEnvUpdatedEvent, - PythonLocatorQuery, -} from './locator'; +import { ILocator, IPythonEnvsIterator, PythonEnvUpdatedEvent, PythonLocatorQuery } from './locator'; import { PythonEnvsWatchers } from './watchers'; /** @@ -26,7 +21,8 @@ export function combineIterators(iterators: IPythonEnvsIterator[]): IPythonEnvsI const emitter = new EventEmitter(); let numActive = events.length; events.forEach((event) => { - event!((e: PythonEnvUpdatedEvent | null) => { // NOSONAR + event!((e: PythonEnvUpdatedEvent | null) => { + // NOSONAR if (e === null) { numActive -= 1; if (numActive === 0) { diff --git a/src/client/pythonEnvironments/base/locators/common/resourceBasedLocator.ts b/src/client/pythonEnvironments/base/locators/common/resourceBasedLocator.ts index e2bee7b0b5e7..a370b37e5f6d 100644 --- a/src/client/pythonEnvironments/base/locators/common/resourceBasedLocator.ts +++ b/src/client/pythonEnvironments/base/locators/common/resourceBasedLocator.ts @@ -31,7 +31,7 @@ export abstract class LazyResourceBasedLocator extends Locator implements IDispo await this.disposables.dispose(); } - public async* iterEnvs(query?: PythonLocatorQuery): IPythonEnvsIterator { + public async *iterEnvs(query?: PythonLocatorQuery): IPythonEnvsIterator { await this.ensureResourcesReady(); yield* this.doIterEnvs(query); // There is not need to wait for the watchers to get started. diff --git a/src/client/pythonEnvironments/base/locators/common/wrappingLocator.ts b/src/client/pythonEnvironments/base/locators/common/wrappingLocator.ts index 01c094dbce71..76431fc2869a 100644 --- a/src/client/pythonEnvironments/base/locators/common/wrappingLocator.ts +++ b/src/client/pythonEnvironments/base/locators/common/wrappingLocator.ts @@ -4,9 +4,7 @@ import { Event } from 'vscode'; import { IDisposable } from '../../../../common/utils/resourceLifecycle'; import { PythonEnvInfo } from '../../info'; -import { - ILocator, IPythonEnvsIterator, PythonLocatorQuery, -} from '../../locator'; +import { ILocator, IPythonEnvsIterator, PythonLocatorQuery } from '../../locator'; import { PythonEnvsChangedEvent, PythonEnvsWatcher } from '../../watcher'; import { LazyResourceBasedLocator } from './resourceBasedLocator'; @@ -24,14 +22,12 @@ export class LazyWrappingLocator extends LazyResourceBasedLocator { private wrapped?: ILocator; - constructor( - private readonly getLocator: GetLocatorFunc, - ) { + constructor(private readonly getLocator: GetLocatorFunc) { super(); this.onChanged = this.watcher.onChanged; } - protected async* doIterEnvs(query?: PythonLocatorQuery): IPythonEnvsIterator { + protected async *doIterEnvs(query?: PythonLocatorQuery): IPythonEnvsIterator { yield* this.wrapped!.iterEnvs(query); } diff --git a/src/client/pythonEnvironments/base/locators/composite/cachingLocator.ts b/src/client/pythonEnvironments/base/locators/composite/cachingLocator.ts index a5bf4089eda6..fd2bb7bbf46c 100644 --- a/src/client/pythonEnvironments/base/locators/composite/cachingLocator.ts +++ b/src/client/pythonEnvironments/base/locators/composite/cachingLocator.ts @@ -8,11 +8,7 @@ import { logWarning } from '../../../../logging'; import { IEnvsCache } from '../../envsCache'; import { PythonEnvInfo } from '../../info'; import { getMinimalPartialInfo } from '../../info/env'; -import { - ILocator, - IPythonEnvsIterator, - PythonLocatorQuery, -} from '../../locator'; +import { ILocator, IPythonEnvsIterator, PythonLocatorQuery } from '../../locator'; import { getEnvs, getQueryFilter } from '../../locatorUtils'; import { PythonEnvsChangedEvent, PythonEnvsWatcher } from '../../watcher'; import { LazyResourceBasedLocator } from '../common/resourceBasedLocator'; @@ -28,15 +24,12 @@ export class CachingLocator extends LazyResourceBasedLocator { private handleOnChanged?: (event: PythonEnvsChangedEvent) => void; - constructor( - private readonly cache: IEnvsCache, - private readonly locator: ILocator, - ) { + constructor(private readonly cache: IEnvsCache, private readonly locator: ILocator) { super(); this.onChanged = this.watcher.onChanged; } - protected async* doIterEnvs(query?: PythonLocatorQuery): IPythonEnvsIterator { + protected async *doIterEnvs(query?: PythonLocatorQuery): IPythonEnvsIterator { yield* this.iterFromCache(query); } @@ -94,7 +87,7 @@ export class CachingLocator extends LazyResourceBasedLocator { * * Contrast this with `iterFromWrappedLocator()`. */ - private async* iterFromCache(query?: PythonLocatorQuery): IPythonEnvsIterator { + private async *iterFromCache(query?: PythonLocatorQuery): IPythonEnvsIterator { const envs = this.cache.getAllEnvs(); if (envs === undefined) { logWarning('envs cache unexpectedly not activated'); @@ -118,9 +111,7 @@ export class CachingLocator extends LazyResourceBasedLocator { * wait for it to finish. Otherwise we do not make a new request, * but instead only wait for the last requested refresh to complete. */ - private ensureRecentRefresh( - looper: BackgroundRequestLooper, - ): Promise { + private ensureRecentRefresh(looper: BackgroundRequestLooper): Promise { // Re-use the last req in the queue if possible. const last = looper.getLastRequest(); if (last !== undefined) { @@ -142,16 +133,12 @@ export class CachingLocator extends LazyResourceBasedLocator { * waiting in the queue then we wait for that one instead of making * a new request. */ - private ensureCurrentRefresh( - looper: BackgroundRequestLooper, - event?: PythonEnvsChangedEvent, - ): void { + private ensureCurrentRefresh(looper: BackgroundRequestLooper, event?: PythonEnvsChangedEvent): void { const req = looper.getNextRequest(); if (req === undefined) { // There isn't already a pending request (due to an // onChanged event), so we add one. - this.addRefreshRequest(looper, event) - .ignoreErrors(); + this.addRefreshRequest(looper, event).ignoreErrors(); } // Otherwise let the pending request take care of it. } @@ -165,10 +152,7 @@ export class CachingLocator extends LazyResourceBasedLocator { * `ensureRecentRefresh()` or * `ensureCurrentRefresh()` instead, * to avoid unnecessary refreshes. */ - private addRefreshRequest( - looper: BackgroundRequestLooper, - event?: PythonEnvsChangedEvent, - ): Promise { + private addRefreshRequest(looper: BackgroundRequestLooper, event?: PythonEnvsChangedEvent): Promise { const [, waitUntilDone] = looper.addRequest(async () => { const iterator = this.locator.iterEnvs(); const envs = await getEnvs(iterator); @@ -180,10 +164,7 @@ export class CachingLocator extends LazyResourceBasedLocator { /** * Set the cache to the given envs, flush, and emit an onChanged event. */ - private async updateCache( - envs: PythonEnvInfo[], - event?: PythonEnvsChangedEvent, - ): Promise { + private async updateCache(envs: PythonEnvInfo[], event?: PythonEnvsChangedEvent): Promise { // If necessary, we could skip if there are no changes. this.cache.setAllEnvs(envs); await this.cache.flush(); diff --git a/src/client/pythonEnvironments/base/locators/composite/cachingWrapper.ts b/src/client/pythonEnvironments/base/locators/composite/cachingWrapper.ts index 9ae52c5aa70d..f6f49d755846 100644 --- a/src/client/pythonEnvironments/base/locators/composite/cachingWrapper.ts +++ b/src/client/pythonEnvironments/base/locators/composite/cachingWrapper.ts @@ -5,11 +5,7 @@ import { Event } from 'vscode'; import { createDeferred } from '../../../../common/utils/async'; import { PythonEnvsCache } from '../../envsCache'; import { PythonEnvInfo } from '../../info'; -import { - ILocator, - IPythonEnvsIterator, - PythonLocatorQuery, -} from '../../locator'; +import { ILocator, IPythonEnvsIterator, PythonLocatorQuery } from '../../locator'; import { getEnvs as getFinalEnvs } from '../../locatorUtils'; import { PythonEnvsChangedEvent, PythonEnvsWatcher } from '../../watcher'; import { LazyResourceBasedLocator } from '../common/resourceBasedLocator'; @@ -30,15 +26,13 @@ export class CachingLocatorWrapper extends LazyResourceBasedLocator { private readonly cache = new PythonEnvsCache(); - constructor( - private readonly wrapped: ILocator, - ) { + constructor(private readonly wrapped: ILocator) { super(); this.onChanged = this.watcher.onChanged; } // eslint-disable-next-line @typescript-eslint/no-unused-vars - protected async* doIterEnvs(_query?: PythonLocatorQuery): IPythonEnvsIterator { + protected async *doIterEnvs(_query?: PythonLocatorQuery): IPythonEnvsIterator { yield* this.cache.getEnvs(); } @@ -61,12 +55,9 @@ export class CachingLocatorWrapper extends LazyResourceBasedLocator { // The wrapped locator noticed changes while we're // already refreshing, so trigger another refresh // when that finishes. - this.refreshing - .then(() => this.refresh(event)) - .ignoreErrors(); + this.refreshing.then(() => this.refresh(event)).ignoreErrors(); } else { - this.refresh(event) - .ignoreErrors(); + this.refresh(event).ignoreErrors(); } }); this.disposables.push(listener); @@ -75,9 +66,7 @@ export class CachingLocatorWrapper extends LazyResourceBasedLocator { /** * Update the cache using the values iterated from the wrapped locator. */ - private async refresh( - event?: PythonEnvsChangedEvent, - ): Promise { + private async refresh(event?: PythonEnvsChangedEvent): Promise { if (this.refreshing !== undefined) { await this.refreshing; return; diff --git a/src/client/pythonEnvironments/base/locators/composite/environmentsReducer.ts b/src/client/pythonEnvironments/base/locators/composite/environmentsReducer.ts index ed7c270fe8dd..907ebf87830b 100644 --- a/src/client/pythonEnvironments/base/locators/composite/environmentsReducer.ts +++ b/src/client/pythonEnvironments/base/locators/composite/environmentsReducer.ts @@ -6,9 +6,7 @@ import { Event, EventEmitter } from 'vscode'; import { traceVerbose } from '../../../../common/logger'; import { PythonEnvInfo, PythonEnvKind } from '../../info'; import { areSameEnv, mergeEnvironments } from '../../info/env'; -import { - ILocator, IPythonEnvsIterator, PythonEnvUpdatedEvent, PythonLocatorQuery, -} from '../../locator'; +import { ILocator, IPythonEnvsIterator, PythonEnvUpdatedEvent, PythonLocatorQuery } from '../../locator'; import { getEnvs } from '../../locatorUtils'; import { PythonEnvsChangedEvent } from '../../watcher'; diff --git a/src/client/pythonEnvironments/base/locators/composite/environmentsResolver.ts b/src/client/pythonEnvironments/base/locators/composite/environmentsResolver.ts index d86a6095ae92..56356f8ab2f1 100644 --- a/src/client/pythonEnvironments/base/locators/composite/environmentsResolver.ts +++ b/src/client/pythonEnvironments/base/locators/composite/environmentsResolver.ts @@ -7,9 +7,7 @@ import { traceVerbose } from '../../../../common/logger'; import { IEnvironmentInfoService } from '../../../info/environmentInfoService'; import { PythonEnvInfo } from '../../info'; import { InterpreterInformation } from '../../info/interpreter'; -import { - ILocator, IPythonEnvsIterator, PythonEnvUpdatedEvent, PythonLocatorQuery, -} from '../../locator'; +import { ILocator, IPythonEnvsIterator, PythonEnvUpdatedEvent, PythonLocatorQuery } from '../../locator'; import { PythonEnvsChangedEvent } from '../../watcher'; /** @@ -47,7 +45,7 @@ export class PythonEnvsResolver implements ILocator { return iterator; } - private async* iterEnvsIterator( + private async *iterEnvsIterator( iterator: IPythonEnvsIterator, didUpdate: EventEmitter, ): IPythonEnvsIterator { @@ -65,8 +63,7 @@ export class PythonEnvsResolver implements ILocator { listener.dispose(); } else if (seen[event.index] !== undefined) { seen[event.index] = event.update; - this.resolveInBackground(event.index, state, didUpdate, seen) - .ignoreErrors(); + this.resolveInBackground(event.index, state, didUpdate, seen).ignoreErrors(); } else { // This implies a problem in a downstream locator traceVerbose(`Expected already iterated env, got ${event.old} (#${event.index})`); diff --git a/src/client/pythonEnvironments/base/locators/lowLevel/filesLocator.ts b/src/client/pythonEnvironments/base/locators/lowLevel/filesLocator.ts index 2570a6a338c4..40d1c7a24c60 100644 --- a/src/client/pythonEnvironments/base/locators/lowLevel/filesLocator.ts +++ b/src/client/pythonEnvironments/base/locators/lowLevel/filesLocator.ts @@ -5,12 +5,7 @@ import { Event, EventEmitter } from 'vscode'; import { normalizeFilename } from '../../../../common/utils/filesystem'; import { PythonEnvInfo, PythonEnvKind } from '../../info'; import { getFastEnvInfo } from '../../info/env'; -import { - ILocator, - IPythonEnvsIterator, - PythonEnvUpdatedEvent, - PythonLocatorQuery, -} from '../../locator'; +import { ILocator, IPythonEnvsIterator, PythonEnvUpdatedEvent, PythonLocatorQuery } from '../../locator'; import { iterAndUpdateEnvs, resolveEnvFromIterator } from '../../locatorUtils'; import { PythonEnvsChangedEvent, PythonEnvsWatcher } from '../../watcher'; @@ -38,9 +33,7 @@ export class FoundFilesLocator implements ILocator { public iterEnvs(_query?: PythonLocatorQuery): IPythonEnvsIterator { const executablesPromise = this.getExecutables(); const emitter = new EventEmitter(); - async function* generator( - kind: PythonEnvKind, - ): IPythonEnvsIterator { + async function* generator(kind: PythonEnvKind): IPythonEnvsIterator { const executables = await executablesPromise; yield* iterAndUpdateEnvs( iterMinimalEnvsFromExecutables(executables, kind), diff --git a/src/client/pythonEnvironments/base/locators/lowLevel/fsWatchingLocator.ts b/src/client/pythonEnvironments/base/locators/lowLevel/fsWatchingLocator.ts index c88f8ed2a4b1..239394884a28 100644 --- a/src/client/pythonEnvironments/base/locators/lowLevel/fsWatchingLocator.ts +++ b/src/client/pythonEnvironments/base/locators/lowLevel/fsWatchingLocator.ts @@ -64,12 +64,6 @@ export abstract class FSWatchingLocator extends LazyResourceBasedLocator { const kind = await this.getKind(executable).catch(() => undefined); this.emitter.fire({ type, kind }); }; - this.disposables.push( - watchLocationForPythonBinaries( - root, - callback, - this.opts.executableBaseGlob, - ), - ); + this.disposables.push(watchLocationForPythonBinaries(root, callback, this.opts.executableBaseGlob)); } } diff --git a/src/client/pythonEnvironments/base/locators/lowLevel/workspaceVirtualEnvLocator.ts b/src/client/pythonEnvironments/base/locators/lowLevel/workspaceVirtualEnvLocator.ts index 84e71d655bc5..27678b652806 100644 --- a/src/client/pythonEnvironments/base/locators/lowLevel/workspaceVirtualEnvLocator.ts +++ b/src/client/pythonEnvironments/base/locators/lowLevel/workspaceVirtualEnvLocator.ts @@ -5,13 +5,17 @@ import * as path from 'path'; import { traceVerbose } from '../../../../common/logger'; import { chain, iterable } from '../../../../common/utils/async'; import { - findInterpretersInDir, getEnvironmentDirFromPath, getPythonVersionFromPath, isStandardPythonBinary, + findInterpretersInDir, + getEnvironmentDirFromPath, + getPythonVersionFromPath, + isStandardPythonBinary, } from '../../../common/commonUtils'; -import { - getFileInfo, isParentPath, pathExists, -} from '../../../common/externalDependencies'; +import { getFileInfo, isParentPath, pathExists } from '../../../common/externalDependencies'; import { isPipenvEnvironment } from '../../../discovery/locators/services/pipEnvHelper'; -import { isVenvEnvironment, isVirtualenvEnvironment } from '../../../discovery/locators/services/virtualEnvironmentIdentifier'; +import { + isVenvEnvironment, + isVirtualenvEnvironment, +} from '../../../discovery/locators/services/virtualEnvironmentIdentifier'; import { PythonEnvInfo, PythonEnvKind } from '../../info'; import { buildEnvInfo } from '../../info/env'; import { IPythonEnvsIterator } from '../../locator'; @@ -118,7 +122,7 @@ export class WorkspaceVirtualEnvironmentLocator extends FSWatchingLocator { // eslint-disable-next-line class-methods-use-this protected async doResolveEnv(env: string | PythonEnvInfo): Promise { const executablePath = typeof env === 'string' ? env : env.executable.filename; - if (isParentPath(executablePath, this.root) && await pathExists(executablePath)) { + if (isParentPath(executablePath, this.root) && (await pathExists(executablePath))) { // We should extract the kind here to avoid doing is*Environment() // check multiple times. Those checks are file system heavy and // we can use the kind to determine this anyway. diff --git a/src/client/pythonEnvironments/base/watcher.ts b/src/client/pythonEnvironments/base/watcher.ts index 3620b193a30f..5eb14e4d97e5 100644 --- a/src/client/pythonEnvironments/base/watcher.ts +++ b/src/client/pythonEnvironments/base/watcher.ts @@ -61,7 +61,8 @@ export interface IPythonEnvsWatcher implements IPythonEnvsWatcher { +export class PythonEnvsWatcher + implements IPythonEnvsWatcher { /** * The hook for registering event listeners (callbacks). */ diff --git a/src/client/pythonEnvironments/common/commonUtils.ts b/src/client/pythonEnvironments/common/commonUtils.ts index a8fbf3eaf374..5b5126eb5e45 100644 --- a/src/client/pythonEnvironments/common/commonUtils.ts +++ b/src/client/pythonEnvironments/common/commonUtils.ts @@ -54,7 +54,7 @@ export async function* findInterpretersInDir( * Looks for files in the same directory which might have version in their name. * @param interpreterPath */ -export async function getPythonVersionFromNearByFiles(interpreterPath:string): Promise { +export async function getPythonVersionFromNearByFiles(interpreterPath: string): Promise { const root = path.dirname(interpreterPath); let version = UNKNOWN_PYTHON_VERSION; for await (const interpreter of findInterpretersInDir(root)) { @@ -113,9 +113,9 @@ export function isStandardPythonBinary(executable: string): boolean { * environment directory. * @param envDir Absolute path to the environment directory */ -export async function getInterpreterPathFromDir(envDir: string): Promise { +export async function getInterpreterPathFromDir(envDir: string): Promise { // Ignore any folders or files that not directly python binary related. - function filter(str:string):boolean { + function filter(str: string): boolean { const lower = str.toLowerCase(); return ['bin', 'scripts'].includes(lower) || lower.search('python') >= 0; } @@ -134,7 +134,7 @@ export async function getInterpreterPathFromDir(envDir: string): Promise { +export async function getFileInfo(filePath: string): Promise<{ ctime: number; mtime: number }> { try { const data = await fsapi.lstat(filePath); return { @@ -78,7 +78,7 @@ export async function resolveSymbolicLink(filepath: string): Promise { return filepath; } -export async function* getSubDirs(root:string): AsyncIterableIterator { +export async function* getSubDirs(root: string): AsyncIterableIterator { const dirContents = await fsapi.readdir(root); const generators = dirContents.map((item) => { async function* generator() { diff --git a/src/client/pythonEnvironments/common/posixUtils.ts b/src/client/pythonEnvironments/common/posixUtils.ts index a1155550d377..181976fddf3d 100644 --- a/src/client/pythonEnvironments/common/posixUtils.ts +++ b/src/client/pythonEnvironments/common/posixUtils.ts @@ -10,7 +10,7 @@ import { getSearchPathEntries } from '../../common/utils/exec'; * @param {string} interpreterPath : Path to python interpreter. * @returns {boolean} : Returns true if the path matches pattern for windows python executable. */ -export function isPosixPythonBin(interpreterPath:string): boolean { +export function isPosixPythonBin(interpreterPath: string): boolean { /** * This Reg-ex matches following file names: * python @@ -26,33 +26,35 @@ export function isPosixPythonBin(interpreterPath:string): boolean { export async function commonPosixBinPaths(): Promise { const searchPaths = getSearchPathEntries(); - const paths: string[] = Array.from(new Set( - [ - '/bin', - '/etc', - '/lib', - '/lib/x86_64-linux-gnu', - '/lib64', - '/sbin', - '/snap/bin', - '/usr/bin', - '/usr/games', - '/usr/include', - '/usr/lib', - '/usr/lib/x86_64-linux-gnu', - '/usr/lib64', - '/usr/libexec', - '/usr/local', - '/usr/local/bin', - '/usr/local/etc', - '/usr/local/games', - '/usr/local/lib', - '/usr/local/sbin', - '/usr/sbin', - '/usr/share', - '~/.local/bin', - ].concat(searchPaths), - )); + const paths: string[] = Array.from( + new Set( + [ + '/bin', + '/etc', + '/lib', + '/lib/x86_64-linux-gnu', + '/lib64', + '/sbin', + '/snap/bin', + '/usr/bin', + '/usr/games', + '/usr/include', + '/usr/lib', + '/usr/lib/x86_64-linux-gnu', + '/usr/lib64', + '/usr/libexec', + '/usr/local', + '/usr/local/bin', + '/usr/local/etc', + '/usr/local/games', + '/usr/local/lib', + '/usr/local/sbin', + '/usr/sbin', + '/usr/share', + '~/.local/bin', + ].concat(searchPaths), + ), + ); const exists = await Promise.all(paths.map((p) => fsapi.pathExists(p))); return paths.filter((_, index) => exists[index]); diff --git a/src/client/pythonEnvironments/common/pythonBinariesWatcher.ts b/src/client/pythonEnvironments/common/pythonBinariesWatcher.ts index 7e6d021c7936..afda0ee3656d 100644 --- a/src/client/pythonEnvironments/common/pythonBinariesWatcher.ts +++ b/src/client/pythonEnvironments/common/pythonBinariesWatcher.ts @@ -25,11 +25,7 @@ export function watchLocationForPythonBinaries( throw new Error('Glob basename contains invalid characters'); } function callbackClosure(type: FileChangeType, e: string) { - const isMatch = minimatch( - path.basename(e), - executableBaseGlob, - { nocase: getOSType() === OSType.Windows }, - ); + const isMatch = minimatch(path.basename(e), executableBaseGlob, { nocase: getOSType() === OSType.Windows }); if (!isMatch) { // When deleting the file for some reason path to all directories leading up to python are reported // Skip those events @@ -39,16 +35,8 @@ export function watchLocationForPythonBinaries( } return new Disposables( - ...[ - executableBaseGlob, - `*/${executableBaseGlob}`, - `*/${binName}/${executableBaseGlob}`, - ].map( - (pattern) => watchLocationForPattern( - baseDir, - pattern, - callbackClosure, - ), + ...[executableBaseGlob, `*/${executableBaseGlob}`, `*/${binName}/${executableBaseGlob}`].map((pattern) => + watchLocationForPattern(baseDir, pattern, callbackClosure), ), ); } diff --git a/src/client/pythonEnvironments/common/windowsRegistry.ts b/src/client/pythonEnvironments/common/windowsRegistry.ts index 63831d513fbc..30047e1c9907 100644 --- a/src/client/pythonEnvironments/common/windowsRegistry.ts +++ b/src/client/pythonEnvironments/common/windowsRegistry.ts @@ -1,9 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import { - HKCU, HKLM, Options, REG_SZ, Registry, RegistryItem, -} from 'winreg'; +import { HKCU, HKLM, Options, REG_SZ, Registry, RegistryItem } from 'winreg'; import { createDeferred } from '../../common/utils/async'; export { HKCU, HKLM, REG_SZ, Options }; diff --git a/src/client/pythonEnvironments/common/windowsUtils.ts b/src/client/pythonEnvironments/common/windowsUtils.ts index e79e7b3e6122..7b95174997b3 100644 --- a/src/client/pythonEnvironments/common/windowsUtils.ts +++ b/src/client/pythonEnvironments/common/windowsUtils.ts @@ -4,7 +4,15 @@ import { uniqBy } from 'lodash'; import * as path from 'path'; import { traceError, traceVerbose } from '../../common/logger'; -import { HKCU, HKLM, IRegistryKey, IRegistryValue, readRegistryKeys, readRegistryValues, REG_SZ } from './windowsRegistry'; +import { + HKCU, + HKLM, + IRegistryKey, + IRegistryValue, + readRegistryKeys, + readRegistryValues, + REG_SZ, +} from './windowsRegistry'; // tslint:disable-next-line: no-single-line-block-comment /* eslint-disable global-require */ diff --git a/src/client/pythonEnvironments/discovery/locators/helpers.ts b/src/client/pythonEnvironments/discovery/locators/helpers.ts index d2b64b20d895..b1ec40d4dc3c 100644 --- a/src/client/pythonEnvironments/discovery/locators/helpers.ts +++ b/src/client/pythonEnvironments/discovery/locators/helpers.ts @@ -40,17 +40,17 @@ export class InterpreterLocatorHelper implements IInterpreterLocatorHelper { item.path = path.normalize(item.path); return item; }) - .reduce((accumulator, current:PythonEnvironment) => { + .reduce((accumulator, current: PythonEnvironment) => { const currentVersion = current && current.version ? current.version.raw : undefined; let existingItem = accumulator.find((item) => { // If same version and same base path, then ignore. // Could be Python 3.6 with path = python.exe, and Python 3.6 and path = python3.exe. if ( - item.version - && item.version.raw === currentVersion - && item.path - && current.path - && this.fs.arePathsSame(path.dirname(item.path), path.dirname(current.path)) + item.version && + item.version.raw === currentVersion && + item.path && + current.path && + this.fs.arePathsSame(path.dirname(item.path), path.dirname(current.path)) ) { return true; } @@ -62,8 +62,8 @@ export class InterpreterLocatorHelper implements IInterpreterLocatorHelper { // Preserve type information. // Possible we identified environment as unknown, but a later provider has identified env type. if ( - existingItem.envType === EnvironmentType.Unknown - && current.envType !== EnvironmentType.Unknown + existingItem.envType === EnvironmentType.Unknown && + current.envType !== EnvironmentType.Unknown ) { existingItem.envType = current.envType; } diff --git a/src/client/pythonEnvironments/discovery/locators/index.ts b/src/client/pythonEnvironments/discovery/locators/index.ts index fc00b66406cf..4fe308f35397 100644 --- a/src/client/pythonEnvironments/discovery/locators/index.ts +++ b/src/client/pythonEnvironments/discovery/locators/index.ts @@ -3,9 +3,7 @@ import { inject, injectable } from 'inversify'; import { flatten } from 'lodash'; -import { - Disposable, Event, EventEmitter, Uri, -} from 'vscode'; +import { Disposable, Event, EventEmitter, Uri } from 'vscode'; import { traceDecorators } from '../../../common/logger'; import { IPlatformService } from '../../../common/platform/types'; import { IDisposableRegistry } from '../../../common/types'; @@ -29,16 +27,8 @@ import { } from '../../../interpreter/contracts'; import { IServiceContainer } from '../../../ioc/types'; import { PythonEnvInfo } from '../../base/info'; -import { - ILocator, - IPythonEnvsIterator, - NOOP_ITERATOR, - PythonLocatorQuery, -} from '../../base/locator'; -import { - combineIterators, - Locators, -} from '../../base/locators'; +import { ILocator, IPythonEnvsIterator, NOOP_ITERATOR, PythonLocatorQuery } from '../../base/locator'; +import { combineIterators, Locators } from '../../base/locators'; import { LazyResourceBasedLocator } from '../../base/locators/common/resourceBasedLocator'; import { PythonEnvironment } from '../../info'; import { isHiddenInterpreter } from './services/interpreterFilter'; @@ -64,9 +54,9 @@ type WorkspaceLocatorFactory = (root: Uri) => WorkspaceLocatorFactoryResult[]; type RootURI = string; export type WatchRootsArgs = { - initRoot(root:Uri): void; - addRoot(root:Uri): void; - removeRoot(root:Uri): void; + initRoot(root: Uri): void; + addRoot(root: Uri): void; + removeRoot(root: Uri): void; }; type WatchRootsFunc = (args: WatchRootsArgs) => IDisposable; @@ -82,10 +72,7 @@ export class WorkspaceLocators extends LazyResourceBasedLocator { private readonly roots: Record = {}; - constructor( - private readonly watchRoots: WatchRootsFunc, - private readonly factories: WorkspaceLocatorFactory[], - ) { + constructor(private readonly watchRoots: WatchRootsFunc, private readonly factories: WorkspaceLocatorFactory[]) { super(); } @@ -217,8 +204,9 @@ export class PythonInterpreterLocatorService implements IInterpreterLocatorServi private readonly _hasInterpreters: Deferred; - private readonly onLocatingEmitter:EventEmitter> = - new EventEmitter>(); + private readonly onLocatingEmitter: EventEmitter> = new EventEmitter< + Promise + >(); constructor( @inject(IServiceContainer) private serviceContainer: IServiceContainer, @@ -257,7 +245,7 @@ export class PythonInterpreterLocatorService implements IInterpreterLocatorServi * * Called by VS Code to indicate it is done with the resource. */ - public dispose():void { + public dispose(): void { this.disposables.forEach((disposable) => disposable.dispose()); } diff --git a/src/client/pythonEnvironments/discovery/locators/services/KnownPathsService.ts b/src/client/pythonEnvironments/discovery/locators/services/KnownPathsService.ts index dca24b926d7f..0cc4e729988c 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/KnownPathsService.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/KnownPathsService.ts @@ -55,15 +55,13 @@ export class KnownPathsService extends CacheableLocatorService { const promises = this.knownSearchPaths.getSearchPaths().map((dir) => this.getInterpretersInDirectory(dir)); return Promise.all(promises) .then((listOfInterpreters) => flatten(listOfInterpreters)) - .then((interpreters) => interpreters.filter( - (item) => item.length > 0, - )) - .then((interpreters) => Promise.all( - interpreters.map((interpreter) => this.getInterpreterDetails(interpreter)), - )) - .then((interpreters) => interpreters.filter( - (interpreter) => !!interpreter, - ).map((interpreter) => interpreter!)); + .then((interpreters) => interpreters.filter((item) => item.length > 0)) + .then((interpreters) => + Promise.all(interpreters.map((interpreter) => this.getInterpreterDetails(interpreter))), + ) + .then((interpreters) => + interpreters.filter((interpreter) => !!interpreter).map((interpreter) => interpreter!), + ); } /** diff --git a/src/client/pythonEnvironments/discovery/locators/services/baseVirtualEnvService.ts b/src/client/pythonEnvironments/discovery/locators/services/baseVirtualEnvService.ts index cdbc266ae9c1..a6886888584e 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/baseVirtualEnvService.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/baseVirtualEnvService.ts @@ -56,12 +56,12 @@ export class BaseVirtualEnvService extends CacheableLocatorService { .then((dirs) => dirs.filter((dir) => dir.length > 0)) .then((dirs) => Promise.all(dirs.map((d) => lookForInterpretersInDirectory(d)))) .then((pathsWithInterpreters) => flatten(pathsWithInterpreters)) - .then((interpreters) => Promise.all( - interpreters.map((interpreter) => this.getVirtualEnvDetails(interpreter, resource)), - )) - .then((interpreters) => interpreters.filter( - (interpreter) => !!interpreter, - ).map((interpreter) => interpreter!)) // NOSONAR + .then((interpreters) => + Promise.all(interpreters.map((interpreter) => this.getVirtualEnvDetails(interpreter, resource))), + ) + .then((interpreters) => + interpreters.filter((interpreter) => !!interpreter).map((interpreter) => interpreter!), + ) // NOSONAR .catch((err) => { traceError('Python Extension (lookForInterpretersInVenvs):', err); // Ignore exceptions. @@ -72,20 +72,22 @@ export class BaseVirtualEnvService extends CacheableLocatorService { private getProspectiveDirectoriesForLookup(subDirs: string[]) { const platform = this.serviceContainer.get(IPlatformService); const dirToLookFor = platform.virtualEnvBinName; - return subDirs.map((subDir) => this.fileSystem - .getSubDirectories(subDir) - .then((dirs) => { - const scriptOrBinDirs = dirs.filter((dir) => { - const folderName = path.basename(dir); - return this.fileSystem.arePathsSame(folderName, dirToLookFor); - }); - return scriptOrBinDirs.length === 1 ? scriptOrBinDirs[0] : ''; - }) - .catch((err) => { - traceError('Python Extension (getProspectiveDirectoriesForLookup):', err); - // Ignore exceptions. - return ''; - })); + return subDirs.map((subDir) => + this.fileSystem + .getSubDirectories(subDir) + .then((dirs) => { + const scriptOrBinDirs = dirs.filter((dir) => { + const folderName = path.basename(dir); + return this.fileSystem.arePathsSame(folderName, dirToLookFor); + }); + return scriptOrBinDirs.length === 1 ? scriptOrBinDirs[0] : ''; + }) + .catch((err) => { + traceError('Python Extension (getProspectiveDirectoriesForLookup):', err); + // Ignore exceptions. + return ''; + }), + ); } private async getVirtualEnvDetails(interpreter: string, resource?: Uri): Promise { @@ -93,16 +95,18 @@ export class BaseVirtualEnvService extends CacheableLocatorService { this.helper.getInterpreterInformation(interpreter), this.virtualEnvMgr.getEnvironmentName(interpreter, resource), this.virtualEnvMgr.getEnvironmentType(interpreter, resource), - ]).then(([details, virtualEnvName, type]):Promise => { - if (!details) { - return Promise.resolve(undefined); - } - this._hasInterpreters.resolve(true); - return Promise.resolve({ - ...(details as PythonEnvironment), - envName: virtualEnvName, - type: type! as EnvironmentType, - }); - }); + ]).then( + ([details, virtualEnvName, type]): Promise => { + if (!details) { + return Promise.resolve(undefined); + } + this._hasInterpreters.resolve(true); + return Promise.resolve({ + ...(details as PythonEnvironment), + envName: virtualEnvName, + type: type! as EnvironmentType, + }); + }, + ); } } diff --git a/src/client/pythonEnvironments/discovery/locators/services/cacheableLocatorService.ts b/src/client/pythonEnvironments/discovery/locators/services/cacheableLocatorService.ts index fb48566f9ec6..7736faff9ccc 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/cacheableLocatorService.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/cacheableLocatorService.ts @@ -6,16 +6,18 @@ // eslint-disable-next-line max-classes-per-file import { injectable, unmanaged } from 'inversify'; import * as md5 from 'md5'; -import { - Disposable, Event, EventEmitter, Uri, -} from 'vscode'; +import { Disposable, Event, EventEmitter, Uri } from 'vscode'; import { IWorkspaceService } from '../../../../common/application/types'; import '../../../../common/extensions'; import { traceDecorators, traceVerbose } from '../../../../common/logger'; import { IDisposableRegistry, IPersistentStateFactory } from '../../../../common/types'; import { createDeferred, Deferred } from '../../../../common/utils/async'; import { StopWatch } from '../../../../common/utils/stopWatch'; -import { GetInterpreterLocatorOptions, IInterpreterLocatorService, IInterpreterWatcher } from '../../../../interpreter/contracts'; +import { + GetInterpreterLocatorOptions, + IInterpreterLocatorService, + IInterpreterWatcher, +} from '../../../../interpreter/contracts'; import { IServiceContainer } from '../../../../ioc/types'; import { sendTelemetryEvent } from '../../../../telemetry'; import { EventName } from '../../../../telemetry/constants'; diff --git a/src/client/pythonEnvironments/discovery/locators/services/conda.ts b/src/client/pythonEnvironments/discovery/locators/services/conda.ts index f77b4659a4e4..7da0e06ca60c 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/conda.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/conda.ts @@ -1,9 +1,7 @@ import * as fsapi from 'fs-extra'; import * as path from 'path'; import { traceVerbose } from '../../../../common/logger'; -import { - getEnvironmentVariable, getOSType, getUserHomeDir, OSType, -} from '../../../../common/utils/platform'; +import { getEnvironmentVariable, getOSType, getUserHomeDir, OSType } from '../../../../common/utils/platform'; import { exec } from '../../../common/externalDependencies'; import { getRegistryInterpreters } from '../../../common/windowsUtils'; import { EnvironmentType, PythonEnvironment } from '../../../info'; @@ -34,8 +32,8 @@ export type CondaInfo = { }; export type CondaEnvInfo = { - prefix: string, - name?: string, + prefix: string; + name?: string; }; /** @@ -76,9 +74,9 @@ export async function parseCondaInfo( return ( Promise.all(promises) - .then((interpreters) => interpreters.filter( - (interpreter) => interpreter !== null && interpreter !== undefined, - )) + .then((interpreters) => + interpreters.filter((interpreter) => interpreter !== null && interpreter !== undefined), + ) // tslint:disable-next-line:no-non-null-assertion .then((interpreters) => interpreters.map((interpreter) => interpreter!)) ); @@ -93,8 +91,7 @@ export class Conda { * @param command - Command used to spawn conda. This has the same meaning as the * first argument of spawn() - i.e. it can be a full path, or just a binary name. */ - constructor(readonly command: string) { - } + constructor(readonly command: string) {} /** * Locates the preferred "conda" utility on this system by considering user settings, @@ -241,7 +238,7 @@ export class Conda { return envs.map((prefix) => ({ prefix, - name: getName(prefix) + name: getName(prefix), })); } } diff --git a/src/client/pythonEnvironments/discovery/locators/services/condaEnvFileService.ts b/src/client/pythonEnvironments/discovery/locators/services/condaEnvFileService.ts index 7bba62a160f5..61cca7ff025e 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/condaEnvFileService.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/condaEnvFileService.ts @@ -62,9 +62,9 @@ export class CondaEnvFileService extends CacheableLocatorService { } return this.fileSystem .fileExists(this.condaService.condaEnvironmentsFile!) - .then((exists) => ( - exists ? this.getEnvironmentsFromFile(this.condaService.condaEnvironmentsFile!) : Promise.resolve([]) - )); + .then((exists) => + exists ? this.getEnvironmentsFromFile(this.condaService.condaEnvironmentsFile!) : Promise.resolve([]), + ); } /** @@ -89,8 +89,8 @@ export class CondaEnvFileService extends CacheableLocatorService { const environments = await this.condaService.getCondaEnvironments(true); if (Array.isArray(environments) && environments.length > 0) { interpreters.forEach((interpreter) => { - const environment = environments.find( - (item) => this.fileSystem.arePathsSame(item.path, interpreter!.envPath!), + const environment = environments.find((item) => + this.fileSystem.arePathsSame(item.path, interpreter!.envPath!), ); if (environment) { interpreter.envName = environment!.name; diff --git a/src/client/pythonEnvironments/discovery/locators/services/condaEnvService.ts b/src/client/pythonEnvironments/discovery/locators/services/condaEnvService.ts index 3dde7eda1d48..753dd0c42a6c 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/condaEnvService.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/condaEnvService.ts @@ -64,8 +64,8 @@ export class CondaEnvService extends CacheableLocatorService { const environments = await this.condaService.getCondaEnvironments(true); if (Array.isArray(environments) && environments.length > 0) { interpreters.forEach((interpreter) => { - const environment = environments.find( - (item) => this.fileSystem.arePathsSame(item.path, interpreter!.envPath!), + const environment = environments.find((item) => + this.fileSystem.arePathsSame(item.path, interpreter!.envPath!), ); if (environment) { interpreter.envName = environment!.name; diff --git a/src/client/pythonEnvironments/discovery/locators/services/condaLocator.ts b/src/client/pythonEnvironments/discovery/locators/services/condaLocator.ts index 3515b49e4330..a20fa571968a 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/condaLocator.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/condaLocator.ts @@ -6,7 +6,7 @@ import { PythonVersion, UNKNOWN_PYTHON_VERSION } from '../../../base/info'; import { parseVersion } from '../../../base/info/pythonVersion'; import { pathExists, readFile } from '../../../common/externalDependencies'; -function getCondaMetaPaths(interpreterPath:string): string[] { +function getCondaMetaPaths(interpreterPath: string): string[] { const condaMetaDir = 'conda-meta'; // Check if the conda-meta directory is in the same directory as the interpreter. @@ -77,7 +77,7 @@ export async function isCondaEnvironment(interpreterPath: string): Promise { +export async function getPythonVersionFromConda(interpreterPath: string): Promise { const configPaths = getCondaMetaPaths(interpreterPath).map((p) => path.join(p, 'history')); const pattern = /\:python-(([\d\.a-z]?)+)/; @@ -105,7 +105,8 @@ export async function getPythonVersionFromConda(interpreterPath:string): Promise // we only need the second one return matches ? matches[1] : ''; - }).filter((v) => v.length > 0); + }) + .filter((v) => v.length > 0); if (pythonVersionStrings.length > 0) { const last = pythonVersionStrings.length - 1; diff --git a/src/client/pythonEnvironments/discovery/locators/services/condaService.ts b/src/client/pythonEnvironments/discovery/locators/services/condaService.ts index b891f36e48a2..392d1dc8446a 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/condaService.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/condaService.ts @@ -1,20 +1,19 @@ -import { - inject, injectable, named, optional, -} from 'inversify'; +import { inject, injectable, named, optional } from 'inversify'; import * as path from 'path'; import { compare, parse, SemVer } from 'semver'; import { ConfigurationChangeEvent, Uri } from 'vscode'; import { IWorkspaceService } from '../../../../common/application/types'; -import { - traceDecorators, traceError, traceVerbose, traceWarning, -} from '../../../../common/logger'; +import { traceDecorators, traceError, traceVerbose, traceWarning } from '../../../../common/logger'; import { IFileSystem, IPlatformService } from '../../../../common/platform/types'; import { IProcessServiceFactory } from '../../../../common/process/types'; import { IConfigurationService, IDisposableRegistry, IPersistentStateFactory } from '../../../../common/types'; import { cache } from '../../../../common/utils/decorators'; import { - IComponentAdapter, ICondaService, IInterpreterLocatorService, WINDOWS_REGISTRY_SERVICE, + IComponentAdapter, + ICondaService, + IInterpreterLocatorService, + WINDOWS_REGISTRY_SERVICE, } from '../../../../interpreter/contracts'; import { EnvironmentType, PythonEnvironment } from '../../../info'; import { CondaEnvironmentInfo, CondaInfo } from './conda'; @@ -108,10 +107,10 @@ export class CondaService implements ICondaService { */ private static detectCondaEnvironment(env: PythonEnvironment): boolean { return ( - env.envType === EnvironmentType.Conda - || (env.displayName ? env.displayName : '').toUpperCase().includes('ANACONDA') - || (env.companyDisplayName ? env.companyDisplayName : '').toUpperCase().includes('ANACONDA') - || (env.companyDisplayName ? env.companyDisplayName : '').toUpperCase().includes('CONTINUUM') + env.envType === EnvironmentType.Conda || + (env.displayName ? env.displayName : '').toUpperCase().includes('ANACONDA') || + (env.companyDisplayName ? env.companyDisplayName : '').toUpperCase().includes('ANACONDA') || + (env.companyDisplayName ? env.companyDisplayName : '').toUpperCase().includes('CONTINUUM') ); } @@ -121,7 +120,7 @@ export class CondaService implements ICondaService { * Called by VS Code to indicate it is done with the resource. */ // tslint:disable-next-line:no-empty - public dispose(): void {} // eslint-disable-line + public dispose(): void {} // eslint-disable-line /** * Return the path to the "conda file". diff --git a/src/client/pythonEnvironments/discovery/locators/services/currentPathService.ts b/src/client/pythonEnvironments/discovery/locators/services/currentPathService.ts index 1ee191308bf2..ce72d38e338a 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/currentPathService.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/currentPathService.ts @@ -67,9 +67,9 @@ export class CurrentPathService extends CacheableLocatorService { pythonPaths .then((interpreters) => interpreters.filter((item) => item.length > 0)) // tslint:disable-next-line:promise-function-async - .then((interpreters) => Promise.all( - interpreters.map((interpreter) => this.getInterpreterDetails(interpreter)), - )) + .then((interpreters) => + Promise.all(interpreters.map((interpreter) => this.getInterpreterDetails(interpreter))), + ) .then((interpreters) => interpreters.filter((item) => !!item).map((item) => item!)) ); } @@ -139,8 +139,6 @@ export class PythonInPathCommandProvider implements IPythonInPathCommandProvider } const versions = ['3.7', '3.6', '3', '2']; - return paths.concat( - versions.map((version) => ({ command: 'py', args: [`-${version}`] })), - ); + return paths.concat(versions.map((version) => ({ command: 'py', args: [`-${version}`] }))); } } diff --git a/src/client/pythonEnvironments/discovery/locators/services/customVirtualEnvLocator.ts b/src/client/pythonEnvironments/discovery/locators/services/customVirtualEnvLocator.ts index 4cf1c31cc0c5..2dcc203e2495 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/customVirtualEnvLocator.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/customVirtualEnvLocator.ts @@ -11,10 +11,16 @@ import { buildEnvInfo } from '../../../base/info/env'; import { IPythonEnvsIterator } from '../../../base/locator'; import { FSWatchingLocator } from '../../../base/locators/lowLevel/fsWatchingLocator'; import { - findInterpretersInDir, getEnvironmentDirFromPath, getPythonVersionFromPath, isStandardPythonBinary, + findInterpretersInDir, + getEnvironmentDirFromPath, + getPythonVersionFromPath, + isStandardPythonBinary, } from '../../../common/commonUtils'; import { - getFileInfo, getPythonSetting, onDidChangePythonSetting, pathExists, + getFileInfo, + getPythonSetting, + onDidChangePythonSetting, + pathExists, } from '../../../common/externalDependencies'; import { isPipenvEnvironment } from './pipEnvHelper'; import { @@ -43,9 +49,7 @@ async function getCustomVirtualEnvDirs(): Promise { const venvFolders = getPythonSetting(VENVFOLDERS_SETTING_KEY) ?? []; const homeDir = getUserHomeDir(); if (homeDir && (await pathExists(homeDir))) { - venvFolders - .map((item) => path.join(homeDir, item)) - .forEach((d) => venvDirs.push(d)); + venvFolders.map((item) => path.join(homeDir, item)).forEach((d) => venvDirs.push(d)); } return uniq(venvDirs).filter(pathExists); } diff --git a/src/client/pythonEnvironments/discovery/locators/services/globalVirtualEnvService.ts b/src/client/pythonEnvironments/discovery/locators/services/globalVirtualEnvService.ts index 1292e974df5e..7d462495f12b 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/globalVirtualEnvService.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/globalVirtualEnvService.ts @@ -22,7 +22,7 @@ export class GlobalVirtualEnvService extends BaseVirtualEnvService { public constructor( @inject(IVirtualEnvironmentsSearchPathProvider) @named('global') - globalVirtualEnvPathProvider: IVirtualEnvironmentsSearchPathProvider, + globalVirtualEnvPathProvider: IVirtualEnvironmentsSearchPathProvider, @inject(IServiceContainer) serviceContainer: IServiceContainer, ) { super(globalVirtualEnvPathProvider, serviceContainer, 'VirtualEnvService'); diff --git a/src/client/pythonEnvironments/discovery/locators/services/globalVirtualEnvronmentLocator.ts b/src/client/pythonEnvironments/discovery/locators/services/globalVirtualEnvronmentLocator.ts index e687ef7ebe69..30e81a31b8f9 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/globalVirtualEnvronmentLocator.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/globalVirtualEnvronmentLocator.ts @@ -5,15 +5,16 @@ import { uniq } from 'lodash'; import * as path from 'path'; import { traceVerbose } from '../../../../common/logger'; import { chain, iterable } from '../../../../common/utils/async'; -import { - getEnvironmentVariable, getOSType, getUserHomeDir, OSType, -} from '../../../../common/utils/platform'; +import { getEnvironmentVariable, getOSType, getUserHomeDir, OSType } from '../../../../common/utils/platform'; import { PythonEnvInfo, PythonEnvKind } from '../../../base/info'; import { buildEnvInfo } from '../../../base/info/env'; import { IPythonEnvsIterator } from '../../../base/locator'; import { FSWatchingLocator } from '../../../base/locators/lowLevel/fsWatchingLocator'; import { - findInterpretersInDir, getEnvironmentDirFromPath, getPythonVersionFromPath, isStandardPythonBinary + findInterpretersInDir, + getEnvironmentDirFromPath, + getPythonVersionFromPath, + isStandardPythonBinary, } from '../../../common/commonUtils'; import { getFileInfo, pathExists } from '../../../common/externalDependencies'; import { isPipenvEnvironment } from './pipEnvHelper'; diff --git a/src/client/pythonEnvironments/discovery/locators/services/hashProviderFactory.ts b/src/client/pythonEnvironments/discovery/locators/services/hashProviderFactory.ts index c67d13d9cd2a..57fe5672bf02 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/hashProviderFactory.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/hashProviderFactory.ts @@ -24,9 +24,8 @@ export class InterpeterHashProviderFactory implements IInterpreterHashProviderFa ) {} public async create(options: { pythonPath: string } | { resource: Uri }): Promise { - const pythonPath = 'pythonPath' in options - ? options.pythonPath - : this.configService.getSettings(options.resource).pythonPath; + const pythonPath = + 'pythonPath' in options ? options.pythonPath : this.configService.getSettings(options.resource).pythonPath; return (await this.windowsStoreInterpreter.isWindowsStoreInterpreter(pythonPath)) ? this.windowsStoreHashProvider diff --git a/src/client/pythonEnvironments/discovery/locators/services/pipEnvHelper.ts b/src/client/pythonEnvironments/discovery/locators/services/pipEnvHelper.ts index cf64be974a96..91ac1c2dcc3a 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/pipEnvHelper.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/pipEnvHelper.ts @@ -29,7 +29,7 @@ function getSearchHeight() { */ export async function _getAssociatedPipfile( searchDir: string, - options: {lookIntoParentDirectories: boolean}, + options: { lookIntoParentDirectories: boolean }, ): Promise { const pipFileName = getEnvironmentVariable('PIPENV_PIPFILE') || 'Pipfile'; let heightToSearch = options.lookIntoParentDirectories ? getSearchHeight() : 1; @@ -85,7 +85,9 @@ async function getProjectDir(envFolder: string): Promise { } const projectDir = await readFile(dotProjectFile); if (!(await pathExists(projectDir))) { - traceError(`The .project file inside environment folder: ${envFolder} doesn't contain a valid path to the project`); + traceError( + `The .project file inside environment folder: ${envFolder} doesn't contain a valid path to the project`, + ); return undefined; } return projectDir; @@ -142,7 +144,7 @@ export async function isPipenvEnvironmentRelatedToFolder(interpreterPath: string // PIPENV_NO_INHERIT is used to tell pipenv not to look for Pipfile in parent directories // https://pipenv.pypa.io/en/latest/advanced/#pipenv.environments.PIPENV_NO_INHERIT - const lookIntoParentDirectories = (getEnvironmentVariable('PIPENV_NO_INHERIT') === undefined); + const lookIntoParentDirectories = getEnvironmentVariable('PIPENV_NO_INHERIT') === undefined; const pipFileAssociatedWithFolder = await _getAssociatedPipfile(folder, { lookIntoParentDirectories }); if (!pipFileAssociatedWithFolder) { return false; diff --git a/src/client/pythonEnvironments/discovery/locators/services/pipEnvService.ts b/src/client/pythonEnvironments/discovery/locators/services/pipEnvService.ts index fe0938c832e1..596751ccffb6 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/pipEnvService.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/pipEnvService.ts @@ -198,7 +198,8 @@ export class PipEnvService extends CacheableLocatorService implements IPipEnvSer LC_ALL: currentProc.env.LC_ALL, LANG: currentProc.env.LANG, }; - enviromentVariableValues[platformService.pathVariableName] = currentProc.env[platformService.pathVariableName]; + enviromentVariableValues[platformService.pathVariableName] = + currentProc.env[platformService.pathVariableName]; traceWarning('Error in invoking PipEnv', error); traceWarning(`Relevant Environment Variables ${JSON.stringify(enviromentVariableValues, undefined, 4)}`); diff --git a/src/client/pythonEnvironments/discovery/locators/services/posixKnownPathsLocator.ts b/src/client/pythonEnvironments/discovery/locators/services/posixKnownPathsLocator.ts index 9c0572102eb2..999006f51224 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/posixKnownPathsLocator.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/posixKnownPathsLocator.ts @@ -6,9 +6,7 @@ import * as path from 'path'; import { traceError, traceInfo } from '../../../../common/logger'; import { Architecture } from '../../../../common/utils/platform'; -import { - PythonEnvInfo, PythonEnvKind, PythonReleaseLevel, PythonVersion, -} from '../../../base/info'; +import { PythonEnvInfo, PythonEnvKind, PythonReleaseLevel, PythonVersion } from '../../../base/info'; import { parseVersion } from '../../../base/info/pythonVersion'; import { IPythonEnvsIterator, Locator } from '../../../base/locator'; import { getFileInfo, resolveSymbolicLink } from '../../../common/externalDependencies'; @@ -16,10 +14,10 @@ import { commonPosixBinPaths, isPosixPythonBin } from '../../../common/posixUtil async function getPythonBinFromKnownPaths(): Promise { const knownPaths = await commonPosixBinPaths(); - const pythonBins:Set = new Set(); + const pythonBins: Set = new Set(); for (const knownPath of knownPaths) { const files = (await fsapi.readdir(knownPath)) - .map((filename:string) => path.join(knownPath, filename)) + .map((filename: string) => path.join(knownPath, filename)) .filter(isPosixPythonBin); for (const file of files) { @@ -42,7 +40,7 @@ export class PosixKnownPathsLocator extends Locator { private kind: PythonEnvKind = PythonEnvKind.OtherGlobal; public iterEnvs(): IPythonEnvsIterator { - const buildEnvInfo = (bin:string) => this.buildEnvInfo(bin); + const buildEnvInfo = (bin: string) => this.buildEnvInfo(bin); const iterator = async function* () { const exes = await getPythonBinFromKnownPaths(); yield* exes.map(buildEnvInfo); @@ -55,8 +53,8 @@ export class PosixKnownPathsLocator extends Locator { return this.buildEnvInfo(executablePath); } - private async buildEnvInfo(bin:string): Promise { - let version:PythonVersion; + private async buildEnvInfo(bin: string): Promise { + let version: PythonVersion; try { version = parseVersion(path.basename(bin)); } catch (ex) { diff --git a/src/client/pythonEnvironments/discovery/locators/services/pyenvLocator.ts b/src/client/pythonEnvironments/discovery/locators/services/pyenvLocator.ts index 5fb45db9dd5c..008a00a837ac 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/pyenvLocator.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/pyenvLocator.ts @@ -2,17 +2,15 @@ // Licensed under the MIT License. import * as path from 'path'; -import { - getEnvironmentVariable, getOSType, getUserHomeDir, OSType, -} from '../../../../common/utils/platform'; -import { - PythonEnvInfo, PythonEnvKind, -} from '../../../base/info'; +import { getEnvironmentVariable, getOSType, getUserHomeDir, OSType } from '../../../../common/utils/platform'; +import { PythonEnvInfo, PythonEnvKind } from '../../../base/info'; import { buildEnvInfo } from '../../../base/info/env'; import { IPythonEnvsIterator } from '../../../base/locator'; import { FSWatchingLocator } from '../../../base/locators/lowLevel/fsWatchingLocator'; import { - getEnvironmentDirFromPath, getInterpreterPathFromDir, getPythonVersionFromPath, + getEnvironmentDirFromPath, + getInterpreterPathFromDir, + getPythonVersionFromPath, } from '../../../common/commonUtils'; import { getFileInfo, getSubDirs, pathExists } from '../../../common/externalDependencies'; @@ -27,7 +25,8 @@ function getPyenvDir(): string { if (!pyenvDir) { const homeDir = getUserHomeDir() || ''; - pyenvDir = getOSType() === OSType.Windows ? path.join(homeDir, '.pyenv', 'pyenv-win') : path.join(homeDir, '.pyenv'); + pyenvDir = + getOSType() === OSType.Windows ? path.join(homeDir, '.pyenv', 'pyenv-win') : path.join(homeDir, '.pyenv'); } return pyenvDir; @@ -42,11 +41,11 @@ function getPyenvVersionsDir(): string { * @param {string} interpreterPath: Absolute path to the python interpreter. * @returns {boolean}: Returns true if the interpreter belongs to a pyenv environment. */ -export async function isPyenvEnvironment(interpreterPath:string): Promise { +export async function isPyenvEnvironment(interpreterPath: string): Promise { let pathToCheck = interpreterPath; let pyenvDir = getPyenvDir(); - if (!await pathExists(pyenvDir)) { + if (!(await pathExists(pyenvDir))) { return false; } @@ -65,7 +64,7 @@ export async function isPyenvEnvironment(interpreterPath:string): Promise Promise> { +function getKnownPyenvVersionParsers(): Map Promise> { /** * This function parses versions that are plain python versions. * @param str string to parse @@ -84,7 +83,7 @@ function getKnownPyenvVersionParsers() : Map Promise { + function pythonOnly(str: string): Promise { return Promise.resolve({ pythonVer: str, distro: undefined, @@ -100,7 +99,7 @@ function getKnownPyenvVersionParsers() : Map Promise { + function distroOnly(str: string): Promise { const parts = str.split('-'); if (parts.length === 3) { return Promise.resolve({ @@ -142,7 +141,7 @@ function getKnownPyenvVersionParsers() : Map Promise { + function pypyParser(str: string): Promise { const pattern = /[0-9\.]+/; const parts = str.split('-'); @@ -155,7 +154,10 @@ function getKnownPyenvVersionParsers() : Map Promise Promise Promise Promise> = new Map(); + const parsers: Map Promise> = new Map(); parsers.set('activepython', distroOnly); parsers.set('anaconda', distroOnly); parsers.set('graalpython', distroOnly); @@ -219,7 +221,7 @@ function getKnownPyenvVersionParsers() : Map Promise { +export function parsePyenvVersion(str: string): Promise { const allParsers = getKnownPyenvVersionParsers(); const knownPrefixes = Array.from(allParsers.keys()); @@ -286,8 +288,7 @@ async function* getPyenvEnvironments(): AsyncIterableIterator { envInfo.defaultDisplayName = `${subDir}:pyenv`; envInfo.name = subDir; - envInfo.distro.org = (versionStrings && versionStrings.distro) - ? versionStrings.distro : envInfo.distro.org; + envInfo.distro.org = versionStrings && versionStrings.distro ? versionStrings.distro : envInfo.distro.org; const fileData = await getFileInfo(interpreterPath); envInfo.executable.ctime = fileData.ctime; @@ -300,10 +301,7 @@ async function* getPyenvEnvironments(): AsyncIterableIterator { export class PyenvLocator extends FSWatchingLocator { constructor() { - super( - getPyenvVersionsDir, - async () => PythonEnvKind.Pyenv, - ); + super(getPyenvVersionsDir, async () => PythonEnvKind.Pyenv); } // eslint-disable-next-line class-methods-use-this @@ -328,8 +326,7 @@ export class PyenvLocator extends FSWatchingLocator { const versionStrings = await parsePyenvVersion(envInfo.name); envInfo.version = await getPythonVersionFromPath(executablePath, versionStrings?.pythonVer); - envInfo.distro.org = (versionStrings && versionStrings.distro) - ? versionStrings.distro : envInfo.distro.org; + envInfo.distro.org = versionStrings && versionStrings.distro ? versionStrings.distro : envInfo.distro.org; const fileData = await getFileInfo(executablePath); envInfo.executable.ctime = fileData.ctime; diff --git a/src/client/pythonEnvironments/discovery/locators/services/virtualEnvironmentIdentifier.ts b/src/client/pythonEnvironments/discovery/locators/services/virtualEnvironmentIdentifier.ts index 1757c383ab86..37387e092d1b 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/virtualEnvironmentIdentifier.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/virtualEnvironmentIdentifier.ts @@ -4,19 +4,13 @@ import * as fsapi from 'fs-extra'; import * as path from 'path'; import '../../../../common/extensions'; -import { - getEnvironmentVariable, getOSType, getUserHomeDir, OSType, -} from '../../../../common/utils/platform'; +import { getEnvironmentVariable, getOSType, getUserHomeDir, OSType } from '../../../../common/utils/platform'; import { PythonVersion, UNKNOWN_PYTHON_VERSION } from '../../../base/info'; import { comparePythonVersionSpecificity } from '../../../base/info/env'; -import { - parseBasicVersion, - parseRelease, - parseVersion, -} from '../../../base/info/pythonVersion'; +import { parseBasicVersion, parseRelease, parseVersion } from '../../../base/info/pythonVersion'; import { pathExists, readFile } from '../../../common/externalDependencies'; -function getPyvenvConfigPathsFrom(interpreterPath:string): string[] { +function getPyvenvConfigPathsFrom(interpreterPath: string): string[] { const pyvenvConfigFile = 'pyvenv.cfg'; // Check if the pyvenv.cfg file is in the parent directory relative to the interpreter. @@ -41,7 +35,7 @@ function getPyvenvConfigPathsFrom(interpreterPath:string): string[] { * @param {string} interpreterPath: Absolute path to the python interpreter. * @returns {boolean} : Returns true if the interpreter belongs to a venv environment. */ -export async function isVenvEnvironment(interpreterPath:string): Promise { +export async function isVenvEnvironment(interpreterPath: string): Promise { const venvPaths = getPyvenvConfigPathsFrom(interpreterPath); // We don't need to test all at once, testing each one here @@ -58,7 +52,7 @@ export async function isVenvEnvironment(interpreterPath:string): Promise { +export async function isVirtualenvEnvironment(interpreterPath: string): Promise { // Check if there are any activate.* files in the same directory as the interpreter. // // env @@ -103,7 +97,7 @@ function getWorkOnHome(): Promise { * @param {string} interpreterPath: Absolute path to the python interpreter. * @returns {boolean}: Returns true if the interpreter belongs to a virtualenvWrapper environment. */ -export async function isVirtualenvwrapperEnvironment(interpreterPath:string): Promise { +export async function isVirtualenvwrapperEnvironment(interpreterPath: string): Promise { const workOnHomeDir = await getWorkOnHome(); let pathToCheck = interpreterPath; let workOnRoot = workOnHomeDir; @@ -116,9 +110,11 @@ export async function isVirtualenvwrapperEnvironment(interpreterPath:string): Pr // For environment to be a virtualenvwrapper based it has to follow these two rules: // 1. It should be in a sub-directory under the WORKON_HOME // 2. It should be a valid virtualenv environment - return await pathExists(workOnHomeDir) - && pathToCheck.startsWith(`${workOnRoot}${path.sep}`) - && isVirtualenvEnvironment(interpreterPath); + return ( + (await pathExists(workOnHomeDir)) && + pathToCheck.startsWith(`${workOnRoot}${path.sep}`) && + isVirtualenvEnvironment(interpreterPath) + ); } /** @@ -129,7 +125,7 @@ export async function isVirtualenvwrapperEnvironment(interpreterPath:string): Pr * Reads the pyvenv.cfg and finds the line that looks like 'version = 3.9.0`. Gets the * version string from that lines and parses it. */ -export async function getPythonVersionFromPyvenvCfg(interpreterPath:string): Promise { +export async function getPythonVersionFromPyvenvCfg(interpreterPath: string): Promise { const configPaths = getPyvenvConfigPathsFrom(interpreterPath); let version = UNKNOWN_PYTHON_VERSION; diff --git a/src/client/pythonEnvironments/discovery/locators/services/windowsRegistryLocator.ts b/src/client/pythonEnvironments/discovery/locators/services/windowsRegistryLocator.ts index 92ce68edcbca..cb98940751b5 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/windowsRegistryLocator.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/windowsRegistryLocator.ts @@ -3,9 +3,7 @@ import { traceVerbose } from '../../../../common/logger'; import { Architecture } from '../../../../common/utils/platform'; -import { - PythonEnvInfo, PythonEnvKind, PythonVersion, UNKNOWN_PYTHON_VERSION, -} from '../../../base/info'; +import { PythonEnvInfo, PythonEnvKind, PythonVersion, UNKNOWN_PYTHON_VERSION } from '../../../base/info'; import { parseVersion } from '../../../base/info/pythonVersion'; import { IPythonEnvsIterator, Locator } from '../../../base/locator'; import { getFileInfo } from '../../../common/externalDependencies'; @@ -43,7 +41,7 @@ export class WindowsRegistryLocator extends Locator { } private async buildEnvInfo(data: IRegistryInterpreterData): Promise { - const versionStr = (data.versionStr ?? data.sysVersionStr) ?? data.interpreterPath; + const versionStr = data.versionStr ?? data.sysVersionStr ?? data.interpreterPath; let version: PythonVersion = UNKNOWN_PYTHON_VERSION; try { diff --git a/src/client/pythonEnvironments/discovery/locators/services/windowsRegistryService.ts b/src/client/pythonEnvironments/discovery/locators/services/windowsRegistryService.ts index 0ca04aedf81d..543b9bae0740 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/windowsRegistryService.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/windowsRegistryService.ts @@ -3,9 +3,7 @@ import { inject, injectable } from 'inversify'; import * as path from 'path'; import { traceError } from '../../../../common/logger'; -import { - IFileSystem, IPlatformService, IRegistry, RegistryHive, -} from '../../../../common/platform/types'; +import { IFileSystem, IPlatformService, IRegistry, RegistryHive } from '../../../../common/platform/types'; import { IPathUtils } from '../../../../common/types'; import { Architecture } from '../../../../common/utils/platform'; import { IInterpreterHelper } from '../../../../interpreter/contracts'; @@ -59,9 +57,9 @@ export class WindowsRegistryService extends CacheableLocatorService { protected async getInterpretersImplementation(): Promise { return this.platform.isWindows ? this.getInterpretersFromRegistry().catch((ex) => { - traceError('Fetching interpreters from registry failed with error', ex); - return []; - }) + traceError('Fetching interpreters from registry failed with error', ex); + return []; + }) : []; } @@ -81,27 +79,32 @@ export class WindowsRegistryService extends CacheableLocatorService { const companyInterpreters = await Promise.all( flatten(companies) .filter((item: CompanyInterpreter) => item !== undefined && item !== null) - .map((company: CompanyInterpreter) => this.getInterpretersForCompany(company.companyKey, company.hive, company.arch)), + .map((company: CompanyInterpreter) => + this.getInterpretersForCompany(company.companyKey, company.hive, company.arch), + ), ); - return ( - flatten(companyInterpreters) - .filter((item: PythonEnvironment | null | undefined) => item !== undefined && item !== null) - .reduce((prev: PythonEnvironment[], current: PythonEnvironment) => { - if (prev.findIndex((item) => item.path.toUpperCase() === current.path.toUpperCase()) === -1) { - prev.push(current); - } - return prev; - }, []) - ); + return flatten(companyInterpreters) + .filter((item: PythonEnvironment | null | undefined) => item !== undefined && item !== null) + .reduce((prev: PythonEnvironment[], current: PythonEnvironment) => { + if (prev.findIndex((item) => item.path.toUpperCase() === current.path.toUpperCase()) === -1) { + prev.push(current); + } + return prev; + }, []); } private async getCompanies(hive: RegistryHive, arch?: Architecture): Promise { - return this.registry.getKeys('\\Software\\Python', hive, arch).then((companyKeys) => companyKeys - .filter( - (companyKey) => CompaniesToIgnore.indexOf(this.pathUtils.basename(companyKey).toUpperCase()) === -1, - ) - .map((companyKey) => ({ companyKey, hive, arch }))); + return this.registry + .getKeys('\\Software\\Python', hive, arch) + .then((companyKeys) => + companyKeys + .filter( + (companyKey) => + CompaniesToIgnore.indexOf(this.pathUtils.basename(companyKey).toUpperCase()) === -1, + ) + .map((companyKey) => ({ companyKey, hive, arch })), + ); } private async getInterpretersForCompany(companyKey: string, hive: RegistryHive, arch?: Architecture) { @@ -144,9 +147,10 @@ export class WindowsRegistryService extends CacheableLocatorService { this.registry.getValue(tagKey, hive, arch, 'SysVersion'), this.getCompanyDisplayName(companyKey, hive, arch), ]).then(([installedPath, executablePath, version, companyDisplayName]) => { - companyDisplayName = AnacondaCompanyNames.indexOf(companyDisplayName!) === -1 - ? companyDisplayName - : AnacondaCompanyName; + companyDisplayName = + AnacondaCompanyNames.indexOf(companyDisplayName!) === -1 + ? companyDisplayName + : AnacondaCompanyName; // tslint:disable-next-line:prefer-type-cast no-object-literal-type-assertion return { installPath: installedPath, @@ -161,9 +165,10 @@ export class WindowsRegistryService extends CacheableLocatorService { return undefined; } - const executablePath = interpreterInfo.executablePath && interpreterInfo.executablePath.length > 0 - ? interpreterInfo.executablePath - : path.join(interpreterInfo.installPath, DefaultPythonExecutable); + const executablePath = + interpreterInfo.executablePath && interpreterInfo.executablePath.length > 0 + ? interpreterInfo.executablePath + : path.join(interpreterInfo.installPath, DefaultPythonExecutable); if (this.windowsStoreInterpreter.isHiddenInterpreter(executablePath)) { return undefined; @@ -190,12 +195,14 @@ export class WindowsRegistryService extends CacheableLocatorService { : EnvironmentType.Unknown, } as PythonEnvironment; }) - .then((interpreter) => (interpreter - ? this.fs - .fileExists(interpreter.path) - .catch(() => false) - .then((exists) => (exists ? interpreter : null)) - : null)) + .then((interpreter) => + interpreter + ? this.fs + .fileExists(interpreter.path) + .catch(() => false) + .then((exists) => (exists ? interpreter : null)) + : null, + ) .catch((error) => { traceError( `Failed to retrieve interpreter details for company ${companyKey},tag: ${tagKey}, hive: ${hive}, arch: ${arch}`, diff --git a/src/client/pythonEnvironments/discovery/locators/services/windowsStoreInterpreter.ts b/src/client/pythonEnvironments/discovery/locators/services/windowsStoreInterpreter.ts index 0976c2d891fa..53e3916f61cb 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/windowsStoreInterpreter.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/windowsStoreInterpreter.ts @@ -27,8 +27,8 @@ import { IServiceContainer } from '../../../../ioc/types'; export function isRestrictedWindowsStoreInterpreterPath(pythonPath: string): boolean { const pythonPathToCompare = pythonPath.toUpperCase().replace(/\//g, '\\'); return ( - pythonPathToCompare.includes('\\Program Files\\WindowsApps\\'.toUpperCase()) - || pythonPathToCompare.includes('\\Microsoft\\WindowsApps\\PythonSoftwareFoundation'.toUpperCase()) + pythonPathToCompare.includes('\\Program Files\\WindowsApps\\'.toUpperCase()) || + pythonPathToCompare.includes('\\Microsoft\\WindowsApps\\PythonSoftwareFoundation'.toUpperCase()) ); } @@ -66,7 +66,7 @@ export class WindowsStoreInterpreter implements IWindowsStoreInterpreter, IInter @inject(IServiceContainer) private readonly serviceContainer: IServiceContainer, @inject(IPersistentStateFactory) private readonly persistentFactory: IPersistentStateFactory, @inject(IFileSystem) private readonly fs: IFileSystem, - @inject(IComponentAdapter) private readonly pyenvs: IComponent + @inject(IComponentAdapter) private readonly pyenvs: IComponent, ) {} /** @@ -83,9 +83,9 @@ export class WindowsStoreInterpreter implements IWindowsStoreInterpreter, IInter } const pythonPathToCompare = pythonPath.toUpperCase().replace(/\//g, '\\'); return ( - pythonPathToCompare.includes('\\Microsoft\\WindowsApps\\'.toUpperCase()) - || pythonPathToCompare.includes('\\Program Files\\WindowsApps\\'.toUpperCase()) - || pythonPathToCompare.includes('\\Microsoft\\WindowsApps\\PythonSoftwareFoundation'.toUpperCase()) + pythonPathToCompare.includes('\\Microsoft\\WindowsApps\\'.toUpperCase()) || + pythonPathToCompare.includes('\\Program Files\\WindowsApps\\'.toUpperCase()) || + pythonPathToCompare.includes('\\Microsoft\\WindowsApps\\PythonSoftwareFoundation'.toUpperCase()) ); } diff --git a/src/client/pythonEnvironments/discovery/locators/services/windowsStoreLocator.ts b/src/client/pythonEnvironments/discovery/locators/services/windowsStoreLocator.ts index a6e8d4a6a0af..65c904d79497 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/windowsStoreLocator.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/windowsStoreLocator.ts @@ -71,9 +71,7 @@ export function isForbiddenStorePath(interpreterPath: string): boolean { */ export async function isWindowsStoreEnvironment(interpreterPath: string): Promise { const pythonPathToCompare = path.normalize(interpreterPath).toUpperCase(); - const localAppDataStorePath = path - .normalize(getWindowsStoreAppsRoot()) - .toUpperCase(); + const localAppDataStorePath = path.normalize(getWindowsStoreAppsRoot()).toUpperCase(); if (pythonPathToCompare.includes(localAppDataStorePath)) { return true; } @@ -100,7 +98,7 @@ export async function isWindowsStoreEnvironment(interpreterPath: string): Promis * Note chokidar fails to match multiple digits using +([0-9]), even though the underlying glob pattern matcher * they use (picomatch), or any other glob matcher does. Hence why we had to use {[0-9],[0-9][0-9]} instead. */ -const pythonExeGlob = 'python3\.{[0-9],[0-9][0-9]}\.exe'; +const pythonExeGlob = 'python3.{[0-9],[0-9][0-9]}.exe'; /** * Checks if a given path ends with python3.*.exe. Not all python executables are matched as @@ -133,33 +131,29 @@ export async function getWindowsStorePythonExes(): Promise { // Collect python*.exe directly under %LOCALAPPDATA%/Microsoft/WindowsApps const files = await fsapi.readdir(windowsAppsRoot); - return files - .map((filename: string) => path.join(windowsAppsRoot, filename)) - .filter(isWindowsStorePythonExe); + return files.map((filename: string) => path.join(windowsAppsRoot, filename)).filter(isWindowsStorePythonExe); } export class WindowsStoreLocator extends FSWatchingLocator { private readonly kind: PythonEnvKind = PythonEnvKind.WindowsStore; constructor() { - super( - getWindowsStoreAppsRoot, - async () => this.kind, - { executableBaseGlob: pythonExeGlob }, - ); + super(getWindowsStoreAppsRoot, async () => this.kind, { executableBaseGlob: pythonExeGlob }); } protected doIterEnvs(): IPythonEnvsIterator { const iterator = async function* (kind: PythonEnvKind) { const exes = await getWindowsStorePythonExes(); - yield* exes.map(async (executable: string) => buildEnvInfo({ - kind, - executable, - version: getPythonVersionFromPath(executable), - org: 'Microsoft', - arch: Architecture.x64, - fileInfo: await getFileInfo(executable), - })); + yield* exes.map(async (executable: string) => + buildEnvInfo({ + kind, + executable, + version: getPythonVersionFromPath(executable), + org: 'Microsoft', + arch: Architecture.x64, + fileInfo: await getFileInfo(executable), + }), + ); }; return iterator(this.kind); } diff --git a/src/client/pythonEnvironments/discovery/locators/services/workspaceVirtualEnvService.ts b/src/client/pythonEnvironments/discovery/locators/services/workspaceVirtualEnvService.ts index a3a469e32f4d..48b1b3d60ba6 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/workspaceVirtualEnvService.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/workspaceVirtualEnvService.ts @@ -27,7 +27,7 @@ export class WorkspaceVirtualEnvService extends BaseVirtualEnvService { public constructor( @inject(IVirtualEnvironmentsSearchPathProvider) @named('workspace') - workspaceVirtualEnvPathProvider: IVirtualEnvironmentsSearchPathProvider, + workspaceVirtualEnvPathProvider: IVirtualEnvironmentsSearchPathProvider, @inject(IServiceContainer) serviceContainer: IServiceContainer, @inject(IInterpreterWatcherBuilder) private readonly builder: IInterpreterWatcherBuilder, ) { diff --git a/src/client/pythonEnvironments/discovery/locators/services/workspaceVirtualEnvWatcherService.ts b/src/client/pythonEnvironments/discovery/locators/services/workspaceVirtualEnvWatcherService.ts index fc5309baa5cd..ee66e34aec2c 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/workspaceVirtualEnvWatcherService.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/workspaceVirtualEnvWatcherService.ts @@ -6,9 +6,7 @@ import { inject, injectable } from 'inversify'; import * as path from 'path'; import { clearTimeout, setTimeout } from 'timers'; -import { - Disposable, Event, EventEmitter, FileSystemWatcher, RelativePattern, Uri, -} from 'vscode'; +import { Disposable, Event, EventEmitter, FileSystemWatcher, RelativePattern, Uri } from 'vscode'; import { IWorkspaceService } from '../../../../common/application/types'; import '../../../../common/extensions'; import { traceDecorators, traceVerbose } from '../../../../common/logger'; diff --git a/src/client/pythonEnvironments/index.ts b/src/client/pythonEnvironments/index.ts index a9eb6c8191fd..d35118f3a579 100644 --- a/src/client/pythonEnvironments/index.ts +++ b/src/client/pythonEnvironments/index.ts @@ -5,10 +5,7 @@ import * as vscode from 'vscode'; import { getGlobalStorage } from '../common/persistentState'; import { getOSType, OSType } from '../common/utils/platform'; import { IDisposable } from '../common/utils/resourceLifecycle'; -import { - ActivationResult, - ExtensionState, -} from '../components'; +import { ActivationResult, ExtensionState } from '../components'; import { PythonEnvironments } from './api'; import { getPersistentCache } from './base/envsCache'; import { PythonEnvInfo } from './base/info'; @@ -44,18 +41,9 @@ export function initialize(ext: ExtensionState): PythonEnvironments { // Any other initialization goes here. // Deal with legacy IOC. - registerLegacyDiscoveryForIOC( - ext.legacyIOC.serviceManager, - ); - initializeLegacyExternalDependencies( - ext.legacyIOC.serviceContainer, - ); - registerNewDiscoveryForIOC( - ext.legacyIOC.serviceManager, - api, - environmentsSecurity, - ext.disposables, - ); + registerLegacyDiscoveryForIOC(ext.legacyIOC.serviceManager); + initializeLegacyExternalDependencies(ext.legacyIOC.serviceContainer); + registerNewDiscoveryForIOC(ext.legacyIOC.serviceManager, api, environmentsSecurity, ext.disposables); return api; } @@ -63,9 +51,7 @@ export function initialize(ext: ExtensionState): PythonEnvironments { /** * Make use of the component (e.g. register with VS Code). */ -export async function activate( - api: PythonEnvironments, -): Promise { +export async function activate(api: PythonEnvironments): Promise { // Force an initial background refresh of the environments. getEnvs(api.iterEnvs()).ignoreErrors(); @@ -81,10 +67,7 @@ export async function activate( */ async function createLocators(ext: ExtensionState, environmentsSecurity: IEnvironmentsSecurity): Promise { // Create the low-level locators. - let locators: ILocator = new ExtensionLocators( - createNonWorkspaceLocators(ext), - createWorkspaceLocator(ext), - ); + let locators: ILocator = new ExtensionLocators(createNonWorkspaceLocators(ext), createWorkspaceLocator(ext)); // Create the env info service used by ResolvingLocator and CachingLocator. const envInfoService = new EnvironmentInfoService(); @@ -100,28 +83,17 @@ async function createLocators(ext: ExtensionState, environmentsSecurity: IEnviro return locators; } -function createNonWorkspaceLocators( - ext: ExtensionState, -): ILocator[] { +function createNonWorkspaceLocators(ext: ExtensionState): ILocator[] { let locators: (ILocator & Partial)[]; if (getOSType() === OSType.Windows) { // Windows specific locators go here - locators = [ - new WindowsRegistryLocator(), - new WindowsStoreLocator(), - ]; + locators = [new WindowsRegistryLocator(), new WindowsStoreLocator()]; } else { // Linux/Mac locators go here - locators = [ - new PosixKnownPathsLocator(), - ]; + locators = [new PosixKnownPathsLocator()]; } - locators.push( - new GlobalVirtualEnvironmentLocator(), - new PyenvLocator(), - new CustomVirtualEnvironmentLocator(), - ); - const disposables = (locators.filter((d) => d.dispose !== undefined)) as IDisposable[]; + locators.push(new GlobalVirtualEnvironmentLocator(), new PyenvLocator(), new CustomVirtualEnvironmentLocator()); + const disposables = locators.filter((d) => d.dispose !== undefined) as IDisposable[]; ext.disposables.push(...disposables); return locators; } @@ -144,16 +116,11 @@ function watchRoots(args: WatchRootsArgs): IDisposable { }); } -function createWorkspaceLocator( - ext: ExtensionState, -): WorkspaceLocators { - const locators = new WorkspaceLocators( - watchRoots, - [ - (root: vscode.Uri) => [new WorkspaceVirtualEnvironmentLocator(root.fsPath)], - // Add an ILocator factory func here for each kind of workspace-rooted locator. - ], - ); +function createWorkspaceLocator(ext: ExtensionState): WorkspaceLocators { + const locators = new WorkspaceLocators(watchRoots, [ + (root: vscode.Uri) => [new WorkspaceVirtualEnvironmentLocator(root.fsPath)], + // Add an ILocator factory func here for each kind of workspace-rooted locator. + ]); ext.disposables.push(locators); return locators; } @@ -163,10 +130,7 @@ async function createCachingLocator( envInfoService: EnvironmentInfoService, locators: ILocator, ): Promise { - const storage = getGlobalStorage( - ext.context, - 'PYTHON_ENV_INFO_CACHE', - ); + const storage = getGlobalStorage(ext.context, 'PYTHON_ENV_INFO_CACHE'); const cache = await getPersistentCache( { load: async () => storage.get(), diff --git a/src/client/pythonEnvironments/info/environmentInfoService.ts b/src/client/pythonEnvironments/info/environmentInfoService.ts index 37118d03667f..09715b888b8f 100644 --- a/src/client/pythonEnvironments/info/environmentInfoService.ts +++ b/src/client/pythonEnvironments/info/environmentInfoService.ts @@ -9,13 +9,13 @@ import { buildPythonExecInfo } from '../exec'; export enum EnvironmentInfoServiceQueuePriority { Default, - High + High, } export interface IEnvironmentInfoService { getEnvironmentInfo( interpreterPath: string, - priority?: EnvironmentInfoServiceQueuePriority + priority?: EnvironmentInfoServiceQueuePriority, ): Promise; isInfoProvided(interpreterPath: string): boolean; } @@ -60,9 +60,7 @@ export class EnvironmentInfoService implements IEnvironmentInfoService { } if (this.workerPool === undefined) { - this.workerPool = createRunningWorkerPool( - buildEnvironmentInfo, - ); + this.workerPool = createRunningWorkerPool(buildEnvironmentInfo); } const deferred = createDeferred(); diff --git a/src/client/pythonEnvironments/info/index.ts b/src/client/pythonEnvironments/info/index.ts index 51fc84285638..a32e2d9286d0 100644 --- a/src/client/pythonEnvironments/info/index.ts +++ b/src/client/pythonEnvironments/info/index.ts @@ -23,7 +23,7 @@ export enum EnvironmentType { Poetry = 'Poetry', VirtualEnvWrapper = 'VirtualEnvWrapper', Global = 'Global', - System = 'System' + System = 'System', } type ReleaseLevel = 'alpha' | 'beta' | 'candidate' | 'final' | 'unknown'; diff --git a/src/client/pythonEnvironments/info/interpreter.ts b/src/client/pythonEnvironments/info/interpreter.ts index c204b7e6744f..628b2ae3f193 100644 --- a/src/client/pythonEnvironments/info/interpreter.ts +++ b/src/client/pythonEnvironments/info/interpreter.ts @@ -2,7 +2,10 @@ // Licensed under the MIT License. import { InterpreterInformation } from '.'; -import { interpreterInfo as getInterpreterInfoCommand, InterpreterInfoJson } from '../../common/process/internal/scripts'; +import { + interpreterInfo as getInterpreterInfoCommand, + InterpreterInfoJson, +} from '../../common/process/internal/scripts'; import { Architecture } from '../../common/utils/platform'; import { copyPythonExecInfo, PythonExecInfo } from '../exec'; import { parsePythonVersion } from './pythonVersion'; diff --git a/src/client/pythonEnvironments/legacyIOC.ts b/src/client/pythonEnvironments/legacyIOC.ts index 6ee8d3135a1e..f5444bf157f2 100644 --- a/src/client/pythonEnvironments/legacyIOC.ts +++ b/src/client/pythonEnvironments/legacyIOC.ts @@ -67,29 +67,22 @@ import { WorkspaceVirtualEnvWatcherService } from './discovery/locators/services import { EnvironmentType, PythonEnvironment } from './info'; import { EnvironmentsSecurity, IEnvironmentsSecurity } from './security'; -const convertedKinds = new Map(Object.entries({ - [PythonEnvKind.System]: EnvironmentType.System, - [PythonEnvKind.MacDefault]: EnvironmentType.System, - [PythonEnvKind.WindowsStore]: EnvironmentType.WindowsStore, - [PythonEnvKind.Pyenv]: EnvironmentType.Pyenv, - [PythonEnvKind.Conda]: EnvironmentType.Conda, - [PythonEnvKind.CondaBase]: EnvironmentType.Conda, - [PythonEnvKind.VirtualEnv]: EnvironmentType.VirtualEnv, - [PythonEnvKind.Pipenv]: EnvironmentType.Pipenv, - [PythonEnvKind.Venv]: EnvironmentType.Venv, -})); +const convertedKinds = new Map( + Object.entries({ + [PythonEnvKind.System]: EnvironmentType.System, + [PythonEnvKind.MacDefault]: EnvironmentType.System, + [PythonEnvKind.WindowsStore]: EnvironmentType.WindowsStore, + [PythonEnvKind.Pyenv]: EnvironmentType.Pyenv, + [PythonEnvKind.Conda]: EnvironmentType.Conda, + [PythonEnvKind.CondaBase]: EnvironmentType.Conda, + [PythonEnvKind.VirtualEnv]: EnvironmentType.VirtualEnv, + [PythonEnvKind.Pipenv]: EnvironmentType.Pipenv, + [PythonEnvKind.Venv]: EnvironmentType.Venv, + }), +); function convertEnvInfo(info: PythonEnvInfo): PythonEnvironment { - const { - name, - location, - executable, - arch, - kind, - searchLocation, - version, - distro, - } = info; + const { name, location, executable, arch, kind, searchLocation, version, distro } = info; const { filename, sysPrefix } = executable; const env: PythonEnvironment = { sysPrefix, @@ -120,9 +113,7 @@ function convertEnvInfo(info: PythonEnvInfo): PythonEnvironment { env.sysVersion = ''; } else { const { level, serial } = release; - const releaseStr = level === PythonReleaseLevel.Final - ? 'final' - : `${level}${serial}`; + const releaseStr = level === PythonReleaseLevel.Final ? 'final' : `${level}${serial}`; const versionStr = `${getVersionString(version)}-${releaseStr}`; env.version = parseVersion(versionStr); env.sysVersion = sysVersion; @@ -157,20 +148,22 @@ class ComponentAdapter implements IComponentAdapter, IExtensionSingleActivationS ) {} public async activate(): Promise { - this.enabled = (await Promise.all( - [ + this.enabled = ( + await Promise.all([ inExperiment(DiscoveryVariants.discoverWithFileWatching), inExperiment(DiscoveryVariants.discoveryWithoutFileWatching), - ], - )).includes(true); - this.disposables.push(this.api.onChanged((e) => { - const query = { - kinds: e.kind ? [e.kind] : undefined, - searchLocations: e.searchLocation ? { roots: [e.searchLocation] } : undefined - }; - // Trigger a background refresh of the environments. - getEnvs(this.api.iterEnvs(query)).ignoreErrors(); - })); + ]) + ).includes(true); + this.disposables.push( + this.api.onChanged((e) => { + const query = { + kinds: e.kind ? [e.kind] : undefined, + searchLocations: e.searchLocation ? { roots: [e.searchLocation] } : undefined, + }; + // Trigger a background refresh of the environments. + getEnvs(this.api.iterEnvs(query)).ignoreErrors(); + }), + ); } // IInterpreterLocatorProgressHandler @@ -330,9 +323,7 @@ class ComponentAdapter implements IComponentAdapter, IExtensionSingleActivationS } } -export function registerLegacyDiscoveryForIOC( - serviceManager: IServiceManager, -): void { +export function registerLegacyDiscoveryForIOC(serviceManager: IServiceManager): void { serviceManager.addSingleton(IInterpreterLocatorHelper, InterpreterLocatorHelper); serviceManager.addSingleton( IInterpreterLocatorService, @@ -419,7 +410,7 @@ export function registerNewDiscoveryForIOC( serviceManager: IServiceManager, api: IPythonEnvironments, environmentsSecurity: EnvironmentsSecurity, - disposables: IDisposableRegistry + disposables: IDisposableRegistry, ): void { serviceManager.addSingletonInstance( IComponentAdapter, diff --git a/src/client/refactor/proxy.ts b/src/client/refactor/proxy.ts index 94bc5cba1b7a..8e29c378b786 100644 --- a/src/client/refactor/proxy.ts +++ b/src/client/refactor/proxy.ts @@ -20,7 +20,7 @@ export class RefactorProxy extends Disposable { private initialized!: Deferred; constructor( private workspaceRoot: string, - private getPythonExecutionService: () => Promise + private getPythonExecutionService: () => Promise, ) { super(() => {}); } @@ -50,7 +50,7 @@ export class RefactorProxy extends Disposable { name: string, filePath: string, range: Range, - options?: TextEditorOptions + options?: TextEditorOptions, ): Promise { if (!options) { options = window.activeTextEditor!.options; @@ -61,7 +61,7 @@ export class RefactorProxy extends Disposable { start: this.getOffsetAt(document, range.start).toString(), id: '1', name: name, - indent_size: options.tabSize + indent_size: options.tabSize, }; return this.sendCommand(JSON.stringify(command)); @@ -71,7 +71,7 @@ export class RefactorProxy extends Disposable { name: string, filePath: string, range: Range, - options?: TextEditorOptions + options?: TextEditorOptions, ): Promise { if (!options) { options = window.activeTextEditor!.options; @@ -83,7 +83,7 @@ export class RefactorProxy extends Disposable { end: this.getOffsetAt(document, range.end).toString(), id: '1', name: name, - indent_size: options.tabSize + indent_size: options.tabSize, }; return this.sendCommand(JSON.stringify(command)); } @@ -92,7 +92,7 @@ export class RefactorProxy extends Disposable { name: string, filePath: string, range: Range, - options?: TextEditorOptions + options?: TextEditorOptions, ): Promise { if (!options) { options = window.activeTextEditor!.options; @@ -111,7 +111,7 @@ export class RefactorProxy extends Disposable { end: this.getOffsetAt(document, range.end).toString(), id: '1', name: name, - indent_size: options.tabSize + indent_size: options.tabSize, }; return this.sendCommand(JSON.stringify(command)); } @@ -143,7 +143,7 @@ export class RefactorProxy extends Disposable { this.handleStdError(output.out); } }, - (error) => this.handleError(error) + (error) => this.handleError(error), ); return this.initialized.promise; diff --git a/src/client/sourceMapSupport.ts b/src/client/sourceMapSupport.ts index 0303e1e43a93..69134f85ccee 100644 --- a/src/client/sourceMapSupport.ts +++ b/src/client/sourceMapSupport.ts @@ -51,11 +51,11 @@ export class SourceMapSupport { 'client', 'debugger', 'debugAdapter', - 'main.js' + 'main.js', ); await Promise.all([ this.enableSourceMap(enable, extensionSourceFile), - this.enableSourceMap(enable, debuggerSourceFile) + this.enableSourceMap(enable, debuggerSourceFile), ]); } protected async enableSourceMap(enable: boolean, sourceFile: string) { diff --git a/src/client/startupTelemetry.ts b/src/client/startupTelemetry.ts index 13f8bcfbd5da..0a391d14be5e 100644 --- a/src/client/startupTelemetry.ts +++ b/src/client/startupTelemetry.ts @@ -11,12 +11,12 @@ import { IExperimentsManager, IInterpreterPathService, InspectInterpreterSettingType, - Resource + Resource, } from './common/types'; import { AutoSelectionRule, IInterpreterAutoSelectionRule, - IInterpreterAutoSelectionService + IInterpreterAutoSelectionService, } from './interpreter/autoSelection/types'; import { ICondaService, IInterpreterService } from './interpreter/contracts'; import { IServiceContainer } from './ioc/types'; @@ -34,7 +34,7 @@ export async function sendStartupTelemetry( activatedPromise: Promise, durations: Record, stopWatch: IStopWatch, - serviceContainer: IServiceContainer + serviceContainer: IServiceContainer, ) { if (isTestExecution()) { return; @@ -53,7 +53,7 @@ export async function sendStartupTelemetry( export async function sendErrorTelemetry( ex: Error, durations: Record, - serviceContainer?: IServiceContainer + serviceContainer?: IServiceContainer, ) { try { // tslint:disable-next-line:no-any @@ -101,7 +101,7 @@ export function hasUserDefinedPythonPath(resource: Resource, serviceContainer: I function getPreferredWorkspaceInterpreter(resource: Resource, serviceContainer: IServiceContainer) { const workspaceInterpreterSelector = serviceContainer.get( IInterpreterAutoSelectionRule, - AutoSelectionRule.workspaceVirtualEnvs + AutoSelectionRule.workspaceVirtualEnvs, ); const interpreter = workspaceInterpreterSelector.getPreviouslyAutoSelectedInterpreter(resource); return interpreter ? interpreter.path : undefined; @@ -130,7 +130,7 @@ async function getActivationTelemetryProps(serviceContainer: IServiceContainer): .then((ver) => (ver ? ver.raw : '')) .catch(() => ''), interpreterService.getActiveInterpreter().catch(() => undefined), - interpreterService.getInterpreters(mainWorkspaceUri).catch(() => []) + interpreterService.getInterpreters(mainWorkspaceUri).catch(() => []), ]); const workspaceFolderCount = workspaceService.hasWorkspaceFolders ? workspaceService.workspaceFolders!.length : 0; const pythonVersion = interpreter && interpreter.version ? interpreter.version.raw : undefined; @@ -153,6 +153,6 @@ async function getActivationTelemetryProps(serviceContainer: IServiceContainer): hasPython3, usingUserDefinedInterpreter, usingAutoSelectedWorkspaceInterpreter, - usingGlobalInterpreter + usingGlobalInterpreter, }; } diff --git a/src/client/telemetry/constants.ts b/src/client/telemetry/constants.ts index 0e9c224d6b86..8f49b05644b7 100644 --- a/src/client/telemetry/constants.ts +++ b/src/client/telemetry/constants.ts @@ -118,10 +118,10 @@ export enum EventName { HASHED_PACKAGE_NAME = 'HASHED_PACKAGE_NAME', HASHED_PACKAGE_PERF = 'HASHED_PACKAGE_PERF', - JEDI_MEMORY = 'JEDI_MEMORY' + JEDI_MEMORY = 'JEDI_MEMORY', } export enum PlatformErrors { FailedToParseVersion = 'FailedToParseVersion', - FailedToDetermineOS = 'FailedToDetermineOS' + FailedToDetermineOS = 'FailedToDetermineOS', } diff --git a/src/client/telemetry/envFileTelemetry.ts b/src/client/telemetry/envFileTelemetry.ts index dfb30d851297..63c5a67fedec 100644 --- a/src/client/telemetry/envFileTelemetry.ts +++ b/src/client/telemetry/envFileTelemetry.ts @@ -29,7 +29,7 @@ export function sendFileCreationTelemetry() { export async function sendActivationTelemetry( fileSystem: IFileSystem, workspaceService: IWorkspaceService, - resource: Resource + resource: Resource, ) { if (shouldSendTelemetry()) { const systemVariables = new SystemVariables(resource, undefined, workspaceService); diff --git a/src/client/telemetry/importTracker.ts b/src/client/telemetry/importTracker.ts index edf188684857..029eed5d4ecc 100644 --- a/src/client/telemetry/importTracker.ts +++ b/src/client/telemetry/importTracker.ts @@ -52,7 +52,7 @@ export class ImportTracker implements IExtensionSingleActivationService { constructor( @inject(IDocumentManager) private documentManager: IDocumentManager, - @inject(IDisposableRegistry) private disposables: IDisposableRegistry + @inject(IDisposableRegistry) private disposables: IDisposableRegistry, ) { this.documentManager.onDidOpenTextDocument((t) => this.onOpenedOrSavedDocument(t), this, this.disposables); this.documentManager.onDidSaveTextDocument((t) => this.onOpenedOrSavedDocument(t), this, this.disposables); diff --git a/src/client/telemetry/index.ts b/src/client/telemetry/index.ts index 5c15bac7919c..ff237203c091 100644 --- a/src/client/telemetry/index.ts +++ b/src/client/telemetry/index.ts @@ -101,7 +101,7 @@ export function sendTelemetryEvent

| number, properties?: P[E], - ex?: Error + ex?: Error, ) { if (isTestExecution() || !isTelemetrySupported()) { return; @@ -139,7 +139,7 @@ export function sendTelemetryEvent

= ( target: Object, propertyKey: string | symbol, - descriptor: TypedPropertyDescriptor + descriptor: TypedPropertyDescriptor, ) => TypedPropertyDescriptor | void; /** @@ -181,13 +181,13 @@ export function captureTelemetry P[E] + lazyProperties?: (obj: This) => P[E], ): TypedMethodDescriptor<(this: This, ...args: any[]) => any> { // tslint:disable-next-line:no-function-expression no-any return function ( _target: Object, _propertyKey: string | symbol, - descriptor: TypedPropertyDescriptor<(this: This, ...args: any[]) => any> + descriptor: TypedPropertyDescriptor<(this: This, ...args: any[]) => any>, ) { const originalMethod = descriptor.value!; // tslint:disable-next-line:no-function-expression no-any @@ -230,7 +230,7 @@ export function captureTelemetry | Thenable, stopWatch?: StopWatch, - properties?: P[E] + properties?: P[E], ) { stopWatch = stopWatch ? stopWatch : new StopWatch(); if (typeof promise.then === 'function') { @@ -265,7 +265,7 @@ export function sendTelemetryWhenDone

( IExtensionSingleActivationService, - TensorBoardSessionProvider + TensorBoardSessionProvider, ); serviceManager.addSingleton( IExtensionSingleActivationService, - TensorBoardFileWatcher + TensorBoardFileWatcher, ); serviceManager.addSingleton(TensorBoardPrompt, TensorBoardPrompt); serviceManager.addSingleton(ITensorBoardImportTracker, TensorBoardImportTracker); serviceManager.addBinding(ITensorBoardImportTracker, IExtensionSingleActivationService); serviceManager.addSingleton( IExtensionSingleActivationService, - TensorBoardCodeLensProvider + TensorBoardCodeLensProvider, ); serviceManager.addSingleton( IExtensionSingleActivationService, - TensorBoardCodeActionProvider + TensorBoardCodeActionProvider, ); } diff --git a/src/client/tensorBoard/tensorBoardCodeActionProvider.ts b/src/client/tensorBoard/tensorBoardCodeActionProvider.ts index 37553913737c..aecfbd3c3dda 100644 --- a/src/client/tensorBoard/tensorBoardCodeActionProvider.ts +++ b/src/client/tensorBoard/tensorBoardCodeActionProvider.ts @@ -14,7 +14,7 @@ import { containsTensorBoardImport } from './helpers'; export class TensorBoardCodeActionProvider implements CodeActionProvider, IExtensionSingleActivationService { constructor( @inject(IExperimentService) private experimentService: IExperimentService, - @inject(IDisposableRegistry) private disposables: IDisposableRegistry + @inject(IDisposableRegistry) private disposables: IDisposableRegistry, ) {} public async activate(): Promise { @@ -31,7 +31,7 @@ export class TensorBoardCodeActionProvider implements CodeActionProvider, IExten const nativeTensorBoardSession = new CodeAction(title, CodeActionKind.QuickFix); nativeTensorBoardSession.command = { title, - command: Commands.LaunchTensorBoard + command: Commands.LaunchTensorBoard, }; return [nativeTensorBoardSession]; } @@ -45,8 +45,8 @@ export class TensorBoardCodeActionProvider implements CodeActionProvider, IExten ) { this.disposables.push( languages.registerCodeActionsProvider(PYTHON, this, { - providedCodeActionKinds: [CodeActionKind.QuickFix] - }) + providedCodeActionKinds: [CodeActionKind.QuickFix], + }), ); } } diff --git a/src/client/tensorBoard/tensorBoardCodeLensProvider.ts b/src/client/tensorBoard/tensorBoardCodeLensProvider.ts index eadb1bf999eb..1f5a6235e84f 100644 --- a/src/client/tensorBoard/tensorBoardCodeLensProvider.ts +++ b/src/client/tensorBoard/tensorBoardCodeLensProvider.ts @@ -14,7 +14,7 @@ import { containsTensorBoardImport } from './helpers'; export class TensorBoardCodeLensProvider implements IExtensionSingleActivationService { constructor( @inject(IExperimentService) private experimentService: IExperimentService, - @inject(IDisposableRegistry) private disposables: IDisposableRegistry + @inject(IDisposableRegistry) private disposables: IDisposableRegistry, ) {} public async activate(): Promise { @@ -25,7 +25,7 @@ export class TensorBoardCodeLensProvider implements IExtensionSingleActivationSe public provideCodeLenses(document: TextDocument): CodeLens[] { const command: Command = { title: TensorBoard.launchNativeTensorBoardSessionCodeLens(), - command: Commands.LaunchTensorBoard + command: Commands.LaunchTensorBoard, }; const codelenses: CodeLens[] = []; for (let index = 0; index < document.lineCount; index += 1) { diff --git a/src/client/tensorBoard/tensorBoardFileWatcher.ts b/src/client/tensorBoard/tensorBoardFileWatcher.ts index e704f138e248..cd105445e2ec 100644 --- a/src/client/tensorBoard/tensorBoardFileWatcher.ts +++ b/src/client/tensorBoard/tensorBoardFileWatcher.ts @@ -22,7 +22,7 @@ export class TensorBoardFileWatcher implements IExtensionSingleActivationService @inject(IWorkspaceService) private workspaceService: IWorkspaceService, @inject(TensorBoardPrompt) private tensorBoardPrompt: TensorBoardPrompt, @inject(IDisposableRegistry) private readonly disposables: IDisposableRegistry, - @inject(IExperimentService) private experimentService: IExperimentService + @inject(IExperimentService) private experimentService: IExperimentService, ) {} public async activate(): Promise { @@ -50,7 +50,7 @@ export class TensorBoardFileWatcher implements IExtensionSingleActivationService // If workspace folders change, ensure we update our FileSystemWatchers this.disposables.push( - this.workspaceService.onDidChangeWorkspaceFolders((e) => this.updateFileSystemWatchers(e)) + this.workspaceService.onDidChangeWorkspaceFolders((e) => this.updateFileSystemWatchers(e)), ); } @@ -65,7 +65,7 @@ export class TensorBoardFileWatcher implements IExtensionSingleActivationService } } catch (e) { traceError( - `Failed to prompt to launch TensorBoard session based on preexisting tfevent files in workspace: ${e}` + `Failed to prompt to launch TensorBoard session based on preexisting tfevent files in workspace: ${e}`, ); } } @@ -91,10 +91,10 @@ export class TensorBoardFileWatcher implements IExtensionSingleActivationService // When a file is created or changed that matches `this.globPattern`, try to show our prompt this.disposables.push( - fileSystemWatcher.onDidCreate(() => this.tensorBoardPrompt.showNativeTensorBoardPrompt()) + fileSystemWatcher.onDidCreate(() => this.tensorBoardPrompt.showNativeTensorBoardPrompt()), ); this.disposables.push( - fileSystemWatcher.onDidChange(() => this.tensorBoardPrompt.showNativeTensorBoardPrompt()) + fileSystemWatcher.onDidChange(() => this.tensorBoardPrompt.showNativeTensorBoardPrompt()), ); this.disposables.push(fileSystemWatcher); fileWatchers.push(fileSystemWatcher); diff --git a/src/client/tensorBoard/tensorBoardImportTracker.ts b/src/client/tensorBoard/tensorBoardImportTracker.ts index 7cc98c308bef..6db39849422f 100644 --- a/src/client/tensorBoard/tensorBoardImportTracker.ts +++ b/src/client/tensorBoard/tensorBoardImportTracker.ts @@ -21,7 +21,7 @@ export class TensorBoardImportTracker implements ITensorBoardImportTracker, IExt constructor( @inject(IDocumentManager) private documentManager: IDocumentManager, - @inject(IDisposableRegistry) private disposables: IDisposableRegistry + @inject(IDisposableRegistry) private disposables: IDisposableRegistry, ) {} // Fires when the active text editor contains a tensorboard import. @@ -48,7 +48,7 @@ export class TensorBoardImportTracker implements ITensorBoardImportTracker, IExt this.documentManager.onDidChangeActiveTextEditor( (e) => this.onChangedActiveTextEditor(e), this, - this.disposables + this.disposables, ); } diff --git a/src/client/tensorBoard/tensorBoardPrompt.ts b/src/client/tensorBoard/tensorBoardPrompt.ts index 96ead544dc42..9c10906351ce 100644 --- a/src/client/tensorBoard/tensorBoardPrompt.ts +++ b/src/client/tensorBoard/tensorBoardPrompt.ts @@ -10,7 +10,7 @@ import { Common, TensorBoard } from '../common/utils/localize'; import { ITensorBoardImportTracker } from './types'; enum TensorBoardPromptStateKeys { - ShowNativeTensorBoardPrompt = 'showNativeTensorBoardPrompt' + ShowNativeTensorBoardPrompt = 'showNativeTensorBoardPrompt', } @injectable() @@ -31,11 +31,11 @@ export class TensorBoardPrompt { @inject(ITensorBoardImportTracker) private importTracker: ITensorBoardImportTracker, @inject(IDisposableRegistry) private disposableRegistry: IDisposableRegistry, @inject(IPersistentStateFactory) private persistentStateFactory: IPersistentStateFactory, - @inject(IExperimentService) private experimentService: IExperimentService + @inject(IExperimentService) private experimentService: IExperimentService, ) { this.state = this.persistentStateFactory.createWorkspacePersistentState( TensorBoardPromptStateKeys.ShowNativeTensorBoardPrompt, - true + true, ); this.enabled = this.isPromptEnabled(); this.inExperiment = this.isInExperiment(); @@ -56,7 +56,7 @@ export class TensorBoardPrompt { this.waitingForUserSelection = true; const selection = await this.applicationShell.showInformationMessage( TensorBoard.nativeTensorBoardPrompt(), - ...options + ...options, ); this.waitingForUserSelection = false; this.enabledInCurrentSession = false; diff --git a/src/client/tensorBoard/tensorBoardSession.ts b/src/client/tensorBoard/tensorBoardSession.ts index 02b048813579..ce687024ca7d 100644 --- a/src/client/tensorBoard/tensorBoardSession.ts +++ b/src/client/tensorBoard/tensorBoardSession.ts @@ -12,7 +12,7 @@ import { QuickPickItem, ViewColumn, WebviewPanel, - window + window, } from 'vscode'; import { ICommandManager, IWorkspaceService } from '../common/application/types'; import { createPromiseFromCancellation } from '../common/cancellation'; @@ -46,7 +46,7 @@ export class TensorBoardSession { private readonly interpreterService: IInterpreterService, private readonly workspaceService: IWorkspaceService, private readonly processServiceFactory: IProcessServiceFactory, - private readonly commandManager: ICommandManager + private readonly commandManager: ICommandManager, ) {} public async initialize(): Promise { @@ -82,11 +82,11 @@ export class TensorBoardSession { const cancellationPromise = createPromiseFromCancellation({ cancelAction: 'resolve', defaultValue: InstallerResponse.Ignore, - token: installerToken + token: installerToken, }); const response = await Promise.race([ this.installer.promptToInstall(Product.tensorboard, interpreter, installerToken), - cancellationPromise + cancellationPromise, ]); return response === InstallerResponse.Installed; } @@ -96,7 +96,7 @@ export class TensorBoardSession { const selection = await window.showOpenDialog({ canSelectFiles: false, canSelectFolders: true, - canSelectMany: false + canSelectMany: false, }); // If the user selected a folder, return the uri.fsPath // There will only be one selection since canSelectMany: false @@ -111,17 +111,17 @@ export class TensorBoardSession { if (logDir) { const useCwd = { label: TensorBoard.useCurrentWorkingDirectory(), - detail: TensorBoard.useCurrentWorkingDirectoryDetail() + detail: TensorBoard.useCurrentWorkingDirectoryDetail(), }; const selectAnotherFolder = { label: TensorBoard.selectAnotherFolder(), - detail: TensorBoard.selectAnotherFolderDetail() + detail: TensorBoard.selectAnotherFolderDetail(), }; return [useCwd, selectAnotherFolder]; } const selectAFolder = { label: TensorBoard.selectAFolder(), - detail: TensorBoard.selectAFolderDetail() + detail: TensorBoard.selectAFolderDetail(), }; return [selectAFolder]; } @@ -138,7 +138,7 @@ export class TensorBoardSession { const item = await window.showQuickPick(items, { canPickMany: false, ignoreFocusOut: false, - placeHolder: logDir ? TensorBoard.currentDirectory().format(logDir) : undefined + placeHolder: logDir ? TensorBoard.currentDirectory().format(logDir) : undefined, }); switch (item?.label) { case useCurrentWorkingDirectory: @@ -169,7 +169,7 @@ export class TensorBoardSession { const progressOptions: ProgressOptions = { title: TensorBoard.progressMessage(), location: ProgressLocation.Notification, - cancellable: true + cancellable: true, }; const processService = await this.processServiceFactory.create(); @@ -185,11 +185,11 @@ export class TensorBoardSession { const userCancellation = createPromiseFromCancellation({ token, cancelAction: 'resolve', - defaultValue: 'canceled' + defaultValue: 'canceled', }); return Promise.race([sleep(timeout), spawnTensorBoard, userCancellation]); - } + }, ); switch (result) { @@ -225,7 +225,7 @@ export class TensorBoardSession { }, error: (err) => { traceError(err); - } + }, }); return urlThatTensorBoardIsRunningAt.promise; @@ -239,7 +239,7 @@ export class TensorBoardSession { private createPanel() { const webviewPanel = window.createWebviewPanel('tensorBoardSession', 'TensorBoard', ViewColumn.Two, { - enableScripts: true + enableScripts: true, }); this.webviewPanel = webviewPanel; webviewPanel.onDidDispose(() => { diff --git a/src/client/tensorBoard/tensorBoardSessionProvider.ts b/src/client/tensorBoard/tensorBoardSessionProvider.ts index a85e107cb542..fd4576c2634d 100644 --- a/src/client/tensorBoard/tensorBoardSessionProvider.ts +++ b/src/client/tensorBoard/tensorBoardSessionProvider.ts @@ -24,7 +24,7 @@ export class TensorBoardSessionProvider implements IExtensionSingleActivationSer @inject(ICommandManager) private readonly commandManager: ICommandManager, @inject(IDisposableRegistry) private readonly disposables: IDisposableRegistry, @inject(IExperimentService) private readonly experimentService: IExperimentService, - @inject(IProcessServiceFactory) private readonly processServiceFactory: IProcessServiceFactory + @inject(IProcessServiceFactory) private readonly processServiceFactory: IProcessServiceFactory, ) {} public async activate() { @@ -34,7 +34,7 @@ export class TensorBoardSessionProvider implements IExtensionSingleActivationSer private async activateInternal() { if (await this.experimentService.inExperiment(NativeTensorBoard.experiment)) { this.disposables.push( - this.commandManager.registerCommand(Commands.LaunchTensorBoard, () => this.createNewSession()) + this.commandManager.registerCommand(Commands.LaunchTensorBoard, () => this.createNewSession()), ); const contextKey = new ContextKey('python.isInNativeTensorBoardExperiment', this.commandManager); contextKey.set(true).ignoreErrors(); @@ -49,7 +49,7 @@ export class TensorBoardSessionProvider implements IExtensionSingleActivationSer this.interpreterService, this.workspaceService, this.processServiceFactory, - this.commandManager + this.commandManager, ); await newSession.initialize(); } catch (e) { diff --git a/src/client/terminals/activation.ts b/src/client/terminals/activation.ts index b42d4b3bd4b0..5206bfa172d3 100644 --- a/src/client/terminals/activation.ts +++ b/src/client/terminals/activation.ts @@ -20,7 +20,7 @@ export class ExtensionActivationForTerminalActivation implements IExtensionSingl constructor( @inject(ICommandManager) private commands: ICommandManager, @inject(IExtensions) private extensions: IExtensions, - @inject(IDisposableRegistry) disposables: IDisposable[] + @inject(IDisposableRegistry) disposables: IDisposable[], ) { disposables.push(this.extensions.onDidChange(this.activate.bind(this))); } @@ -45,7 +45,7 @@ export class TerminalAutoActivation implements ITerminalAutoActivation { @inject(ITerminalManager) private readonly terminalManager: ITerminalManager, @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry, @inject(ITerminalActivator) private readonly activator: ITerminalActivator, - @inject(IActiveResourceService) private readonly activeResourceService: IActiveResourceService + @inject(IActiveResourceService) private readonly activeResourceService: IActiveResourceService, ) { disposableRegistry.push(this); } @@ -68,7 +68,7 @@ export class TerminalAutoActivation implements ITerminalAutoActivation { // If we have just one workspace, then pass that as the resource. // Until upstream VSC issue is resolved https://github.com/Microsoft/vscode/issues/63052. await this.activator.activateEnvironmentInTerminal(terminal, { - resource: this.activeResourceService.getActiveResource() + resource: this.activeResourceService.getActiveResource(), }); } } diff --git a/src/client/terminals/codeExecution/codeExecutionManager.ts b/src/client/terminals/codeExecution/codeExecutionManager.ts index 87756f2c8943..3cba68ecdc77 100644 --- a/src/client/terminals/codeExecution/codeExecutionManager.ts +++ b/src/client/terminals/codeExecution/codeExecutionManager.ts @@ -26,7 +26,7 @@ export class CodeExecutionManager implements ICodeExecutionManager { @inject(IDocumentManager) private documentManager: IDocumentManager, @inject(IDisposableRegistry) private disposableRegistry: Disposable[], @inject(IFileSystem) private fileSystem: IFileSystem, - @inject(IServiceContainer) private serviceContainer: IServiceContainer + @inject(IServiceContainer) private serviceContainer: IServiceContainer, ) {} public get onExecutedCode(): Event { @@ -42,23 +42,23 @@ export class CodeExecutionManager implements ICodeExecutionManager { async (file: Resource) => { const trigger = cmd === Commands.Exec_In_Terminal ? 'command' : 'icon'; await this.executeFileInTerminal(file, trigger).catch((ex) => - traceError('Failed to execute file in terminal', ex) + traceError('Failed to execute file in terminal', ex), ); - } - ) + }, + ), ); }); this.disposableRegistry.push( this.commandManager.registerCommand( Commands.Exec_Selection_In_Terminal, - this.executeSelectionInTerminal.bind(this) - ) + this.executeSelectionInTerminal.bind(this), + ), ); this.disposableRegistry.push( this.commandManager.registerCommand( Commands.Exec_Selection_In_Django_Shell, - this.executeSelectionInDjangoShell.bind(this) - ) + this.executeSelectionInDjangoShell.bind(this), + ), ); } private async executeFileInTerminal(file: Resource, trigger: 'command' | 'icon') { diff --git a/src/client/terminals/codeExecution/djangoContext.ts b/src/client/terminals/codeExecution/djangoContext.ts index 2c3de7b79a07..3e63e4b7d3ce 100644 --- a/src/client/terminals/codeExecution/djangoContext.ts +++ b/src/client/terminals/codeExecution/djangoContext.ts @@ -21,12 +21,12 @@ export class DjangoContextInitializer implements Disposable { private documentManager: IDocumentManager, private workpaceService: IWorkspaceService, private fileSystem: IFileSystem, - commandManager: ICommandManager + commandManager: ICommandManager, ) { this.isDjangoProject = new ContextKey('python.isDjangoProject', commandManager); this.ensureContextStateIsSet().catch((ex) => traceError('Python Extension: ensureState', ex)); this.disposables.push( - this.workpaceService.onDidChangeWorkspaceFolders(() => this.updateContextKeyBasedOnActiveWorkspace()) + this.workpaceService.onDidChangeWorkspaceFolders(() => this.updateContextKeyBasedOnActiveWorkspace()), ); } diff --git a/src/client/terminals/codeExecution/djangoShellCodeExecution.ts b/src/client/terminals/codeExecution/djangoShellCodeExecution.ts index 0e96c13e1690..61f4cef7758f 100644 --- a/src/client/terminals/codeExecution/djangoShellCodeExecution.ts +++ b/src/client/terminals/codeExecution/djangoShellCodeExecution.ts @@ -25,7 +25,7 @@ export class DjangoShellCodeExecutionProvider extends TerminalCodeExecutionProvi @inject(IPlatformService) platformService: IPlatformService, @inject(ICommandManager) commandManager: ICommandManager, @inject(IFileSystem) fileSystem: IFileSystem, - @inject(IDisposableRegistry) disposableRegistry: Disposable[] + @inject(IDisposableRegistry) disposableRegistry: Disposable[], ) { super(terminalServiceFactory, configurationService, workspace, disposableRegistry, platformService); this.terminalTitle = 'Django Shell'; diff --git a/src/client/terminals/codeExecution/helper.ts b/src/client/terminals/codeExecution/helper.ts index 4090439b20cd..39f4cf569a64 100644 --- a/src/client/terminals/codeExecution/helper.ts +++ b/src/client/terminals/codeExecution/helper.ts @@ -50,7 +50,7 @@ export class CodeExecutionHelper implements ICodeExecutionHelper { ? internalScripts.normalizeSelection() : internalScripts.normalizeForInterpreter(); const observable = processService.execObservable(interpreter?.path || 'python', args, { - throwOnStdErr: true + throwOnStdErr: true, }); const normalizeOutput = createDeferred(); @@ -64,7 +64,7 @@ export class CodeExecutionHelper implements ICodeExecutionHelper { }, complete: () => { normalizeOutput.resolve(normalized); - } + }, }); // The normalization script expects a serialized JSON object, with the selection under the "code" key. @@ -162,7 +162,7 @@ export class CodeExecutionHelper implements ICodeExecutionHelper { const fullTextRange = new Range( new Position(selection.start.line, 0), - new Position(selection.end.line, textEditor.document.lineAt(selection.end.line).text.length) + new Position(selection.end.line, textEditor.document.lineAt(selection.end.line).text.length), ); const fullText = textEditor.document.getText(fullTextRange); @@ -190,7 +190,7 @@ export class CodeExecutionHelper implements ICodeExecutionHelper { const fullStartLineText = textEditor.document.lineAt(selection.start.line).text; const selectionFirstLineRange = new Range( selection.start, - new Position(selection.start.line, fullStartLineText.length) + new Position(selection.start.line, fullStartLineText.length), ); const selectionFirstLineText = textEditor.document.getText(selectionFirstLineRange); diff --git a/src/client/terminals/codeExecution/repl.ts b/src/client/terminals/codeExecution/repl.ts index f3c620e83b75..fe5f5860bb28 100644 --- a/src/client/terminals/codeExecution/repl.ts +++ b/src/client/terminals/codeExecution/repl.ts @@ -18,7 +18,7 @@ export class ReplProvider extends TerminalCodeExecutionProvider { @inject(IConfigurationService) configurationService: IConfigurationService, @inject(IWorkspaceService) workspace: IWorkspaceService, @inject(IDisposableRegistry) disposableRegistry: Disposable[], - @inject(IPlatformService) platformService: IPlatformService + @inject(IPlatformService) platformService: IPlatformService, ) { super(terminalServiceFactory, configurationService, workspace, disposableRegistry, platformService); this.terminalTitle = 'REPL'; diff --git a/src/client/terminals/codeExecution/terminalCodeExecution.ts b/src/client/terminals/codeExecution/terminalCodeExecution.ts index 8884ef97b156..52709b71979e 100644 --- a/src/client/terminals/codeExecution/terminalCodeExecution.ts +++ b/src/client/terminals/codeExecution/terminalCodeExecution.ts @@ -24,7 +24,7 @@ export class TerminalCodeExecutionProvider implements ICodeExecutionService { @inject(IConfigurationService) protected readonly configurationService: IConfigurationService, @inject(IWorkspaceService) protected readonly workspace: IWorkspaceService, @inject(IDisposableRegistry) protected readonly disposables: Disposable[], - @inject(IPlatformService) protected readonly platformService: IPlatformService + @inject(IPlatformService) protected readonly platformService: IPlatformService, ) {} public async executeFile(file: Uri) { @@ -77,7 +77,7 @@ export class TerminalCodeExecutionProvider implements ICodeExecutionService { this.disposables.push( this._terminalService.onDidCloseTerminal(() => { this.replActive = undefined; - }) + }), ); } return this._terminalService; diff --git a/src/client/terminals/serviceRegistry.ts b/src/client/terminals/serviceRegistry.ts index 619c69eab7c0..424b8f2f6328 100644 --- a/src/client/terminals/serviceRegistry.ts +++ b/src/client/terminals/serviceRegistry.ts @@ -16,7 +16,7 @@ interface IServiceRegistry { addSingleton( serviceIdentifier: interfaces.ServiceIdentifier, constructor: ClassType, - name?: string | number | symbol + name?: string | number | symbol, ): void; } @@ -28,12 +28,12 @@ export function registerTypes(serviceManager: IServiceRegistry) { serviceManager.addSingleton( ICodeExecutionService, DjangoShellCodeExecutionProvider, - 'djangoShell' + 'djangoShell', ); serviceManager.addSingleton( ICodeExecutionService, TerminalCodeExecutionProvider, - 'standard' + 'standard', ); serviceManager.addSingleton(ICodeExecutionService, ReplProvider, 'repl'); @@ -41,6 +41,6 @@ export function registerTypes(serviceManager: IServiceRegistry) { serviceManager.addSingleton( IExtensionSingleActivationService, - ExtensionActivationForTerminalActivation + ExtensionActivationForTerminalActivation, ); } diff --git a/src/client/testing/codeLenses/main.ts b/src/client/testing/codeLenses/main.ts index 2179c10d2ec8..9c2a7e688ee9 100644 --- a/src/client/testing/codeLenses/main.ts +++ b/src/client/testing/codeLenses/main.ts @@ -8,20 +8,20 @@ export function activateCodeLenses( onDidChange: vscode.EventEmitter, symbolProvider: vscode.DocumentSymbolProvider, testCollectionStorage: ITestCollectionStorageService, - serviceContainer: IServiceContainer + serviceContainer: IServiceContainer, ): vscode.Disposable { const disposables: vscode.Disposable[] = []; const codeLensProvider = new TestFileCodeLensProvider( onDidChange, symbolProvider, testCollectionStorage, - serviceContainer + serviceContainer, ); disposables.push(vscode.languages.registerCodeLensProvider(PYTHON, codeLensProvider)); return { dispose: () => { disposables.forEach((d) => d.dispose()); - } + }, }; } diff --git a/src/client/testing/codeLenses/testFiles.ts b/src/client/testing/codeLenses/testFiles.ts index 4186e216dc45..67c6c012aec8 100644 --- a/src/client/testing/codeLenses/testFiles.ts +++ b/src/client/testing/codeLenses/testFiles.ts @@ -15,7 +15,7 @@ import { SymbolInformation, SymbolKind, TextDocument, - Uri + Uri, } from 'vscode'; import { IWorkspaceService } from '../../../client/common/application/types'; import { IFileSystem } from '../../../client/common/platform/types'; @@ -28,7 +28,7 @@ import { TestFunction, TestStatus, TestsToRun, - TestSuite + TestSuite, } from '../common/types'; type FunctionsAndSuites = { @@ -44,7 +44,7 @@ export class TestFileCodeLensProvider implements CodeLensProvider { private _onDidChange: EventEmitter, private symbolProvider: DocumentSymbolProvider, private testCollectionStorage: ITestCollectionStorageService, - serviceContainer: IServiceContainer + serviceContainer: IServiceContainer, ) { this.workspaceService = serviceContainer.get(IWorkspaceService); this.fileSystem = serviceContainer.get(IFileSystem); @@ -100,7 +100,7 @@ export class TestFileCodeLensProvider implements CodeLensProvider { private async getCodeLenses( document: TextDocument, token: CancellationToken, - symbolProvider: DocumentSymbolProvider + symbolProvider: DocumentSymbolProvider, ) { const file = this.getTestFileWhichNeedsCodeLens(document); if (!file) { @@ -118,14 +118,14 @@ export class TestFileCodeLensProvider implements CodeLensProvider { (symbol) => symbol.kind === SymbolKind.Function || symbol.kind === SymbolKind.Method || - symbol.kind === SymbolKind.Class + symbol.kind === SymbolKind.Class, ) .map((symbol) => { // This is crucial, if the start and end columns are the same then vscode bugs out // whenever you edit a line (start scrolling magically). const range = new Range( symbol.location.range.start, - new Position(symbol.location.range.end.line, symbol.location.range.end.character + 1) + new Position(symbol.location.range.end.line, symbol.location.range.end.character + 1), ); return this.getCodeLens( @@ -134,7 +134,7 @@ export class TestFileCodeLensProvider implements CodeLensProvider { range, symbol.name, symbol.kind, - symbol.containerName + symbol.containerName, ); }) .reduce((previous, current) => previous.concat(current), []) @@ -153,7 +153,7 @@ export class TestFileCodeLensProvider implements CodeLensProvider { range: Range, symbolName: string, symbolKind: SymbolKind, - symbolContainer: string + symbolContainer: string, ): CodeLens[] { switch (symbolKind) { case SymbolKind.Function: @@ -169,13 +169,13 @@ export class TestFileCodeLensProvider implements CodeLensProvider { new CodeLens(range, { title: getTestStatusIcon(cls.status) + constants.Text.CodeLensRunUnitTest, command: constants.Commands.Tests_Run, - arguments: [undefined, CommandSource.codelens, file, { testSuite: [cls] }] + arguments: [undefined, CommandSource.codelens, file, { testSuite: [cls] }], }), new CodeLens(range, { title: getTestStatusIcon(cls.status) + constants.Text.CodeLensDebugUnitTest, command: constants.Commands.Tests_Debug, - arguments: [undefined, CommandSource.codelens, file, { testSuite: [cls] }] - }) + arguments: [undefined, CommandSource.codelens, file, { testSuite: [cls] }], + }), ]; } default: { @@ -231,7 +231,7 @@ function getFunctionCodeLens( functionsAndSuites: FunctionsAndSuites, symbolName: string, range: Range, - symbolContainer: string + symbolContainer: string, ): CodeLens[] { let fn: TestFunction | undefined; if (symbolContainer.length === 0) { @@ -253,20 +253,20 @@ function getFunctionCodeLens( new CodeLens(range, { title: getTestStatusIcon(fn.status) + constants.Text.CodeLensRunUnitTest, command: constants.Commands.Tests_Run, - arguments: [undefined, CommandSource.codelens, file, { testFunction: [fn] }] + arguments: [undefined, CommandSource.codelens, file, { testFunction: [fn] }], }), new CodeLens(range, { title: getTestStatusIcon(fn.status) + constants.Text.CodeLensDebugUnitTest, command: constants.Commands.Tests_Debug, - arguments: [undefined, CommandSource.codelens, file, { testFunction: [fn] }] - }) + arguments: [undefined, CommandSource.codelens, file, { testFunction: [fn] }], + }), ]; } // Ok, possible we're dealing with parameterized unit tests. // If we have [ in the name, then this is a parameterized function. const functions = functionsAndSuites.functions.filter( - (func) => func.name.startsWith(`${symbolName}[`) && func.name.endsWith(']') + (func) => func.name.startsWith(`${symbolName}[`) && func.name.endsWith(']'), ); if (functions.length === 0) { return []; @@ -277,13 +277,13 @@ function getFunctionCodeLens( new CodeLens(range, { title: `${getTestStatusIcons(functions)} ${constants.Text.CodeLensRunUnitTest} (Multiple)`, command: constants.Commands.Tests_Picker_UI, - arguments: [undefined, CommandSource.codelens, file, functions] + arguments: [undefined, CommandSource.codelens, file, functions], }), new CodeLens(range, { title: `${getTestStatusIcons(functions)} ${constants.Text.CodeLensDebugUnitTest} (Multiple)`, command: constants.Commands.Tests_Picker_UI_Debug, - arguments: [undefined, CommandSource.codelens, file, functions] - }) + arguments: [undefined, CommandSource.codelens, file, functions], + }), ]; } diff --git a/src/client/testing/common/argumentsHelper.ts b/src/client/testing/common/argumentsHelper.ts index 2633f99ab50c..4050bbc401bd 100644 --- a/src/client/testing/common/argumentsHelper.ts +++ b/src/client/testing/common/argumentsHelper.ts @@ -41,7 +41,7 @@ export class ArgumentsHelper implements IArgumentsHelper { public getPositionalArguments( args: string[], optionsWithArguments: string[] = [], - optionsWithoutArguments: string[] = [] + optionsWithoutArguments: string[] = [], ): string[] { const nonPositionalIndexes: number[] = []; args.forEach((arg, index) => { @@ -58,14 +58,14 @@ export class ArgumentsHelper implements IArgumentsHelper { } else if (arg.startsWith('-')) { // Ok this is an unknown option, lets treat this as one without values. traceWarning( - `Unknown command line option passed into args parser for tests '${arg}'. Please report on https://github.com/Microsoft/vscode-python/issues/new` + `Unknown command line option passed into args parser for tests '${arg}'. Please report on https://github.com/Microsoft/vscode-python/issues/new`, ); nonPositionalIndexes.push(index); return; } else if (arg.indexOf('=') > 0) { // Ok this is an unknown option with a value traceWarning( - `Unknown command line option passed into args parser for tests '${arg}'. Please report on https://github.com/Microsoft/vscode-python/issues/new` + `Unknown command line option passed into args parser for tests '${arg}'. Please report on https://github.com/Microsoft/vscode-python/issues/new`, ); nonPositionalIndexes.push(index); } @@ -75,7 +75,7 @@ export class ArgumentsHelper implements IArgumentsHelper { public filterArguments( args: string[], optionsWithArguments: string[] = [], - optionsWithoutArguments: string[] = [] + optionsWithoutArguments: string[] = [], ): string[] { let ignoreIndex = -1; return args.filter((arg, index) => { diff --git a/src/client/testing/common/constants.ts b/src/client/testing/common/constants.ts index 002b250d58c5..70d71cd20a2c 100644 --- a/src/client/testing/common/constants.ts +++ b/src/client/testing/common/constants.ts @@ -7,7 +7,7 @@ export enum CommandSource { ui = 'ui', codelens = 'codelens', commandPalette = 'commandpalette', - testExplorer = 'testExplorer' + testExplorer = 'testExplorer', } export const TEST_OUTPUT_CHANNEL = 'TEST_OUTPUT_CHANNEL'; @@ -20,5 +20,5 @@ export enum Icons { discovering = 'discovering-tests.svg', passed = 'status-ok.svg', failed = 'status-error.svg', - unknown = 'status-unknown.svg' + unknown = 'status-unknown.svg', } diff --git a/src/client/testing/common/debugLauncher.ts b/src/client/testing/common/debugLauncher.ts index 9620cacac292..3ca8d0bc7300 100644 --- a/src/client/testing/common/debugLauncher.ts +++ b/src/client/testing/common/debugLauncher.ts @@ -24,7 +24,7 @@ export class DebugLauncher implements ITestDebugLauncher { @inject(IServiceContainer) private serviceContainer: IServiceContainer, @inject(IDebugConfigurationResolver) @named('launch') - private readonly launchResolver: IDebugConfigurationResolver + private readonly launchResolver: IDebugConfigurationResolver, ) { this.configService = this.serviceContainer.get(IConfigurationService); this.workspaceService = this.serviceContainer.get(IWorkspaceService); @@ -40,7 +40,7 @@ export class DebugLauncher implements ITestDebugLauncher { const launchArgs = await this.getLaunchArgs( options, workspaceFolder, - this.configService.getSettings(workspaceFolder.uri) + this.configService.getSettings(workspaceFolder.uri), ); const debugManager = this.serviceContainer.get(IDebugService); return debugManager @@ -68,7 +68,7 @@ export class DebugLauncher implements ITestDebugLauncher { traceError('could not get debug config', exc); const appShell = this.serviceContainer.get(IApplicationShell); await appShell.showErrorMessage( - 'Could not load unit test config from launch.json as it is missing a field' + 'Could not load unit test config from launch.json as it is missing a field', ); return []; } @@ -89,7 +89,7 @@ export class DebugLauncher implements ITestDebugLauncher { private async getLaunchArgs( options: LaunchOptions, workspaceFolder: WorkspaceFolder, - configSettings: IPythonSettings + configSettings: IPythonSettings, ): Promise { let debugConfig = await this.readDebugConfig(workspaceFolder); if (!debugConfig) { @@ -97,7 +97,7 @@ export class DebugLauncher implements ITestDebugLauncher { name: 'Debug Unit Test', type: 'python', request: 'test', - subProcess: true + subProcess: true, }; } if (!debugConfig.rules) { @@ -105,7 +105,7 @@ export class DebugLauncher implements ITestDebugLauncher { } debugConfig.rules.push({ path: path.join(EXTENSION_ROOT_DIR, 'pythonFiles'), - include: false + include: false, }); this.applyDefaults(debugConfig!, workspaceFolder, configSettings); @@ -159,7 +159,7 @@ export class DebugLauncher implements ITestDebugLauncher { private async convertConfigToArgs( debugConfig: ITestDebugConfig, workspaceFolder: WorkspaceFolder, - options: LaunchOptions + options: LaunchOptions, ): Promise { const configArgs = debugConfig as LaunchRequestArguments; @@ -173,7 +173,7 @@ export class DebugLauncher implements ITestDebugLauncher { let launchArgs = await this.launchResolver.resolveDebugConfiguration( workspaceFolder, configArgs, - options.token + options.token, ); if (!launchArgs) { throw Error(`Invalid debug config "${debugConfig.name}"`); @@ -181,7 +181,7 @@ export class DebugLauncher implements ITestDebugLauncher { launchArgs = await this.launchResolver.resolveDebugConfigurationWithSubstitutedVariables( workspaceFolder, launchArgs, - options.token + options.token, ); if (!launchArgs) { throw Error(`Invalid debug config "${debugConfig.name}"`); diff --git a/src/client/testing/common/enablementTracker.ts b/src/client/testing/common/enablementTracker.ts index fe6b319873ec..8f23681350ed 100644 --- a/src/client/testing/common/enablementTracker.ts +++ b/src/client/testing/common/enablementTracker.ts @@ -19,7 +19,7 @@ export class EnablementTracker implements IExtensionSingleActivationService { @inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService, @inject(IDisposableRegistry) private readonly disposables: IDisposableRegistry, @inject(ITestConfigSettingsService) private readonly testConfig: ITestConfigSettingsService, - @inject(ITestsHelper) private readonly testsHelper: ITestsHelper + @inject(ITestsHelper) private readonly testsHelper: ITestsHelper, ) {} public async activate(): Promise { this.disposables.push(this.workspaceService.onDidChangeConfiguration(this.onDidChangeConfiguration, this)); diff --git a/src/client/testing/common/managers/baseTestManager.ts b/src/client/testing/common/managers/baseTestManager.ts index 1154933f10fe..8e9e86b2faff 100644 --- a/src/client/testing/common/managers/baseTestManager.ts +++ b/src/client/testing/common/managers/baseTestManager.ts @@ -9,7 +9,7 @@ import { EventEmitter, languages, OutputChannel, - Uri + Uri, } from 'vscode'; import { ICommandManager, IWorkspaceService } from '../../../common/application/types'; import '../../../common/extensions'; @@ -22,7 +22,7 @@ import { IInstaller, IOutputChannel, IPythonSettings, - Product + Product, } from '../../../common/types'; import { getNamesAndValues } from '../../../common/utils/enum'; import { noop } from '../../../common/utils/misc'; @@ -44,12 +44,12 @@ import { TestProvider, Tests, TestStatus, - TestsToRun + TestsToRun, } from './../types'; enum CancellationTokenType { testDiscovery, - testRunner + testRunner, } // tslint:disable: member-ordering max-func-body-length @@ -89,7 +89,7 @@ export abstract class BaseTestManager implements ITestManager { private readonly product: Product, public readonly workspaceFolder: Uri, protected rootDirectory: string, - protected serviceContainer: IServiceContainer + protected serviceContainer: IServiceContainer, ) { this.updateStatus(TestStatus.Unknown); const configService = serviceContainer.get(IConfigurationService); @@ -97,7 +97,7 @@ export abstract class BaseTestManager implements ITestManager { const disposables = serviceContainer.get(IDisposableRegistry); this._outputChannel = this.serviceContainer.get(IOutputChannel, TEST_OUTPUT_CHANNEL); this.testCollectionStorage = this.serviceContainer.get( - ITestCollectionStorageService + ITestCollectionStorageService, ); this._testResultsService = this.serviceContainer.get(ITestResultsService); this.workspaceService = this.serviceContainer.get(IWorkspaceService); @@ -151,7 +151,7 @@ export abstract class BaseTestManager implements ITestManager { ignoreCache: boolean = false, quietMode: boolean = false, userInitiated: boolean = false, - clearTestStatus: boolean = false + clearTestStatus: boolean = false, ): Promise { if (this.discoverTestsPromise) { return this.discoverTestsPromise; @@ -161,7 +161,7 @@ export abstract class BaseTestManager implements ITestManager { ignoreCache, quietMode, userInitiated, - clearTestStatus + clearTestStatus, ); this.discoverTestsPromise .catch(noop) @@ -174,7 +174,7 @@ export abstract class BaseTestManager implements ITestManager { ignoreCache: boolean = false, quietMode: boolean = false, userInitiated: boolean = false, - clearTestStatus: boolean = false + clearTestStatus: boolean = false, ): Promise { if (!ignoreCache && this.tests! && this.tests!.testFunctions.length > 0) { this.updateStatus(TestStatus.Idle); @@ -193,14 +193,14 @@ export abstract class BaseTestManager implements ITestManager { tool: this.testProvider, // tslint:disable-next-line:no-any prefer-type-cast trigger: cmdSource as any, - failed: false + failed: false, }; this.commandManager.executeCommand('setContext', 'testsDiscovered', true).then(noop, noop); this.createCancellationToken(CancellationTokenType.testDiscovery); const discoveryOptions = this.getDiscoveryOptions(ignoreCache); const discoveryService = this.serviceContainer.get( ITestDiscoveryService, - this.testProvider + this.testProvider, ); return discoveryService .discoverTests(discoveryOptions) @@ -276,14 +276,14 @@ export abstract class BaseTestManager implements ITestManager { cmdSource: CommandSource, testsToRun?: TestsToRun, runFailedTests?: boolean, - debug?: boolean + debug?: boolean, ): Promise { const moreInfo = { Test_Provider: this.testProvider, Run_Failed_Tests: 'false', Run_Specific_File: 'false', Run_Specific_Class: 'false', - Run_Specific_Function: 'false' + Run_Specific_Function: 'false', }; //Ensure valid values are sent. const validCmdSourceValues = getNamesAndValues(CommandSource).map((item) => item.value); @@ -292,7 +292,7 @@ export abstract class BaseTestManager implements ITestManager { scope: 'all', debugging: debug === true, triggerSource: validCmdSourceValues.indexOf(cmdSource) === -1 ? 'commandpalette' : cmdSource, - failed: false + failed: false, }; if (!runFailedTests && !testsToRun) { @@ -325,7 +325,7 @@ export abstract class BaseTestManager implements ITestManager { this.testsStatusUpdaterService.updateStatusAsRunningSpecificTests( this.workspaceFolder, testsToRun, - this.tests + this.tests, ); } @@ -356,7 +356,7 @@ export abstract class BaseTestManager implements ITestManager { testFolders: [], testFunctions: [], testSuites: [], - summary: { errors: 0, failures: 0, passed: 0, skipped: 0 } + summary: { errors: 0, failures: 0, passed: 0, skipped: 0 }, }; }) .then((tests) => { @@ -430,7 +430,7 @@ export abstract class BaseTestManager implements ITestManager { tests: Tests, testsToRun?: TestsToRun, runFailedTests?: boolean, - debug?: boolean + debug?: boolean, ): Promise; protected abstract getDiscoveryOptions(ignoreCache: boolean): TestDiscoveryOptions; private updateStatus(status: TestStatus): void { @@ -480,7 +480,7 @@ export abstract class BaseTestManager implements ITestManager { if (matchingMsg === undefined) { // No matching message was found, so this test was not included in the test run. const matchingTest = tests.testFunctions.find( - (tf) => tf.testFunction.nameToRun === diagnostic.code + (tf) => tf.testFunction.nameToRun === diagnostic.code, ); if (matchingTest !== undefined) { // Matching test was found, so the diagnostic is still relevant. @@ -501,7 +501,7 @@ export abstract class BaseTestManager implements ITestManager { const diagnostic = new Diagnostic( stackStart.location.range, `${diagPrefix ? `${diagPrefix}: ` : 'Ok'}${diagMsg}`, - severity + severity, ); diagnostic.code = message.code; diagnostic.source = message.provider; diff --git a/src/client/testing/common/managers/testConfigurationManager.ts b/src/client/testing/common/managers/testConfigurationManager.ts index 22c19e0b821d..d746acdbd0e2 100644 --- a/src/client/testing/common/managers/testConfigurationManager.ts +++ b/src/client/testing/common/managers/testConfigurationManager.ts @@ -18,7 +18,7 @@ export abstract class TestConfigurationManager implements ITestConfigurationMana protected workspace: Uri, protected product: UnitTestProduct, protected readonly serviceContainer: IServiceContainer, - cfg?: ITestConfigSettingsService + cfg?: ITestConfigSettingsService, ) { this.outputChannel = serviceContainer.get(IOutputChannel, TEST_OUTPUT_CHANNEL); this.installer = serviceContainer.get(IInstaller); @@ -32,8 +32,8 @@ export abstract class TestConfigurationManager implements ITestConfigurationMana // Disable other test frameworks. await Promise.all( UNIT_TEST_PRODUCTS.filter((prod) => prod !== this.product).map((prod) => - this.testConfigSettingsService.disable(this.workspace, prod) - ) + this.testConfigSettingsService.disable(this.workspace, prod), + ), ); await this.testConfigSettingsService.enable(this.workspace, this.product); } @@ -46,7 +46,7 @@ export abstract class TestConfigurationManager implements ITestConfigurationMana ignoreFocusOut: true, matchOnDescription: true, matchOnDetail: true, - placeHolder: 'Select the directory containing the tests' + placeHolder: 'Select the directory containing the tests', }; let items: QuickPickItem[] = subDirs .map((dir) => { @@ -56,7 +56,7 @@ export abstract class TestConfigurationManager implements ITestConfigurationMana } return { label: dirName, - description: '' + description: '', }; }) .filter((item) => item !== undefined) @@ -83,14 +83,14 @@ export abstract class TestConfigurationManager implements ITestConfigurationMana ignoreFocusOut: true, matchOnDescription: true, matchOnDetail: true, - placeHolder: 'Select the pattern to identify test files' + placeHolder: 'Select the pattern to identify test files', }; const items: QuickPickItem[] = [ { label: '*test.py', description: "Python Files ending with 'test'" }, { label: '*_test.py', description: "Python Files ending with '_test'" }, { label: 'test*.py', description: "Python Files beginning with 'test'" }, { label: 'test_*.py', description: "Python Files beginning with 'test_'" }, - { label: '*test*.py', description: "Python Files containing the word 'test'" } + { label: '*test*.py', description: "Python Files containing the word 'test'" }, ]; const def = createDeferred(); diff --git a/src/client/testing/common/runner.ts b/src/client/testing/common/runner.ts index fd2f3145b7d8..dae5d12b5b28 100644 --- a/src/client/testing/common/runner.ts +++ b/src/client/testing/common/runner.ts @@ -7,7 +7,7 @@ import { IPythonExecutionService, IPythonToolExecutionService, ObservableExecutionResult, - SpawnOptions + SpawnOptions, } from '../../common/process/types'; import { ExecutionInfo, IConfigurationService, IPythonSettings } from '../../common/types'; import { IServiceContainer } from '../../ioc/types'; @@ -26,11 +26,11 @@ export class TestRunner implements ITestRunner { export async function run( serviceContainer: IServiceContainer, testProvider: TestProvider, - options: Options + options: Options, ): Promise { const testExecutablePath = getExecutablePath( testProvider, - serviceContainer.get(IConfigurationService).getSettings(options.workspaceFolder) + serviceContainer.get(IConfigurationService).getSettings(options.workspaceFolder), ); const moduleName = getTestModuleName(testProvider); const spawnOptions = options as SpawnOptions; @@ -46,7 +46,7 @@ export async function run( execPath: testExecutablePath, args: options.args, moduleName: testExecutablePath && testExecutablePath.length > 0 ? undefined : moduleName, - product: testHelper.parseProduct(testProvider) + product: testHelper.parseProduct(testProvider), }; if (testProvider === UNITTEST_PROVIDER) { @@ -59,11 +59,11 @@ export async function run( .get(IPythonExecutionFactory) .createActivatedEnvironment({ resource: options.workspaceFolder }); promise = pythonExecutionServicePromise.then((executionService) => - executionService.execModuleObservable(executionInfo.moduleName!, executionInfo.args, options) + executionService.execModuleObservable(executionInfo.moduleName!, executionInfo.args, options), ); } else { const pythonToolsExecutionService = serviceContainer.get( - IPythonToolExecutionService + IPythonToolExecutionService, ); promise = pythonToolsExecutionService.execObservable(executionInfo, spawnOptions, options.workspaceFolder); } @@ -99,7 +99,7 @@ export async function run( } } resolve(stdOut); - } + }, ); }); }); diff --git a/src/client/testing/common/services/configSettingService.ts b/src/client/testing/common/services/configSettingService.ts index 1976a51c0144..dc9ba0b48866 100644 --- a/src/client/testing/common/services/configSettingService.ts +++ b/src/client/testing/common/services/configSettingService.ts @@ -59,7 +59,7 @@ export class TestConfigSettingsService implements ITestConfigSettingsService { } else if (this.workspaceService.workspaceFolders!.length === 1) { pythonConfig = this.workspaceService.getConfiguration( 'python', - this.workspaceService.workspaceFolders![0].uri + this.workspaceService.workspaceFolders![0].uri, ); } else { const workspaceFolder = this.workspaceService.getWorkspaceFolder(resource); diff --git a/src/client/testing/common/services/contextService.ts b/src/client/testing/common/services/contextService.ts index 40b70561b649..8db2b1a4d3eb 100644 --- a/src/client/testing/common/services/contextService.ts +++ b/src/client/testing/common/services/contextService.ts @@ -21,7 +21,7 @@ export class TestContextService implements ITestContextService { constructor( @inject(ITestCollectionStorageService) private readonly storage: ITestCollectionStorageService, @inject(ITestManagementService) private readonly testManager: ITestManagementService, - @inject(ICommandManager) cmdManager: ICommandManager + @inject(ICommandManager) cmdManager: ICommandManager, ) { this.hasFailedTests = new ContextKey('hasFailedTests', cmdManager); this.runningTests = new ContextKey('runningTests', cmdManager); @@ -45,8 +45,8 @@ export class TestContextService implements ITestContextService { ...[ this.runningTests.set(status.status === TestStatus.Running), this.discoveringTests.set(status.status === TestStatus.Discovering), - this.busyTests.set(status.status === TestStatus.Running || status.status === TestStatus.Discovering) - ] + this.busyTests.set(status.status === TestStatus.Running || status.status === TestStatus.Discovering), + ], ); await Promise.all(promises); diff --git a/src/client/testing/common/services/discoveredTestParser.ts b/src/client/testing/common/services/discoveredTestParser.ts index fa7a55c39aeb..076b510b3d36 100644 --- a/src/client/testing/common/services/discoveredTestParser.ts +++ b/src/client/testing/common/services/discoveredTestParser.ts @@ -24,7 +24,7 @@ export class TestDiscoveredTestParser implements discovery.ITestDiscoveredTestPa testFiles: [], testFolders: [], testFunctions: [], - testSuites: [] + testSuites: [], }; const workspace = this.workspaceService.getWorkspaceFolder(resource); @@ -40,7 +40,7 @@ export class TestDiscoveredTestParser implements discovery.ITestDiscoveredTestPa time: 0, testFiles: [], resource: resource, - nameToRun: data.rootid + nameToRun: data.rootid, }; tests.rootTestFolders.push(rootFolder); tests.testFolders.push(rootFolder); @@ -67,7 +67,7 @@ export class TestDiscoveredTestParser implements discovery.ITestDiscoveredTestPa rootFolder: testing.TestFolder, parent: TestDataItem, discoveredTests: discovery.DiscoveredTests, - tests: testing.Tests + tests: testing.Tests, ) { const parentType = getTestDataItemType(parent); switch (parentType) { @@ -104,7 +104,7 @@ export class TestDiscoveredTestParser implements discovery.ITestDiscoveredTestPa rootFolder: testing.TestFolder, parentFolder: testing.TestFolder, discoveredTests: discovery.DiscoveredTests, - tests: testing.Tests + tests: testing.Tests, ) { const folders = discoveredTests.parents .filter((child) => child.kind === 'folder' && child.parentid === parentFolder.nameToRun) @@ -141,7 +141,7 @@ export class TestDiscoveredTestParser implements discovery.ITestDiscoveredTestPa rootFolder: testing.TestFolder, parentFile: testing.TestFile, discoveredTests: discovery.DiscoveredTests, - tests: testing.Tests + tests: testing.Tests, ) { const suites = discoveredTests.parents .filter((child) => child.kind === 'suite' && child.parentid === parentFile.nameToRun) @@ -164,7 +164,7 @@ export class TestDiscoveredTestParser implements discovery.ITestDiscoveredTestPa .filter((child) => child.kind === 'function' && child.parentid === parentFile.nameToRun) .map((func) => createParameterizedTestFunction(rootFolder, func as discovery.TestFunction)); parameterizedFunctions.forEach((func) => - this.processParameterizedFunction(rootFolder, parentFile, func, discoveredTests, tests) + this.processParameterizedFunction(rootFolder, parentFile, func, discoveredTests, tests), ); } @@ -184,7 +184,7 @@ export class TestDiscoveredTestParser implements discovery.ITestDiscoveredTestPa rootFolder: testing.TestFolder, parentSuite: testing.TestSuite, discoveredTests: discovery.DiscoveredTests, - tests: testing.Tests + tests: testing.Tests, ) { const suites = discoveredTests.parents .filter((child) => child.kind === 'suite' && child.parentid === parentSuite.nameToRun) @@ -207,7 +207,7 @@ export class TestDiscoveredTestParser implements discovery.ITestDiscoveredTestPa .filter((child) => child.kind === 'function' && child.parentid === parentSuite.nameToRun) .map((func) => createParameterizedTestFunction(rootFolder, func as discovery.TestFunction)); parameterizedFunctions.forEach((func) => - this.processParameterizedFunction(rootFolder, parentSuite, func, discoveredTests, tests) + this.processParameterizedFunction(rootFolder, parentSuite, func, discoveredTests, tests), ); } @@ -230,7 +230,7 @@ export class TestDiscoveredTestParser implements discovery.ITestDiscoveredTestPa parent: testing.TestFile | testing.TestSuite, parentFunction: testing.SubtestParent, discoveredTests: discovery.DiscoveredTests, - tests: testing.Tests + tests: testing.Tests, ) { if (!parentFunction.asSuite) { return; @@ -254,7 +254,7 @@ function createTestFolder(root: testing.TestFolder, item: discovery.TestFolder): resource: root.resource, time: 0, folders: [], - testFiles: [] + testFiles: [], }; } @@ -268,14 +268,14 @@ function createTestFile(root: testing.TestFolder, item: discovery.TestFile): tes resource: root.resource, suites: [], time: 0, - xmlName: createXmlName(item.id) + xmlName: createXmlName(item.id), }; } function createTestSuite( parentSuiteFile: testing.TestFile | testing.TestSuite, resource: Uri, - item: discovery.TestSuite + item: discovery.TestSuite, ): testing.TestSuite { const suite = { functions: [], @@ -286,7 +286,7 @@ function createTestSuite( time: 0, xmlName: '', isInstance: false, - isUnitTest: false + isUnitTest: false, }; suite.xmlName = `${parentSuiteFile.xmlName}.${item.name}`; return suite; @@ -297,14 +297,14 @@ function createFlattenedSuite(tests: testing.Tests, suite: testing.TestSuite): t return { parentTestFile: parentFile, testSuite: suite, - xmlClassName: parentFile.xmlName + xmlClassName: parentFile.xmlName, }; } function createFlattenedParameterizedFunction( tests: testing.Tests, func: testing.TestFunction, - parent: testing.TestFile | testing.TestSuite + parent: testing.TestFile | testing.TestSuite, ): testing.FlattenedTestFunction { const type = getTestDataItemType(parent); const parentFile = @@ -314,7 +314,7 @@ function createFlattenedParameterizedFunction( parentTestFile: parentFile, parentTestSuite: parentSuite, xmlClassName: parentSuite ? parentSuite.xmlName : parentFile.xmlName, - testFunction: func + testFunction: func, }; } @@ -327,13 +327,13 @@ function createFlattenedFunction(tests: testing.Tests, func: testing.TestFunctio parentTestFile: parentFile, parentTestSuite: parentSuite, xmlClassName: parentSuite ? parentSuite.xmlName : parentFile.xmlName, - testFunction: func + testFunction: func, }; } function createParameterizedTestFunction( root: testing.TestFolder, - item: discovery.TestFunction + item: discovery.TestFunction, ): testing.SubtestParent { const suite: testing.TestSuite = { functions: [], @@ -344,13 +344,13 @@ function createParameterizedTestFunction( resource: root.resource, time: 0, suites: [], - xmlName: '' + xmlName: '', }; return { asSuite: suite, name: item.name, nameToRun: item.id, - time: 0 + time: 0, }; } @@ -360,7 +360,7 @@ function createTestFunction(root: testing.TestFolder, item: discovery.Test): tes nameToRun: item.id, resource: root.resource, time: 0, - file: item.source.substr(0, item.source.lastIndexOf(':')) + file: item.source.substr(0, item.source.lastIndexOf(':')), }; } diff --git a/src/client/testing/common/services/discovery.ts b/src/client/testing/common/services/discovery.ts index 0042f5e003f0..9f512deddc87 100644 --- a/src/client/testing/common/services/discovery.ts +++ b/src/client/testing/common/services/discovery.ts @@ -10,7 +10,7 @@ import * as internalScripts from '../../../common/process/internal/scripts'; import { ExecutionFactoryCreateWithEnvironmentOptions, IPythonExecutionFactory, - SpawnOptions + SpawnOptions, } from '../../../common/process/types'; import { IOutputChannel } from '../../../common/types'; import { captureTelemetry } from '../../../telemetry'; @@ -24,7 +24,7 @@ export class TestsDiscoveryService implements ITestDiscoveryService { constructor( @inject(IPythonExecutionFactory) private readonly execFactory: IPythonExecutionFactory, @inject(ITestDiscoveredTestParser) private readonly parser: ITestDiscoveredTestParser, - @inject(IOutputChannel) @named(TEST_OUTPUT_CHANNEL) private readonly outChannel: OutputChannel + @inject(IOutputChannel) @named(TEST_OUTPUT_CHANNEL) private readonly outChannel: OutputChannel, ) {} @captureTelemetry(EventName.UNITTEST_DISCOVER_WITH_PYCODE, undefined, true) public async discoverTests(options: TestDiscoveryOptions): Promise { @@ -43,13 +43,13 @@ export class TestsDiscoveryService implements ITestDiscoveryService { const [args, parse] = internalScripts.testing_tools.run_adapter(options.args); const creationOptions: ExecutionFactoryCreateWithEnvironmentOptions = { allowEnvironmentFetchExceptions: false, - resource: options.workspaceFolder + resource: options.workspaceFolder, }; const execService = await this.execFactory.createActivatedEnvironment(creationOptions); const spawnOptions: SpawnOptions = { token: options.token, cwd: options.cwd, - throwOnStdErr: true + throwOnStdErr: true, }; this.outChannel.appendLine(`python ${args.join(' ')}`); const proc = await execService.exec(args, spawnOptions); diff --git a/src/client/testing/common/services/storageService.ts b/src/client/testing/common/services/storageService.ts index 46aafe1c74de..f2a2c11a6bb3 100644 --- a/src/client/testing/common/services/storageService.ts +++ b/src/client/testing/common/services/storageService.ts @@ -9,7 +9,7 @@ import { ITestCollectionStorageService, TestFunction, Tests, - TestSuite + TestSuite, } from './../types'; @injectable() @@ -19,7 +19,7 @@ export class TestCollectionStorageService implements ITestCollectionStorageServi constructor( @inject(IDisposableRegistry) disposables: Disposable[], - @inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService + @inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService, ) { disposables.push(this); } diff --git a/src/client/testing/common/services/testsStatusService.ts b/src/client/testing/common/services/testsStatusService.ts index b2094a3e26b1..ff8f676688d0 100644 --- a/src/client/testing/common/services/testsStatusService.ts +++ b/src/client/testing/common/services/testsStatusService.ts @@ -55,7 +55,7 @@ export class TestsStatusUpdaterService implements ITestsStatusUpdaterService { }; const failedItems = [ ...tests.testFunctions.map((f) => f.testFunction).filter(predicate), - ...tests.testSuites.map((f) => f.testSuite).filter(predicate) + ...tests.testSuites.map((f) => f.testSuite).filter(predicate), ]; failedItems.forEach((failedItem) => visitRecursive(tests, failedItem, visitor)); } @@ -66,7 +66,7 @@ export class TestsStatusUpdaterService implements ITestsStatusUpdaterService { const itemsRunning = [ ...(testsToRun.testFile || []), ...(testsToRun.testSuite || []), - ...(testsToRun.testFunction || []) + ...(testsToRun.testFunction || []), ]; const visitor = (item: TestDataItem) => { item.status = TestStatus.Running; diff --git a/src/client/testing/common/services/workspaceTestManagerService.ts b/src/client/testing/common/services/workspaceTestManagerService.ts index e0061997e8dd..8124272a416e 100644 --- a/src/client/testing/common/services/workspaceTestManagerService.ts +++ b/src/client/testing/common/services/workspaceTestManagerService.ts @@ -7,7 +7,7 @@ import { ITestManagerService, ITestManagerServiceFactory, IWorkspaceTestManagerService, - UnitTestProduct + UnitTestProduct, } from './../types'; @injectable() @@ -16,7 +16,7 @@ export class WorkspaceTestManagerService implements IWorkspaceTestManagerService constructor( @inject(IOutputChannel) @named(TEST_OUTPUT_CHANNEL) private outChannel: OutputChannel, @inject(ITestManagerServiceFactory) private testManagerServiceFactory: ITestManagerServiceFactory, - @inject(IDisposableRegistry) disposables: Disposable[] + @inject(IDisposableRegistry) disposables: Disposable[], ) { disposables.push(this); } diff --git a/src/client/testing/common/testUtils.ts b/src/client/testing/common/testUtils.ts index d29152dbce19..6e5fa49750cf 100644 --- a/src/client/testing/common/testUtils.ts +++ b/src/client/testing/common/testUtils.ts @@ -21,7 +21,7 @@ import { TestSettingsPropertyNames, TestsToRun, TestSuite, - UnitTestProduct + UnitTestProduct, } from './types'; export async function selectTestWorkspace(appShell: IApplicationShell): Promise { @@ -51,7 +51,7 @@ export class TestsHelper implements ITestsHelper { private readonly commandManager: ICommandManager; constructor( @inject(ITestVisitor) @named('TestFlatteningVisitor') private readonly flatteningVisitor: TestFlatteningVisitor, - @inject(IServiceContainer) serviceContainer: IServiceContainer + @inject(IServiceContainer) serviceContainer: IServiceContainer, ) { this.appShell = serviceContainer.get(IApplicationShell); this.commandManager = serviceContainer.get(ICommandManager); @@ -89,20 +89,20 @@ export class TestsHelper implements ITestsHelper { return { argsName: 'pytestArgs' as keyof ITestingSettings, pathName: 'pytestPath' as keyof ITestingSettings, - enabledName: 'pytestEnabled' as keyof ITestingSettings + enabledName: 'pytestEnabled' as keyof ITestingSettings, }; } case 'nosetest': { return { argsName: 'nosetestArgs' as keyof ITestingSettings, pathName: 'nosetestPath' as keyof ITestingSettings, - enabledName: 'nosetestsEnabled' as keyof ITestingSettings + enabledName: 'nosetestsEnabled' as keyof ITestingSettings, }; } case 'unittest': { return { argsName: 'unittestArgs' as keyof ITestingSettings, - enabledName: 'unittestEnabled' as keyof ITestingSettings + enabledName: 'unittestEnabled' as keyof ITestingSettings, }; } default: { @@ -120,7 +120,7 @@ export class TestsHelper implements ITestsHelper { testSuites: this.flatteningVisitor.flattenedTestSuites, testFolders: [], rootTestFolders: [], - summary: { passed: 0, failures: 0, errors: 0, skipped: 0 } + summary: { passed: 0, failures: 0, errors: 0, skipped: 0 }, }; this.placeTestFilesIntoFolders(tests, workspaceFolder); @@ -161,7 +161,7 @@ export class TestsHelper implements ITestsHelper { time: 0, functionsPassed: 0, functionsFailed: 0, - functionsDidNotRun: 0 + functionsDidNotRun: 0, }; folderMap.set(newPath, testFolder); if (parentFolder) { @@ -190,14 +190,14 @@ export class TestsHelper implements ITestsHelper { } const absolutePath = path.isAbsolute(name) ? name : path.resolve(rootDirectory, name); const testFolders = tests.testFolders.filter( - (folder) => folder.nameToRun === name || folder.name === name || folder.name === absolutePath + (folder) => folder.nameToRun === name || folder.name === name || folder.name === absolutePath, ); if (testFolders.length > 0) { return { testFolder: testFolders }; } const testFiles = tests.testFiles.filter( - (file) => file.nameToRun === name || file.name === name || file.fullPath === absolutePath + (file) => file.nameToRun === name || file.name === name || file.fullPath === absolutePath, ); if (testFiles.length > 0) { return { testFile: testFiles }; @@ -224,9 +224,9 @@ export class TestsHelper implements ITestsHelper { time: 0, functionsPassed: 0, functionsFailed: 0, - functionsDidNotRun: 0 - } - ] + functionsDidNotRun: 0, + }, + ], }; } public displayTestErrorMessage(message: string) { @@ -542,7 +542,7 @@ export function copyDesiredTestResults(source: Tests, target: Tests): void { function copyResultsForFolders(source: TestFolder[], target: TestFolder[]): void { source.forEach((sourceFolder) => { const targetFolder = target.find( - (folder) => folder.name === sourceFolder.name && folder.nameToRun === sourceFolder.nameToRun + (folder) => folder.name === sourceFolder.name && folder.nameToRun === sourceFolder.nameToRun, ); if (!targetFolder) { return; @@ -583,7 +583,7 @@ function copyResultsForSuites(source: TestSuite[], target: TestSuite[]): void { (suite) => suite.name === sourceSuite.name && suite.nameToRun === sourceSuite.nameToRun && - suite.xmlName === sourceSuite.xmlName + suite.xmlName === sourceSuite.xmlName, ); if (!targetSuite) { return; diff --git a/src/client/testing/common/testVisitors/flatteningVisitor.ts b/src/client/testing/common/testVisitors/flatteningVisitor.ts index bca5cc0cc271..e48cb6da7791 100644 --- a/src/client/testing/common/testVisitors/flatteningVisitor.ts +++ b/src/client/testing/common/testVisitors/flatteningVisitor.ts @@ -7,7 +7,7 @@ import { TestFile, TestFolder, TestFunction, - TestSuite + TestSuite, } from '../types'; @injectable() @@ -43,7 +43,7 @@ export class TestFlatteningVisitor implements ITestVisitor { private visitTestFunctionOfASuite( testFunction: TestFunction, parentTestSuite: TestSuite, - parentTestFile: TestFile + parentTestFile: TestFile, ) { const key = `Function:${testFunction.name},Suite:${parentTestSuite.name},SuiteXmlName:${parentTestSuite.xmlName},ParentFile:${parentTestFile.fullPath}`; if (this._flattenedTestSuites.has(key)) { @@ -53,7 +53,7 @@ export class TestFlatteningVisitor implements ITestVisitor { testFunction, xmlClassName: parentTestSuite.xmlName, parentTestFile, - parentTestSuite + parentTestSuite, }; this._flattedTestFunctions.set(key, flattenedFunction); } diff --git a/src/client/testing/common/types.ts b/src/client/testing/common/types.ts index 18b9e905ff2f..b70481c76218 100644 --- a/src/client/testing/common/types.ts +++ b/src/client/testing/common/types.ts @@ -5,7 +5,7 @@ import { Disposable, Event, OutputChannel, - Uri + Uri, } from 'vscode'; import { ITestingSettings, Product } from '../../common/types'; import { DebuggerTypeName } from '../../debugger/constants'; @@ -77,7 +77,7 @@ export enum TestingType { folder = 'folder', file = 'file', suite = 'suite', - function = 'function' + function = 'function', } export enum TestStatus { @@ -88,7 +88,7 @@ export enum TestStatus { Fail = 'Fail', Error = 'Error', Skipped = 'Skipped', - Pass = 'Pass' + Pass = 'Pass', } export type TestResult = { @@ -256,13 +256,13 @@ export interface ITestManager extends Disposable { ignoreCache?: boolean, quietMode?: boolean, userInitiated?: boolean, - clearTestStatus?: boolean + clearTestStatus?: boolean, ): Promise; runTest( cmdSource: CommandSource, testsToRun?: TestsToRun, runFailedTests?: boolean, - debug?: boolean + debug?: boolean, ): Promise; } diff --git a/src/client/testing/common/updateTestSettings.ts b/src/client/testing/common/updateTestSettings.ts index dc549bdd4fae..c000b9f122b1 100644 --- a/src/client/testing/common/updateTestSettings.ts +++ b/src/client/testing/common/updateTestSettings.ts @@ -21,7 +21,7 @@ export class UpdateTestSettingService implements IExtensionActivationService { constructor( @inject(IFileSystem) private readonly fs: IFileSystem, @inject(IApplicationEnvironment) private readonly application: IApplicationEnvironment, - @inject(IWorkspaceService) private readonly workspace: IWorkspaceService + @inject(IWorkspaceService) private readonly workspace: IWorkspaceService, ) {} public async activate(resource: Resource): Promise { this.updateTestSettings(resource).ignoreErrors(); @@ -48,7 +48,7 @@ export class UpdateTestSettingService implements IExtensionActivationService { files.map(async (file) => { const needsFixing = await this.doesFileNeedToBeFixed(file); return { file, needsFixing }; - }) + }), ); return result.filter((item) => item.needsFixing).map((item) => item.file); } @@ -128,15 +128,15 @@ export class UpdateTestSettingService implements IExtensionActivationService { const modificationOptions: ModificationOptions = { formattingOptions: { tabSize: 4, - insertSpaces: true - } + insertSpaces: true, + }, }; // `jediEnabled` is true, set it to Jedi. if (jediEnabled) { return applyEdits( fileContent, - modify(fileContent, languageServerPath, LanguageServerType.Jedi, modificationOptions) + modify(fileContent, languageServerPath, LanguageServerType.Jedi, modificationOptions), ); } @@ -144,7 +144,7 @@ export class UpdateTestSettingService implements IExtensionActivationService { if (!languageServerNode) { return applyEdits( fileContent, - modify(fileContent, languageServerPath, LanguageServerType.Microsoft, modificationOptions) + modify(fileContent, languageServerPath, LanguageServerType.Microsoft, modificationOptions), ); } diff --git a/src/client/testing/common/xUnitParser.ts b/src/client/testing/common/xUnitParser.ts index 76ed830672ba..7cceb6f193b3 100644 --- a/src/client/testing/common/xUnitParser.ts +++ b/src/client/testing/common/xUnitParser.ts @@ -144,7 +144,7 @@ function updateSummary(summary: TestSummary, testSuiteResult: TestSuiteResult) { function findTestFunction( candidates: FlattenedTestFunction[], className: string, - funcName: string + funcName: string, ): TestFunction | undefined { const xmlClassName = className.replace(/\(\)/g, '').replace(/\.\./g, '.').replace(/\.\./g, '.').replace(/\.+$/, ''); const flattened = candidates.find((fn) => fn.xmlClassName === xmlClassName && fn.testFunction.name === funcName); diff --git a/src/client/testing/configuration.ts b/src/client/testing/configuration.ts index 08e742917e3f..56e7072678f8 100644 --- a/src/client/testing/configuration.ts +++ b/src/client/testing/configuration.ts @@ -15,7 +15,7 @@ import { ITestConfigSettingsService, ITestConfigurationManager, ITestConfigurationManagerFactory, - ITestConfigurationService + ITestConfigurationService, } from './types'; @injectable() @@ -37,13 +37,13 @@ export class UnitTestConfigurationService implements ITestConfigurationService { return this._promptToEnableAndConfigureTestFramework( wkspace, 'Enable only one of the test frameworks (unittest, pytest or nosetest).', - true + true, ); } else { const option = 'Enable and configure a Test Framework'; const item = await this.appShell.showInformationMessage( 'No test framework configured (unittest, pytest or nosetest)', - option + option, ); if (item === option) { return this._promptToEnableAndConfigureTestFramework(wkspace); @@ -57,27 +57,27 @@ export class UnitTestConfigurationService implements ITestConfigurationService { label: 'unittest', product: Product.unittest, description: 'Standard Python test framework', - detail: 'https://docs.python.org/3/library/unittest.html' + detail: 'https://docs.python.org/3/library/unittest.html', }, { label: 'pytest', product: Product.pytest, description: 'pytest framework', // tslint:disable-next-line:no-http-string - detail: 'http://docs.pytest.org/' + detail: 'http://docs.pytest.org/', }, { label: 'nose', product: Product.nosetest, description: 'nose framework', - detail: 'https://nose.readthedocs.io/' - } + detail: 'https://nose.readthedocs.io/', + }, ]; const options = { ignoreFocusOut: true, matchOnDescription: true, matchOnDetail: true, - placeHolder: placeHolderMessage + placeHolder: placeHolderMessage, }; const selectedTestRunner = await this.appShell.showQuickPick(items, options); // tslint:disable-next-line:prefer-type-cast @@ -104,7 +104,7 @@ export class UnitTestConfigurationService implements ITestConfigurationService { }, (reason) => { return configMgr.enable().then(() => Promise.reject(reason)); - } + }, ); } @@ -112,11 +112,11 @@ export class UnitTestConfigurationService implements ITestConfigurationService { wkspace: Uri, messageToDisplay: string = 'Select a test framework/tool to enable', enableOnly: boolean = false, - trigger: 'ui' | 'commandpalette' = 'ui' + trigger: 'ui' | 'commandpalette' = 'ui', ) { const telemetryProps: TestConfiguringTelemetry = { trigger: trigger, - failed: false + failed: false, }; try { const selectedTestRunner = await this.selectTestRunner(messageToDisplay); @@ -127,7 +127,7 @@ export class UnitTestConfigurationService implements ITestConfigurationService { telemetryProps.tool = helper.parseProviderName(selectedTestRunner); const delayed = new BufferedTestConfigSettingsService(); const factory = this.serviceContainer.get( - ITestConfigurationManagerFactory + ITestConfigurationManagerFactory, ); const configMgr = factory.create(wkspace, selectedTestRunner, delayed); if (enableOnly) { diff --git a/src/client/testing/display/main.ts b/src/client/testing/display/main.ts index 51e3fb9ef8be..d2a0694a8eff 100644 --- a/src/client/testing/display/main.ts +++ b/src/client/testing/display/main.ts @@ -58,7 +58,7 @@ export class TestResultDisplay implements ITestResultDisplay { this.displayProgress( 'Running Tests', 'Running Tests (Click to Stop)', - constants.Commands.Tests_Ask_To_Stop_Test + constants.Commands.Tests_Ask_To_Stop_Test, ); testRunResult .then((tests) => this.updateTestRunWithSuccess(tests, debug)) @@ -70,7 +70,7 @@ export class TestResultDisplay implements ITestResultDisplay { this.displayProgress( 'Discovering Tests', 'Discovering tests (click to stop)', - constants.Commands.Tests_Ask_To_Stop_Discovery + constants.Commands.Tests_Ask_To_Stop_Discovery, ); return testDiscovery .then((tests) => { @@ -161,7 +161,7 @@ export class TestResultDisplay implements ITestResultDisplay { 'testing.promptToConfigure', 'testing.pytestEnabled', 'testing.unittestEnabled', - 'testing.nosetestsEnabled' + 'testing.nosetestsEnabled', ]; for (const setting of settingsToDisable) { @@ -186,7 +186,7 @@ export class TestResultDisplay implements ITestResultDisplay { .showInformationMessage( 'No tests discovered, please check the configuration settings for the tests.', Testing.disableTests(), - Testing.configureTests() + Testing.configureTests(), ) .then((item) => { if (item === Testing.disableTests()) { @@ -217,7 +217,7 @@ export class TestResultDisplay implements ITestResultDisplay { // TODO: show an option that will invoke a command 'python.test.configureTest' or similar. // This will be hanlded by main.ts that will capture input from user and configure the tests. this.appShell.showErrorMessage( - 'Test discovery error, please check the configuration settings for the tests.' + 'Test discovery error, please check the configuration settings for the tests.', ); } } diff --git a/src/client/testing/display/picker.ts b/src/client/testing/display/picker.ts index 7ad8657d337f..85c700051536 100644 --- a/src/client/testing/display/picker.ts +++ b/src/client/testing/display/picker.ts @@ -13,7 +13,7 @@ import { TestFunction, Tests, TestStatus, - TestsToRun + TestsToRun, } from '../common/types'; import { ITestDisplay } from '../types'; @@ -23,7 +23,7 @@ export class TestDisplay implements ITestDisplay { private readonly appShell: IApplicationShell; constructor( @inject(IServiceContainer) private readonly serviceRegistry: IServiceContainer, - @inject(ICommandManager) private readonly commandManager: ICommandManager + @inject(ICommandManager) private readonly commandManager: ICommandManager, ) { this.testCollectionStorage = serviceRegistry.get(ITestCollectionStorageService); this.appShell = serviceRegistry.get(IApplicationShell); @@ -40,7 +40,7 @@ export class TestDisplay implements ITestDisplay { this.appShell .showQuickPick(buildItems(tests), { matchOnDescription: true, matchOnDetail: true }) .then((item) => - item ? onItemSelected(this.commandManager, cmdSource, wkspace, item, false) : Promise.resolve() + item ? onItemSelected(this.commandManager, cmdSource, wkspace, item, false) : Promise.resolve(), ); } public selectTestFunction(rootDirectory: string, tests: Tests): Promise { @@ -48,7 +48,7 @@ export class TestDisplay implements ITestDisplay { this.appShell .showQuickPick(buildItemsForFunctions(rootDirectory, tests.testFunctions), { matchOnDescription: true, - matchOnDetail: true + matchOnDetail: true, }) .then((item) => { if (item && item.fn) { @@ -63,7 +63,7 @@ export class TestDisplay implements ITestDisplay { this.appShell .showQuickPick(buildItemsForTestFiles(rootDirectory, tests.testFiles), { matchOnDescription: true, - matchOnDetail: true + matchOnDetail: true, }) .then((item) => { if (item && item.testFile) { @@ -79,7 +79,7 @@ export class TestDisplay implements ITestDisplay { rootDirectory: string, file: Uri, testFunctions: TestFunction[], - debug?: boolean + debug?: boolean, ) { const tests = this.testCollectionStorage.getTests(wkspace); if (!tests) { @@ -88,7 +88,7 @@ export class TestDisplay implements ITestDisplay { const fileName = file.fsPath; const fs = this.serviceRegistry.get(IFileSystem); const testFile = tests.testFiles.find( - (item) => item.name === fileName || fs.arePathsSame(item.fullPath, fileName) + (item) => item.name === fileName || fs.arePathsSame(item.fullPath, fileName), ); if (!testFile) { return; @@ -104,7 +104,7 @@ export class TestDisplay implements ITestDisplay { this.appShell .showQuickPick(runAllItem.concat(...functionItems), { matchOnDescription: true, matchOnDetail: true }) .then((testItem) => - testItem ? onItemSelected(this.commandManager, cmdSource, wkspace, testItem, debug) : Promise.resolve() + testItem ? onItemSelected(this.commandManager, cmdSource, wkspace, testItem, debug) : Promise.resolve(), ); } } @@ -122,7 +122,7 @@ export enum Type { SelectAndRunMethod = 9, DebugMethod = 10, Configure = 11, - RunParametrized = 12 + RunParametrized = 12, } const statusIconMapping = new Map(); statusIconMapping.set(TestStatus.Pass, constants.Octicons.Test_Pass); @@ -176,7 +176,7 @@ function buildItems(tests?: Tests): TestItem[] { description: '', label: 'Run Failed Tests', type: Type.RunFailed, - detail: `${constants.Octicons.Test_Fail} ${tests.summary.failures} Failed` + detail: `${constants.Octicons.Test_Fail} ${tests.summary.failures} Failed`, }); } @@ -191,7 +191,7 @@ const statusSortPrefix = { [TestStatus.Discovering]: undefined, [TestStatus.Idle]: undefined, [TestStatus.Running]: undefined, - [TestStatus.Unknown]: undefined + [TestStatus.Unknown]: undefined, }; function buildRunAllParametrizedItem(tests: FlattenedTestFunction[], debug: boolean = false): TestItem[] { @@ -204,8 +204,8 @@ function buildRunAllParametrizedItem(tests: FlattenedTestFunction[], debug: bool description: '', label: debug ? 'Debug All' : 'Run All', type: Type.RunParametrized, - fns: testFunctions - } + fns: testFunctions, + }, ]; } function buildItemsForFunctions( @@ -213,7 +213,7 @@ function buildItemsForFunctions( tests: FlattenedTestFunction[], sortBasedOnResults: boolean = false, displayStatusIcons: boolean = false, - debug: boolean = false + debug: boolean = false, ): TestItem[] { const functionItems: TestItem[] = []; tests.forEach((fn) => { @@ -227,7 +227,7 @@ function buildItemsForFunctions( detail: path.relative(rootDirectory, fn.parentTestFile.fullPath), label: icon + fn.testFunction.name, type: debug === true ? Type.DebugMethod : Type.RunMethod, - fn: fn + fn: fn, }); }); functionItems.sort((a, b) => { @@ -258,7 +258,7 @@ function buildItemsForTestFiles(rootDirectory: string, testFiles: TestFile[]): T detail: path.relative(rootDirectory, testFile.fullPath), type: Type.RunFile, label: path.basename(testFile.fullPath), - testFile: testFile + testFile: testFile, }; }); fileItems.sort((a, b) => { @@ -280,7 +280,7 @@ export function onItemSelected( cmdSource: CommandSource, wkspace: Uri, selection: TestItem, - debug?: boolean + debug?: boolean, ) { if (!selection || typeof selection.type !== 'number') { return; @@ -295,7 +295,7 @@ export function onItemSelected( undefined, cmdSource, wkspace, - undefined + undefined, ); } case Type.RunParametrized: { @@ -305,7 +305,7 @@ export function onItemSelected( cmdSource, wkspace, selection.fns!, - debug! + debug!, ); } case Type.ReDiscover: { @@ -330,7 +330,7 @@ export function onItemSelected( undefined, cmdSource, wkspace, - testsToRun + testsToRun, ); } case Type.DebugMethod: { @@ -340,7 +340,7 @@ export function onItemSelected( undefined, cmdSource, wkspace, - testsToRun + testsToRun, ); } case Type.Configure: { diff --git a/src/client/testing/explorer/commandHandlers.ts b/src/client/testing/explorer/commandHandlers.ts index 2dd96039c491..fffdc654e950 100644 --- a/src/client/testing/explorer/commandHandlers.ts +++ b/src/client/testing/explorer/commandHandlers.ts @@ -22,7 +22,7 @@ type NavigationCommands = const testNavigationCommandMapping: { [key: string]: NavigationCommands } = { [TestDataItemType.file]: Commands.navigateToTestFile, [TestDataItemType.function]: Commands.navigateToTestFunction, - [TestDataItemType.suite]: Commands.navigateToTestSuite + [TestDataItemType.suite]: Commands.navigateToTestSuite, }; @injectable() @@ -30,13 +30,13 @@ export class TestExplorerCommandHandler implements ITestExplorerCommandHandler { private readonly disposables: IDisposable[] = []; constructor( @inject(ICommandManager) private readonly cmdManager: ICommandManager, - @inject(ITestDataItemResource) private readonly testResource: ITestDataItemResource + @inject(ITestDataItemResource) private readonly testResource: ITestDataItemResource, ) {} public register(): void { this.disposables.push(this.cmdManager.registerCommand(Commands.runTestNode, this.onRunTestNode, this)); this.disposables.push(this.cmdManager.registerCommand(Commands.debugTestNode, this.onDebugTestNode, this)); this.disposables.push( - this.cmdManager.registerCommand(Commands.openTestNodeInEditor, this.onOpenTestNodeInEditor, this) + this.cmdManager.registerCommand(Commands.openTestNodeInEditor, this.onOpenTestNodeInEditor, this), ); } public dispose(): void { diff --git a/src/client/testing/explorer/failedTestHandler.ts b/src/client/testing/explorer/failedTestHandler.ts index ee2ae7a3ba7b..d0927135506b 100644 --- a/src/client/testing/explorer/failedTestHandler.ts +++ b/src/client/testing/explorer/failedTestHandler.ts @@ -22,7 +22,7 @@ export class FailedTestHandler implements IExtensionSingleActivationService, IDi constructor( @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry, @inject(ICommandManager) private readonly commandManager: ICommandManager, - @inject(ITestCollectionStorageService) private readonly storage: ITestCollectionStorageService + @inject(ITestCollectionStorageService) private readonly storage: ITestCollectionStorageService, ) { disposableRegistry.push(this); } diff --git a/src/client/testing/explorer/testTreeViewItem.ts b/src/client/testing/explorer/testTreeViewItem.ts index a9c48b67d1a0..c6b015054d58 100644 --- a/src/client/testing/explorer/testTreeViewItem.ts +++ b/src/client/testing/explorer/testTreeViewItem.ts @@ -31,7 +31,7 @@ export class TestTreeItem extends TreeItem { constructor( public readonly resource: Uri, public readonly data: Readonly, - collapsibleStatue: TreeItemCollapsibleState = getDefaultCollapsibleState(data) + collapsibleStatue: TreeItemCollapsibleState = getDefaultCollapsibleState(data), ) { super(data.name, collapsibleStatue); this.testType = getTestDataItemType(this.data); @@ -128,7 +128,7 @@ export class TestTreeItem extends TreeItem { this.command = { command: Commands.navigateToTestFile, title: 'Open', - arguments: [this.resource, this.data] + arguments: [this.resource, this.data], }; break; } @@ -136,7 +136,7 @@ export class TestTreeItem extends TreeItem { this.command = { command: Commands.navigateToTestFunction, title: 'Open', - arguments: [this.resource, this.data, false] + arguments: [this.resource, this.data, false], }; break; } @@ -145,14 +145,14 @@ export class TestTreeItem extends TreeItem { this.command = { command: Commands.navigateToTestFunction, title: 'Open', - arguments: [this.resource, this.data, false] + arguments: [this.resource, this.data, false], }; break; } this.command = { command: Commands.navigateToTestSuite, title: 'Open', - arguments: [this.resource, this.data, false] + arguments: [this.resource, this.data, false], }; break; } diff --git a/src/client/testing/explorer/testTreeViewProvider.ts b/src/client/testing/explorer/testTreeViewProvider.ts index 195057dcadf5..911adb05fd7a 100644 --- a/src/client/testing/explorer/testTreeViewProvider.ts +++ b/src/client/testing/explorer/testTreeViewProvider.ts @@ -20,7 +20,7 @@ import { TestDataItem, TestDataItemType, TestWorkspaceFolder, - WorkspaceTestStatus + WorkspaceTestStatus, } from '../types'; import { TestTreeItem } from './testTreeViewItem'; @@ -38,7 +38,7 @@ export class TestTreeViewProvider implements ITestTreeViewProvider, ITestDataIte @inject(ITestManagementService) private testService: ITestManagementService, @inject(IWorkspaceService) private readonly workspace: IWorkspaceService, @inject(ICommandManager) private readonly commandManager: ICommandManager, - @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry + @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry, ) { this.onDidChangeTreeData = this._onDidChangeTreeData.event; @@ -49,7 +49,7 @@ export class TestTreeViewProvider implements ITestTreeViewProvider, ITestDataIte this.workspace.onDidChangeWorkspaceFolders( () => this._onDidChangeTreeData.fire(undefined), this, - this.disposables + this.disposables, ); if (Array.isArray(workspace.workspaceFolders) && workspace.workspaceFolders.length > 0) { @@ -107,7 +107,7 @@ export class TestTreeViewProvider implements ITestTreeViewProvider, ITestDataIte Commands.Tests_Discover, element, CommandSource.testExplorer, - undefined + undefined, ); tests = this.testStore.getTests(element.workspaceFolder.uri); } @@ -121,7 +121,7 @@ export class TestTreeViewProvider implements ITestTreeViewProvider, ITestDataIte } sendTelemetryEvent(EventName.UNITTEST_EXPLORER_WORK_SPACE_COUNT, undefined, { - count: this.workspace.workspaceFolders.length + count: this.workspace.workspaceFolders.length, }); // If we are in a single workspace diff --git a/src/client/testing/explorer/treeView.ts b/src/client/testing/explorer/treeView.ts index 0c683ca307db..f6cf5c5939ca 100644 --- a/src/client/testing/explorer/treeView.ts +++ b/src/client/testing/explorer/treeView.ts @@ -22,7 +22,7 @@ export class TreeViewService implements IExtensionSingleActivationService, IDisp @inject(ITestTreeViewProvider) private readonly treeViewProvider: ITestTreeViewProvider, @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry, @inject(IApplicationShell) private readonly appShell: IApplicationShell, - @inject(ICommandManager) private readonly commandManager: ICommandManager + @inject(ICommandManager) private readonly commandManager: ICommandManager, ) { disposableRegistry.push(this); } @@ -32,11 +32,11 @@ export class TreeViewService implements IExtensionSingleActivationService, IDisp public async activate(): Promise { this._treeView = this.appShell.createTreeView('python_tests', { showCollapseAll: true, - treeDataProvider: this.treeViewProvider + treeDataProvider: this.treeViewProvider, }); this.disposables.push(this._treeView); this.disposables.push( - this.commandManager.registerCommand(Commands.Test_Reveal_Test_Item, this.onRevealTestItem, this) + this.commandManager.registerCommand(Commands.Test_Reveal_Test_Item, this.onRevealTestItem, this), ); } public async onRevealTestItem(testItem: TestDataItem): Promise { diff --git a/src/client/testing/main.ts b/src/client/testing/main.ts index f4763bd74b23..67a097e1f90f 100644 --- a/src/client/testing/main.ts +++ b/src/client/testing/main.ts @@ -11,7 +11,7 @@ import { EventEmitter, OutputChannel, TextDocument, - Uri + Uri, } from 'vscode'; import { IApplicationShell, ICommandManager, IDocumentManager, IWorkspaceService } from '../common/application/types'; import * as constants from '../common/constants'; @@ -23,7 +23,7 @@ import { IDisposableRegistry, IExperimentsManager, IOutputChannel, - Resource + Resource, } from '../common/types'; import { noop } from '../common/utils/misc'; import { IInterpreterService } from '../interpreter/contracts'; @@ -40,7 +40,7 @@ import { TestFile, TestFunction, TestStatus, - TestsToRun + TestsToRun, } from './common/types'; import { ITestConfigurationService, @@ -48,7 +48,7 @@ import { ITestManagementService, ITestResultDisplay, TestWorkspaceFolder, - WorkspaceTestStatus + WorkspaceTestStatus, } from './types'; // tslint:disable:no-any @@ -97,14 +97,14 @@ export class UnitTestManagementService implements ITestManagementService, Dispos } this.activatedOnce = true; this.workspaceTestManagerService = this.serviceContainer.get( - IWorkspaceTestManagerService + IWorkspaceTestManagerService, ); this.registerHandlers(); this.registerCommands(); this.checkExperiments(); this.autoDiscoverTests(undefined).catch((ex) => - traceError('Failed to auto discover tests upon activation', ex) + traceError('Failed to auto discover tests upon activation', ex), ); await this.registerSymbolProvider(symbolProvider); } @@ -119,7 +119,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos } public async getTestManager( displayTestNotConfiguredMessage: boolean, - resource?: Uri + resource?: Uri, ): Promise { let wkspace: Uri | undefined; if (resource) { @@ -143,7 +143,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos } if (displayTestNotConfiguredMessage) { const configurationService = this.serviceContainer.get( - ITestConfigurationService + ITestConfigurationService, ); await configurationService.displayTestFrameworkError(wkspace); } @@ -158,7 +158,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos return; } const workspaceFolderUri = this.workspaceService.workspaceFolders.find((w) => - eventArgs.affectsConfiguration('python.testing', w.uri) + eventArgs.affectsConfiguration('python.testing', w.uri), ); if (!workspaceFolderUri) { return; @@ -186,7 +186,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos this.testResultDisplay.enabled = true; } this.autoDiscoverTests(workspaceUri).catch((ex) => - traceError('Failed to auto discover tests upon activation', ex) + traceError('Failed to auto discover tests upon activation', ex), ); } @@ -208,7 +208,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos } this.autoDiscoverTimer = setTimeout( () => this.discoverTests(CommandSource.auto, doc.uri, true, false, true), - 1000 + 1000, ); } public async autoDiscoverTests(resource: Resource) { @@ -237,7 +237,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos ignoreCache?: boolean, userInitiated?: boolean, quietMode?: boolean, - clearTestStatus?: boolean + clearTestStatus?: boolean, ) { const testManager = await this.getTestManager(true, resource); if (!testManager) { @@ -256,7 +256,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos ignoreCache, quietMode, userInitiated, - clearTestStatus + clearTestStatus, ); this.testResultDisplay .displayDiscoverStatus(discoveryPromise, quietMode) @@ -301,14 +301,14 @@ export class UnitTestManagementService implements ITestManagementService, Dispos testManager.workingDirectory, file, testFunctions, - debug + debug, ); } public async runParametrizedTests( cmdSource: CommandSource, resource: Uri, testFunctions: TestFunction[], - debug?: boolean + debug?: boolean, ) { const testManager = await this.getTestManager(true, resource); if (!testManager) { @@ -332,7 +332,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos } const testCollectionStorage = this.serviceContainer.get( - ITestCollectionStorageService + ITestCollectionStorageService, ); const tests = testCollectionStorage.getTests(testManager.workspaceFolder)!; const testDisplay = this.serviceContainer.get(ITestDisplay); @@ -347,7 +347,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos // tslint:disable-next-line:no-object-literal-type-assertion { testFunction: [selectedTestFn.testFunction] } as TestsToRun, false, - debug + debug, ); } public async selectAndRunTestFile(cmdSource: CommandSource) { @@ -362,7 +362,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos } const testCollectionStorage = this.serviceContainer.get( - ITestCollectionStorageService + ITestCollectionStorageService, ); const tests = testCollectionStorage.getTests(testManager.workspaceFolder)!; const testDisplay = this.serviceContainer.get(ITestDisplay); @@ -386,7 +386,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos return; } const testCollectionStorage = this.serviceContainer.get( - ITestCollectionStorageService + ITestCollectionStorageService, ); const tests = testCollectionStorage.getTests(testManager.workspaceFolder)!; const testFiles = tests.testFiles.filter((testFile) => { @@ -403,7 +403,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos resource?: Uri, testsToRun?: TestsToRun, runFailedTests?: boolean, - debug: boolean = false + debug: boolean = false, ) { const testManager = await this.getTestManager(true, resource); if (!testManager) { @@ -427,7 +427,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos public async registerSymbolProvider(symbolProvider: DocumentSymbolProvider): Promise { const testCollectionStorage = this.serviceContainer.get( - ITestCollectionStorageService + ITestCollectionStorageService, ); const event = new EventEmitter(); this.disposableRegistry.push(event); @@ -438,7 +438,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos }); this.disposableRegistry.push(handler); this.disposableRegistry.push( - activateCodeLenses(event, symbolProvider, testCollectionStorage, this.serviceContainer) + activateCodeLenses(event, symbolProvider, testCollectionStorage, this.serviceContainer), ); } @@ -469,7 +469,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos ( treeNode?: TestWorkspaceFolder, cmdSource: CommandSource = CommandSource.commandPalette, - resource?: Uri + resource?: Uri, ) => { if (treeNode && treeNode instanceof TestWorkspaceFolder) { resource = treeNode.resource; @@ -478,7 +478,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos // Ignore the exceptions returned. // This command will be invoked from other places of the extension. return this.discoverTests(cmdSource, resource, true, true, false, true).ignoreErrors(); - } + }, ), commandManager.registerCommand( constants.Commands.Tests_Configure, @@ -486,12 +486,12 @@ export class UnitTestManagementService implements ITestManagementService, Dispos // Ignore the exceptions returned. // This command will be invoked from other places of the extension. this.configureTests(resource).ignoreErrors(); - } + }, ), commandManager.registerCommand( constants.Commands.Tests_Run_Failed, (_, cmdSource: CommandSource = CommandSource.commandPalette, resource: Uri) => - this.runTestsImpl(cmdSource, resource, undefined, true) + this.runTestsImpl(cmdSource, resource, undefined, true), ), commandManager.registerCommand( constants.Commands.Tests_Run, @@ -499,14 +499,14 @@ export class UnitTestManagementService implements ITestManagementService, Dispos treeNode?: TestWorkspaceFolder, cmdSource: CommandSource = CommandSource.commandPalette, resource?: Uri, - testToRun?: TestsToRun + testToRun?: TestsToRun, ) => { if (treeNode && treeNode instanceof TestWorkspaceFolder) { resource = treeNode.resource; cmdSource = CommandSource.testExplorer; } return this.runTestsImpl(cmdSource, resource, testToRun); - } + }, ), commandManager.registerCommand( constants.Commands.Tests_Debug, @@ -514,17 +514,17 @@ export class UnitTestManagementService implements ITestManagementService, Dispos treeNode?: TestWorkspaceFolder, cmdSource: CommandSource = CommandSource.commandPalette, resource?: Uri, - testToRun?: TestsToRun + testToRun?: TestsToRun, ) => { if (treeNode && treeNode instanceof TestWorkspaceFolder) { resource = treeNode.resource; cmdSource = CommandSource.testExplorer; } return this.runTestsImpl(cmdSource, resource, testToRun, false, true); - } + }, ), commandManager.registerCommand(constants.Commands.Tests_View_UI, () => - this.displayUI(CommandSource.commandPalette) + this.displayUI(CommandSource.commandPalette), ), commandManager.registerCommand( constants.Commands.Tests_Picker_UI, @@ -532,8 +532,8 @@ export class UnitTestManagementService implements ITestManagementService, Dispos _, cmdSource: CommandSource = CommandSource.commandPalette, file: Uri, - testFunctions: TestFunction[] - ) => this.displayPickerUI(cmdSource, file, testFunctions) + testFunctions: TestFunction[], + ) => this.displayPickerUI(cmdSource, file, testFunctions), ), commandManager.registerCommand( constants.Commands.Tests_Picker_UI_Debug, @@ -541,8 +541,8 @@ export class UnitTestManagementService implements ITestManagementService, Dispos _, cmdSource: CommandSource = CommandSource.commandPalette, file: Uri, - testFunctions: TestFunction[] - ) => this.displayPickerUI(cmdSource, file, testFunctions, true) + testFunctions: TestFunction[], + ) => this.displayPickerUI(cmdSource, file, testFunctions, true), ), commandManager.registerCommand( constants.Commands.Tests_Run_Parametrized, @@ -551,41 +551,41 @@ export class UnitTestManagementService implements ITestManagementService, Dispos cmdSource: CommandSource = CommandSource.commandPalette, resource: Uri, testFunctions: TestFunction[], - debug: boolean - ) => this.runParametrizedTests(cmdSource, resource, testFunctions, debug) + debug: boolean, + ) => this.runParametrizedTests(cmdSource, resource, testFunctions, debug), ), commandManager.registerCommand(constants.Commands.Tests_Stop, (_, resource: Uri) => - this.stopTests(resource) + this.stopTests(resource), ), commandManager.registerCommand( constants.Commands.Tests_ViewOutput, - (_, cmdSource: CommandSource = CommandSource.commandPalette) => this.viewOutput(cmdSource) + (_, cmdSource: CommandSource = CommandSource.commandPalette) => this.viewOutput(cmdSource), ), commandManager.registerCommand(constants.Commands.Tests_Ask_To_Stop_Discovery, () => - this.displayStopUI('Stop discovering tests') + this.displayStopUI('Stop discovering tests'), ), commandManager.registerCommand(constants.Commands.Tests_Ask_To_Stop_Test, () => - this.displayStopUI('Stop running tests') + this.displayStopUI('Stop running tests'), ), commandManager.registerCommand( constants.Commands.Tests_Select_And_Run_Method, (_, cmdSource: CommandSource = CommandSource.commandPalette, resource: Uri) => - this.selectAndRunTestMethod(cmdSource, resource) + this.selectAndRunTestMethod(cmdSource, resource), ), commandManager.registerCommand( constants.Commands.Tests_Select_And_Debug_Method, (_, cmdSource: CommandSource = CommandSource.commandPalette, resource: Uri) => - this.selectAndRunTestMethod(cmdSource, resource, true) + this.selectAndRunTestMethod(cmdSource, resource, true), ), commandManager.registerCommand( constants.Commands.Tests_Select_And_Run_File, - (_, cmdSource: CommandSource = CommandSource.commandPalette) => this.selectAndRunTestFile(cmdSource) + (_, cmdSource: CommandSource = CommandSource.commandPalette) => this.selectAndRunTestFile(cmdSource), ), commandManager.registerCommand( constants.Commands.Tests_Run_Current_File, - (_, cmdSource: CommandSource = CommandSource.commandPalette) => this.runCurrentTestFile(cmdSource) + (_, cmdSource: CommandSource = CommandSource.commandPalette) => this.runCurrentTestFile(cmdSource), ), - commandManager.registerCommand(constants.Commands.Tests_Discovering, noop) + commandManager.registerCommand(constants.Commands.Tests_Discovering, noop), ]; disposablesRegistry.push(...disposables); @@ -608,14 +608,14 @@ export class UnitTestManagementService implements ITestManagementService, Dispos clearTimeout(this.configChangedTimer as any); } this.configChangedTimer = setTimeout(() => this.configurationChangeHandler(e), 1000); - }) + }), ); this.disposableRegistry.push( interpreterService.onDidChangeInterpreter(() => this.autoDiscoverTests(undefined).catch((ex) => - traceError('Failed to auto discover tests upon changing interpreter', ex) - ) - ) + traceError('Failed to auto discover tests upon changing interpreter', ex), + ), + ), ); } } diff --git a/src/client/testing/navigation/commandHandler.ts b/src/client/testing/navigation/commandHandler.ts index 27df132391bb..dec32de9d490 100644 --- a/src/client/testing/navigation/commandHandler.ts +++ b/src/client/testing/navigation/commandHandler.ts @@ -23,7 +23,7 @@ export class TestCodeNavigatorCommandHandler implements ITestCodeNavigatorComman @inject(ITestCodeNavigator) @named(NavigableItemType.testSuite) private readonly testSuiteNavigator: ITestCodeNavigator, - @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry + @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry, ) { disposableRegistry.push(this); } @@ -37,19 +37,19 @@ export class TestCodeNavigatorCommandHandler implements ITestCodeNavigatorComman let disposable = this.commandManager.registerCommand( Commands.navigateToTestFile, this.testFileNavigator.navigateTo, - this.testFileNavigator + this.testFileNavigator, ); this.disposables.push(disposable); disposable = this.commandManager.registerCommand( Commands.navigateToTestFunction, this.testFunctionNavigator.navigateTo, - this.testFunctionNavigator + this.testFunctionNavigator, ); this.disposables.push(disposable); disposable = this.commandManager.registerCommand( Commands.navigateToTestSuite, this.testSuiteNavigator.navigateTo, - this.testSuiteNavigator + this.testSuiteNavigator, ); this.disposables.push(disposable); } diff --git a/src/client/testing/navigation/functionNavigator.ts b/src/client/testing/navigation/functionNavigator.ts index 0c95e42128b6..6c2c3b6a8808 100644 --- a/src/client/testing/navigation/functionNavigator.ts +++ b/src/client/testing/navigation/functionNavigator.ts @@ -19,7 +19,7 @@ export class TestFunctionCodeNavigator implements ITestCodeNavigator { constructor( @inject(ITestNavigatorHelper) private readonly helper: ITestNavigatorHelper, @inject(IDocumentManager) private readonly docManager: IDocumentManager, - @inject(ITestCollectionStorageService) private readonly storage: ITestCollectionStorageService + @inject(ITestCollectionStorageService) private readonly storage: ITestCollectionStorageService, ) {} @swallowExceptions('Navigate to test function') @captureTelemetry(EventName.UNITTEST_NAVIGATE, { byFunction: true }, true) // To measure execution time. diff --git a/src/client/testing/navigation/helper.ts b/src/client/testing/navigation/helper.ts index 7c5e092ea4a7..767bd53b1df9 100644 --- a/src/client/testing/navigation/helper.ts +++ b/src/client/testing/navigation/helper.ts @@ -14,7 +14,7 @@ import { ITestNavigatorHelper, SymbolSearch } from './types'; export class TestNavigatorHelper implements ITestNavigatorHelper { constructor( @inject(IDocumentManager) private readonly documentManager: IDocumentManager, - @inject(IDocumentSymbolProvider) @named('test') private readonly symbolProvider: IDocumentSymbolProvider + @inject(IDocumentSymbolProvider) @named('test') private readonly symbolProvider: IDocumentSymbolProvider, ) {} public async openFile(file?: Uri): Promise<[TextDocument, TextEditor]> { if (!file) { @@ -27,7 +27,7 @@ export class TestNavigatorHelper implements ITestNavigatorHelper { public async findSymbol( doc: TextDocument, search: SymbolSearch, - token: CancellationToken + token: CancellationToken, ): Promise { const symbols = (await this.symbolProvider.provideDocumentSymbols(doc, token)) as SymbolInformation[]; if (!Array.isArray(symbols) || symbols.length === 0) { diff --git a/src/client/testing/navigation/serviceRegistry.ts b/src/client/testing/navigation/serviceRegistry.ts index bccf480a5b9f..e1a1194ec94f 100644 --- a/src/client/testing/navigation/serviceRegistry.ts +++ b/src/client/testing/navigation/serviceRegistry.ts @@ -17,22 +17,22 @@ export function registerTypes(serviceManager: IServiceManager) { serviceManager.addSingleton(ITestNavigatorHelper, TestNavigatorHelper); serviceManager.addSingleton( ITestCodeNavigatorCommandHandler, - TestCodeNavigatorCommandHandler + TestCodeNavigatorCommandHandler, ); serviceManager.addSingleton( ITestCodeNavigator, TestFileCodeNavigator, - NavigableItemType.testFile + NavigableItemType.testFile, ); serviceManager.addSingleton( ITestCodeNavigator, TestFunctionCodeNavigator, - NavigableItemType.testFunction + NavigableItemType.testFunction, ); serviceManager.addSingleton( ITestCodeNavigator, TestSuiteCodeNavigator, - NavigableItemType.testSuite + NavigableItemType.testSuite, ); serviceManager.addSingleton(IDocumentSymbolProvider, TestFileSymbolProvider, 'test'); } diff --git a/src/client/testing/navigation/suiteNavigator.ts b/src/client/testing/navigation/suiteNavigator.ts index 0230daa95e56..e6763761f4fa 100644 --- a/src/client/testing/navigation/suiteNavigator.ts +++ b/src/client/testing/navigation/suiteNavigator.ts @@ -19,7 +19,7 @@ export class TestSuiteCodeNavigator implements ITestCodeNavigator { constructor( @inject(ITestNavigatorHelper) private readonly helper: ITestNavigatorHelper, @inject(IDocumentManager) private readonly docManager: IDocumentManager, - @inject(ITestCollectionStorageService) private readonly storage: ITestCollectionStorageService + @inject(ITestCollectionStorageService) private readonly storage: ITestCollectionStorageService, ) {} @swallowExceptions('Navigate to test suite') @captureTelemetry(EventName.UNITTEST_NAVIGATE, { bySuite: true }, true) // For measuring execution time. diff --git a/src/client/testing/navigation/symbolProvider.ts b/src/client/testing/navigation/symbolProvider.ts index 806776d89245..d73570533c62 100644 --- a/src/client/testing/navigation/symbolProvider.ts +++ b/src/client/testing/navigation/symbolProvider.ts @@ -12,7 +12,7 @@ import { SymbolInformation, SymbolKind, TextDocument, - Uri + Uri, } from 'vscode'; import { traceError } from '../../common/logger'; import * as internalScripts from '../../common/process/internal/scripts'; @@ -30,7 +30,7 @@ export class TestFileSymbolProvider implements DocumentSymbolProvider { constructor(@inject(IPythonExecutionFactory) private readonly pythonServiceFactory: IPythonExecutionFactory) {} public async provideDocumentSymbols( document: TextDocument, - token: CancellationToken + token: CancellationToken, ): Promise { const rawSymbols = await this.getSymbols(document, token); if (!rawSymbols) { @@ -39,7 +39,7 @@ export class TestFileSymbolProvider implements DocumentSymbolProvider { return [ ...rawSymbols.classes.map((item) => this.parseRawSymbol(document.uri, item, SymbolKind.Class)), ...rawSymbols.methods.map((item) => this.parseRawSymbol(document.uri, item, SymbolKind.Method)), - ...rawSymbols.functions.map((item) => this.parseRawSymbol(document.uri, item, SymbolKind.Function)) + ...rawSymbols.functions.map((item) => this.parseRawSymbol(document.uri, item, SymbolKind.Function)), ]; } private parseRawSymbol(uri: Uri, symbol: RawSymbol, kind: SymbolKind): SymbolInformation { @@ -47,13 +47,13 @@ export class TestFileSymbolProvider implements DocumentSymbolProvider { symbol.range.start.line, symbol.range.start.character, symbol.range.end.line, - symbol.range.end.character + symbol.range.end.character, ); return { containerName: symbol.namespace, kind, name: symbol.name, - location: new Location(uri, range) + location: new Location(uri, range), }; } private async getSymbols(document: TextDocument, token: CancellationToken): Promise { @@ -63,7 +63,7 @@ export class TestFileSymbolProvider implements DocumentSymbolProvider { } const [args, parse] = internalScripts.symbolProvider( document.uri.fsPath, - document.isDirty ? document.getText() : undefined + document.isDirty ? document.getText() : undefined, ); const pythonService = await this.pythonServiceFactory.create({ resource: document.uri }); const proc = await pythonService.exec(args, { throwOnStdErr: true, token }); diff --git a/src/client/testing/navigation/types.ts b/src/client/testing/navigation/types.ts index 62b9e4b809c4..d2ae1cf65d4f 100644 --- a/src/client/testing/navigation/types.ts +++ b/src/client/testing/navigation/types.ts @@ -15,7 +15,7 @@ export type NavigableItem = TestFile | TestFunction | TestSuite; export enum NavigableItemType { testFile = 'testFile', testFunction = 'testFunction', - testSuite = 'testSuite' + testSuite = 'testSuite', } export const ITestCodeNavigator = Symbol('ITestCodeNavigator'); @@ -29,7 +29,7 @@ export interface ITestNavigatorHelper { findSymbol( doc: TextDocument, predicate: SymbolSearch, - token: CancellationToken + token: CancellationToken, ): Promise; } export type SymbolSearch = (item: SymbolInformation) => boolean; diff --git a/src/client/testing/nosetest/main.ts b/src/client/testing/nosetest/main.ts index e8bccbf26bf9..5d4d77143201 100644 --- a/src/client/testing/nosetest/main.ts +++ b/src/client/testing/nosetest/main.ts @@ -18,7 +18,7 @@ export class TestManager extends BaseTestManager { constructor( workspaceFolder: Uri, rootDirectory: string, - @inject(IServiceContainer) serviceContainer: IServiceContainer + @inject(IServiceContainer) serviceContainer: IServiceContainer, ) { super(NOSETEST_PROVIDER, Product.nosetest, workspaceFolder, rootDirectory, serviceContainer); this.argsService = this.serviceContainer.get(IArgumentsService, this.testProvider); @@ -33,14 +33,14 @@ export class TestManager extends BaseTestManager { args, token: this.testDiscoveryCancellationToken!, ignoreCache, - outChannel: this.outputChannel + outChannel: this.outputChannel, }; } public runTestImpl( tests: Tests, testsToRun?: TestsToRun, runFailedTests?: boolean, - debug?: boolean + debug?: boolean, ): Promise { let args: string[]; @@ -48,12 +48,12 @@ export class TestManager extends BaseTestManager { if (debug) { args = this.argsService.filterArguments( this.settings.testing.nosetestArgs, - runAllTests ? TestFilter.debugAll : TestFilter.debugSpecific + runAllTests ? TestFilter.debugAll : TestFilter.debugSpecific, ); } else { args = this.argsService.filterArguments( this.settings.testing.nosetestArgs, - runAllTests ? TestFilter.runAll : TestFilter.runSpecific + runAllTests ? TestFilter.runAll : TestFilter.runSpecific, ); } @@ -71,7 +71,7 @@ export class TestManager extends BaseTestManager { testsToRun, token: this.testRunnerCancellationToken!, outChannel: this.outputChannel, - debug + debug, }; return this.runner.runTest(this.testResultsService, options, this); } diff --git a/src/client/testing/nosetest/runner.ts b/src/client/testing/nosetest/runner.ts index e29a95e155ce..526397ad65d7 100644 --- a/src/client/testing/nosetest/runner.ts +++ b/src/client/testing/nosetest/runner.ts @@ -14,7 +14,7 @@ import { IXUnitParser, LaunchOptions, TestRunOptions, - Tests + Tests, } from '../common/types'; import { IArgumentsHelper, IArgumentsService, ITestManagerRunner } from '../types'; @@ -38,7 +38,7 @@ export class TestManagerRunner implements ITestManagerRunner { public async runTest( testResultsService: ITestResultsService, options: TestRunOptions, - _: ITestManager + _: ITestManager, ): Promise { let testPaths: string[] = []; if (options.testsToRun && options.testsToRun.testFolder) { @@ -80,7 +80,7 @@ export class TestManagerRunner implements ITestManagerRunner { args: debuggerArgs, token: options.token, outChannel: options.outChannel, - testProvider: NOSETEST_PROVIDER + testProvider: NOSETEST_PROVIDER, }; await debugLauncher.launchDebugger(launchOptions); } else { @@ -89,7 +89,7 @@ export class TestManagerRunner implements ITestManagerRunner { cwd: options.cwd, outChannel: options.outChannel, token: options.token, - workspaceFolder: options.workspaceFolder + workspaceFolder: options.workspaceFolder, }; await this.testRunner.run(NOSETEST_PROVIDER, runOptions); } @@ -107,7 +107,7 @@ export class TestManagerRunner implements ITestManagerRunner { private async updateResultsFromLogFiles( tests: Tests, outputXmlFile: string, - testResultsService: ITestResultsService + testResultsService: ITestResultsService, ): Promise { await this.xUnitParser.updateResultsFromXmlLogFile(tests, outputXmlFile); testResultsService.updateResults(tests); diff --git a/src/client/testing/nosetest/services/argsService.ts b/src/client/testing/nosetest/services/argsService.ts index cba04ef343b2..63c4c6785c46 100644 --- a/src/client/testing/nosetest/services/argsService.ts +++ b/src/client/testing/nosetest/services/argsService.ts @@ -52,7 +52,7 @@ const OptionsWithArguments = [ '-w', '--profile-restrict', '--profile-sort', - '--profile-stats-file' + '--profile-stats-file', ]; const OptionsWithoutArguments = [ @@ -104,7 +104,7 @@ const OptionsWithoutArguments = [ '--with-xunit', '--all-modules', '--collect-only', - '--with-profile' + '--with-profile', ]; @injectable() @@ -116,7 +116,7 @@ export class ArgumentsService implements IArgumentsService { public getKnownOptions(): { withArgs: string[]; withoutArgs: string[] } { return { withArgs: OptionsWithArguments, - withoutArgs: OptionsWithoutArguments + withoutArgs: OptionsWithoutArguments, }; } public getOptionValue(args: string[], option: string): string | string[] | undefined { @@ -157,8 +157,8 @@ export class ArgumentsService implements IArgumentsService { ...OptionsWithoutArguments.filter((item) => item.startsWith('--cover')), ...OptionsWithoutArguments.filter((item) => item.startsWith('--logging')), ...OptionsWithoutArguments.filter((item) => item.startsWith('--pdb')), - ...OptionsWithoutArguments.filter((item) => item.indexOf('xunit') >= 0) - ] + ...OptionsWithoutArguments.filter((item) => item.indexOf('xunit') >= 0), + ], ); optionsWithArgsToRemove.push( ...[ @@ -168,8 +168,8 @@ export class ArgumentsService implements IArgumentsService { '--cover-package', ...OptionsWithoutArguments.filter((item) => item.startsWith('--cover')), ...OptionsWithArguments.filter((item) => item.startsWith('--logging')), - ...OptionsWithoutArguments.filter((item) => item.indexOf('xunit') >= 0) - ] + ...OptionsWithoutArguments.filter((item) => item.indexOf('xunit') >= 0), + ], ); break; } @@ -193,7 +193,7 @@ export class ArgumentsService implements IArgumentsService { const positionalArgs = this.helper.getPositionalArguments( filteredArgs, OptionsWithArguments, - OptionsWithoutArguments + OptionsWithoutArguments, ); filteredArgs = filteredArgs.filter((item) => positionalArgs.indexOf(item) === -1); } diff --git a/src/client/testing/nosetest/services/discoveryService.ts b/src/client/testing/nosetest/services/discoveryService.ts index 616b40d14f6c..1825e29fc7d3 100644 --- a/src/client/testing/nosetest/services/discoveryService.ts +++ b/src/client/testing/nosetest/services/discoveryService.ts @@ -15,7 +15,7 @@ export class TestDiscoveryService implements ITestDiscoveryService { private runner: ITestRunner; constructor( @inject(IServiceContainer) private serviceContainer: IServiceContainer, - @inject(ITestsParser) @named(NOSETEST_PROVIDER) private testParser: ITestsParser + @inject(ITestsParser) @named(NOSETEST_PROVIDER) private testParser: ITestsParser, ) { this.argsService = this.serviceContainer.get(IArgumentsService, NOSETEST_PROVIDER); this.runner = this.serviceContainer.get(ITestRunner); @@ -30,7 +30,7 @@ export class TestDiscoveryService implements ITestDiscoveryService { cwd: options.cwd, workspaceFolder: options.workspaceFolder, token, - outChannel: options.outChannel + outChannel: options.outChannel, }; const data = await this.runner.run(NOSETEST_PROVIDER, runOptions); diff --git a/src/client/testing/nosetest/services/parserService.ts b/src/client/testing/nosetest/services/parserService.ts index 80fb184dfc97..bf29d86064d4 100644 --- a/src/client/testing/nosetest/services/parserService.ts +++ b/src/client/testing/nosetest/services/parserService.ts @@ -13,7 +13,7 @@ import { TestFile, TestFunction, Tests, - TestSuite + TestSuite, } from '../../common/types'; const NOSE_WANT_FILE_PREFIX = 'nose.selector: DEBUG: wantFile '; @@ -105,7 +105,7 @@ export class TestsParser implements ITestsParser { time: 0, functionsFailed: 0, functionsPassed: 0, - fullPath: fullyQualifiedName + fullPath: fullyQualifiedName, }; testFiles.push(testFile); return; @@ -125,7 +125,7 @@ export class TestsParser implements ITestsParser { isUnitTest: false, isInstance: false, functionsFailed: 0, - functionsPassed: 0 + functionsPassed: 0, }; testFile.suites.push(testSuite); return; @@ -143,7 +143,7 @@ export class TestsParser implements ITestsParser { isUnitTest: false, isInstance: false, functionsFailed: 0, - functionsPassed: 0 + functionsPassed: 0, }; testFile.suites.push(testSuite); return; @@ -152,7 +152,7 @@ export class TestsParser implements ITestsParser { const name = extractBetweenDelimiters( line, 'nose.selector: DEBUG: wantMethod ? True' + '>? True', ); const fnName = path.extname(name).substring(1); const clsName = path.basename(name, path.extname(name)); @@ -162,7 +162,7 @@ export class TestsParser implements ITestsParser { nameToRun: `${fileName}:${clsName}.${fnName}`, time: 0, functionsFailed: 0, - functionsPassed: 0 + functionsPassed: 0, }; const cls = testFile.suites.find((suite) => suite.name === clsName); @@ -179,7 +179,7 @@ export class TestsParser implements ITestsParser { nameToRun: `${fileName}:${name}`, time: 0, functionsFailed: 0, - functionsPassed: 0 + functionsPassed: 0, }; testFile.functions.push(fn); return; diff --git a/src/client/testing/pytest/main.ts b/src/client/testing/pytest/main.ts index 3873db1c5b1b..aaf647773775 100644 --- a/src/client/testing/pytest/main.ts +++ b/src/client/testing/pytest/main.ts @@ -11,7 +11,7 @@ import { TestDiscoveryOptions, TestRunOptions, Tests, - TestsToRun + TestsToRun, } from '../common/types'; import { IArgumentsService, IPythonTestMessage, ITestManagerRunner, TestFilter } from '../types'; @@ -30,7 +30,7 @@ export class TestManager extends BaseTestManager { this.runner = this.serviceContainer.get(ITestManagerRunner, this.testProvider); this.testMessageService = this.serviceContainer.get( ITestMessageService, - this.testProvider + this.testProvider, ); } public getDiscoveryOptions(ignoreCache: boolean): TestDiscoveryOptions { @@ -41,14 +41,14 @@ export class TestManager extends BaseTestManager { args, token: this.testDiscoveryCancellationToken!, ignoreCache, - outChannel: this.outputChannel + outChannel: this.outputChannel, }; } public async runTestImpl( tests: Tests, testsToRun?: TestsToRun, runFailedTests?: boolean, - debug?: boolean + debug?: boolean, ): Promise { let args: string[]; @@ -56,12 +56,12 @@ export class TestManager extends BaseTestManager { if (debug) { args = this.argsService.filterArguments( this.settings.testing.pytestArgs, - runAllTests ? TestFilter.debugAll : TestFilter.debugSpecific + runAllTests ? TestFilter.debugAll : TestFilter.debugSpecific, ); } else { args = this.argsService.filterArguments( this.settings.testing.pytestArgs, - runAllTests ? TestFilter.runAll : TestFilter.runSpecific + runAllTests ? TestFilter.runAll : TestFilter.runSpecific, ); } @@ -76,12 +76,12 @@ export class TestManager extends BaseTestManager { testsToRun, debug, token: this.testRunnerCancellationToken!, - outChannel: this.outputChannel + outChannel: this.outputChannel, }; const testResults = await this.runner.runTest(this.testResultsService, options, this); const messages: IPythonTestMessage[] = await this.testMessageService.getFilteredTestMessages( this.rootDirectory, - testResults + testResults, ); await this.updateDiagnostics(tests, messages); return testResults; diff --git a/src/client/testing/pytest/runner.ts b/src/client/testing/pytest/runner.ts index cde8e4765125..82ddd448a5ae 100644 --- a/src/client/testing/pytest/runner.ts +++ b/src/client/testing/pytest/runner.ts @@ -13,7 +13,7 @@ import { IXUnitParser, LaunchOptions, TestRunOptions, - Tests + Tests, } from '../common/types'; import { IArgumentsHelper, IArgumentsService, ITestManagerRunner } from '../types'; @@ -36,7 +36,7 @@ export class TestManagerRunner implements ITestManagerRunner { public async runTest( testResultsService: ITestResultsService, options: TestRunOptions, - _: ITestManager + _: ITestManager, ): Promise { let testPaths: string[] = []; if (options.testsToRun && options.testsToRun.testFolder) { @@ -76,7 +76,7 @@ export class TestManagerRunner implements ITestManagerRunner { args: debuggerArgs, token: options.token, outChannel: options.outChannel, - testProvider: PYTEST_PROVIDER + testProvider: PYTEST_PROVIDER, }; await debugLauncher.launchDebugger(launchOptions); } else { @@ -85,7 +85,7 @@ export class TestManagerRunner implements ITestManagerRunner { cwd: options.cwd, outChannel: options.outChannel, token: options.token, - workspaceFolder: options.workspaceFolder + workspaceFolder: options.workspaceFolder, }; await this.testRunner.run(PYTEST_PROVIDER, runOptions); } @@ -103,7 +103,7 @@ export class TestManagerRunner implements ITestManagerRunner { private async updateResultsFromLogFiles( tests: Tests, outputXmlFile: string, - testResultsService: ITestResultsService + testResultsService: ITestResultsService, ): Promise { await this.xUnitParser.updateResultsFromXmlLogFile(tests, outputXmlFile); testResultsService.updateResults(tests); diff --git a/src/client/testing/pytest/services/argsService.ts b/src/client/testing/pytest/services/argsService.ts index ffa80c329dfe..5846c7a6c6a1 100644 --- a/src/client/testing/pytest/services/argsService.ts +++ b/src/client/testing/pytest/services/argsService.ts @@ -63,7 +63,7 @@ const OptionsWithArguments = [ '--numprocesses', '--rsyncdir', '--rsyncignore', - '--tx' + '--tx', ]; const OptionsWithoutArguments = [ @@ -129,7 +129,7 @@ const OptionsWithoutArguments = [ '--looponfail', '--trace', '--tx', - '-d' + '-d', ]; @injectable() @@ -141,7 +141,7 @@ export class ArgumentsService implements IArgumentsService { public getKnownOptions(): { withArgs: string[]; withoutArgs: string[] } { return { withArgs: OptionsWithArguments, - withoutArgs: OptionsWithoutArguments + withoutArgs: OptionsWithoutArguments, }; } public getOptionValue(args: string[], option: string): string | string[] | undefined { @@ -167,7 +167,7 @@ export class ArgumentsService implements IArgumentsService { switch (argumentToRemoveOrFilter) { case TestFilter.removeTests: { optionsWithoutArgsToRemove.push( - ...['--lf', '--last-failed', '--ff', '--failed-first', '--nf', '--new-first'] + ...['--lf', '--last-failed', '--ff', '--failed-first', '--nf', '--new-first'], ); optionsWithArgsToRemove.push(...['-k', '-m', '--lfnf', '--last-failed-no-failures']); removePositionalArgs = true; @@ -200,8 +200,8 @@ export class ArgumentsService implements IArgumentsService { '--setup-only', '--setup-show', '--setup-plan', - '--trace' - ] + '--trace', + ], ); optionsWithArgsToRemove.push( ...[ @@ -222,8 +222,8 @@ export class ArgumentsService implements IArgumentsService { '--result-log', '-W', '--pythonwarnings', - '--log-*' - ] + '--log-*', + ], ); removePositionalArgs = true; break; @@ -244,8 +244,8 @@ export class ArgumentsService implements IArgumentsService { '--failed-first', '--nf', '--new-first', - '--trace' - ] + '--trace', + ], ); optionsWithArgsToRemove.push(...['-k', '-m', '--lfnf', '--last-failed-no-failures']); removePositionalArgs = true; @@ -262,7 +262,7 @@ export class ArgumentsService implements IArgumentsService { const positionalArgs = this.helper.getPositionalArguments( filteredArgs, OptionsWithArguments, - OptionsWithoutArguments + OptionsWithoutArguments, ); filteredArgs = filteredArgs.filter((item) => positionalArgs.indexOf(item) === -1); } diff --git a/src/client/testing/pytest/services/discoveryService.ts b/src/client/testing/pytest/services/discoveryService.ts index 965336217405..4a36be208bb8 100644 --- a/src/client/testing/pytest/services/discoveryService.ts +++ b/src/client/testing/pytest/services/discoveryService.ts @@ -24,7 +24,7 @@ export class TestDiscoveryService implements ITestDiscoveryService { if (testDirectories.length === 0) { const opts = { ...options, - args + args, }; return this.discoverTestsInTestDirectory(opts); } @@ -33,10 +33,10 @@ export class TestDiscoveryService implements ITestDiscoveryService { // Add test directory as a positional argument. const opts = { ...options, - args: [...args, testDir] + args: [...args, testDir], }; return this.discoverTestsInTestDirectory(opts); - }) + }), ); return this.helper.mergeTests(results); diff --git a/src/client/testing/pytest/services/testMessageService.ts b/src/client/testing/pytest/services/testMessageService.ts index 049833c001e9..21195045771b 100644 --- a/src/client/testing/pytest/services/testMessageService.ts +++ b/src/client/testing/pytest/services/testMessageService.ts @@ -44,7 +44,7 @@ export class TestMessageService implements ITestMessageService { provider: provider, testTime: tf.testFunction.time, status: status, - testFilePath: tf.parentTestFile.fullPath + testFilePath: tf.parentTestFile.fullPath, }; messages.push(msg); } else { @@ -68,7 +68,7 @@ export class TestMessageService implements ITestMessageService { testTime: tf.testFunction.time, testFilePath: testFilePath, status: status, - locationStack: locationStack + locationStack: locationStack, }; messages.push(msg); } @@ -84,7 +84,7 @@ export class TestMessageService implements ITestMessageService { */ private async getLocationStack( rootDirectory: string, - testFunction: FlattenedTestFunction + testFunction: FlattenedTestFunction, ): Promise { const locationStack: ILocationStackFrameDetails[] = []; if (testFunction.testFunction.traceback) { @@ -102,12 +102,12 @@ export class TestMessageService implements ITestMessageService { fileUri, new Range( new Position(fileLineNum - 1, line.firstNonWhitespaceCharacterIndex), - new Position(fileLineNum - 1, line.text.length) - ) + new Position(fileLineNum - 1, line.text.length), + ), ); const stackFrame: ILocationStackFrameDetails = { location: location, - lineText: file.getText(location.range) + lineText: file.getText(location.range), }; locationStack.push(stackFrame); } @@ -161,7 +161,7 @@ export class TestMessageService implements ITestMessageService { if ( !fs.arePathsSame( Uri.file(testFunction.parentTestFile.fullPath).fsPath, - locationStack[0].location.uri.fsPath + locationStack[0].location.uri.fsPath, ) ) { // test method was imported, so reference class declaration line. diff --git a/src/client/testing/pytest/testConfigurationManager.ts b/src/client/testing/pytest/testConfigurationManager.ts index 2c3b627342a1..a48dd8c2c371 100644 --- a/src/client/testing/pytest/testConfigurationManager.ts +++ b/src/client/testing/pytest/testConfigurationManager.ts @@ -31,7 +31,7 @@ export class ConfigurationManager extends TestConfigurationManager { if (configFiles.length === 1 && configFiles[0] === 'setup.cfg') { options.push({ label: configFileOptionLabel, - description: 'setup.cfg' + description: 'setup.cfg', }); } const subDirs = await this.getTestDirs(wkspace.fsPath); @@ -48,7 +48,7 @@ export class ConfigurationManager extends TestConfigurationManager { private async getConfigFiles(rootDir: string): Promise { const fs = this.serviceContainer.get(IFileSystem); const promises = ['pytest.ini', 'tox.ini', 'setup.cfg'].map(async (cfg) => - (await fs.fileExists(path.join(rootDir, cfg))) ? cfg : '' + (await fs.fileExists(path.join(rootDir, cfg))) ? cfg : '', ); const values = await Promise.all(promises); return values.filter((exists) => exists.length > 0); diff --git a/src/client/testing/serviceRegistry.ts b/src/client/testing/serviceRegistry.ts index 5ebb8dc4f36f..d9ff1fa644e6 100644 --- a/src/client/testing/serviceRegistry.ts +++ b/src/client/testing/serviceRegistry.ts @@ -42,7 +42,7 @@ import { IUnitTestSocketServer, IWorkspaceTestManagerService, IXUnitParser, - TestProvider + TestProvider, } from './common/types'; import { UpdateTestSettingService } from './common/updateTestSettings'; import { XUnitParser } from './common/xUnitParser'; @@ -80,7 +80,7 @@ import { ITestManagerRunner, ITestResultDisplay, ITestTreeViewProvider, - IUnitTestHelper + IUnitTestHelper, } from './types'; import { UnitTestHelper } from './unittest/helper'; import { TestManager as UnitTestTestManager } from './unittest/main'; @@ -95,11 +95,11 @@ export function registerTypes(serviceManager: IServiceManager) { serviceManager.addSingleton(ITestDebugLauncher, DebugLauncher); serviceManager.addSingleton( ITestCollectionStorageService, - TestCollectionStorageService + TestCollectionStorageService, ); serviceManager.addSingleton( IWorkspaceTestManagerService, - WorkspaceTestManagerService + WorkspaceTestManagerService, ); serviceManager.add(ITestsHelper, TestsHelper); @@ -140,7 +140,7 @@ export function registerTypes(serviceManager: IServiceManager) { serviceManager.addSingleton(ITestConfigSettingsService, TestConfigSettingsService); serviceManager.addSingleton( ITestConfigurationManagerFactory, - TestConfigurationManagerFactory + TestConfigurationManagerFactory, ); serviceManager.addSingleton(ITestDiagnosticService, UnitTestDiagnosticService); @@ -151,11 +151,11 @@ export function registerTypes(serviceManager: IServiceManager) { serviceManager.addSingleton(IExtensionSingleActivationService, TreeViewService); serviceManager.addSingleton( IExtensionSingleActivationService, - FailedTestHandler + FailedTestHandler, ); serviceManager.addSingleton( IExtensionSingleActivationService, - EnablementTracker + EnablementTracker, ); serviceManager.addSingleton(IExtensionActivationService, UpdateTestSettingService); diff --git a/src/client/testing/types.ts b/src/client/testing/types.ts index 3949e0c502f8..da7c3ca0c880 100644 --- a/src/client/testing/types.ts +++ b/src/client/testing/types.ts @@ -15,7 +15,7 @@ import { TreeDataProvider, TreeItem, Uri, - WorkspaceFolder + WorkspaceFolder, } from 'vscode'; import { Product, Resource } from '../common/types'; import { CommandSource } from './common/constants'; @@ -31,7 +31,7 @@ import { TestStatus, TestsToRun, TestSuite, - UnitTestProduct + UnitTestProduct, } from './common/types'; export const ITestConfigurationService = Symbol('ITestConfigurationService'); @@ -63,7 +63,7 @@ export interface ITestDisplay { rootDirectory: string, file: Uri, testFunctions: TestFunction[], - debug?: boolean + debug?: boolean, ): void; } @@ -79,7 +79,7 @@ export interface ITestManagementService { resource?: Uri, ignoreCache?: boolean, userInitiated?: boolean, - quietMode?: boolean + quietMode?: boolean, ): Promise; stopTests(resource: Uri): Promise; displayStopUI(message: string): Promise; @@ -90,7 +90,7 @@ export interface ITestManagementService { resource?: Uri, testsToRun?: TestsToRun, runFailedTests?: boolean, - debug?: boolean + debug?: boolean, ): Promise; runCurrentTestFile(cmdSource: CommandSource): Promise; @@ -127,7 +127,7 @@ export enum TestFilter { runAll = 'runAll', runSpecific = 'runSpecific', debugAll = 'debugAll', - debugSpecific = 'debugSpecific' + debugSpecific = 'debugSpecific', } export const IArgumentsService = Symbol('IArgumentsService'); export interface IArgumentsService { @@ -145,7 +145,7 @@ export interface IArgumentsHelper { getPositionalArguments( args: string[], optionsWithArguments?: string[], - optionsWithoutArguments?: string[] + optionsWithoutArguments?: string[], ): string[]; } @@ -154,7 +154,7 @@ export interface ITestManagerRunner { runTest( testResultsService: ITestResultsService, options: TestRunOptions, - testManager: ITestManager + testManager: ITestManager, ): Promise; } @@ -185,13 +185,13 @@ export enum PythonTestMessageSeverity { Error, Failure, Skip, - Pass + Pass, } export enum DiagnosticMessageType { Error, Fail, Skipped, - Pass + Pass, } export interface ILocationStackFrameDetails { @@ -206,7 +206,7 @@ export enum TestDataItemType { folder = 'folder', file = 'file', suite = 'suite', - function = 'function' + function = 'function', } export type TestDataItem = TestWorkspaceFolder | TestFolder | TestFile | TestSuite | TestFunction; diff --git a/src/client/testing/unittest/main.ts b/src/client/testing/unittest/main.ts index cb81d3de5f23..d892a4c89b52 100644 --- a/src/client/testing/unittest/main.ts +++ b/src/client/testing/unittest/main.ts @@ -31,14 +31,14 @@ export class TestManager extends BaseTestManager { args, token: this.testDiscoveryCancellationToken!, ignoreCache, - outChannel: this.outputChannel + outChannel: this.outputChannel, }; } public async runTest( cmdSource: CommandSource, testsToRun?: TestsToRun, runFailedTests?: boolean, - debug?: boolean + debug?: boolean, ): Promise { if (runFailedTests === true && this.tests) { testsToRun = { testFile: [], testFolder: [], testSuite: [], testFunction: [] }; @@ -54,7 +54,7 @@ export class TestManager extends BaseTestManager { tests: Tests, testsToRun?: TestsToRun, _runFailedTests?: boolean, - debug?: boolean + debug?: boolean, ): Promise { let args: string[]; @@ -62,12 +62,12 @@ export class TestManager extends BaseTestManager { if (debug) { args = this.argsService.filterArguments( this.settings.testing.unittestArgs, - runAllTests ? TestFilter.debugAll : TestFilter.debugSpecific + runAllTests ? TestFilter.debugAll : TestFilter.debugSpecific, ); } else { args = this.argsService.filterArguments( this.settings.testing.unittestArgs, - runAllTests ? TestFilter.runAll : TestFilter.runSpecific + runAllTests ? TestFilter.runAll : TestFilter.runSpecific, ); } @@ -79,7 +79,7 @@ export class TestManager extends BaseTestManager { testsToRun, debug, token: this.testRunnerCancellationToken!, - outChannel: this.outputChannel + outChannel: this.outputChannel, }; return this.runner.runTest(this.testResultsService, options, this); } diff --git a/src/client/testing/unittest/runner.ts b/src/client/testing/unittest/runner.ts index 77f23ee3de54..62776aa50e35 100644 --- a/src/client/testing/unittest/runner.ts +++ b/src/client/testing/unittest/runner.ts @@ -18,7 +18,7 @@ import { LaunchOptions, TestRunOptions, Tests, - TestStatus + TestStatus, } from '../common/types'; import { IArgumentsHelper, ITestManagerRunner, IUnitTestHelper } from '../types'; @@ -60,7 +60,7 @@ export class TestManagerRunner implements ITestManagerRunner { public async runTest( testResultsService: ITestResultsService, options: TestRunOptions, - testManager: ITestManager + testManager: ITestManager, ): Promise { if (this.busy && !this.busy.completed) { return this.busy.promise; @@ -138,7 +138,7 @@ export class TestManagerRunner implements ITestManagerRunner { args: testArgs, token: options.token, outChannel: options.outChannel, - testProvider: UNITTEST_PROVIDER + testProvider: UNITTEST_PROVIDER, }; return debugLauncher.launchDebugger(launchOptions); } else { @@ -149,7 +149,7 @@ export class TestManagerRunner implements ITestManagerRunner { cwd: options.cwd, outChannel: options.outChannel, token: options.token, - workspaceFolder: options.workspaceFolder + workspaceFolder: options.workspaceFolder, }; await this.testRunner.run(UNITTEST_PROVIDER, runOptions); } diff --git a/src/client/testing/unittest/services/argsService.ts b/src/client/testing/unittest/services/argsService.ts index 73e27087a01e..8325807c2fbd 100644 --- a/src/client/testing/unittest/services/argsService.ts +++ b/src/client/testing/unittest/services/argsService.ts @@ -22,7 +22,7 @@ const OptionsWithoutArguments = [ '--help', '--locals', '--quiet', - '--verbose' + '--verbose', ]; @injectable() @@ -34,7 +34,7 @@ export class ArgumentsService implements IArgumentsService { public getKnownOptions(): { withArgs: string[]; withoutArgs: string[] } { return { withArgs: OptionsWithArguments, - withoutArgs: OptionsWithoutArguments + withoutArgs: OptionsWithoutArguments, }; } public getOptionValue(args: string[], option: string): string | string[] | undefined { @@ -64,7 +64,7 @@ export class ArgumentsService implements IArgumentsService { const positionalArgs = this.helper.getPositionalArguments( filteredArgs, OptionsWithArguments, - OptionsWithoutArguments + OptionsWithoutArguments, ); filteredArgs = filteredArgs.filter((item) => positionalArgs.indexOf(item) === -1); } diff --git a/src/client/testing/unittest/services/discoveryService.ts b/src/client/testing/unittest/services/discoveryService.ts index f09901e37f5f..b69e0725e398 100644 --- a/src/client/testing/unittest/services/discoveryService.ts +++ b/src/client/testing/unittest/services/discoveryService.ts @@ -20,7 +20,7 @@ export class TestDiscoveryService implements ITestDiscoveryService { private readonly runner: ITestRunner; constructor( @inject(IServiceContainer) serviceContainer: IServiceContainer, - @inject(ITestsParser) @named(UNITTEST_PROVIDER) private testParser: ITestsParser + @inject(ITestsParser) @named(UNITTEST_PROVIDER) private testParser: ITestsParser, ) { this.argsHelper = serviceContainer.get(IArgumentsHelper); this.runner = serviceContainer.get(ITestRunner); @@ -35,7 +35,7 @@ export class TestDiscoveryService implements ITestDiscoveryService { cwd: options.cwd, workspaceFolder: options.workspaceFolder, token: options.token, - outChannel: options.outChannel + outChannel: options.outChannel, }; const data = await this.runner.run(UNITTEST_PROVIDER, runOptions); @@ -65,7 +65,7 @@ for suite in suites._tests: return { ...options, startDirectory: this.getStartDirectory(options), - pattern: this.getTestPattern(options) + pattern: this.getTestPattern(options), }; } private getStartDirectory(options: TestDiscoveryOptions) { diff --git a/src/client/testing/unittest/services/parserService.ts b/src/client/testing/unittest/services/parserService.ts index 41ad7c9fa28c..353e710e1fb6 100644 --- a/src/client/testing/unittest/services/parserService.ts +++ b/src/client/testing/unittest/services/parserService.ts @@ -11,7 +11,7 @@ import { TestFunction, Tests, TestStatus, - UnitTestParserOptions + UnitTestParserOptions, } from '../../common/types'; @injectable() @@ -88,7 +88,7 @@ export class TestsParser implements ITestsParser { nameToRun: moduleName, xmlName: '', status: TestStatus.Idle, - time: 0 + time: 0, }; testFiles.push(testFile); } @@ -107,7 +107,7 @@ export class TestsParser implements ITestsParser { nameToRun: suiteToRun, xmlName: '', status: TestStatus.Idle, - time: 0 + time: 0, }; testFile.suites.push(testSuite!); } @@ -117,7 +117,7 @@ export class TestsParser implements ITestsParser { name: functionName, nameToRun: testId, status: TestStatus.Idle, - time: 0 + time: 0, }; testSuite!.functions.push(testFunction); diff --git a/src/client/testing/unittest/socketServer.ts b/src/client/testing/unittest/socketServer.ts index 9dc23b87e33a..864607a22732 100644 --- a/src/client/testing/unittest/socketServer.ts +++ b/src/client/testing/unittest/socketServer.ts @@ -78,7 +78,7 @@ export class UnitTestSocketServer extends EventEmitter implements IUnitTestSocke } const lengthOfMessage = parseInt( dataStr.slice(dataStr.indexOf(':') + 1, dataStr.indexOf('{')).trim(), - 10 + 10, ); if (dataStr.length < startIndex + lengthOfMessage) { return; diff --git a/src/client/typeFormatters/blockFormatProvider.ts b/src/client/typeFormatters/blockFormatProvider.ts index 822caa5632e9..ec8d5edf16c3 100644 --- a/src/client/typeFormatters/blockFormatProvider.ts +++ b/src/client/typeFormatters/blockFormatProvider.ts @@ -4,7 +4,7 @@ import { OnTypeFormattingEditProvider, Position, TextDocument, - TextEdit + TextEdit, } from 'vscode'; import { CodeBlockFormatProvider } from './codeBlockFormatProvider'; import { @@ -19,7 +19,7 @@ import { FOR_IN_REGEX, IF_REGEX, TRY_REGEX, - WHILE_REGEX + WHILE_REGEX, } from './contracts'; export class BlockFormatProviders implements OnTypeFormattingEditProvider { @@ -35,7 +35,7 @@ export class BlockFormatProviders implements OnTypeFormattingEditProvider { ASYNC_FOR_IN_REGEX, WHILE_REGEX, TRY_REGEX, - EXCEPT_REGEX + EXCEPT_REGEX, ]; this.providers.push(new CodeBlockFormatProvider(ELSE_REGEX, elseParentBlocks, boundaryBlocks)); @@ -54,7 +54,7 @@ export class BlockFormatProviders implements OnTypeFormattingEditProvider { position: Position, ch: string, options: FormattingOptions, - _token: CancellationToken + _token: CancellationToken, ): TextEdit[] { if (position.line === 0) { return []; diff --git a/src/client/typeFormatters/codeBlockFormatProvider.ts b/src/client/typeFormatters/codeBlockFormatProvider.ts index 25d677003bb9..e912a1732257 100644 --- a/src/client/typeFormatters/codeBlockFormatProvider.ts +++ b/src/client/typeFormatters/codeBlockFormatProvider.ts @@ -5,7 +5,7 @@ export class CodeBlockFormatProvider { constructor( private blockRegExp: BlockRegEx, private previousBlockRegExps: BlockRegEx[], - private boundaryRegExps: BlockRegEx[] + private boundaryRegExps: BlockRegEx[], ) {} public canProvideEdits(line: string): boolean { return this.blockRegExp.test(line); @@ -16,7 +16,7 @@ export class CodeBlockFormatProvider { position: Position, _ch: string, options: FormattingOptions, - line: TextLine + line: TextLine, ): TextEdit[] { // We can have else for the following blocks: // if: @@ -64,7 +64,7 @@ export class CodeBlockFormatProvider { return [ TextEdit.delete(new Range(startDeletePosition, endDeletePosition)), - TextEdit.insert(startDeletePosition, prefixOfPreviousBlock) + TextEdit.insert(startDeletePosition, prefixOfPreviousBlock), ]; } } diff --git a/src/client/typeFormatters/dispatcher.ts b/src/client/typeFormatters/dispatcher.ts index 452eb2f38d79..c1668380998f 100644 --- a/src/client/typeFormatters/dispatcher.ts +++ b/src/client/typeFormatters/dispatcher.ts @@ -10,7 +10,7 @@ import { Position, ProviderResult, TextDocument, - TextEdit + TextEdit, } from 'vscode'; export class OnTypeFormattingDispatcher implements OnTypeFormattingEditProvider { @@ -25,7 +25,7 @@ export class OnTypeFormattingDispatcher implements OnTypeFormattingEditProvider position: Position, ch: string, options: FormattingOptions, - cancellationToken: CancellationToken + cancellationToken: CancellationToken, ): ProviderResult { const provider = this.providers[ch]; @@ -45,7 +45,7 @@ export class OnTypeFormattingDispatcher implements OnTypeFormattingEditProvider if (first) { return { first: first, - more: keys + more: keys, }; } diff --git a/src/client/typeFormatters/onEnterFormatter.ts b/src/client/typeFormatters/onEnterFormatter.ts index f4464b26cf6b..da4c2b166510 100644 --- a/src/client/typeFormatters/onEnterFormatter.ts +++ b/src/client/typeFormatters/onEnterFormatter.ts @@ -7,7 +7,7 @@ import { OnTypeFormattingEditProvider, Position, TextDocument, - TextEdit + TextEdit, } from 'vscode'; import { LineFormatter } from '../formatters/lineFormatter'; import { TokenizerMode, TokenType } from '../language/types'; @@ -21,7 +21,7 @@ export class OnEnterFormatter implements OnTypeFormattingEditProvider { position: Position, _ch: string, _options: FormattingOptions, - _cancellationToken: CancellationToken + _cancellationToken: CancellationToken, ): TextEdit[] { if (position.line === 0) { return []; diff --git a/src/client/workspaceSymbols/generator.ts b/src/client/workspaceSymbols/generator.ts index e90db302d26f..779440d8cfb5 100644 --- a/src/client/workspaceSymbols/generator.ts +++ b/src/client/workspaceSymbols/generator.ts @@ -24,7 +24,7 @@ export class Generator implements Disposable { private readonly appShell: IApplicationShell, private readonly fs: IFileSystem, private readonly processServiceFactory: IProcessServiceFactory, - configurationService: IConfigurationService + configurationService: IConfigurationService, ) { this.disposables = []; this.optionsFile = path.join(EXTENSION_ROOT_DIR, 'resources', 'ctagOptions'); @@ -85,7 +85,7 @@ export class Generator implements Disposable { } else { resolve(); } - } + }, ); } catch (ex) { reject(ex); diff --git a/src/client/workspaceSymbols/main.ts b/src/client/workspaceSymbols/main.ts index 256373af7a9c..57c1661a69e4 100644 --- a/src/client/workspaceSymbols/main.ts +++ b/src/client/workspaceSymbols/main.ts @@ -37,7 +37,7 @@ export class WorkspaceSymbols implements Disposable { this.registerCommands(); this.initializeGenerators(); languages.registerWorkspaceSymbolProvider( - new WorkspaceSymbolProvider(this.fs, this.commandMgr, this.generators) + new WorkspaceSymbolProvider(this.fs, this.commandMgr, this.generators), ); this.disposables.push(this.workspace.onDidChangeWorkspaceFolders(() => this.initializeGenerators())); this.disposables.push(this.documents.onDidSaveTextDocument((e) => this.onDocumentSaved(e))); @@ -61,8 +61,8 @@ export class WorkspaceSymbols implements Disposable { this.appShell, this.fs, this.processFactory, - this.configurationService - ) + this.configurationService, + ), ); }); } @@ -87,8 +87,8 @@ export class WorkspaceSymbols implements Disposable { async (rebuild: boolean = true, token?: CancellationToken) => { const promises = this.buildWorkspaceSymbols(rebuild, token); return Promise.all(promises); - } - ) + }, + ), ); } diff --git a/src/client/workspaceSymbols/parser.ts b/src/client/workspaceSymbols/parser.ts index 7ec49ba082ce..f11471644aa7 100644 --- a/src/client/workspaceSymbols/parser.ts +++ b/src/client/workspaceSymbols/parser.ts @@ -108,7 +108,7 @@ export function parseTags( tagFile: string, query: string, token: vscode.CancellationToken, - fs: IFileSystem + fs: IFileSystem, ): Promise { return fs.fileExists(tagFile).then((exists) => { if (!exists) { @@ -167,6 +167,6 @@ function parseTagsLine(workspaceFolder: string, line: string, searchPattern: str code: match.code, position: new vscode.Position(Number(match.line) - 1, 0), symbolName: match.name, - symbolKind: symbolKind + symbolKind: symbolKind, }; } diff --git a/src/client/workspaceSymbols/provider.ts b/src/client/workspaceSymbols/provider.ts index 1719445aa0ae..05ede0d2d8b3 100644 --- a/src/client/workspaceSymbols/provider.ts +++ b/src/client/workspaceSymbols/provider.ts @@ -7,7 +7,7 @@ import { Location, SymbolInformation, Uri, - WorkspaceSymbolProvider as IWorspaceSymbolProvider + WorkspaceSymbolProvider as IWorspaceSymbolProvider, } from 'vscode'; import { ICommandManager } from '../common/application/types'; import { Commands } from '../common/constants'; @@ -21,7 +21,7 @@ export class WorkspaceSymbolProvider implements IWorspaceSymbolProvider { public constructor( private fs: IFileSystem, private commands: ICommandManager, - private tagGenerators: Generator[] + private tagGenerators: Generator[], ) {} @captureTelemetry(EventName.WORKSPACE_SYMBOLS_GO_TO) @@ -30,7 +30,7 @@ export class WorkspaceSymbolProvider implements IWorspaceSymbolProvider { return []; } const generatorsWithTagFiles = await Promise.all( - this.tagGenerators.map((generator) => this.fs.fileExists(generator.tagFilePath)) + this.tagGenerators.map((generator) => this.fs.fileExists(generator.tagFilePath)), ); if (generatorsWithTagFiles.filter((exists) => exists).length !== this.tagGenerators.length) { await this.commands.executeCommand(Commands.Build_Workspace_Symbols, true, token); @@ -42,7 +42,7 @@ export class WorkspaceSymbolProvider implements IWorspaceSymbolProvider { if (await this.fs.fileExists(generator.tagFilePath)) { generators.push(generator); } - }) + }), ); const promises = generators @@ -54,7 +54,7 @@ export class WorkspaceSymbolProvider implements IWorspaceSymbolProvider { generator!.tagFilePath, query, token, - this.fs + this.fs, ); if (!Array.isArray(items)) { return []; @@ -65,8 +65,8 @@ export class WorkspaceSymbolProvider implements IWorspaceSymbolProvider { item.symbolName, item.symbolKind, '', - new Location(Uri.file(item.fileName), item.position) - ) + new Location(Uri.file(item.fileName), item.position), + ), ); }); diff --git a/src/startPage-ui/react-common/image.tsx b/src/startPage-ui/react-common/image.tsx index fa8091cbfa04..489fa3a3ce44 100644 --- a/src/startPage-ui/react-common/image.tsx +++ b/src/startPage-ui/react-common/image.tsx @@ -14,7 +14,7 @@ export enum ImageName { Interactive, Python, PythonColor, - OpenFolder + OpenFolder, } // All of the images must be 'require' so that webpack doesn't rewrite the import as requiring a .default. @@ -22,24 +22,24 @@ export enum ImageName { const images: { [key: string]: { light: string; dark: string } } = { Notebook: { light: require('./images/StartPage/Notebook.svg'), - dark: require('./images/StartPage/Notebook-inverse.svg') + dark: require('./images/StartPage/Notebook-inverse.svg'), }, Interactive: { light: require('./images/StartPage/Interactive.svg'), - dark: require('./images/StartPage/Interactive-inverse.svg') + dark: require('./images/StartPage/Interactive-inverse.svg'), }, Python: { light: require('./images/StartPage/Python.svg'), - dark: require('./images/StartPage/Python-inverse.svg') + dark: require('./images/StartPage/Python-inverse.svg'), }, PythonColor: { light: require('./images/StartPage/Python-color.svg'), - dark: require('./images/StartPage/Python-color.svg') + dark: require('./images/StartPage/Python-color.svg'), }, OpenFolder: { light: require('./images/StartPage/OpenFolder.svg'), - dark: require('./images/StartPage/OpenFolder-inverse.svg') - } + dark: require('./images/StartPage/OpenFolder-inverse.svg'), + }, }; interface IImageProps { diff --git a/src/startPage-ui/startPage/index.tsx b/src/startPage-ui/startPage/index.tsx index a9848c2b5df4..d5b875d09349 100644 --- a/src/startPage-ui/startPage/index.tsx +++ b/src/startPage-ui/startPage/index.tsx @@ -28,5 +28,5 @@ const skipDefault = testMode ? false : typeof acquireVsCodeApi !== 'undefined'; ReactDOM.render( , - document.getElementById('root') as HTMLElement + document.getElementById('root') as HTMLElement, ); diff --git a/src/startPage-ui/startPage/startPage.tsx b/src/startPage-ui/startPage/startPage.tsx index 3794c22919fe..3e34fdff6412 100644 --- a/src/startPage-ui/startPage/startPage.tsx +++ b/src/startPage-ui/startPage/startPage.tsx @@ -20,7 +20,7 @@ export interface IStartPageProps { // In general it consists of its render method and methods that send and receive messages. export class StartPage extends React.Component implements IMessageHandler { private releaseNotes: ISettingPackage = { - showAgainSetting: false + showAgainSetting: false, }; private postOffice: PostOffice = new PostOffice(); @@ -122,7 +122,7 @@ export class StartPage extends React.Component implements IMess

{getLocString( 'StartPage.openInteractiveWindow', - 'Use the Interactive Window to develop Python Scripts' + 'Use the Interactive Window to develop Python Scripts', )}
{this.renderInteractiveWindowDescription()} @@ -177,8 +177,8 @@ export class StartPage extends React.Component implements IMess dangerouslySetInnerHTML={{ __html: getLocString( 'StartPage.notebookDescription', - '- Run "" in the Command Palette (
Shift + Command + P
)
- Explore our to learn about notebook features' - ).format('openCommandPaletteWithSelection()', 'openSampleNotebook()') + '- Run "" in the Command Palette (
Shift + Command + P
)
- Explore our to learn about notebook features', + ).format('openCommandPaletteWithSelection()', 'openSampleNotebook()'), }} /> ); @@ -192,8 +192,8 @@ export class StartPage extends React.Component implements IMess dangerouslySetInnerHTML={{ __html: getLocString( 'StartPage.pythonFileDescription', - '- Create a with a .py extension' - ).format('createPythonFile()') + '- Create a with a .py extension', + ).format('createPythonFile()'), }} /> ); @@ -207,8 +207,8 @@ export class StartPage extends React.Component implements IMess dangerouslySetInnerHTML={{ __html: getLocString( 'StartPage.interactiveWindowDesc', - '- You can create cells on a Python file by typing "#%%"
- Use "
Shift + Enter
" to run a cell, the output will be shown in the interactive window' - ) + '- You can create cells on a Python file by typing "#%%"
- Use "
Shift + Enter
" to run a cell, the output will be shown in the interactive window', + ), }} /> ); @@ -222,8 +222,8 @@ export class StartPage extends React.Component implements IMess dangerouslySetInnerHTML={{ __html: getLocString( 'StartPage.folderDesc', - '- Open a
- Open a ' - ).format('openFolder()', 'openWorkspace()') + '- Open a
- Open a ', + ).format('openFolder()', 'openWorkspace()'), }} /> ); @@ -237,8 +237,8 @@ export class StartPage extends React.Component implements IMess dangerouslySetInnerHTML={{ __html: getLocString( 'StartPage.releaseNotes', - 'Take a look at our Release Notes to learn more about the latest features.' - ).format('https://aka.ms/AA8dxtb') + 'Take a look at our Release Notes to learn more about the latest features.', + ).format('https://aka.ms/AA8dxtb'), }} /> ); @@ -252,8 +252,8 @@ export class StartPage extends React.Component implements IMess dangerouslySetInnerHTML={{ __html: getLocString( 'StartPage.tutorialAndDoc', - 'Explore more features in our Tutorials or check Documentation for tips and troubleshooting.' - ).format('https://aka.ms/AA8dqti', 'https://aka.ms/AA8dxwy') + 'Explore more features in our Tutorials or check Documentation for tips and troubleshooting.', + ).format('https://aka.ms/AA8dqti', 'https://aka.ms/AA8dxwy'), }} /> ); @@ -287,7 +287,7 @@ export class StartPage extends React.Component implements IMess this.releaseNotes.showAgainSetting = !this.releaseNotes.showAgainSetting; this.postOffice.sendMessage( StartPageMessages.UpdateSettings, - this.releaseNotes.showAgainSetting + this.releaseNotes.showAgainSetting, ); }; } diff --git a/src/test/activation/activationManager.unit.test.ts b/src/test/activation/activationManager.unit.test.ts index c4fc941ed17b..b8e9c57ec068 100644 --- a/src/test/activation/activationManager.unit.test.ts +++ b/src/test/activation/activationManager.unit.test.ts @@ -26,7 +26,7 @@ import { createDeferred, createDeferredFromPromise } from '../../client/common/u import { InterpreterSecurityService } from '../../client/interpreter/autoSelection/interpreterSecurity/interpreterSecurityService'; import { IInterpreterAutoSelectionService, - IInterpreterSecurityService + IInterpreterSecurityService, } from '../../client/interpreter/autoSelection/types'; import { IInterpreterService } from '../../client/interpreter/contracts'; import { InterpreterService } from '../../client/interpreter/interpreterService'; @@ -91,7 +91,7 @@ suite('Activation Manager', () => { instance(activeResourceService), instance(experiments), interpreterPathService.object, - instance(interpreterSecurityService) + instance(interpreterSecurityService), ); sinon.stub(EnvFileTelemetry, 'sendActivationTelemetry').resolves(); @@ -300,7 +300,7 @@ suite('Activation Manager', () => { test('If doc opened is not python, return', async () => { const doc = { uri: Uri.parse('doc'), - languageId: 'NOT PYTHON' + languageId: 'NOT PYTHON', }; managerTest.onDocOpened(doc as any); @@ -310,7 +310,7 @@ suite('Activation Manager', () => { test('If we have opened a doc that does not belong to workspace, then do nothing', async () => { const doc = { uri: Uri.parse('doc'), - languageId: PYTHON_LANGUAGE + languageId: PYTHON_LANGUAGE, }; when(workspaceService.getWorkspaceFolderIdentifier(doc.uri, anything())).thenReturn(''); when(workspaceService.hasWorkspaceFolders).thenReturn(true); @@ -324,7 +324,7 @@ suite('Activation Manager', () => { test('If workspace corresponding to the doc has already been activated, then do nothing', async () => { const doc = { uri: Uri.parse('doc'), - languageId: PYTHON_LANGUAGE + languageId: PYTHON_LANGUAGE, }; when(workspaceService.getWorkspaceFolderIdentifier(doc.uri, anything())).thenReturn('key'); managerTest.activatedWorkspaces.add('key'); @@ -446,7 +446,7 @@ suite('Activation Manager', () => { instance(activeResourceService), instance(experiments), interpreterPathService.object, - instance(interpreterSecurityService) + instance(interpreterSecurityService), ); managerTest.evaluateAutoSelectedInterpreterSafety = () => Promise.resolve(); }); @@ -528,7 +528,7 @@ suite('Activation Manager', () => { instance(activeResourceService), instance(experiments), instance(interpreterPathService), - instance(interpreterSecurityService) + instance(interpreterSecurityService), ); }); @@ -542,7 +542,7 @@ suite('Activation Manager', () => { .verifiable(typemoq.Times.once()); when(interpreterPathService.get(resource)).thenReturn('python'); when( - interpreterSecurityService.evaluateAndRecordInterpreterSafety(interpreter as any, resource) + interpreterSecurityService.evaluateAndRecordInterpreterSafety(interpreter as any, resource), ).thenResolve(); await managerTest.evaluateAutoSelectedInterpreterSafety(resource); autoSelection.verifyAll(); @@ -560,12 +560,12 @@ suite('Activation Manager', () => { .verifiable(typemoq.Times.once()); when(interpreterPathService.get(resource)).thenReturn(setting); when( - interpreterSecurityService.evaluateAndRecordInterpreterSafety(interpreter as any, resource) + interpreterSecurityService.evaluateAndRecordInterpreterSafety(interpreter as any, resource), ).thenResolve(); await managerTest.evaluateAutoSelectedInterpreterSafety(resource); autoSelection.verifyAll(); verify( - interpreterSecurityService.evaluateAndRecordInterpreterSafety(interpreter as any, resource) + interpreterSecurityService.evaluateAndRecordInterpreterSafety(interpreter as any, resource), ).once(); }); }); @@ -580,7 +580,7 @@ suite('Activation Manager', () => { .verifiable(typemoq.Times.once()); when(interpreterPathService.get(resource)).thenReturn('python'); when( - interpreterSecurityService.evaluateAndRecordInterpreterSafety(interpreter as any, resource) + interpreterSecurityService.evaluateAndRecordInterpreterSafety(interpreter as any, resource), ).thenResolve(); await managerTest.evaluateAutoSelectedInterpreterSafety(resource); autoSelection.verifyAll(); @@ -604,10 +604,10 @@ suite('Activation Manager', () => { autoSelection.setup((a) => a.getAutoSelectedInterpreter(resource)).returns(() => interpreter as any); when(interpreterPathService.get(resource)).thenReturn('python'); when( - interpreterSecurityService.evaluateAndRecordInterpreterSafety(interpreter as any, resource) + interpreterSecurityService.evaluateAndRecordInterpreterSafety(interpreter as any, resource), ).thenReturn(evaluateIfInterpreterIsSafeDeferred.promise); const deferredPromise = createDeferredFromPromise( - managerTest.evaluateAutoSelectedInterpreterSafety(resource) + managerTest.evaluateAutoSelectedInterpreterSafety(resource), ); expect(deferredPromise.completed).to.equal(false, 'Promise should not be resolved yet'); reset(interpreterPathService); diff --git a/src/test/activation/activationService.unit.test.ts b/src/test/activation/activationService.unit.test.ts index b85b27917aba..d9564b3324cf 100644 --- a/src/test/activation/activationService.unit.test.ts +++ b/src/test/activation/activationService.unit.test.ts @@ -11,7 +11,7 @@ import { IExtensionActivationService, ILanguageServerActivator, ILanguageServerFolderService, - LanguageServerType + LanguageServerType, } from '../../client/activation/types'; import { LSNotSupportedDiagnosticServiceId } from '../../client/application/diagnostics/checks/lsNotSupported'; import { IDiagnostic, IDiagnosticsService } from '../../client/application/diagnostics/types'; @@ -26,7 +26,7 @@ import { IPersistentState, IPersistentStateFactory, IPythonSettings, - Resource + Resource, } from '../../client/common/types'; import { noop } from '../../client/common/utils/misc'; import { Architecture } from '../../client/common/utils/platform'; @@ -69,7 +69,7 @@ suite('Language Server Activation - ActivationService', () => { const extensionsMock = TypeMoq.Mock.ofType(); const folderVer: FolderVersionPair = { path: '', - version: new SemVer('1.2.3') + version: new SemVer('1.2.3'), }; lsNotSupportedDiagnosticService = TypeMoq.Mock.ofType(); workspaceService.setup((w) => w.hasWorkspaceFolders).returns(() => false); @@ -91,8 +91,8 @@ suite('Language Server Activation - ActivationService', () => { f.createGlobalPersistentState( TypeMoq.It.isValue('SWITCH_LS'), TypeMoq.It.isAny(), - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => state.object); state.setup((s) => s.value).returns(() => undefined); @@ -134,8 +134,8 @@ suite('Language Server Activation - ActivationService', () => { .setup((s) => s.get( TypeMoq.It.isValue(IDiagnosticsService), - TypeMoq.It.isValue(LSNotSupportedDiagnosticServiceId) - ) + TypeMoq.It.isValue(LSNotSupportedDiagnosticServiceId), + ), ) .returns(() => lsNotSupportedDiagnosticService.object); }); @@ -144,7 +144,7 @@ suite('Language Server Activation - ActivationService', () => { activationService: IExtensionActivationService, activator: TypeMoq.IMock, lsSupported: boolean = true, - activatorName: LanguageServerType = LanguageServerType.Jedi + activatorName: LanguageServerType = LanguageServerType.Jedi, ) { activator .setup((a) => a.start(undefined, undefined)) @@ -175,7 +175,7 @@ suite('Language Server Activation - ActivationService', () => { .returns(() => Promise.resolve()); serviceContainer .setup((c) => - c.get(TypeMoq.It.isValue(ILanguageServerActivator), TypeMoq.It.isValue(activatorName)) + c.get(TypeMoq.It.isValue(ILanguageServerActivator), TypeMoq.It.isValue(activatorName)), ) .returns(() => activator.object) .verifiable(TypeMoq.Times.once()); @@ -190,7 +190,7 @@ suite('Language Server Activation - ActivationService', () => { let callbackHandler!: (e: ConfigurationChangeEvent) => Promise; workspaceService .setup((w) => - w.onDidChangeConfiguration(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + w.onDidChangeConfiguration(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .callback((cb) => (callbackHandler = cb)) .returns(() => TypeMoq.Mock.ofType().object) @@ -200,7 +200,7 @@ suite('Language Server Activation - ActivationService', () => { const activator = TypeMoq.Mock.ofType(); const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); workspaceService.verifyAll(); @@ -209,7 +209,7 @@ suite('Language Server Activation - ActivationService', () => { const event = TypeMoq.Mock.ofType(); event .setup((e) => - e.affectsConfiguration(TypeMoq.It.isValue(`python.${settingName}`), TypeMoq.It.isAny()) + e.affectsConfiguration(TypeMoq.It.isValue(`python.${settingName}`), TypeMoq.It.isAny()), ) .returns(() => true) .verifiable(TypeMoq.Times.atLeastOnce()); @@ -238,7 +238,7 @@ suite('Language Server Activation - ActivationService', () => { const activator = TypeMoq.Mock.ofType(); const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); await testActivation(activationService, activator, true); @@ -248,7 +248,7 @@ suite('Language Server Activation - ActivationService', () => { const activator = TypeMoq.Mock.ofType(); const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); await testActivation(activationService, activator, false); @@ -259,7 +259,7 @@ suite('Language Server Activation - ActivationService', () => { const activator = TypeMoq.Mock.ofType(); const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); await testActivation(activationService, activator); @@ -269,7 +269,7 @@ suite('Language Server Activation - ActivationService', () => { const activator = TypeMoq.Mock.ofType(); const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); await testActivation(activationService, activator); @@ -284,7 +284,7 @@ suite('Language Server Activation - ActivationService', () => { const activator = TypeMoq.Mock.ofType(); const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); await testActivation(activationService, activator, false, LanguageServerType.None); }); @@ -295,7 +295,7 @@ suite('Language Server Activation - ActivationService', () => { let callbackHandler!: (e: ConfigurationChangeEvent) => Promise; workspaceService .setup((w) => - w.onDidChangeConfiguration(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + w.onDidChangeConfiguration(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .callback((cb) => (callbackHandler = cb)) .returns(() => TypeMoq.Mock.ofType().object) @@ -305,7 +305,7 @@ suite('Language Server Activation - ActivationService', () => { const activator = TypeMoq.Mock.ofType(); const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); workspaceService.verifyAll(); @@ -314,7 +314,7 @@ suite('Language Server Activation - ActivationService', () => { const event = TypeMoq.Mock.ofType(); event .setup((e) => - e.affectsConfiguration(TypeMoq.It.isValue('python.languageServer'), TypeMoq.It.isAny()) + e.affectsConfiguration(TypeMoq.It.isValue('python.languageServer'), TypeMoq.It.isAny()), ) .returns(() => false) .verifiable(TypeMoq.Times.atLeastOnce()); @@ -340,7 +340,7 @@ suite('Language Server Activation - ActivationService', () => { envName: '1', sysVersion: '3.1.1.1', architecture: Architecture.x64, - envType: EnvironmentType.Unknown + envType: EnvironmentType.Unknown, }; const interpreter2: PythonEnvironment = { path: '/foo/baz/python', @@ -348,7 +348,7 @@ suite('Language Server Activation - ActivationService', () => { envName: '2', sysVersion: '3.1.1.1', architecture: Architecture.x64, - envType: EnvironmentType.Unknown + envType: EnvironmentType.Unknown, }; const folder1 = { name: 'one', uri: Uri.parse('one'), index: 1 }; const activator = TypeMoq.Mock.ofType(); @@ -380,7 +380,7 @@ suite('Language Server Activation - ActivationService', () => { pythonSettings.setup((p) => p.languageServer).returns(() => LanguageServerType.Microsoft); const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); const ls1 = await activationService.get(folder1.uri, interpreter1); const ls2 = await activationService.get(folder1.uri, interpreter2); @@ -399,7 +399,7 @@ suite('Language Server Activation - ActivationService', () => { envName: '1', sysVersion: '3.1.1.1', architecture: Architecture.x64, - envType: EnvironmentType.Unknown + envType: EnvironmentType.Unknown, }; const interpreter2: PythonEnvironment = { path: '/foo/baz/python', @@ -407,7 +407,7 @@ suite('Language Server Activation - ActivationService', () => { envName: '2', sysVersion: '3.1.1.1', architecture: Architecture.x64, - envType: EnvironmentType.Unknown + envType: EnvironmentType.Unknown, }; let getActiveCount = 0; interpreterService @@ -450,7 +450,7 @@ suite('Language Server Activation - ActivationService', () => { pythonSettings.setup((p) => p.languageServer).returns(() => LanguageServerType.Microsoft); const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); await activationService.activate(folder1.uri); await interpreterChangedHandler(); @@ -472,7 +472,7 @@ suite('Language Server Activation - ActivationService', () => { const activatorJedi = TypeMoq.Mock.ofType(); const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); const diagnostics: IDiagnostic[] = []; lsNotSupportedDiagnosticService @@ -485,8 +485,8 @@ suite('Language Server Activation - ActivationService', () => { .setup((c) => c.get( TypeMoq.It.isValue(ILanguageServerActivator), - TypeMoq.It.isValue(LanguageServerType.Microsoft) - ) + TypeMoq.It.isValue(LanguageServerType.Microsoft), + ), ) .returns(() => activatorLS.object) .verifiable(TypeMoq.Times.once()); @@ -498,8 +498,8 @@ suite('Language Server Activation - ActivationService', () => { .setup((c) => c.get( TypeMoq.It.isValue(ILanguageServerActivator), - TypeMoq.It.isValue(LanguageServerType.Jedi) - ) + TypeMoq.It.isValue(LanguageServerType.Jedi), + ), ) .returns(() => activatorJedi.object) .verifiable(TypeMoq.Times.once()); @@ -521,7 +521,7 @@ suite('Language Server Activation - ActivationService', () => { async function testActivationOfResource( activationService: IExtensionActivationService, activator: TypeMoq.IMock, - resource: Resource + resource: Resource, ) { activator .setup((a) => a.start(TypeMoq.It.isValue(resource), undefined)) @@ -538,8 +538,8 @@ suite('Language Server Activation - ActivationService', () => { .setup((c) => c.get( TypeMoq.It.isValue(ILanguageServerActivator), - TypeMoq.It.isValue(LanguageServerType.Microsoft) - ) + TypeMoq.It.isValue(LanguageServerType.Microsoft), + ), ) .returns(() => activator.object) .verifiable(TypeMoq.Times.atLeastOnce()); @@ -564,7 +564,7 @@ suite('Language Server Activation - ActivationService', () => { .verifiable(TypeMoq.Times.once()); const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); workspaceService.verifyAll(); expect(workspaceFoldersChangedHandler).not.to.be.equal(undefined, 'Handler not set'); @@ -603,7 +603,7 @@ suite('Language Server Activation - ActivationService', () => { const activator1 = TypeMoq.Mock.ofType(); const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); const folder1 = { name: 'one', uri: Uri.parse('one'), index: 1 }; const folder2 = { name: 'two', uri: Uri.parse('two'), index: 2 }; @@ -611,8 +611,8 @@ suite('Language Server Activation - ActivationService', () => { .setup((c) => c.get( TypeMoq.It.isValue(ILanguageServerActivator), - TypeMoq.It.isValue(LanguageServerType.Jedi) - ) + TypeMoq.It.isValue(LanguageServerType.Jedi), + ), ) .returns(() => activator1.object) .verifiable(TypeMoq.Times.once()); @@ -630,8 +630,8 @@ suite('Language Server Activation - ActivationService', () => { .setup((c) => c.get( TypeMoq.It.isValue(ILanguageServerActivator), - TypeMoq.It.isValue(LanguageServerType.Jedi) - ) + TypeMoq.It.isValue(LanguageServerType.Jedi), + ), ) .returns(() => activator2.object) .verifiable(TypeMoq.Times.once()); @@ -647,7 +647,7 @@ suite('Language Server Activation - ActivationService', () => { activator2.verifyAll(); }); } - } + }, ); }); @@ -680,7 +680,7 @@ suite('Language Server Activation - ActivationService', () => { const extensionsMock = TypeMoq.Mock.ofType(); const folderVer: FolderVersionPair = { path: '', - version: new SemVer('1.2.3') + version: new SemVer('1.2.3'), }; lsNotSupportedDiagnosticService = TypeMoq.Mock.ofType(); workspaceService.setup((w) => w.hasWorkspaceFolders).returns(() => false); @@ -694,8 +694,8 @@ suite('Language Server Activation - ActivationService', () => { f.createGlobalPersistentState( TypeMoq.It.isValue('SWITCH_LS'), TypeMoq.It.isAny(), - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => state.object); state.setup((s) => s.value).returns(() => undefined); @@ -731,8 +731,8 @@ suite('Language Server Activation - ActivationService', () => { .setup((s) => s.get( TypeMoq.It.isValue(IDiagnosticsService), - TypeMoq.It.isValue(LSNotSupportedDiagnosticServiceId) - ) + TypeMoq.It.isValue(LSNotSupportedDiagnosticServiceId), + ), ) .returns(() => lsNotSupportedDiagnosticService.object); }); @@ -753,7 +753,7 @@ suite('Language Server Activation - ActivationService', () => { const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); await activationService.sendTelemetryForChosenLanguageServer(LanguageServerType.Jedi); @@ -772,7 +772,7 @@ suite('Language Server Activation - ActivationService', () => { const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); await activationService.sendTelemetryForChosenLanguageServer(LanguageServerType.Microsoft); @@ -791,7 +791,7 @@ suite('Language Server Activation - ActivationService', () => { const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); await activationService.sendTelemetryForChosenLanguageServer(LanguageServerType.Jedi); @@ -810,7 +810,7 @@ suite('Language Server Activation - ActivationService', () => { const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); await activationService.sendTelemetryForChosenLanguageServer(LanguageServerType.Jedi); @@ -847,7 +847,7 @@ suite('Language Server Activation - ActivationService', () => { const extensionsMock = TypeMoq.Mock.ofType(); const folderVer: FolderVersionPair = { path: '', - version: new SemVer('1.2.3') + version: new SemVer('1.2.3'), }; lsNotSupportedDiagnosticService = TypeMoq.Mock.ofType(); workspaceService.setup((w) => w.hasWorkspaceFolders).returns(() => false); @@ -861,8 +861,8 @@ suite('Language Server Activation - ActivationService', () => { f.createGlobalPersistentState( TypeMoq.It.isValue('SWITCH_LS'), TypeMoq.It.isAny(), - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => state.object); state.setup((s) => s.value).returns(() => undefined); @@ -898,8 +898,8 @@ suite('Language Server Activation - ActivationService', () => { .setup((s) => s.get( TypeMoq.It.isValue(IDiagnosticsService), - TypeMoq.It.isValue(LSNotSupportedDiagnosticServiceId) - ) + TypeMoq.It.isValue(LSNotSupportedDiagnosticServiceId), + ), ) .returns(() => lsNotSupportedDiagnosticService.object); }); @@ -910,7 +910,7 @@ suite('Language Server Activation - ActivationService', () => { .map(() => Array(3) .fill(false) - .map(() => Array(3).fill(false)) + .map(() => Array(3).fill(false)), ); expectedResults[0][0][0] = true; for (const globalIndex of index) { @@ -920,7 +920,7 @@ suite('Language Server Activation - ActivationService', () => { const settings = { globalValue: value[globalIndex], workspaceValue: value[workspaceIndex], - workspaceFolderValue: value[workspaceFolderIndex] + workspaceFolderValue: value[workspaceFolderIndex], }; const testName = `Returns ${expectedResult} for setting = ${JSON.stringify(settings)}`; test(testName, async () => { @@ -932,7 +932,7 @@ suite('Language Server Activation - ActivationService', () => { const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); const result = activationService.isJediUsingDefaultConfiguration(Uri.parse('a')); expect(result).to.equal(expectedResult); @@ -952,7 +952,7 @@ suite('Language Server Activation - ActivationService', () => { const activationService = new LanguageServerExtensionActivationService( serviceContainer.object, - stateFactory.object + stateFactory.object, ); const result = activationService.isJediUsingDefaultConfiguration(Uri.parse('a')); expect(result).to.equal(false, 'Return value should be false'); diff --git a/src/test/activation/activeResource.unit.test.ts b/src/test/activation/activeResource.unit.test.ts index ca203155078c..bb6510564782 100644 --- a/src/test/activation/activeResource.unit.test.ts +++ b/src/test/activation/activeResource.unit.test.ts @@ -26,8 +26,8 @@ suite('Active resource service', () => { const activeTextEditor = { document: { isUntitled: false, - uri: Uri.parse('a') - } + uri: Uri.parse('a'), + }, }; // tslint:disable-next-line:no-any when(documentManager.activeTextEditor).thenReturn(activeTextEditor as any); @@ -43,8 +43,8 @@ suite('Active resource service', () => { const activeTextEditor = { document: { isUntitled: true, - uri: Uri.parse('a') - } + uri: Uri.parse('a'), + }, }; // tslint:disable-next-line:no-any when(documentManager.activeTextEditor).thenReturn(activeTextEditor as any); @@ -60,11 +60,11 @@ suite('Active resource service', () => { test('If no document is currently opened & the workspace opened contains workspace folders, return the uri of the first workspace folder', async () => { const workspaceFolders = [ { - uri: Uri.parse('a') + uri: Uri.parse('a'), }, { - uri: Uri.parse('b') - } + uri: Uri.parse('b'), + }, ]; when(documentManager.activeTextEditor).thenReturn(undefined); // tslint:disable-next-line:no-any diff --git a/src/test/activation/extensionSurvey.unit.test.ts b/src/test/activation/extensionSurvey.unit.test.ts index d49c566df0bf..6f5a3d6274fd 100644 --- a/src/test/activation/extensionSurvey.unit.test.ts +++ b/src/test/activation/extensionSurvey.unit.test.ts @@ -17,7 +17,7 @@ import { IExperimentsManager, IPersistentState, IPersistentStateFactory, - IRandom + IRandom, } from '../../client/common/types'; import { createDeferred } from '../../client/common/utils/async'; import { Common, ExtensionSurveyBanner } from '../../client/common/utils/localize'; @@ -52,11 +52,11 @@ suite('Extension survey prompt - shouldShowBanner()', () => { persistentStateFactory.createGlobalPersistentState( extensionSurveyStateKeys.disableSurveyForTime, false, - anything() - ) + anything(), + ), ).thenReturn(disableSurveyForTime.object); when( - persistentStateFactory.createGlobalPersistentState(extensionSurveyStateKeys.doNotShowAgain, false) + persistentStateFactory.createGlobalPersistentState(extensionSurveyStateKeys.doNotShowAgain, false), ).thenReturn(doNotShowAgain.object); extensionSurveyPrompt = new ExtensionSurveyPrompt( appShell.object, @@ -66,7 +66,7 @@ suite('Extension survey prompt - shouldShowBanner()', () => { experiments.object, appEnvironment.object, platformService.object, - 10 + 10, ); }); test('Returns false if do not show again is clicked', async () => { @@ -83,11 +83,11 @@ suite('Extension survey prompt - shouldShowBanner()', () => { persistentStateFactory.createGlobalPersistentState( extensionSurveyStateKeys.disableSurveyForTime, false, - anything() - ) + anything(), + ), ).never(); verify( - persistentStateFactory.createGlobalPersistentState(extensionSurveyStateKeys.doNotShowAgain, false) + persistentStateFactory.createGlobalPersistentState(extensionSurveyStateKeys.doNotShowAgain, false), ).once(); random.verifyAll(); }); @@ -106,11 +106,11 @@ suite('Extension survey prompt - shouldShowBanner()', () => { persistentStateFactory.createGlobalPersistentState( extensionSurveyStateKeys.disableSurveyForTime, false, - anything() - ) + anything(), + ), ).once(); verify( - persistentStateFactory.createGlobalPersistentState(extensionSurveyStateKeys.doNotShowAgain, false) + persistentStateFactory.createGlobalPersistentState(extensionSurveyStateKeys.doNotShowAgain, false), ).once(); random.verifyAll(); }); @@ -145,7 +145,7 @@ suite('Extension survey prompt - shouldShowBanner()', () => { experiments.object, appEnvironment.object, platformService.object, - 100 + 100, ); disableSurveyForTime.setup((d) => d.value).returns(() => false); doNotShowAgain.setup((d) => d.value).returns(() => false); @@ -165,7 +165,7 @@ suite('Extension survey prompt - shouldShowBanner()', () => { experiments.object, appEnvironment.object, platformService.object, - 0 + 0, ); disableSurveyForTime.setup((d) => d.value).returns(() => false); doNotShowAgain.setup((d) => d.value).returns(() => false); @@ -203,11 +203,11 @@ suite('Extension survey prompt - showSurvey()', () => { persistentStateFactory.createGlobalPersistentState( extensionSurveyStateKeys.disableSurveyForTime, false, - anything() - ) + anything(), + ), ).thenReturn(disableSurveyForTime.object); when( - persistentStateFactory.createGlobalPersistentState(extensionSurveyStateKeys.doNotShowAgain, false) + persistentStateFactory.createGlobalPersistentState(extensionSurveyStateKeys.doNotShowAgain, false), ).thenReturn(doNotShowAgain.object); experiments = TypeMoq.Mock.ofType(); extensionSurveyPrompt = new ExtensionSurveyPrompt( @@ -218,18 +218,18 @@ suite('Extension survey prompt - showSurvey()', () => { experiments.object, appEnvironment.object, platformService.object, - 10 + 10, ); }); test("Launch survey if 'Yes' option is clicked", async () => { const packageJson = { - version: 'extensionVersion' + version: 'extensionVersion', }; const prompts = [ ExtensionSurveyBanner.bannerLabelYes(), ExtensionSurveyBanner.maybeLater(), - Common.doNotShowAgain() + Common.doNotShowAgain(), ]; const expectedUrl = `https://aka.ms/AA5rjx5?o=Windows&v=vscodeVersion&e=extensionVersion&m=sessionId`; appEnvironment @@ -271,11 +271,11 @@ suite('Extension survey prompt - showSurvey()', () => { persistentStateFactory.createGlobalPersistentState( extensionSurveyStateKeys.disableSurveyForTime, false, - anything() - ) + anything(), + ), ).once(); verify( - persistentStateFactory.createGlobalPersistentState(extensionSurveyStateKeys.doNotShowAgain, false) + persistentStateFactory.createGlobalPersistentState(extensionSurveyStateKeys.doNotShowAgain, false), ).never(); appShell.verifyAll(); browserService.verifyAll(); @@ -289,7 +289,7 @@ suite('Extension survey prompt - showSurvey()', () => { const prompts = [ ExtensionSurveyBanner.bannerLabelYes(), ExtensionSurveyBanner.maybeLater(), - Common.doNotShowAgain() + Common.doNotShowAgain(), ]; platformService.setup((p) => p.osType).verifiable(TypeMoq.Times.never()); appShell @@ -315,11 +315,11 @@ suite('Extension survey prompt - showSurvey()', () => { persistentStateFactory.createGlobalPersistentState( extensionSurveyStateKeys.disableSurveyForTime, false, - anything() - ) + anything(), + ), ).never(); verify( - persistentStateFactory.createGlobalPersistentState(extensionSurveyStateKeys.doNotShowAgain, false) + persistentStateFactory.createGlobalPersistentState(extensionSurveyStateKeys.doNotShowAgain, false), ).never(); appShell.verifyAll(); browserService.verifyAll(); @@ -332,7 +332,7 @@ suite('Extension survey prompt - showSurvey()', () => { const prompts = [ ExtensionSurveyBanner.bannerLabelYes(), ExtensionSurveyBanner.maybeLater(), - Common.doNotShowAgain() + Common.doNotShowAgain(), ]; platformService.setup((p) => p.osType).verifiable(TypeMoq.Times.never()); appShell @@ -358,11 +358,11 @@ suite('Extension survey prompt - showSurvey()', () => { persistentStateFactory.createGlobalPersistentState( extensionSurveyStateKeys.disableSurveyForTime, false, - anything() - ) + anything(), + ), ).never(); verify( - persistentStateFactory.createGlobalPersistentState(extensionSurveyStateKeys.doNotShowAgain, false) + persistentStateFactory.createGlobalPersistentState(extensionSurveyStateKeys.doNotShowAgain, false), ).never(); appShell.verifyAll(); browserService.verifyAll(); @@ -375,7 +375,7 @@ suite('Extension survey prompt - showSurvey()', () => { const prompts = [ ExtensionSurveyBanner.bannerLabelYes(), ExtensionSurveyBanner.maybeLater(), - Common.doNotShowAgain() + Common.doNotShowAgain(), ]; platformService.setup((p) => p.osType).verifiable(TypeMoq.Times.never()); appShell @@ -401,11 +401,11 @@ suite('Extension survey prompt - showSurvey()', () => { persistentStateFactory.createGlobalPersistentState( extensionSurveyStateKeys.disableSurveyForTime, false, - anything() - ) + anything(), + ), ).never(); verify( - persistentStateFactory.createGlobalPersistentState(extensionSurveyStateKeys.doNotShowAgain, false) + persistentStateFactory.createGlobalPersistentState(extensionSurveyStateKeys.doNotShowAgain, false), ).once(); appShell.verifyAll(); browserService.verifyAll(); @@ -453,7 +453,7 @@ suite('Extension survey prompt - activate()', () => { experiments.object, appEnvironment.object, platformService.object, - 10 + 10, ); experiments .setup((exp) => exp.inExperiment(ShowExtensionSurveyPrompt.enabled)) @@ -487,7 +487,7 @@ suite('Extension survey prompt - activate()', () => { appEnvironment.object, platformService.object, 10, - 50 + 50, ); experiments .setup((exp) => exp.inExperiment(ShowExtensionSurveyPrompt.enabled)) @@ -525,7 +525,7 @@ suite('Extension survey prompt - activate()', () => { appEnvironment.object, platformService.object, 10, - 50 + 50, ); experiments .setup((exp) => exp.inExperiment(ShowExtensionSurveyPrompt.enabled)) diff --git a/src/test/activation/languageServer/activator.unit.test.ts b/src/test/activation/languageServer/activator.unit.test.ts index 13452eac1356..1b9ca594ac15 100644 --- a/src/test/activation/languageServer/activator.unit.test.ts +++ b/src/test/activation/languageServer/activator.unit.test.ts @@ -11,7 +11,7 @@ import { DotNetLanguageServerManager } from '../../../client/activation/language import { ILanguageServerDownloader, ILanguageServerFolderService, - ILanguageServerManager + ILanguageServerManager, } from '../../../client/activation/types'; import { IWorkspaceService } from '../../../client/common/application/types'; import { IFileSystem } from '../../../client/common/platform/types'; @@ -49,7 +49,7 @@ suite('Microsoft Language Server - Activator', () => { instance(lsDownloader), instance(lsFolderService), instance(configuration), - instance(banner) + instance(banner), ); }); test('Manager must be started without any workspace', async () => { @@ -150,7 +150,7 @@ suite('Microsoft Language Server - Activator', () => { const mscorlib = path.join(languageServerFolderPath, 'mscorlib.dll'); const targetJsonFile = path.join( languageServerFolderPath, - 'Microsoft.Python.LanguageServer.runtimeconfig.json' + 'Microsoft.Python.LanguageServer.runtimeconfig.json', ); when(settings.downloadLanguageServer).thenReturn(true); @@ -171,7 +171,7 @@ suite('Microsoft Language Server - Activator', () => { const mscorlib = path.join(languageServerFolderPath, 'mscorlib.dll'); const targetJsonFile = path.join( languageServerFolderPath, - 'Microsoft.Python.LanguageServer.runtimeconfig.json' + 'Microsoft.Python.LanguageServer.runtimeconfig.json', ); const jsonContents = { runtimeOptions: { configProperties: { 'System.Globalization.Invariant': false } } }; diff --git a/src/test/activation/languageServer/analysisOptions.unit.test.ts b/src/test/activation/languageServer/analysisOptions.unit.test.ts index 34d12c454939..34551cf3c0df 100644 --- a/src/test/activation/languageServer/analysisOptions.unit.test.ts +++ b/src/test/activation/languageServer/analysisOptions.unit.test.ts @@ -19,7 +19,7 @@ import { IDisposable, IExtensionContext, IOutputChannel, - IPathUtils + IPathUtils, } from '../../../client/common/types'; import { EnvironmentVariablesProvider } from '../../../client/common/variables/environmentVariablesProvider'; import { IEnvironmentVariablesProvider } from '../../../client/common/variables/types'; @@ -77,7 +77,7 @@ suite('Language Server - Analysis Options', () => { instance(workspace), lsOutputChannel.object, instance(pathUtils), - instance(lsFolderService) + instance(lsFolderService), ); }); test('Initialize will add event handlers and will dispose them when running dispose', async () => { @@ -212,7 +212,7 @@ suite('Language Server - Analysis Options', () => { { scheme: 'file', language: PYTHON_LANGUAGE }, { scheme: 'untitled', language: PYTHON_LANGUAGE }, { scheme: 'vscode-notebook', language: PYTHON_LANGUAGE }, - { scheme: 'vscode-notebook-cell', language: PYTHON_LANGUAGE } + { scheme: 'vscode-notebook-cell', language: PYTHON_LANGUAGE }, ]; const selector = analysisOptions.getDocumentFilters(); @@ -227,7 +227,7 @@ suite('Language Server - Analysis Options', () => { { scheme: 'file', language: PYTHON_LANGUAGE }, { scheme: 'untitled', language: PYTHON_LANGUAGE }, { scheme: 'vscode-notebook', language: PYTHON_LANGUAGE }, - { scheme: 'vscode-notebook-cell', language: PYTHON_LANGUAGE } + { scheme: 'vscode-notebook-cell', language: PYTHON_LANGUAGE }, ]; const selector = analysisOptions.getDocumentFilters(workspaceFolder); @@ -243,7 +243,7 @@ suite('Language Server - Analysis Options', () => { { scheme: 'file', language: PYTHON_LANGUAGE, pattern: `${workspaceFolder1.uri.fsPath}/**/*` }, { scheme: 'untitled', language: PYTHON_LANGUAGE }, { scheme: 'vscode-notebook', language: PYTHON_LANGUAGE }, - { scheme: 'vscode-notebook-cell', language: PYTHON_LANGUAGE } + { scheme: 'vscode-notebook-cell', language: PYTHON_LANGUAGE }, ]; const selector = analysisOptions.getDocumentFilters(workspaceFolder1); diff --git a/src/test/activation/languageServer/downloadChannelRules.unit.test.ts b/src/test/activation/languageServer/downloadChannelRules.unit.test.ts index 2b7c09eddb9e..6f0fdc1d5caa 100644 --- a/src/test/activation/languageServer/downloadChannelRules.unit.test.ts +++ b/src/test/activation/languageServer/downloadChannelRules.unit.test.ts @@ -10,7 +10,7 @@ import * as typeMoq from 'typemoq'; import { DownloadBetaChannelRule, DownloadDailyChannelRule, - DownloadStableChannelRule + DownloadStableChannelRule, } from '../../../client/activation/common/downloadChannelRules'; import { IPersistentState, IPersistentStateFactory } from '../../../client/common/types'; import { IServiceContainer } from '../../../client/ioc/types'; @@ -30,7 +30,7 @@ suite('Microsoft Language Server Download Channel Rules', () => { const hasExistingLSFolder = currentFolderPath ? false : true; expect(await rule.shouldLookForNewLanguageServer(currentFolder)).to.be.equal( hasExistingLSFolder, - 'invalid value' + 'invalid value', ); }); @@ -45,7 +45,7 @@ suite('Microsoft Language Server Download Channel Rules', () => { state = typeMoq.Mock.ofType>(); stateFactory .setup((s) => - s.createGlobalPersistentState(typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny()) + s.createGlobalPersistentState(typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny()), ) .returns(() => state.object) .verifiable(typeMoq.Times.once()); @@ -71,7 +71,7 @@ suite('Microsoft Language Server Download Channel Rules', () => { const shouldDownload = currentFolderPath ? false : true; expect(await rule.shouldLookForNewLanguageServer(currentFolder)).to.be.equal( shouldDownload, - 'invalid value' + 'invalid value', ); }); }); diff --git a/src/test/activation/languageServer/downloader.unit.test.ts b/src/test/activation/languageServer/downloader.unit.test.ts index fa72ee5e8cf9..b2c96454ec7f 100644 --- a/src/test/activation/languageServer/downloader.unit.test.ts +++ b/src/test/activation/languageServer/downloader.unit.test.ts @@ -16,7 +16,7 @@ import { DotNetLanguageServerFolderService } from '../../../client/activation/la import { ILanguageServerFolderService, ILanguageServerOutputChannel, - IPlatformData + IPlatformData, } from '../../../client/activation/types'; import { ApplicationShell } from '../../../client/common/application/applicationShell'; import { IApplicationShell, IWorkspaceService } from '../../../client/common/application/types'; @@ -53,7 +53,7 @@ suite('Language Server Activation - Downloader', () => { undefined as any, undefined as any, workspaceService.object, - undefined as any + undefined as any, ); }); @@ -192,7 +192,7 @@ suite('Language Server Activation - Downloader', () => { instance(appShell), instance(fs), instance(workspaceService), - undefined as any + undefined as any, ); }); @@ -202,7 +202,7 @@ suite('Language Server Activation - Downloader', () => { const expectedDownloadOptions = { extension: '.nupkg', outputChannel: instance(outputChannelDownload), - progressMessagePrefix: downloadTitle + progressMessagePrefix: downloadTitle, }; const file = await lsDownloader.downloadFile(downloadUri, downloadTitle); @@ -299,7 +299,7 @@ suite('Language Server Activation - Downloader', () => { appShell.object, fs.object, workspaceService.object, - undefined as any + undefined as any, ); languageServerExtractorTest = new LanguageServerExtractorTest( lsOutputChannel.object, @@ -308,7 +308,7 @@ suite('Language Server Activation - Downloader', () => { appShell.object, fs.object, workspaceService.object, - undefined as any + undefined as any, ); languageServerBundledTest = new LanguageServeBundledTest( lsOutputChannel.object, @@ -317,7 +317,7 @@ suite('Language Server Activation - Downloader', () => { appShell.object, fs.object, workspaceService.object, - undefined as any + undefined as any, ); }); test('Display error message if LS downloading fails', async () => { @@ -386,6 +386,6 @@ function makePkgInfo(name: string, uri: string, version: string = '0.0.0') { return { package: name, uri: uri, - version: new SemVer(version) + version: new SemVer(version), } as any; } diff --git a/src/test/activation/languageServer/languageClientFactory.unit.test.ts b/src/test/activation/languageServer/languageClientFactory.unit.test.ts index 5b1b73ffe03e..69538d02dd1d 100644 --- a/src/test/activation/languageServer/languageClientFactory.unit.test.ts +++ b/src/test/activation/languageServer/languageClientFactory.unit.test.ts @@ -15,7 +15,7 @@ import { LanguageClientOptions, ServerOptions } from 'vscode-languageclient/node import { DotNetDownloadedLanguageClientFactory, DotNetLanguageClientFactory, - DotNetSimpleLanguageClientFactory + DotNetSimpleLanguageClientFactory, } from '../../../client/activation/languageServer/languageClientFactory'; import { DotNetLanguageServerFolderService } from '../../../client/activation/languageServer/languageServerFolderService'; import { PlatformData } from '../../../client/activation/languageServer/platformData'; @@ -53,7 +53,7 @@ suite('Language Server - LanguageClient Factory', () => { undefined as any, undefined as any, instance(downloadFactory), - instance(simpleFactory) + instance(simpleFactory), ); const uri = Uri.file(__filename); const options = typemoq.Mock.ofType().object; @@ -80,7 +80,7 @@ suite('Language Server - LanguageClient Factory', () => { undefined as any, undefined as any, instance(downloadFactory), - instance(simpleFactory) + instance(simpleFactory), ); const uri = Uri.file(__filename); const options = typemoq.Mock.ofType().object; @@ -109,7 +109,7 @@ suite('Language Server - LanguageClient Factory', () => { const serverModule = path.join(EXTENSION_ROOT_DIR, languageServerFolder, engineDllName); const expectedServerOptions = { run: { command: serverModule, args: [], options: { stdio: 'pipe', env: { FOO: 'bar' } } }, - debug: { command: serverModule, args: ['--debug'], options: { stdio: 'pipe', env: { FOO: 'bar' } } } + debug: { command: serverModule, args: ['--debug'], options: { stdio: 'pipe', env: { FOO: 'bar' } } }, }; rewiremock.enable(); @@ -118,7 +118,7 @@ suite('Language Server - LanguageClient Factory', () => { language: string, name: string, serverOptions: ServerOptions, - clientOptions: LanguageClientOptions + clientOptions: LanguageClientOptions, ) { expect(language).to.be.equal('python'); expect(name).to.be.equal(languageClientName); @@ -153,8 +153,8 @@ suite('Language Server - LanguageClient Factory', () => { debug: { command: dotNetCommand, args: [serverModule, '--debug'], - options: { stdio: 'pipe', env: { FOO: 'bar' } } - } + options: { stdio: 'pipe', env: { FOO: 'bar' } }, + }, }; rewiremock.enable(); @@ -163,7 +163,7 @@ suite('Language Server - LanguageClient Factory', () => { language: string, name: string, serverOptions: ServerOptions, - clientOptions: LanguageClientOptions + clientOptions: LanguageClientOptions, ) { expect(language).to.be.equal('python'); expect(name).to.be.equal(languageClientName); diff --git a/src/test/activation/languageServer/languageServer.unit.test.ts b/src/test/activation/languageServer/languageServer.unit.test.ts index 1ae30d5fe2f7..1a8ccf56777e 100644 --- a/src/test/activation/languageServer/languageServer.unit.test.ts +++ b/src/test/activation/languageServer/languageServer.unit.test.ts @@ -98,7 +98,7 @@ suite('Language Server - LanguageServer', () => { .verifiable(typemoq.Times.once()); client .setup((c) => - c.sendRequest(typemoq.It.isValue('python/loadExtension'), typemoq.It.isValue(loadExtensionArgs)) + c.sendRequest(typemoq.It.isValue('python/loadExtension'), typemoq.It.isValue(loadExtensionArgs)), ) .returns(() => Promise.resolve(undefined) as any); @@ -151,7 +151,7 @@ suite('Language Server - LanguageServer', () => { .verifiable(typemoq.Times.once()); client .setup((c) => - c.sendRequest(typemoq.It.isValue('python/loadExtension'), typemoq.It.isValue(loadExtensionArgs)) + c.sendRequest(typemoq.It.isValue('python/loadExtension'), typemoq.It.isValue(loadExtensionArgs)), ) .returns(() => Promise.resolve(undefined) as any); diff --git a/src/test/activation/languageServer/languageServerExtension.unit.test.ts b/src/test/activation/languageServer/languageServerExtension.unit.test.ts index d18bacd66e3d..a8c4f293ba4b 100644 --- a/src/test/activation/languageServer/languageServerExtension.unit.test.ts +++ b/src/test/activation/languageServer/languageServerExtension.unit.test.ts @@ -39,7 +39,7 @@ suite('Language Server - Language Server Extension', () => { }); test('Must register command handler', async () => { when(cmdManager.registerCommand(loadExtensionCommand, anything())).thenReturn( - commandRegistrationDisposable.object + commandRegistrationDisposable.object, ); await extension.register(); verify(cmdManager.registerCommand(loadExtensionCommand, anything())).once(); diff --git a/src/test/activation/languageServer/languageServerFolderService.unit.test.ts b/src/test/activation/languageServer/languageServerFolderService.unit.test.ts index 381ff514c4ad..8f3a977424e1 100644 --- a/src/test/activation/languageServer/languageServerFolderService.unit.test.ts +++ b/src/test/activation/languageServer/languageServerFolderService.unit.test.ts @@ -29,7 +29,7 @@ suite('Language Server Folder Service', () => { let getCurrentLanguageServerDirectory: sinon.SinonStub; const currentLSDirectory = { path: 'path/to/currentLSDirectoryName', - version: new semver.SemVer('1.2.3') + version: new semver.SemVer('1.2.3'), }; let languageServerPackageService: TypeMoq.IMock; setup(() => { @@ -46,12 +46,12 @@ suite('Language Server Folder Service', () => { test('Returns current Language server directory name if rule says we should not look for new LS', async () => { shouldLookForNewLS = sinon.stub( DotNetLanguageServerFolderService.prototype, - 'shouldLookForNewLanguageServer' + 'shouldLookForNewLanguageServer', ); shouldLookForNewLS.resolves(false); getCurrentLanguageServerDirectory = sinon.stub( DotNetLanguageServerFolderService.prototype, - 'getCurrentLanguageServerDirectory' + 'getCurrentLanguageServerDirectory', ); getCurrentLanguageServerDirectory.resolves(currentLSDirectory); languageServerFolderService = new DotNetLanguageServerFolderService(serviceContainer.object); @@ -62,7 +62,7 @@ suite('Language Server Folder Service', () => { test('Returns current Language server directory name if fetching latest LS version returns undefined', async () => { shouldLookForNewLS = sinon.stub( DotNetLanguageServerFolderService.prototype, - 'shouldLookForNewLanguageServer' + 'shouldLookForNewLanguageServer', ); shouldLookForNewLS.resolves(true); languageServerPackageService @@ -71,7 +71,7 @@ suite('Language Server Folder Service', () => { .returns(() => Promise.resolve(undefined) as any); getCurrentLanguageServerDirectory = sinon.stub( DotNetLanguageServerFolderService.prototype, - 'getCurrentLanguageServerDirectory' + 'getCurrentLanguageServerDirectory', ); getCurrentLanguageServerDirectory.resolves(currentLSDirectory); languageServerFolderService = new DotNetLanguageServerFolderService(serviceContainer.object); @@ -82,20 +82,20 @@ suite('Language Server Folder Service', () => { test('Returns current Language server directory name if fetched latest LS version is less than the current LS version', async () => { shouldLookForNewLS = sinon.stub( DotNetLanguageServerFolderService.prototype, - 'shouldLookForNewLanguageServer' + 'shouldLookForNewLanguageServer', ); shouldLookForNewLS.resolves(true); const nugetPackage = { package: 'packageName', version: new semver.SemVer('1.1.3'), - uri: 'nugetUri' + uri: 'nugetUri', }; languageServerPackageService .setup((l) => l.getLatestNugetPackageVersion(resource)) .returns(() => Promise.resolve(nugetPackage)); getCurrentLanguageServerDirectory = sinon.stub( DotNetLanguageServerFolderService.prototype, - 'getCurrentLanguageServerDirectory' + 'getCurrentLanguageServerDirectory', ); getCurrentLanguageServerDirectory.resolves(currentLSDirectory); languageServerFolderService = new DotNetLanguageServerFolderService(serviceContainer.object); @@ -106,20 +106,20 @@ suite('Language Server Folder Service', () => { test('Returns expected Language server directory name otherwise', async () => { shouldLookForNewLS = sinon.stub( DotNetLanguageServerFolderService.prototype, - 'shouldLookForNewLanguageServer' + 'shouldLookForNewLanguageServer', ); shouldLookForNewLS.resolves(true); const nugetPackage = { package: 'packageName', version: new semver.SemVer('1.3.2'), - uri: 'nugetUri' + uri: 'nugetUri', }; languageServerPackageService .setup((l) => l.getLatestNugetPackageVersion(resource, '0.0.0')) .returns(() => Promise.resolve(nugetPackage)); getCurrentLanguageServerDirectory = sinon.stub( DotNetLanguageServerFolderService.prototype, - 'getCurrentLanguageServerDirectory' + 'getCurrentLanguageServerDirectory', ); getCurrentLanguageServerDirectory.resolves(currentLSDirectory); languageServerFolderService = new DotNetLanguageServerFolderService(serviceContainer.object); @@ -134,7 +134,7 @@ suite('Language Server Folder Service', () => { let downloadChannelRule: TypeMoq.IMock; const currentLSDirectory = { path: 'path/to/currentLSDirectoryName', - version: new semver.SemVer('1.2.3') + version: new semver.SemVer('1.2.3'), }; setup(() => { configurationService = TypeMoq.Mock.ofType(); @@ -157,7 +157,7 @@ suite('Language Server Folder Service', () => { test('Returns false if current folder is provided and setting `python.downloadLanguageServer` is set to false', async () => { const settings = { downloadLanguageServer: false, - autoUpdateLanguageServer: true + autoUpdateLanguageServer: true, }; configurationService .setup((c) => c.getSettings()) @@ -170,7 +170,7 @@ suite('Language Server Folder Service', () => { test('Returns false if current folder is provided and setting `python.autoUpdateLanguageServer` is set to false', async () => { const settings = { downloadLanguageServer: true, - autoUpdateLanguageServer: false + autoUpdateLanguageServer: false, }; configurationService .setup((c) => c.getSettings()) @@ -183,7 +183,7 @@ suite('Language Server Folder Service', () => { test('Returns whatever the rule to infer LS returns otherwise', async () => { const settings = { downloadLanguageServer: true, - autoUpdateLanguageServer: false + autoUpdateLanguageServer: false, }; configurationService .setup((c) => c.getSettings()) @@ -215,11 +215,11 @@ suite('Language Server Folder Service', () => { test('Returns the expected LS directory if setting `python.downloadLanguageServer` is set to false', async () => { const settings = { - downloadLanguageServer: false + downloadLanguageServer: false, }; const expectedLSDirectory = { path: 'languageServer', - version: new semver.SemVer('0.0.0') + version: new semver.SemVer('0.0.0'), }; configurationService .setup((c) => c.getSettings()) @@ -231,7 +231,7 @@ suite('Language Server Folder Service', () => { test('Returns `undefined` if no LS directory exists', async () => { const settings = { - downloadLanguageServer: true + downloadLanguageServer: true, }; const directories = ['path/to/directory1', 'path/to/directory2']; configurationService @@ -245,18 +245,18 @@ suite('Language Server Folder Service', () => { test('Returns the LS directory with highest version if multiple LS directories exists', async () => { const settings = { - downloadLanguageServer: true + downloadLanguageServer: true, }; const directories = [ 'path/to/languageServer', 'path/to/languageServer.0.9.3', 'path/to/languageServer.1.0.7', 'path/to/languageServer.1.2.3', - 'path/to/languageServer.1.2.3.5' + 'path/to/languageServer.1.2.3.5', ]; const expectedLSDirectory = { path: 'path/to/languageServer.1.2.3', - version: semver.parse('1.2.3', true)! + version: semver.parse('1.2.3', true)!, }; configurationService .setup((c) => c.getSettings()) diff --git a/src/test/activation/languageServer/languageServerPackageRepository.unit.test.ts b/src/test/activation/languageServer/languageServerPackageRepository.unit.test.ts index e32bc7acbf82..00a8cf280821 100644 --- a/src/test/activation/languageServer/languageServerPackageRepository.unit.test.ts +++ b/src/test/activation/languageServer/languageServerPackageRepository.unit.test.ts @@ -9,7 +9,7 @@ import { LanguageServerDownloadChannel } from '../../../client/activation/common import { BetaDotNetLanguageServerPackageRepository, DailyDotNetLanguageServerPackageRepository, - StableDotNetLanguageServerPackageRepository + StableDotNetLanguageServerPackageRepository, } from '../../../client/activation/languageServer/languageServerPackageRepository'; import { IServiceContainer } from '../../../client/ioc/types'; @@ -55,19 +55,19 @@ suite('Language Server Download Channels', () => { test('Stable', () => { expect(getPackageInfo(LanguageServerDownloadChannel.stable)).to.be.deep.equal([ 'https://pvsc.azureedge.net', - 'python-language-server-stable' + 'python-language-server-stable', ]); }); test('Beta', () => { expect(getPackageInfo(LanguageServerDownloadChannel.beta)).to.be.deep.equal([ 'https://pvsc.azureedge.net', - 'python-language-server-beta' + 'python-language-server-beta', ]); }); test('Daily', () => { expect(getPackageInfo(LanguageServerDownloadChannel.daily)).to.be.deep.equal([ 'https://pvsc.azureedge.net', - 'python-language-server-daily' + 'python-language-server-daily', ]); }); }); diff --git a/src/test/activation/languageServer/languageServerPackageService.test.ts b/src/test/activation/languageServer/languageServerPackageService.test.ts index 1101876781e2..7a0b3bd70aa9 100644 --- a/src/test/activation/languageServer/languageServerPackageService.test.ts +++ b/src/test/activation/languageServer/languageServerPackageService.test.ts @@ -41,7 +41,7 @@ suite('Language Server Package Service', () => { serviceContainer.object, azureBlobStorageAccount, defaultStorageChannel, - azureCDNBlobStorageAccount + azureCDNBlobStorageAccount, ); serviceContainer.setup((c) => c.get(typeMoq.It.isValue(INugetRepository))).returns(() => nugetRepo); const appEnv = typeMoq.Mock.ofType(); @@ -51,7 +51,7 @@ suite('Language Server Package Service', () => { const lsPackageService = new DotNetLanguageServerPackageService( serviceContainer.object, appEnv.object, - platform.object + platform.object, ); const packageName = lsPackageService.getNugetPackageName(); const packages = await nugetRepo.getPackages(packageName, undefined); @@ -65,7 +65,7 @@ suite('Language Server Package Service', () => { expect(latestReleases).to.be.length.greaterThan(0, 'No release packages returned.'); expect(latestRelease.version.major).to.be.equal( lsPackageService.maxMajorVersion, - 'New Major version of Language server has been released, we need to update it at our end.' + 'New Major version of Language server has been released, we need to update it at our end.', ); }); }); diff --git a/src/test/activation/languageServer/languageServerPackageService.unit.test.ts b/src/test/activation/languageServer/languageServerPackageService.unit.test.ts index 358b48f63c41..59653e158fa3 100644 --- a/src/test/activation/languageServer/languageServerPackageService.unit.test.ts +++ b/src/test/activation/languageServer/languageServerPackageService.unit.test.ts @@ -10,7 +10,7 @@ import { SemVer } from 'semver'; import * as typeMoq from 'typemoq'; import { azureCDNBlobStorageAccount, - LanguageServerDownloadChannel + LanguageServerDownloadChannel, } from '../../../client/activation/common/packageRepository'; import { DotNetLanguageServerMinVersionKey } from '../../../client/activation/languageServer/languageServerFolderService'; import { DotNetLanguageServerPackageService } from '../../../client/activation/languageServer/languageServerPackageService'; @@ -37,7 +37,7 @@ suite('Language Server - Package Service', () => { lsPackageService = new DotNetLanguageServerPackageService( serviceContainer.object, appVersion.object, - platform.object + platform.object, ); lsPackageService.getLanguageServerDownloadChannel = () => 'stable'; }); @@ -87,7 +87,7 @@ suite('Language Server - Package Service', () => { { package: '', uri: '', version: new SemVer('1.1.1') }, { package: '', uri: '', version: new SemVer('3.4.1') }, { package: '', uri: '', version: new SemVer('3.1.1') }, - { package: '', uri: '', version: new SemVer('2.1.1') } + { package: '', uri: '', version: new SemVer('2.1.1') }, ]; const expectedPackage = packages[1]; const repo = typeMoq.Mock.ofType(); @@ -120,7 +120,7 @@ suite('Language Server - Package Service', () => { { package: '', uri: '', version: new SemVer('1.1.1') }, { package: '', uri: '', version: new SemVer('1.3.1-alpha') }, { package: '', uri: '', version: new SemVer('1.4.1-preview') }, - { package: '', uri: '', version: new SemVer('1.2.1-internal') } + { package: '', uri: '', version: new SemVer('1.2.1-internal') }, ]; const expectedPackage = packages[0]; const repo = typeMoq.Mock.ofType(); @@ -147,7 +147,7 @@ suite('Language Server - Package Service', () => { lsPackageService.maxMajorVersion = 0; const packages: NugetPackage[] = [ { package: '', uri: '', version: new SemVer('0.1.48') }, - { package: '', uri: '', version: new SemVer('0.1.49') } + { package: '', uri: '', version: new SemVer('0.1.49') }, ]; const repo = typeMoq.Mock.ofType(); const nuget = new NugetService(); @@ -166,7 +166,7 @@ suite('Language Server - Package Service', () => { const expectedPackage: NugetPackage = { version: new SemVer(minimumVersion), package: LanguageServerDownloadChannel.stable, - uri: `${azureCDNBlobStorageAccount}/${LanguageServerDownloadChannel.stable}/${packageName}.${minimumVersion}.nupkg` + uri: `${azureCDNBlobStorageAccount}/${LanguageServerDownloadChannel.stable}/${packageName}.${minimumVersion}.nupkg`, }; expect(info).to.deep.equal(expectedPackage); }); @@ -186,15 +186,15 @@ suite('Language Server Package Service - getLanguageServerDownloadChannel()', () lsPackageService = new DotNetLanguageServerPackageService( serviceContainer.object, appVersion.object, - platform.object + platform.object, ); lsPackageService.isAlphaVersionOfExtension = () => true; }); test("If 'python.analysis.downloadChannel' setting is specified, return the value of the setting", async () => { const settings = { analysis: { - downloadChannel: 'someValue' - } + downloadChannel: 'someValue', + }, }; configService.setup((c) => c.getSettings()).returns(() => settings as any); @@ -209,7 +209,7 @@ suite('Language Server Package Service - getLanguageServerDownloadChannel()', () test("If 'python.analysis.downloadChannel' setting is not specified and insiders channel is 'weekly', return 'beta'", async () => { const settings = { analysis: {}, - insidersChannel: 'weekly' + insidersChannel: 'weekly', }; configService.setup((c) => c.getSettings()).returns(() => settings as any); @@ -224,7 +224,7 @@ suite('Language Server Package Service - getLanguageServerDownloadChannel()', () test("If 'python.analysis.downloadChannel' setting is not specified and insiders channel is 'daily', return 'beta'", async () => { const settings = { analysis: {}, - insidersChannel: 'daily' + insidersChannel: 'daily', }; configService.setup((c) => c.getSettings()).returns(() => settings as any); @@ -239,7 +239,7 @@ suite('Language Server Package Service - getLanguageServerDownloadChannel()', () test("If 'python.analysis.downloadChannel' setting is not specified, user is not using insiders, and extension has Alpha version, return 'beta'", async () => { const settings = { analysis: {}, - insidersChannel: 'off' + insidersChannel: 'off', }; configService.setup((c) => c.getSettings()).returns(() => settings as any); @@ -252,7 +252,7 @@ suite('Language Server Package Service - getLanguageServerDownloadChannel()', () test("If 'python.analysis.downloadChannel' setting is not specified, user is not using insiders, and extension does not have Alpha version, return 'stable'", async () => { const settings = { analysis: {}, - insidersChannel: 'off' + insidersChannel: 'off', }; configService.setup((c) => c.getSettings()).returns(() => settings as any); diff --git a/src/test/activation/languageServer/manager.unit.test.ts b/src/test/activation/languageServer/manager.unit.test.ts index d8130c399977..80a31e627b09 100644 --- a/src/test/activation/languageServer/manager.unit.test.ts +++ b/src/test/activation/languageServer/manager.unit.test.ts @@ -15,7 +15,7 @@ import { ILanguageServerAnalysisOptions, ILanguageServerExtension, ILanguageServerFolderService, - ILanguageServerProxy + ILanguageServerProxy, } from '../../../client/activation/types'; import { CommandManager } from '../../../client/common/application/commandManager'; import { ICommandManager } from '../../../client/common/application/types'; @@ -53,7 +53,7 @@ suite('Language Server - Manager', () => { instance(analysisOptions), instance(lsExtension), instance(folderService), - instance(commandManager) + instance(commandManager), ); }); @@ -97,7 +97,7 @@ suite('Language Server - Manager', () => { await startLanguageServer(); await expect(manager.start(resource, undefined)).to.eventually.be.rejectedWith( - 'Language server already started' + 'Language server already started', ); }); test('Changes in analysis options must restart LS', async () => { @@ -123,7 +123,7 @@ suite('Language Server - Manager', () => { onChangeAnalysisHandler.call(manager), onChangeAnalysisHandler.call(manager), onChangeAnalysisHandler.call(manager), - onChangeAnalysisHandler.call(manager) + onChangeAnalysisHandler.call(manager), ]); await sleep(1); @@ -144,7 +144,7 @@ suite('Language Server - Manager', () => { onChangeAnalysisHandler.call(manager), onChangeAnalysisHandler.call(manager), onChangeAnalysisHandler.call(manager), - onChangeAnalysisHandler.call(manager) + onChangeAnalysisHandler.call(manager), ]); await sleep(1); @@ -162,7 +162,7 @@ suite('Language Server - Manager', () => { onChangeAnalysisHandler.call(manager), onChangeAnalysisHandler.call(manager), onChangeAnalysisHandler.call(manager), - onChangeAnalysisHandler.call(manager) + onChangeAnalysisHandler.call(manager), ]); await sleep(1); diff --git a/src/test/activation/languageServer/outputChannel.unit.test.ts b/src/test/activation/languageServer/outputChannel.unit.test.ts index c120cfdc45ca..e4d93c73ca14 100644 --- a/src/test/activation/languageServer/outputChannel.unit.test.ts +++ b/src/test/activation/languageServer/outputChannel.unit.test.ts @@ -54,8 +54,8 @@ suite('Language Server Output Channel', () => { c.executeCommand( TypeMoq.It.isValue('setContext'), TypeMoq.It.isValue('python.hasLanguageServerOutputChannel'), - TypeMoq.It.isValue(true) - ) + TypeMoq.It.isValue(true), + ), ) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.once()); @@ -85,8 +85,8 @@ suite('Language Server Output Channel', () => { c.executeCommand( TypeMoq.It.isValue('setContext'), TypeMoq.It.isValue('python.hasLanguageServerOutputChannel'), - TypeMoq.It.isValue(true) - ) + TypeMoq.It.isValue(true), + ), ) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.once()); diff --git a/src/test/activation/languageServer/platformData.unit.test.ts b/src/test/activation/languageServer/platformData.unit.test.ts index d424aa63ceac..dc51c6678454 100644 --- a/src/test/activation/languageServer/platformData.unit.test.ts +++ b/src/test/activation/languageServer/platformData.unit.test.ts @@ -12,7 +12,7 @@ import { IPlatformService } from '../../../client/common/platform/types'; const testDataWinMac = [ { isWindows: true, is64Bit: true, expectedName: 'win-x64' }, { isWindows: true, is64Bit: false, expectedName: 'win-x86' }, - { isWindows: false, is64Bit: true, expectedName: 'osx-x64' } + { isWindows: false, is64Bit: true, expectedName: 'osx-x64' }, ]; const testDataLinux = [ @@ -22,13 +22,13 @@ const testDataLinux = [ { name: 'ol', expectedName: 'linux-x64' }, { name: 'opensuse', expectedName: 'linux-x64' }, { name: 'rhel', expectedName: 'linux-x64' }, - { name: 'ubuntu', expectedName: 'linux-x64' } + { name: 'ubuntu', expectedName: 'linux-x64' }, ]; const testDataModuleName = [ { isWindows: true, isMac: false, isLinux: false, expectedName: PlatformLSExecutables.Windows }, { isWindows: false, isMac: true, isLinux: false, expectedName: PlatformLSExecutables.MacOS }, - { isWindows: false, isMac: false, isLinux: true, expectedName: PlatformLSExecutables.Linux } + { isWindows: false, isMac: false, isLinux: true, expectedName: PlatformLSExecutables.Linux }, ]; // tslint:disable-next-line:max-func-body-length diff --git a/src/test/activation/node/activator.unit.test.ts b/src/test/activation/node/activator.unit.test.ts index 3b87588774eb..af7b7f8a8f73 100644 --- a/src/test/activation/node/activator.unit.test.ts +++ b/src/test/activation/node/activator.unit.test.ts @@ -12,7 +12,7 @@ import { ILanguageServerManager } from '../../../client/activation/types'; import { IApplicationEnvironment, IApplicationShell, - IWorkspaceService + IWorkspaceService, } from '../../../client/common/application/types'; import { WorkspaceService } from '../../../client/common/application/workspace'; import { PythonSettings } from '../../../client/common/configSettings'; @@ -65,7 +65,7 @@ suite('Pylance Language Server - Activator', () => { instance(configuration), instance(extensions), instance(appShell), - instance(appEnv) + instance(appEnv), ); }); teardown(() => { @@ -104,8 +104,8 @@ suite('Pylance Language Server - Activator', () => { appShell.showWarningMessage( Pylance.installPylanceMessage(), Common.bannerLabelYes(), - Common.bannerLabelNo() - ) + Common.bannerLabelNo(), + ), ).thenReturn(Promise.resolve(Common.bannerLabelNo())); try { @@ -116,8 +116,8 @@ suite('Pylance Language Server - Activator', () => { appShell.showWarningMessage( Pylance.installPylanceMessage(), Common.bannerLabelYes(), - Common.bannerLabelNo() - ) + Common.bannerLabelNo(), + ), ).once(); verify(appShell.openUrl(`scheme:extension/${PYLANCE_EXTENSION_ID}`)).never(); }); @@ -127,8 +127,8 @@ suite('Pylance Language Server - Activator', () => { appShell.showWarningMessage( Pylance.installPylanceMessage(), Common.bannerLabelYes(), - Common.bannerLabelNo() - ) + Common.bannerLabelNo(), + ), ).thenReturn(Promise.resolve(Common.bannerLabelYes())); try { diff --git a/src/test/activation/node/languageServerChangeHandler.unit.test.ts b/src/test/activation/node/languageServerChangeHandler.unit.test.ts index 94b7ef180311..ee2a78ca6825 100644 --- a/src/test/activation/node/languageServerChangeHandler.unit.test.ts +++ b/src/test/activation/node/languageServerChangeHandler.unit.test.ts @@ -57,14 +57,14 @@ suite('Language Server - Change Handler', () => { test(`Handler should prompt for reload when language server type changes to ${t}, Pylance is installed ans user clicks Reload`, async () => { when(extensions.getExtension(PYLANCE_EXTENSION_ID)).thenReturn(instance(pylanceExtension)); when( - appShell.showInformationMessage(LanguageService.reloadAfterLanguageServerChange(), Common.reload()) + appShell.showInformationMessage(LanguageService.reloadAfterLanguageServerChange(), Common.reload()), ).thenReturn(Promise.resolve(Common.reload())); handler = makeHandler(undefined); await handler.handleLanguageServerChange(t); verify( - appShell.showInformationMessage(LanguageService.reloadAfterLanguageServerChange(), Common.reload()) + appShell.showInformationMessage(LanguageService.reloadAfterLanguageServerChange(), Common.reload()), ).once(); verify(commands.executeCommand('workbench.action.reloadWindow')).once(); }); @@ -74,14 +74,14 @@ suite('Language Server - Change Handler', () => { test(`Handler should not prompt for reload when language server type changes to ${t}, Pylance is installed ans user does not clicks Reload`, async () => { when(extensions.getExtension(PYLANCE_EXTENSION_ID)).thenReturn(instance(pylanceExtension)); when( - appShell.showInformationMessage(LanguageService.reloadAfterLanguageServerChange(), Common.reload()) + appShell.showInformationMessage(LanguageService.reloadAfterLanguageServerChange(), Common.reload()), ).thenReturn(Promise.resolve(undefined)); handler = makeHandler(undefined); await handler.handleLanguageServerChange(t); verify( - appShell.showInformationMessage(LanguageService.reloadAfterLanguageServerChange(), Common.reload()) + appShell.showInformationMessage(LanguageService.reloadAfterLanguageServerChange(), Common.reload()), ).once(); verify(commands.executeCommand('workbench.action.reloadWindow')).never(); }); @@ -92,22 +92,22 @@ suite('Language Server - Change Handler', () => { appShell.showWarningMessage( Pylance.installPylanceMessage(), Common.bannerLabelYes(), - Common.bannerLabelNo() - ) + Common.bannerLabelNo(), + ), ).thenReturn(Promise.resolve(undefined)); handler = makeHandler(undefined); await handler.handleLanguageServerChange(LanguageServerType.Node); verify( - appShell.showInformationMessage(LanguageService.reloadAfterLanguageServerChange(), Common.reload()) + appShell.showInformationMessage(LanguageService.reloadAfterLanguageServerChange(), Common.reload()), ).never(); verify( appShell.showWarningMessage( Pylance.installPylanceMessage(), Common.bannerLabelYes(), - Common.bannerLabelNo() - ) + Common.bannerLabelNo(), + ), ).once(); }); @@ -116,8 +116,8 @@ suite('Language Server - Change Handler', () => { appShell.showWarningMessage( Pylance.installPylanceMessage(), Common.bannerLabelYes(), - Common.bannerLabelNo() - ) + Common.bannerLabelNo(), + ), ).thenReturn(Promise.resolve(Common.bannerLabelYes())); handler = makeHandler(undefined); @@ -132,8 +132,8 @@ suite('Language Server - Change Handler', () => { appShell.showWarningMessage( Pylance.installPylanceMessage(), Common.bannerLabelYes(), - Common.bannerLabelNo() - ) + Common.bannerLabelNo(), + ), ).thenReturn(Promise.resolve(Common.bannerLabelNo())); handler = makeHandler(undefined); @@ -148,8 +148,8 @@ suite('Language Server - Change Handler', () => { appShell.showWarningMessage( Pylance.pylanceInstalledReloadPromptMessage(), Common.bannerLabelYes(), - Common.bannerLabelNo() - ) + Common.bannerLabelNo(), + ), ).thenReturn(Promise.resolve(Common.bannerLabelYes())); handler = makeHandler(LanguageServerType.Node); @@ -165,8 +165,8 @@ suite('Language Server - Change Handler', () => { appShell.showWarningMessage( Pylance.pylanceInstalledReloadPromptMessage(), Common.bannerLabelYes(), - Common.bannerLabelNo() - ) + Common.bannerLabelNo(), + ), ).thenReturn(Promise.resolve(Common.bannerLabelNo())); handler = makeHandler(LanguageServerType.Node); @@ -183,7 +183,7 @@ suite('Language Server - Change Handler', () => { instance(extensions), instance(appShell), instance(appEnv), - instance(commands) + instance(commands), ); } }); diff --git a/src/test/activation/node/languageServerFolderService.unit.test.ts b/src/test/activation/node/languageServerFolderService.unit.test.ts index b944dde8ffb6..0bcae8f3d720 100644 --- a/src/test/activation/node/languageServerFolderService.unit.test.ts +++ b/src/test/activation/node/languageServerFolderService.unit.test.ts @@ -9,7 +9,7 @@ import { Extension, Uri, WorkspaceConfiguration } from 'vscode'; import { ILanguageServerFolder, ILSExtensionApi, - NodeLanguageServerFolderService + NodeLanguageServerFolderService, } from '../../../client/activation/node/languageServerFolderService'; import { IWorkspaceService } from '../../../client/common/application/types'; import { PYLANCE_EXTENSION_ID } from '../../../client/common/constants'; @@ -56,7 +56,7 @@ suite('Node Language Server Folder Service', () => { serviceContainer.object, configService.object, workspaceService.object, - extensions.object + extensions.object, ); const lsf = await folderService.languageServerFolder(); @@ -72,7 +72,7 @@ suite('Node Language Server Folder Service', () => { serviceContainer.object, configService.object, workspaceService.object, - extensions.object + extensions.object, ); const lsf = await folderService.languageServerFolder(); @@ -88,7 +88,7 @@ suite('Node Language Server Folder Service', () => { serviceContainer.object, configService.object, workspaceService.object, - extensions.object + extensions.object, ); const lsf = await folderService.languageServerFolder(); @@ -104,7 +104,7 @@ suite('Node Language Server Folder Service', () => { serviceContainer.object, configService.object, workspaceService.object, - extensions.object + extensions.object, ); const lsf = await folderService.languageServerFolder(); @@ -121,7 +121,7 @@ suite('Node Language Server Folder Service', () => { serviceContainer.object, configService.object, workspaceService.object, - extensions.object + extensions.object, ); const lsf = await folderService.languageServerFolder(); @@ -135,8 +135,8 @@ suite('Node Language Server Folder Service', () => { const extensionApi: ILSExtensionApi = { languageServerFolder: async () => ({ path: lsPath, - version: lsVersion - }) + version: lsVersion, + }), }; let folderService: TestService; @@ -153,7 +153,7 @@ suite('Node Language Server Folder Service', () => { serviceContainer.object, configService.object, workspaceService.object, - extensions.object + extensions.object, ); }); diff --git a/src/test/activation/serviceRegistry.unit.test.ts b/src/test/activation/serviceRegistry.unit.test.ts index bc02b3da6abc..56fc17c0fbec 100644 --- a/src/test/activation/serviceRegistry.unit.test.ts +++ b/src/test/activation/serviceRegistry.unit.test.ts @@ -18,7 +18,7 @@ import { DotNetLanguageServerFolderService } from '../../client/activation/langu import { BetaDotNetLanguageServerPackageRepository, DailyDotNetLanguageServerPackageRepository, - StableDotNetLanguageServerPackageRepository + StableDotNetLanguageServerPackageRepository, } from '../../client/activation/languageServer/languageServerPackageRepository'; import { DotNetLanguageServerPackageService } from '../../client/activation/languageServer/languageServerPackageService'; import { DotNetLanguageServerProxy } from '../../client/activation/languageServer/languageServerProxy'; @@ -43,7 +43,7 @@ import { ILanguageServerPackageService, ILanguageServerProxy, IPlatformData, - LanguageServerType + LanguageServerType, } from '../../client/activation/types'; import { INugetRepository } from '../../client/common/nuget/types'; import { BANNER_NAME_PROPOSE_LS, IPythonExtensionBanner } from '../../client/common/types'; @@ -67,119 +67,122 @@ suite('Unit Tests - Language Server Activation Service Registry', () => { verify( serviceManager.addSingleton( ILanguageServerCache, - LanguageServerExtensionActivationService - ) + LanguageServerExtensionActivationService, + ), ).once(); verify( - serviceManager.addSingleton(ILanguageServerExtension, LanguageServerExtension) + serviceManager.addSingleton(ILanguageServerExtension, LanguageServerExtension), ).once(); verify( - serviceManager.add(IExtensionActivationManager, ExtensionActivationManager) + serviceManager.add(IExtensionActivationManager, ExtensionActivationManager), ).once(); verify( serviceManager.add( ILanguageServerActivator, DotNetLanguageServerActivator, - LanguageServerType.Microsoft - ) + LanguageServerType.Microsoft, + ), ).once(); verify( serviceManager.addSingleton( IPythonExtensionBanner, ProposePylanceBanner, - BANNER_NAME_PROPOSE_LS - ) + BANNER_NAME_PROPOSE_LS, + ), ).once(); verify( serviceManager.addSingleton( ILanguageServerFolderService, - DotNetLanguageServerFolderService - ) + DotNetLanguageServerFolderService, + ), ).once(); verify( serviceManager.addSingleton( ILanguageServerPackageService, - DotNetLanguageServerPackageService - ) + DotNetLanguageServerPackageService, + ), ).once(); verify( serviceManager.addSingleton( INugetRepository, StableDotNetLanguageServerPackageRepository, - LanguageServerDownloadChannel.stable - ) + LanguageServerDownloadChannel.stable, + ), ).once(); verify( serviceManager.addSingleton( INugetRepository, BetaDotNetLanguageServerPackageRepository, - LanguageServerDownloadChannel.beta - ) + LanguageServerDownloadChannel.beta, + ), ).once(); verify( serviceManager.addSingleton( INugetRepository, DailyDotNetLanguageServerPackageRepository, - LanguageServerDownloadChannel.daily - ) + LanguageServerDownloadChannel.daily, + ), ).once(); verify( serviceManager.addSingleton( IDownloadChannelRule, DownloadDailyChannelRule, - LanguageServerDownloadChannel.daily - ) + LanguageServerDownloadChannel.daily, + ), ).once(); verify( serviceManager.addSingleton( IDownloadChannelRule, DownloadBetaChannelRule, - LanguageServerDownloadChannel.beta - ) + LanguageServerDownloadChannel.beta, + ), ).once(); verify( serviceManager.addSingleton( IDownloadChannelRule, DownloadBetaChannelRule, - LanguageServerDownloadChannel.stable - ) + LanguageServerDownloadChannel.stable, + ), ).once(); verify( serviceManager.addSingleton( ILanagueServerCompatibilityService, - LanguageServerCompatibilityService - ) + LanguageServerCompatibilityService, + ), ).once(); verify( - serviceManager.addSingleton(ILanguageClientFactory, DotNetLanguageClientFactory) + serviceManager.addSingleton(ILanguageClientFactory, DotNetLanguageClientFactory), ).once(); verify( - serviceManager.addSingleton(ILanguageServerDownloader, LanguageServerDownloader) + serviceManager.addSingleton(ILanguageServerDownloader, LanguageServerDownloader), ).once(); verify(serviceManager.addSingleton(IPlatformData, PlatformData)).once(); verify( serviceManager.add( ILanguageServerAnalysisOptions, DotNetLanguageServerAnalysisOptions, - LanguageServerType.Microsoft - ) + LanguageServerType.Microsoft, + ), ).once(); verify(serviceManager.add(ILanguageServerProxy, DotNetLanguageServerProxy)).once(); verify(serviceManager.add(ILanguageServerManager, DotNetLanguageServerManager)).once(); verify( - serviceManager.addSingleton(IExtensionSingleActivationService, AATesting) + serviceManager.addSingleton( + IExtensionSingleActivationService, + AATesting, + ), ).once(); verify( serviceManager.addSingleton( ILanguageServerOutputChannel, - LanguageServerOutputChannel - ) + LanguageServerOutputChannel, + ), ).once(); verify( serviceManager.addSingleton( IExtensionSingleActivationService, - ExtensionSurveyPrompt - ) + ExtensionSurveyPrompt, + ), ).once(); }); }); diff --git a/src/test/api.functional.test.ts b/src/test/api.functional.test.ts index 58a32defc402..bf2a82029d13 100644 --- a/src/test/api.functional.test.ts +++ b/src/test/api.functional.test.ts @@ -37,7 +37,7 @@ suite('Extension API', () => { interpreterService = mock(InterpreterService); when(serviceContainer.get(IConfigurationService)).thenReturn( - instance(configurationService) + instance(configurationService), ); when(serviceContainer.get(IInterpreterService)).thenReturn(instance(interpreterService)); }); @@ -49,7 +49,7 @@ suite('Extension API', () => { const execDetails = buildApi( Promise.resolve(), instance(serviceManager), - instance(serviceContainer) + instance(serviceContainer), ).settings.getExecutionDetails(resource); assert.deepEqual(execDetails, { execCommand: ['settingValue'] }); @@ -62,7 +62,7 @@ suite('Extension API', () => { const execDetails = buildApi( Promise.resolve(), instance(serviceManager), - instance(serviceContainer) + instance(serviceContainer), ).settings.getExecutionDetails(resource); assert.deepEqual(execDetails, { execCommand: undefined }); @@ -84,7 +84,7 @@ suite('Extension API', () => { const args = await buildApi( Promise.resolve(), instance(serviceManager), - instance(serviceContainer) + instance(serviceContainer), ).debug.getRemoteLauncherCommand(debuggerHost, debuggerPort, waitForAttach); const expectedArgs = [debuggerPath.fileToCommandArgument(), '--listen', `${debuggerHost}:${debuggerPort}`]; @@ -97,13 +97,13 @@ suite('Extension API', () => { const args = await buildApi( Promise.resolve(), instance(serviceManager), - instance(serviceContainer) + instance(serviceContainer), ).debug.getRemoteLauncherCommand(debuggerHost, debuggerPort, waitForAttach); const expectedArgs = [ debuggerPath.fileToCommandArgument(), '--listen', `${debuggerHost}:${debuggerPort}`, - '--wait-for-client' + '--wait-for-client', ]; expect(args).to.be.deep.equal(expectedArgs); @@ -113,7 +113,7 @@ suite('Extension API', () => { const pkgPath = await buildApi( Promise.resolve(), instance(serviceManager), - instance(serviceContainer) + instance(serviceContainer), ).debug.getDebuggerPackagePath(); assert.equal(pkgPath, debuggerPath); diff --git a/src/test/application/diagnostics/applicationDiagnostics.unit.test.ts b/src/test/application/diagnostics/applicationDiagnostics.unit.test.ts index 997a9fdd3725..26ea2fd4352c 100644 --- a/src/test/application/diagnostics/applicationDiagnostics.unit.test.ts +++ b/src/test/application/diagnostics/applicationDiagnostics.unit.test.ts @@ -16,7 +16,7 @@ import { DiagnosticScope, IDiagnostic, IDiagnosticsService, - ISourceMapSupportService + ISourceMapSupportService, } from '../../../client/application/diagnostics/types'; import { IApplicationDiagnostics } from '../../../client/application/types'; import { STANDARD_OUTPUT_CHANNEL } from '../../../client/common/constants'; @@ -105,7 +105,7 @@ suite('Application Diagnostics - ApplicationDiagnostics', () => { scope: undefined, severity: undefined, resource: undefined, - invokeHandler: 'default' + invokeHandler: 'default', } as any; envHealthCheck .setup((e) => e.diagnose(typemoq.It.isAny())) @@ -149,7 +149,7 @@ suite('Application Diagnostics - ApplicationDiagnostics', () => { scope: i % 2 === 0 ? DiagnosticScope.Global : DiagnosticScope.WorkspaceFolder, severity: DiagnosticSeverity.Error, resource: undefined, - invokeHandler: 'default' + invokeHandler: 'default', }; diagnostics.push(diagnostic); } @@ -160,7 +160,7 @@ suite('Application Diagnostics - ApplicationDiagnostics', () => { scope: i % 2 === 0 ? DiagnosticScope.Global : DiagnosticScope.WorkspaceFolder, severity: DiagnosticSeverity.Warning, resource: undefined, - invokeHandler: 'default' + invokeHandler: 'default', }; diagnostics.push(diagnostic); } @@ -171,7 +171,7 @@ suite('Application Diagnostics - ApplicationDiagnostics', () => { scope: i % 2 === 0 ? DiagnosticScope.Global : DiagnosticScope.WorkspaceFolder, severity: DiagnosticSeverity.Information, resource: undefined, - invokeHandler: 'default' + invokeHandler: 'default', }; diagnostics.push(diagnostic); } @@ -223,7 +223,7 @@ suite('Application Diagnostics - ApplicationDiagnostics', () => { when(svcContainer.getAll(IDiagnosticsService)).thenReturn([ instance(foreGroundService), - instance(backGroundService) + instance(backGroundService), ]); when(foreGroundService.runInBackground).thenReturn(false); when(backGroundService.runInBackground).thenReturn(true); diff --git a/src/test/application/diagnostics/checks/envPathVariable.unit.test.ts b/src/test/application/diagnostics/checks/envPathVariable.unit.test.ts index e0e37dd6c774..d5e18adff3b9 100644 --- a/src/test/application/diagnostics/checks/envPathVariable.unit.test.ts +++ b/src/test/application/diagnostics/checks/envPathVariable.unit.test.ts @@ -13,7 +13,7 @@ import { CommandOption, IDiagnosticsCommandFactory } from '../../../../client/ap import { DiagnosticCodes } from '../../../../client/application/diagnostics/constants'; import { DiagnosticCommandPromptHandlerServiceId, - MessageCommandPrompt + MessageCommandPrompt, } from '../../../../client/application/diagnostics/promptHandler'; import { DiagnosticScope, @@ -21,7 +21,7 @@ import { IDiagnosticCommand, IDiagnosticFilterService, IDiagnosticHandlerService, - IDiagnosticsService + IDiagnosticsService, } from '../../../../client/application/diagnostics/types'; import { IApplicationEnvironment, IWorkspaceService } from '../../../../client/common/application/types'; import { IPlatformService } from '../../../../client/common/platform/types'; @@ -54,8 +54,8 @@ suite('Application Diagnostics - Checks Env Path Variable', () => { .setup((s) => s.get( typemoq.It.isValue(IDiagnosticHandlerService), - typemoq.It.isValue(DiagnosticCommandPromptHandlerServiceId) - ) + typemoq.It.isValue(DiagnosticCommandPromptHandlerServiceId), + ), ) .returns(() => messageHandler.object); @@ -181,9 +181,9 @@ suite('Application Diagnostics - Checks Env Path Variable', () => { typemoq.It.isAny(), typemoq.It.isObjectWith>({ type: 'ignore', - options: DiagnosticScope.Global - }) - ) + options: DiagnosticScope.Global, + }), + ), ) .returns(() => alwaysIgnoreCommand.object) .verifiable(typemoq.Times.once()); @@ -192,8 +192,8 @@ suite('Application Diagnostics - Checks Env Path Variable', () => { .setup((f) => f.createCommand( typemoq.It.isAny(), - typemoq.It.isObjectWith>({ type: 'launch' }) - ) + typemoq.It.isObjectWith>({ type: 'launch' }), + ), ) .returns(() => launchBrowserCommand.object) .verifiable(typemoq.Times.once()); @@ -211,7 +211,7 @@ suite('Application Diagnostics - Checks Env Path Variable', () => { filterService .setup((f) => - f.shouldIgnoreDiagnostic(typemoq.It.isValue(DiagnosticCodes.InvalidEnvironmentPathVariableDiagnostic)) + f.shouldIgnoreDiagnostic(typemoq.It.isValue(DiagnosticCodes.InvalidEnvironmentPathVariableDiagnostic)), ) .returns(() => Promise.resolve(true)) .verifiable(typemoq.Times.once()); diff --git a/src/test/application/diagnostics/checks/invalidLaunchJsonDebugger.unit.test.ts b/src/test/application/diagnostics/checks/invalidLaunchJsonDebugger.unit.test.ts index b9e7a61eabc2..6f177f4103e1 100644 --- a/src/test/application/diagnostics/checks/invalidLaunchJsonDebugger.unit.test.ts +++ b/src/test/application/diagnostics/checks/invalidLaunchJsonDebugger.unit.test.ts @@ -9,7 +9,7 @@ import { Uri, WorkspaceFolder } from 'vscode'; import { BaseDiagnosticsService } from '../../../../client/application/diagnostics/base'; import { InvalidLaunchJsonDebuggerDiagnostic, - InvalidLaunchJsonDebuggerService + InvalidLaunchJsonDebuggerService, } from '../../../../client/application/diagnostics/checks/invalidLaunchJsonDebugger'; import { IDiagnosticsCommandFactory } from '../../../../client/application/diagnostics/commands/types'; import { DiagnosticCodes } from '../../../../client/application/diagnostics/constants'; @@ -17,7 +17,7 @@ import { MessageCommandPrompt } from '../../../../client/application/diagnostics import { IDiagnostic, IDiagnosticHandlerService, - IDiagnosticsService + IDiagnosticsService, } from '../../../../client/application/diagnostics/types'; import { IWorkspaceService } from '../../../../client/common/application/types'; import { IFileSystem } from '../../../../client/common/platform/types'; @@ -63,7 +63,7 @@ suite('Application Diagnostics - Checks if launch.json is invalid', () => { for (const code of [ DiagnosticCodes.InvalidDebuggerTypeDiagnostic, DiagnosticCodes.JustMyCodeDiagnostic, - DiagnosticCodes.ConsoleTypeDiagnostic + DiagnosticCodes.ConsoleTypeDiagnostic, ]) { const diagnostic = TypeMoq.Mock.ofType(); diagnostic @@ -162,7 +162,7 @@ suite('Application Diagnostics - Checks if launch.json is invalid', () => { const diagnostics = await diagnosticService.diagnose(undefined); expect(diagnostics).to.be.deep.equal( [new InvalidLaunchJsonDebuggerDiagnostic(DiagnosticCodes.InvalidDebuggerTypeDiagnostic, undefined)], - 'Diagnostics returned are not as expected' + 'Diagnostics returned are not as expected', ); workspaceService.verifyAll(); fs.verifyAll(); @@ -187,7 +187,7 @@ suite('Application Diagnostics - Checks if launch.json is invalid', () => { const diagnostics = await diagnosticService.diagnose(undefined); expect(diagnostics).to.be.deep.equal( [new InvalidLaunchJsonDebuggerDiagnostic(DiagnosticCodes.JustMyCodeDiagnostic, undefined)], - 'Diagnostics returned are not as expected' + 'Diagnostics returned are not as expected', ); workspaceService.verifyAll(); fs.verifyAll(); @@ -212,7 +212,7 @@ suite('Application Diagnostics - Checks if launch.json is invalid', () => { const diagnostics = await diagnosticService.diagnose(undefined); expect(diagnostics).to.be.deep.equal( [new InvalidLaunchJsonDebuggerDiagnostic(DiagnosticCodes.ConfigPythonPathDiagnostic, undefined, false)], - 'Diagnostics returned are not as expected' + 'Diagnostics returned are not as expected', ); workspaceService.verifyAll(); fs.verifyAll(); @@ -237,7 +237,7 @@ suite('Application Diagnostics - Checks if launch.json is invalid', () => { const diagnostics = await diagnosticService.diagnose(undefined); expect(diagnostics).to.be.deep.equal( [new InvalidLaunchJsonDebuggerDiagnostic(DiagnosticCodes.ConfigPythonPathDiagnostic, undefined, false)], - 'Diagnostics returned are not as expected' + 'Diagnostics returned are not as expected', ); workspaceService.verifyAll(); fs.verifyAll(); @@ -263,9 +263,9 @@ suite('Application Diagnostics - Checks if launch.json is invalid', () => { expect(diagnostics).to.be.deep.equal( [ new InvalidLaunchJsonDebuggerDiagnostic(DiagnosticCodes.InvalidDebuggerTypeDiagnostic, undefined), - new InvalidLaunchJsonDebuggerDiagnostic(DiagnosticCodes.JustMyCodeDiagnostic, undefined) + new InvalidLaunchJsonDebuggerDiagnostic(DiagnosticCodes.JustMyCodeDiagnostic, undefined), ], - 'Diagnostics returned are not as expected' + 'Diagnostics returned are not as expected', ); workspaceService.verifyAll(); fs.verifyAll(); @@ -275,7 +275,7 @@ suite('Application Diagnostics - Checks if launch.json is invalid', () => { for (const code of [ DiagnosticCodes.InvalidDebuggerTypeDiagnostic, DiagnosticCodes.JustMyCodeDiagnostic, - DiagnosticCodes.ConsoleTypeDiagnostic + DiagnosticCodes.ConsoleTypeDiagnostic, ]) { const diagnostic = TypeMoq.Mock.ofType(); let options: MessageCommandPrompt | undefined; @@ -345,7 +345,7 @@ suite('Application Diagnostics - Checks if launch.json is invalid', () => { for (const code of [ DiagnosticCodes.InvalidDebuggerTypeDiagnostic, DiagnosticCodes.JustMyCodeDiagnostic, - DiagnosticCodes.ConsoleTypeDiagnostic + DiagnosticCodes.ConsoleTypeDiagnostic, ]) { const diagnostic = TypeMoq.Mock.ofType(); diagnostic @@ -379,7 +379,7 @@ suite('Application Diagnostics - Checks if launch.json is invalid', () => { for (const code of [ DiagnosticCodes.InvalidDebuggerTypeDiagnostic, DiagnosticCodes.JustMyCodeDiagnostic, - DiagnosticCodes.ConsoleTypeDiagnostic + DiagnosticCodes.ConsoleTypeDiagnostic, ]) { workspaceService .setup((w) => w.hasWorkspaceFolders) @@ -398,7 +398,7 @@ suite('Application Diagnostics - Checks if launch.json is invalid', () => { for (const code of [ DiagnosticCodes.InvalidDebuggerTypeDiagnostic, DiagnosticCodes.JustMyCodeDiagnostic, - DiagnosticCodes.ConsoleTypeDiagnostic + DiagnosticCodes.ConsoleTypeDiagnostic, ]) { workspaceService .setup((w) => w.hasWorkspaceFolders) diff --git a/src/test/application/diagnostics/checks/invalidPythonPathInDebugger.unit.test.ts b/src/test/application/diagnostics/checks/invalidPythonPathInDebugger.unit.test.ts index 28e415be967e..0bfeaf5aec37 100644 --- a/src/test/application/diagnostics/checks/invalidPythonPathInDebugger.unit.test.ts +++ b/src/test/application/diagnostics/checks/invalidPythonPathInDebugger.unit.test.ts @@ -15,13 +15,13 @@ import { CommandOption, IDiagnosticsCommandFactory } from '../../../../client/ap import { DiagnosticCodes } from '../../../../client/application/diagnostics/constants'; import { DiagnosticCommandPromptHandlerServiceId, - MessageCommandPrompt + MessageCommandPrompt, } from '../../../../client/application/diagnostics/promptHandler'; import { IDiagnostic, IDiagnosticCommand, IDiagnosticHandlerService, - IInvalidPythonPathInDebuggerService + IInvalidPythonPathInDebuggerService, } from '../../../../client/application/diagnostics/types'; import { CommandsWithoutArgs } from '../../../../client/common/application/commands'; import { IDocumentManager, IWorkspaceService } from '../../../../client/common/application/types'; @@ -45,8 +45,8 @@ suite('Application Diagnostics - Checks Python Path in debugger', () => { .setup((s) => s.get( typemoq.It.isValue(IDiagnosticHandlerService), - typemoq.It.isValue(DiagnosticCommandPromptHandlerServiceId) - ) + typemoq.It.isValue(DiagnosticCommandPromptHandlerServiceId), + ), ) .returns(() => messageHandler.object); commandFactory = typemoq.Mock.ofType(); @@ -79,7 +79,7 @@ suite('Application Diagnostics - Checks Python Path in debugger', () => { docMgr.object, configService.object, [], - messageHandler.object + messageHandler.object, ); (diagnosticService as any)._clear(); }); @@ -87,7 +87,7 @@ suite('Application Diagnostics - Checks Python Path in debugger', () => { test('Can handle InvalidPythonPathInDebugger diagnostics', async () => { for (const code of [ DiagnosticCodes.InvalidPythonPathInDebuggerSettingsDiagnostic, - DiagnosticCodes.InvalidPythonPathInDebuggerLaunchDiagnostic + DiagnosticCodes.InvalidPythonPathInDebuggerLaunchDiagnostic, ]) { const diagnostic = typemoq.Mock.ofType(); diagnostic @@ -127,9 +127,9 @@ suite('Application Diagnostics - Checks Python Path in debugger', () => { f.createCommand( typemoq.It.isAny(), typemoq.It.isObjectWith>({ - type: 'executeVSCCommand' - }) - ) + type: 'executeVSCCommand', + }), + ), ) .returns(() => interpreterSelectionCommand.object) .verifiable(typemoq.Times.once()); @@ -157,9 +157,9 @@ suite('Application Diagnostics - Checks Python Path in debugger', () => { f.createCommand( typemoq.It.isAny(), typemoq.It.isObjectWith>({ - type: 'executeVSCCommand' - }) - ) + type: 'executeVSCCommand', + }), + ), ) .returns(() => interpreterSelectionCommand.object) .verifiable(typemoq.Times.exactly(1)); @@ -190,9 +190,9 @@ suite('Application Diagnostics - Checks Python Path in debugger', () => { f.createCommand( typemoq.It.isAny(), typemoq.It.isObjectWith>({ - type: 'executeVSCCommand' - }) - ) + type: 'executeVSCCommand', + }), + ), ) .returns(() => interpreterSelectionCommand.object) .verifiable(typemoq.Times.exactly(2)); @@ -286,7 +286,7 @@ suite('Application Diagnostics - Checks Python Path in debugger', () => { const valid = await diagnosticService.validatePythonPath( pythonPath, PythonPathSource.settingsJson, - Uri.parse('something') + Uri.parse('something'), ); configService.verifyAll(); diff --git a/src/test/application/diagnostics/checks/lsNotSupported.unit.test.ts b/src/test/application/diagnostics/checks/lsNotSupported.unit.test.ts index 4f537b62c5bf..b1156ffa3fc8 100644 --- a/src/test/application/diagnostics/checks/lsNotSupported.unit.test.ts +++ b/src/test/application/diagnostics/checks/lsNotSupported.unit.test.ts @@ -12,7 +12,7 @@ import { CommandOption, IDiagnosticsCommandFactory } from '../../../../client/ap import { DiagnosticCodes } from '../../../../client/application/diagnostics/constants'; import { DiagnosticCommandPromptHandlerServiceId, - MessageCommandPrompt + MessageCommandPrompt, } from '../../../../client/application/diagnostics/promptHandler'; import { DiagnosticScope, @@ -20,7 +20,7 @@ import { IDiagnosticCommand, IDiagnosticFilterService, IDiagnosticHandlerService, - IDiagnosticsService + IDiagnosticsService, } from '../../../../client/application/diagnostics/types'; import { IWorkspaceService } from '../../../../client/common/application/types'; import { IServiceContainer } from '../../../../client/ioc/types'; @@ -49,8 +49,8 @@ suite('Application Diagnostics - Checks LS not supported', () => { .setup((s) => s.get( TypeMoq.It.isValue(IDiagnosticHandlerService), - TypeMoq.It.isValue(DiagnosticCommandPromptHandlerServiceId) - ) + TypeMoq.It.isValue(DiagnosticCommandPromptHandlerServiceId), + ), ) .returns(() => messageHandler.object); const workspaceService = TypeMoq.Mock.ofType(); @@ -81,8 +81,8 @@ suite('Application Diagnostics - Checks LS not supported', () => { .setup((f) => f.createCommand( TypeMoq.It.isAny(), - TypeMoq.It.isObjectWith>({ type: 'launch' }) - ) + TypeMoq.It.isObjectWith>({ type: 'launch' }), + ), ) .returns(() => launchBrowserCommand.object) .verifiable(TypeMoq.Times.once()); @@ -93,9 +93,9 @@ suite('Application Diagnostics - Checks LS not supported', () => { TypeMoq.It.isAny(), TypeMoq.It.isObjectWith>({ type: 'ignore', - options: DiagnosticScope.Global - }) - ) + options: DiagnosticScope.Global, + }), + ), ) .returns(() => alwaysIgnoreCommand.object) .verifiable(TypeMoq.Times.once()); diff --git a/src/test/application/diagnostics/checks/macPythonInterpreter.unit.test.ts b/src/test/application/diagnostics/checks/macPythonInterpreter.unit.test.ts index cac0a6db20bc..e719259fb8a2 100644 --- a/src/test/application/diagnostics/checks/macPythonInterpreter.unit.test.ts +++ b/src/test/application/diagnostics/checks/macPythonInterpreter.unit.test.ts @@ -11,13 +11,13 @@ import { ConfigurationChangeEvent, Uri } from 'vscode'; import { BaseDiagnosticsService } from '../../../../client/application/diagnostics/base'; import { InvalidMacPythonInterpreterDiagnostic, - InvalidMacPythonInterpreterService + InvalidMacPythonInterpreterService, } from '../../../../client/application/diagnostics/checks/macPythonInterpreter'; import { CommandOption, IDiagnosticsCommandFactory } from '../../../../client/application/diagnostics/commands/types'; import { DiagnosticCodes } from '../../../../client/application/diagnostics/constants'; import { DiagnosticCommandPromptHandlerServiceId, - MessageCommandPrompt + MessageCommandPrompt, } from '../../../../client/application/diagnostics/promptHandler'; import { DiagnosticScope, @@ -25,7 +25,7 @@ import { IDiagnosticCommand, IDiagnosticFilterService, IDiagnosticHandlerService, - IDiagnosticsService + IDiagnosticsService, } from '../../../../client/application/diagnostics/types'; import { CommandsWithoutArgs } from '../../../../client/common/application/commands'; import { IWorkspaceService } from '../../../../client/common/application/types'; @@ -38,7 +38,7 @@ import { IInterpreterPathService, InterpreterConfigurationScope, IPythonSettings, - Resource + Resource, } from '../../../../client/common/types'; import { sleep } from '../../../../client/common/utils/async'; import { noop } from '../../../../client/common/utils/misc'; @@ -64,8 +64,8 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { .setup((s) => s.get( typemoq.It.isValue(IDiagnosticHandlerService), - typemoq.It.isValue(DiagnosticCommandPromptHandlerServiceId) - ) + typemoq.It.isValue(DiagnosticCommandPromptHandlerServiceId), + ), ) .returns(() => messageHandler.object); commandFactory = typemoq.Mock.ofType(); @@ -119,7 +119,7 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { test('Can handle InvalidPythonPathInterpreter diagnostics', async () => { for (const code of [ DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic, - DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic + DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic, ]) { const diagnostic = typemoq.Mock.ofType(); diagnostic @@ -259,10 +259,10 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { [ new InvalidMacPythonInterpreterDiagnostic( DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic, - undefined - ) + undefined, + ), ], - 'not the same' + 'not the same', ); settings.verifyAll(); interpreterService.verifyAll(); @@ -281,8 +281,8 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { Promise.resolve([ { path: pythonPath } as any, { path: pythonPath } as any, - { path: nonMacStandardInterpreter } as any - ]) + { path: nonMacStandardInterpreter } as any, + ]), ) .verifiable(typemoq.Times.once()); platformService @@ -309,10 +309,10 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { [ new InvalidMacPythonInterpreterDiagnostic( DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic, - undefined - ) + undefined, + ), ], - 'not the same' + 'not the same', ); settings.verifyAll(); interpreterService.verifyAll(); @@ -322,7 +322,7 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { test('Handling no interpreters diagnostic should return select interpreter cmd', async () => { const diagnostic = new InvalidMacPythonInterpreterDiagnostic( DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic, - undefined + undefined, ); const cmd = ({} as any) as IDiagnosticCommand; const cmdIgnore = ({} as any) as IDiagnosticCommand; @@ -337,9 +337,9 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { f.createCommand( typemoq.It.isAny(), typemoq.It.isObjectWith>({ - type: 'executeVSCCommand' - }) - ) + type: 'executeVSCCommand', + }), + ), ) .returns(() => cmd) .verifiable(typemoq.Times.once()); @@ -349,9 +349,9 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { typemoq.It.isAny(), typemoq.It.isObjectWith>({ type: 'ignore', - options: DiagnosticScope.Global - }) - ) + options: DiagnosticScope.Global, + }), + ), ) .returns(() => cmdIgnore) .verifiable(typemoq.Times.once()); @@ -363,13 +363,13 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { expect(messagePrompt).not.be.equal(undefined, 'Message prompt not set'); expect(messagePrompt!.commandPrompts).to.be.deep.equal([ { prompt: 'Select Python Interpreter', command: cmd }, - { prompt: 'Do not show again', command: cmdIgnore } + { prompt: 'Do not show again', command: cmdIgnore }, ]); }); test('Handling no interpreters diagnostisc should return 3 commands', async () => { const diagnostic = new InvalidMacPythonInterpreterDiagnostic( DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic, - undefined + undefined, ); const cmdDownload = ({} as any) as IDiagnosticCommand; const cmdLearn = ({} as any) as IDiagnosticCommand; @@ -386,9 +386,9 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { typemoq.It.isAny(), typemoq.It.isObjectWith>({ type: 'launch', - options: 'https://code.visualstudio.com/docs/python/python-tutorial#_prerequisites' - }) - ) + options: 'https://code.visualstudio.com/docs/python/python-tutorial#_prerequisites', + }), + ), ) .returns(() => cmdLearn) .verifiable(typemoq.Times.once()); @@ -398,9 +398,9 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { typemoq.It.isAny(), typemoq.It.isObjectWith>({ type: 'launch', - options: 'https://www.python.org/downloads' - }) - ) + options: 'https://www.python.org/downloads', + }), + ), ) .returns(() => cmdDownload) .verifiable(typemoq.Times.once()); @@ -410,9 +410,9 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { typemoq.It.isAny(), typemoq.It.isObjectWith>({ type: 'ignore', - options: DiagnosticScope.Global - }) - ) + options: DiagnosticScope.Global, + }), + ), ) .returns(() => cmdIgnore) .verifiable(typemoq.Times.once()); @@ -425,20 +425,20 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { expect(messagePrompt!.commandPrompts).to.be.deep.equal([ { prompt: 'Learn more', command: cmdLearn }, { prompt: 'Download', command: cmdDownload }, - { prompt: 'Do not show again', command: cmdIgnore } + { prompt: 'Do not show again', command: cmdIgnore }, ]); }); test('Should not display a message if No Interpreters diagnostic has been ignored', async () => { const diagnostic = new InvalidMacPythonInterpreterDiagnostic( DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic, - undefined + undefined, ); filterService .setup((f) => f.shouldIgnoreDiagnostic( - typemoq.It.isValue(DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic) - ) + typemoq.It.isValue(DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic), + ), ) .returns(() => Promise.resolve(true)) .verifiable(typemoq.Times.once()); @@ -472,7 +472,8 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { let invoked = false; let callbackHandler!: (e: ConfigurationChangeEvent) => Promise; const workspaceService = { - onDidChangeConfiguration: (cb: (e: ConfigurationChangeEvent) => Promise) => (callbackHandler = cb) + onDidChangeConfiguration: (cb: (e: ConfigurationChangeEvent) => Promise) => + (callbackHandler = cb), } as any; const serviceContainerObject = createContainer(); @@ -544,7 +545,7 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { arg1: IServiceContainer, arg2: IInterpreterService, arg3: IPlatformService, - arg4: IInterpreterHelper + arg4: IInterpreterHelper, ) { super(arg1, arg2, [], arg3, arg4); this.changeThrottleTimeout = 1; @@ -558,7 +559,7 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { serviceContainerObject, typemoq.Mock.ofType().object, typemoq.Mock.ofType().object, - typemoq.Mock.ofType().object + typemoq.Mock.ofType().object, ); event @@ -599,7 +600,7 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { arg1: IServiceContainer, arg2: IInterpreterService, arg3: IPlatformService, - arg4: IInterpreterHelper + arg4: IInterpreterHelper, ) { super(arg1, arg2, [], arg3, arg4); this.changeThrottleTimeout = 1; @@ -615,7 +616,7 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { serviceContainerObject, typemoq.Mock.ofType().object, typemoq.Mock.ofType().object, - typemoq.Mock.ofType().object + typemoq.Mock.ofType().object, ); await diagnosticSvc.onDidChangeConfigurationEx(undefined, interpreterConfigurationScope.object); @@ -646,7 +647,7 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { arg1: IServiceContainer, arg2: IInterpreterService, arg3: IPlatformService, - arg4: IInterpreterHelper + arg4: IInterpreterHelper, ) { super(arg1, arg2, [], arg3, arg4); this.changeThrottleTimeout = 1; @@ -657,11 +658,11 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { serviceContainerObject, typemoq.Mock.ofType().object, typemoq.Mock.ofType().object, - typemoq.Mock.ofType().object + typemoq.Mock.ofType().object, ); await expect(diagnosticSvc.onDidChangeConfigurationEx(undefined, undefined)).to.eventually.be.rejectedWith( - Error + Error, ); }); @@ -694,7 +695,7 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { arg1: IServiceContainer, arg2: IInterpreterService, arg3: IPlatformService, - arg4: IInterpreterHelper + arg4: IInterpreterHelper, ) { super(arg1, arg2, [], arg3, arg4); this.changeThrottleTimeout = 100; @@ -708,7 +709,7 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { serviceContainerObject, typemoq.Mock.ofType().object, typemoq.Mock.ofType().object, - typemoq.Mock.ofType().object + typemoq.Mock.ofType().object, ); event @@ -756,7 +757,7 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { undefined as any, [], undefined as any, - undefined as any + undefined as any, ); expect(interpreterPathServiceHandler!).to.not.equal(undefined, 'Handler not set'); diff --git a/src/test/application/diagnostics/checks/powerShellActivation.unit.test.ts b/src/test/application/diagnostics/checks/powerShellActivation.unit.test.ts index fc5a1bb6a35e..0dd79621037a 100644 --- a/src/test/application/diagnostics/checks/powerShellActivation.unit.test.ts +++ b/src/test/application/diagnostics/checks/powerShellActivation.unit.test.ts @@ -11,7 +11,7 @@ import { CommandOption, IDiagnosticsCommandFactory } from '../../../../client/ap import { DiagnosticCodes } from '../../../../client/application/diagnostics/constants'; import { DiagnosticCommandPromptHandlerServiceId, - MessageCommandPrompt + MessageCommandPrompt, } from '../../../../client/application/diagnostics/promptHandler'; import { DiagnosticScope, @@ -19,7 +19,7 @@ import { IDiagnosticCommand, IDiagnosticFilterService, IDiagnosticHandlerService, - IDiagnosticsService + IDiagnosticsService, } from '../../../../client/application/diagnostics/types'; import { IApplicationEnvironment, IWorkspaceService } from '../../../../client/common/application/types'; import { IPlatformService } from '../../../../client/common/platform/types'; @@ -52,8 +52,8 @@ suite('Application Diagnostics - PowerShell Activation', () => { .setup((s) => s.get( typemoq.It.isValue(IDiagnosticHandlerService), - typemoq.It.isValue(DiagnosticCommandPromptHandlerServiceId) - ) + typemoq.It.isValue(DiagnosticCommandPromptHandlerServiceId), + ), ) .returns(() => messageHandler.object); @@ -136,9 +136,9 @@ suite('Application Diagnostics - PowerShell Activation', () => { typemoq.It.isAny(), typemoq.It.isObjectWith>({ type: 'ignore', - options: DiagnosticScope.Global - }) - ) + options: DiagnosticScope.Global, + }), + ), ) .returns(() => alwaysIgnoreCommand.object) .verifiable(typemoq.Times.once()); @@ -147,8 +147,8 @@ suite('Application Diagnostics - PowerShell Activation', () => { .setup((f) => f.createCommand( typemoq.It.isAny(), - typemoq.It.isObjectWith>({ type: 'launch' }) - ) + typemoq.It.isObjectWith>({ type: 'launch' }), + ), ) .returns(() => launchBrowserCommand.object) .verifiable(typemoq.Times.once()); diff --git a/src/test/application/diagnostics/checks/pythonInterpreter.unit.test.ts b/src/test/application/diagnostics/checks/pythonInterpreter.unit.test.ts index 78b9920014bf..2cf1ebf33f9e 100644 --- a/src/test/application/diagnostics/checks/pythonInterpreter.unit.test.ts +++ b/src/test/application/diagnostics/checks/pythonInterpreter.unit.test.ts @@ -11,19 +11,19 @@ import { BaseDiagnosticsService } from '../../../../client/application/diagnosti import { InvalidLaunchJsonDebuggerDiagnostic } from '../../../../client/application/diagnostics/checks/invalidLaunchJsonDebugger'; import { InvalidPythonInterpreterDiagnostic, - InvalidPythonInterpreterService + InvalidPythonInterpreterService, } from '../../../../client/application/diagnostics/checks/pythonInterpreter'; import { CommandOption, IDiagnosticsCommandFactory } from '../../../../client/application/diagnostics/commands/types'; import { DiagnosticCodes } from '../../../../client/application/diagnostics/constants'; import { DiagnosticCommandPromptHandlerServiceId, - MessageCommandPrompt + MessageCommandPrompt, } from '../../../../client/application/diagnostics/promptHandler'; import { IDiagnostic, IDiagnosticCommand, IDiagnosticHandlerService, - IDiagnosticsService + IDiagnosticsService, } from '../../../../client/application/diagnostics/types'; import { CommandsWithoutArgs } from '../../../../client/common/application/commands'; import { IPlatformService } from '../../../../client/common/platform/types'; @@ -50,8 +50,8 @@ suite('Application Diagnostics - Checks Python Interpreter', () => { .setup((s) => s.get( typemoq.It.isValue(IDiagnosticHandlerService), - typemoq.It.isValue(DiagnosticCommandPromptHandlerServiceId) - ) + typemoq.It.isValue(DiagnosticCommandPromptHandlerServiceId), + ), ) .returns(() => messageHandler.object); commandFactory = typemoq.Mock.ofType(); @@ -96,7 +96,7 @@ suite('Application Diagnostics - Checks Python Interpreter', () => { test('Can handle InvalidPythonPathInterpreter diagnostics', async () => { for (const code of [ DiagnosticCodes.NoPythonInterpretersDiagnostic, - DiagnosticCodes.NoCurrentlySelectedPythonInterpreterDiagnostic + DiagnosticCodes.NoCurrentlySelectedPythonInterpreterDiagnostic, ]) { const diagnostic = typemoq.Mock.ofType(); diagnostic @@ -147,7 +147,7 @@ suite('Application Diagnostics - Checks Python Interpreter', () => { const diagnostics = await diagnosticService.diagnose(undefined); expect(diagnostics).to.be.deep.equal( [new InvalidPythonInterpreterDiagnostic(DiagnosticCodes.NoPythonInterpretersDiagnostic, undefined)], - 'not the same' + 'not the same', ); settings.verifyAll(); interpreterService.verifyAll(); @@ -201,10 +201,10 @@ suite('Application Diagnostics - Checks Python Interpreter', () => { [ new InvalidPythonInterpreterDiagnostic( DiagnosticCodes.NoCurrentlySelectedPythonInterpreterDiagnostic, - undefined - ) + undefined, + ), ], - 'not the same' + 'not the same', ); settings.verifyAll(); interpreterService.verifyAll(); @@ -233,7 +233,7 @@ suite('Application Diagnostics - Checks Python Interpreter', () => { test('Handling no interpreters diagnostic should return download link', async () => { const diagnostic = new InvalidPythonInterpreterDiagnostic( DiagnosticCodes.NoPythonInterpretersDiagnostic, - undefined + undefined, ); const cmd = ({} as any) as IDiagnosticCommand; let messagePrompt: MessageCommandPrompt | undefined; @@ -246,8 +246,8 @@ suite('Application Diagnostics - Checks Python Interpreter', () => { .setup((f) => f.createCommand( typemoq.It.isAny(), - typemoq.It.isObjectWith>({ type: 'launch' }) - ) + typemoq.It.isObjectWith>({ type: 'launch' }), + ), ) .returns(() => cmd) .verifiable(typemoq.Times.once()); @@ -263,7 +263,7 @@ suite('Application Diagnostics - Checks Python Interpreter', () => { test('Handling no currently selected interpreter diagnostic should show select interpreter message', async () => { const diagnostic = new InvalidPythonInterpreterDiagnostic( DiagnosticCodes.NoCurrentlySelectedPythonInterpreterDiagnostic, - undefined + undefined, ); const cmd = ({} as any) as IDiagnosticCommand; let messagePrompt: MessageCommandPrompt | undefined; @@ -277,9 +277,9 @@ suite('Application Diagnostics - Checks Python Interpreter', () => { f.createCommand( typemoq.It.isAny(), typemoq.It.isObjectWith>({ - type: 'executeVSCCommand' - }) - ) + type: 'executeVSCCommand', + }), + ), ) .returns(() => cmd) .verifiable(typemoq.Times.once()); @@ -291,13 +291,13 @@ suite('Application Diagnostics - Checks Python Interpreter', () => { expect(messagePrompt).not.be.equal(undefined, 'Message prompt not set'); expect(messagePrompt!.onClose).be.equal(undefined, 'onClose handler should not be set.'); expect(messagePrompt!.commandPrompts).to.be.deep.equal([ - { prompt: 'Select Python Interpreter', command: cmd } + { prompt: 'Select Python Interpreter', command: cmd }, ]); }); test('Handling no interpreters diagnostic should return select interpreter cmd', async () => { const diagnostic = new InvalidPythonInterpreterDiagnostic( DiagnosticCodes.NoCurrentlySelectedPythonInterpreterDiagnostic, - undefined + undefined, ); const cmd = ({} as any) as IDiagnosticCommand; let messagePrompt: MessageCommandPrompt | undefined; @@ -311,9 +311,9 @@ suite('Application Diagnostics - Checks Python Interpreter', () => { f.createCommand( typemoq.It.isAny(), typemoq.It.isObjectWith>({ - type: 'executeVSCCommand' - }) - ) + type: 'executeVSCCommand', + }), + ), ) .returns(() => cmd) .verifiable(typemoq.Times.once()); @@ -325,7 +325,7 @@ suite('Application Diagnostics - Checks Python Interpreter', () => { expect(messagePrompt).not.be.equal(undefined, 'Message prompt not set'); expect(messagePrompt!.onClose).be.equal(undefined, 'onClose handler should not be set.'); expect(messagePrompt!.commandPrompts).to.be.deep.equal([ - { prompt: 'Select Python Interpreter', command: cmd } + { prompt: 'Select Python Interpreter', command: cmd }, ]); }); test('Handling an empty diagnostic should not show a message nor return a command', async () => { @@ -342,9 +342,9 @@ suite('Application Diagnostics - Checks Python Interpreter', () => { f.createCommand( typemoq.It.isAny(), typemoq.It.isObjectWith>({ - type: 'executeVSCCommand' - }) - ) + type: 'executeVSCCommand', + }), + ), ) .returns(() => cmd) .verifiable(typemoq.Times.never()); @@ -357,7 +357,7 @@ suite('Application Diagnostics - Checks Python Interpreter', () => { test('Handling an unsupported diagnostic code should not show a message nor return a command', async () => { const diagnostic = new InvalidPythonInterpreterDiagnostic( DiagnosticCodes.NoCurrentlySelectedPythonInterpreterDiagnostic, - undefined + undefined, ); const cmd = ({} as any) as IDiagnosticCommand; const diagnosticServiceMock = (typemoq.Mock.ofInstance(diagnosticService) as any) as typemoq.IMock< @@ -375,9 +375,9 @@ suite('Application Diagnostics - Checks Python Interpreter', () => { f.createCommand( typemoq.It.isAny(), typemoq.It.isObjectWith>({ - type: 'executeVSCCommand' - }) - ) + type: 'executeVSCCommand', + }), + ), ) .returns(() => cmd) .verifiable(typemoq.Times.never()); @@ -401,9 +401,9 @@ suite('Application Diagnostics - Checks Python Interpreter', () => { f.createCommand( typemoq.It.isAny(), typemoq.It.isObjectWith>({ - type: 'executeVSCCommand' - }) - ) + type: 'executeVSCCommand', + }), + ), ) .returns(() => cmd) .verifiable(typemoq.Times.never()); @@ -413,7 +413,7 @@ suite('Application Diagnostics - Checks Python Interpreter', () => { } catch (err) { expect(err.message).to.be.equal( "Invalid diagnostic for 'InvalidPythonInterpreterService'", - 'Error message is different' + 'Error message is different', ); } diff --git a/src/test/application/diagnostics/checks/pythonPathDeprecated.unit.test.ts b/src/test/application/diagnostics/checks/pythonPathDeprecated.unit.test.ts index 7fab9fb2de27..40720bb5586d 100644 --- a/src/test/application/diagnostics/checks/pythonPathDeprecated.unit.test.ts +++ b/src/test/application/diagnostics/checks/pythonPathDeprecated.unit.test.ts @@ -12,20 +12,20 @@ import { ConfigurationTarget, DiagnosticSeverity, Uri, WorkspaceConfiguration } import { BaseDiagnostic, BaseDiagnosticsService } from '../../../../client/application/diagnostics/base'; import { PythonPathDeprecatedDiagnostic, - PythonPathDeprecatedDiagnosticService + PythonPathDeprecatedDiagnosticService, } from '../../../../client/application/diagnostics/checks/pythonPathDeprecated'; import { CommandOption, IDiagnosticsCommandFactory } from '../../../../client/application/diagnostics/commands/types'; import { DiagnosticCodes } from '../../../../client/application/diagnostics/constants'; import { DiagnosticCommandPromptHandlerServiceId, - MessageCommandPrompt + MessageCommandPrompt, } from '../../../../client/application/diagnostics/promptHandler'; import { DiagnosticScope, IDiagnostic, IDiagnosticCommand, IDiagnosticFilterService, - IDiagnosticHandlerService + IDiagnosticHandlerService, } from '../../../../client/application/diagnostics/types'; import { IWorkspaceService } from '../../../../client/common/application/types'; import { STANDARD_OUTPUT_CHANNEL } from '../../../../client/common/constants'; @@ -57,8 +57,8 @@ suite('Application Diagnostics - Python Path Deprecated', () => { .setup((s) => s.get( typemoq.It.isValue(IDiagnosticHandlerService), - typemoq.It.isValue(DiagnosticCommandPromptHandlerServiceId) - ) + typemoq.It.isValue(DiagnosticCommandPromptHandlerServiceId), + ), ) .returns(() => messageHandler.object); commandFactory = typemoq.Mock.ofType(); @@ -104,7 +104,7 @@ suite('Application Diagnostics - Python Path Deprecated', () => { const canHandle = await diagnosticService.canHandle(diagnostic.object); expect(canHandle).to.be.equal( true, - `Should be able to handle ${DiagnosticCodes.PythonPathDeprecatedDiagnostic}` + `Should be able to handle ${DiagnosticCodes.PythonPathDeprecatedDiagnostic}`, ); diagnostic.verifyAll(); }); @@ -124,7 +124,7 @@ suite('Application Diagnostics - Python Path Deprecated', () => { filterService .setup((f) => - f.shouldIgnoreDiagnostic(typemoq.It.isValue(DiagnosticCodes.PythonPathDeprecatedDiagnostic)) + f.shouldIgnoreDiagnostic(typemoq.It.isValue(DiagnosticCodes.PythonPathDeprecatedDiagnostic)), ) .returns(() => Promise.resolve(true)) .verifiable(typemoq.Times.once()); @@ -151,7 +151,7 @@ suite('Application Diagnostics - Python Path Deprecated', () => { const ignoreCmd = ({ cmd: 'ignoreCmd' } as any) as IDiagnosticCommand; filterService .setup((f) => - f.shouldIgnoreDiagnostic(typemoq.It.isValue(DiagnosticCodes.PythonPathDeprecatedDiagnostic)) + f.shouldIgnoreDiagnostic(typemoq.It.isValue(DiagnosticCodes.PythonPathDeprecatedDiagnostic)), ) .returns(() => Promise.resolve(false)); let messagePrompt: MessageCommandPrompt | undefined; @@ -165,14 +165,14 @@ suite('Application Diagnostics - Python Path Deprecated', () => { .setup((f) => f.createCommand( typemoq.It.isAny(), - typemoq.It.isObjectWith>({ type: 'ignore' }) - ) + typemoq.It.isObjectWith>({ type: 'ignore' }), + ), ) .returns(() => ignoreCmd) .verifiable(typemoq.Times.once()); const _removePythonPathFromWorkspaceSettings = sinon.stub( PythonPathDeprecatedDiagnosticService.prototype, - '_removePythonPathFromWorkspaceSettings' + '_removePythonPathFromWorkspaceSettings', ); _removePythonPathFromWorkspaceSettings.resolves(); @@ -188,7 +188,7 @@ suite('Application Diagnostics - Python Path Deprecated', () => { expect(messagePrompt!.commandPrompts[0].prompt).to.be.deep.equal(Common.openOutputPanel()); expect(messagePrompt!.commandPrompts[1]).to.be.deep.equal({ prompt: Common.doNotShowAgain(), - command: ignoreCmd + command: ignoreCmd, }); output @@ -223,7 +223,7 @@ suite('Application Diagnostics - Python Path Deprecated', () => { message, DiagnosticSeverity.Information, DiagnosticScope.WorkspaceFolder, - uri + uri, ); } })('message', undefined); @@ -258,8 +258,8 @@ suite('Application Diagnostics - Python Path Deprecated', () => { () => ({ workspaceFolderValue: 'workspaceFolderValue', - workspaceValue: 'workspaceValue' - } as any) + workspaceValue: 'workspaceValue', + } as any), ); const diagnostics = await diagnosticService.diagnose(resource); @@ -284,8 +284,8 @@ suite('Application Diagnostics - Python Path Deprecated', () => { .returns( () => ({ - workspaceValue: 'workspaceValue' - } as any) + workspaceValue: 'workspaceValue', + } as any), ); const diagnostics = await diagnosticService.diagnose(resource); @@ -313,8 +313,8 @@ suite('Application Diagnostics - Python Path Deprecated', () => { () => ({ workspaceValue: 'workspaceValue', - workspaceFolderValue: 'workspaceFolderValue' - } as any) + workspaceFolderValue: 'workspaceFolderValue', + } as any), ); const diagnostics = await diagnosticService.diagnose(resource); @@ -342,8 +342,8 @@ suite('Application Diagnostics - Python Path Deprecated', () => { () => ({ workspaceValue: 'workspaceValue', - workspaceFolderValue: 'workspaceFolderValue' - } as any) + workspaceFolderValue: 'workspaceFolderValue', + } as any), ); const diagnostics = await diagnosticService.diagnose(resource); diff --git a/src/test/application/diagnostics/checks/updateTestSettings.unit.test.ts b/src/test/application/diagnostics/checks/updateTestSettings.unit.test.ts index 039086a404a3..9ef46cb89ec1 100644 --- a/src/test/application/diagnostics/checks/updateTestSettings.unit.test.ts +++ b/src/test/application/diagnostics/checks/updateTestSettings.unit.test.ts @@ -34,7 +34,7 @@ suite('Application Diagnostics - Check Test Settings', () => { const stateFactory = mock(PersistentStateFactory); when(stateFactory.createGlobalPersistentState('python.unitTest.Settings', anything())).thenReturn( - instance(storage) + instance(storage), ); diagnosticService = new UpdateTestSettingService(instance(fs), instance(appEnv), instance(workspace)); @@ -133,23 +133,23 @@ suite('Application Diagnostics - Check Test Settings', () => { { testTitle: 'Should fix file if contents contains python.unitTest.', expectedValue: true, - contents: '{"python.pythonPath":"1234", "python.unitTest.unitTestArgs":[]}' + contents: '{"python.pythonPath":"1234", "python.unitTest.unitTestArgs":[]}', }, { testTitle: 'Should fix file if contents contains python.pyTest.', expectedValue: true, - contents: '{"python.pythonPath":"1234", "python.pyTestArgs":[]}' + contents: '{"python.pythonPath":"1234", "python.pyTestArgs":[]}', }, { testTitle: 'Should fix file if contents contains python.pyTest. & python.unitTest.', expectedValue: true, - contents: '{"python.pythonPath":"1234", "python.testing.pyTestArgs":[], "python.unitTest.unitTestArgs":[]}' + contents: '{"python.pythonPath":"1234", "python.testing.pyTestArgs":[], "python.unitTest.unitTestArgs":[]}', }, { testTitle: 'Should not fix file if contents does not contain python.unitTest. and python.pyTest', expectedValue: false, - contents: '{"python.pythonPath":"1234", "python.unittest.unitTestArgs":[]}' - } + contents: '{"python.pythonPath":"1234", "python.unittest.unitTestArgs":[]}', + }, ].forEach((item) => { test(item.testTitle, async () => { when(fs.readFile(__filename)).thenResolve(item.contents); @@ -179,29 +179,29 @@ suite('Application Diagnostics - Check Test Settings', () => { { testTitle: 'Should replace python.unitTest.', contents: '{"python.pythonPath":"1234", "python.unitTest.unitTestArgs":[]}', - expectedContents: '{"python.pythonPath":"1234", "python.testing.unitTestArgs":[]}' + expectedContents: '{"python.pythonPath":"1234", "python.testing.unitTestArgs":[]}', }, { testTitle: 'Should replace python.unitTest.pyTest.', contents: '{"python.pythonPath":"1234", "python.unitTest.pyTestArgs":[], "python.unitTest.pyTestArgs":[], "python.unitTest.pyTestPath":[]}', expectedContents: - '{"python.pythonPath":"1234", "python.testing.pytestArgs":[], "python.testing.pytestArgs":[], "python.testing.pytestPath":[]}' + '{"python.pythonPath":"1234", "python.testing.pytestArgs":[], "python.testing.pytestArgs":[], "python.testing.pytestPath":[]}', }, { testTitle: 'Should replace python.testing.pyTest.', contents: '{"python.pythonPath":"1234", "python.testing.pyTestArgs":[], "python.testing.pyTestArgs":[], "python.testing.pyTestPath":[]}', expectedContents: - '{"python.pythonPath":"1234", "python.testing.pytestArgs":[], "python.testing.pytestArgs":[], "python.testing.pytestPath":[]}' + '{"python.pythonPath":"1234", "python.testing.pytestArgs":[], "python.testing.pytestArgs":[], "python.testing.pytestPath":[]}', }, { testTitle: 'Should not make any changes to the file', contents: '{"python.pythonPath":"1234", "python.unittest.unitTestArgs":[], "python.unitTest.pytestArgs":[], "python.testing.pytestArgs":[], "python.testing.pytestPath":[]}', expectedContents: - '{"python.pythonPath":"1234", "python.unittest.unitTestArgs":[], "python.testing.pytestArgs":[], "python.testing.pytestArgs":[], "python.testing.pytestPath":[]}' - } + '{"python.pythonPath":"1234", "python.unittest.unitTestArgs":[], "python.testing.pytestArgs":[], "python.testing.pytestArgs":[], "python.testing.pytestPath":[]}', + }, ].forEach((item) => { test(item.testTitle, async () => { when(fs.readFile(__filename)).thenResolve(item.contents); @@ -219,48 +219,48 @@ suite('Application Diagnostics - Check Test Settings', () => { { testTitle: 'No jediEnabled setting', contents: '{}', - expectedContent: '{}' + expectedContent: '{}', }, { testTitle: 'jediEnabled setting in comment', contents: '{\n // "python.jediEnabled": true\n }', - expectedContent: '{\n // "python.jediEnabled": true\n }' + expectedContent: '{\n // "python.jediEnabled": true\n }', }, { testTitle: 'jediEnabled: true, no languageServer setting', contents: '{ "python.jediEnabled": true }', - expectedContent: '{ "python.jediEnabled": true, "python.languageServer": "Jedi"}' + expectedContent: '{ "python.jediEnabled": true, "python.languageServer": "Jedi"}', }, { testTitle: 'jediEnabled: true, languageServer setting present', contents: '{ "python.jediEnabled": true }', - expectedContent: '{ "python.jediEnabled": true, "python.languageServer": "Jedi"}' + expectedContent: '{ "python.jediEnabled": true, "python.languageServer": "Jedi"}', }, { testTitle: 'jediEnabled: false, no languageServer setting', contents: '{ "python.jediEnabled": false }', - expectedContent: '{ "python.jediEnabled": false, "python.languageServer": "Microsoft"}' + expectedContent: '{ "python.jediEnabled": false, "python.languageServer": "Microsoft"}', }, { testTitle: 'jediEnabled: false, languageServer is Microsoft', contents: '{ "python.jediEnabled": false, "python.languageServer": "Microsoft" }', - expectedContent: '{ "python.jediEnabled": false, "python.languageServer": "Microsoft"}' + expectedContent: '{ "python.jediEnabled": false, "python.languageServer": "Microsoft"}', }, { testTitle: 'jediEnabled: false, languageServer is None', contents: '{ "python.jediEnabled": false, "python.languageServer": "None" }', - expectedContent: '{ "python.jediEnabled": false, "python.languageServer": "None"}' + expectedContent: '{ "python.jediEnabled": false, "python.languageServer": "None"}', }, { testTitle: 'jediEnabled: false, languageServer is Jedi', contents: '{ "python.jediEnabled": false, "python.languageServer": "Jedi" }', - expectedContent: '{ "python.jediEnabled": false, "python.languageServer": "Jedi"}' + expectedContent: '{ "python.jediEnabled": false, "python.languageServer": "Jedi"}', }, { testTitle: 'jediEnabled not present, languageServer is Microsoft', contents: '{ "python.languageServer": "Microsoft" }', - expectedContent: '{ "python.languageServer": "Microsoft" }' - } + expectedContent: '{ "python.languageServer": "Microsoft" }', + }, ].forEach((item) => { test(item.testTitle, async () => { when(fs.readFile(__filename)).thenResolve(item.contents); diff --git a/src/test/application/diagnostics/checks/upgradeCodeRunner.unit.test.ts b/src/test/application/diagnostics/checks/upgradeCodeRunner.unit.test.ts index e0f220f41080..578f1d6098e2 100644 --- a/src/test/application/diagnostics/checks/upgradeCodeRunner.unit.test.ts +++ b/src/test/application/diagnostics/checks/upgradeCodeRunner.unit.test.ts @@ -11,20 +11,20 @@ import { DiagnosticSeverity, Extension, Uri, WorkspaceConfiguration } from 'vsco import { BaseDiagnostic, BaseDiagnosticsService } from '../../../../client/application/diagnostics/base'; import { UpgradeCodeRunnerDiagnostic, - UpgradeCodeRunnerDiagnosticService + UpgradeCodeRunnerDiagnosticService, } from '../../../../client/application/diagnostics/checks/upgradeCodeRunner'; import { CommandOption, IDiagnosticsCommandFactory } from '../../../../client/application/diagnostics/commands/types'; import { DiagnosticCodes } from '../../../../client/application/diagnostics/constants'; import { DiagnosticCommandPromptHandlerServiceId, - MessageCommandPrompt + MessageCommandPrompt, } from '../../../../client/application/diagnostics/promptHandler'; import { DiagnosticScope, IDiagnostic, IDiagnosticCommand, IDiagnosticFilterService, - IDiagnosticHandlerService + IDiagnosticHandlerService, } from '../../../../client/application/diagnostics/types'; import { IWorkspaceService } from '../../../../client/common/application/types'; import { CODE_RUNNER_EXTENSION_ID } from '../../../../client/common/constants'; @@ -53,8 +53,8 @@ suite('Application Diagnostics - Upgrade Code Runner', () => { .setup((s) => s.get( typemoq.It.isValue(IDiagnosticHandlerService), - typemoq.It.isValue(DiagnosticCommandPromptHandlerServiceId) - ) + typemoq.It.isValue(DiagnosticCommandPromptHandlerServiceId), + ), ) .returns(() => messageHandler.object); commandFactory = typemoq.Mock.ofType(); @@ -96,7 +96,7 @@ suite('Application Diagnostics - Upgrade Code Runner', () => { const canHandle = await diagnosticService.canHandle(diagnostic.object); expect(canHandle).to.be.equal( true, - `Should be able to handle ${DiagnosticCodes.UpgradeCodeRunnerDiagnostic}` + `Should be able to handle ${DiagnosticCodes.UpgradeCodeRunnerDiagnostic}`, ); diagnostic.verifyAll(); }); @@ -156,8 +156,8 @@ suite('Application Diagnostics - Upgrade Code Runner', () => { .setup((f) => f.createCommand( typemoq.It.isAny(), - typemoq.It.isObjectWith>({ type: 'ignore' }) - ) + typemoq.It.isObjectWith>({ type: 'ignore' }), + ), ) .returns(() => ignoreCmd) .verifiable(typemoq.Times.once()); @@ -170,7 +170,7 @@ suite('Application Diagnostics - Upgrade Code Runner', () => { expect(messagePrompt!.commandPrompts.length).to.equal(1, 'Incorrect length'); expect(messagePrompt!.commandPrompts[0]).to.be.deep.equal({ prompt: Common.doNotShowAgain(), - command: ignoreCmd + command: ignoreCmd, }); }); @@ -200,7 +200,7 @@ suite('Application Diagnostics - Upgrade Code Runner', () => { message, DiagnosticSeverity.Information, DiagnosticScope.WorkspaceFolder, - uri + uri, ); } })('message', undefined); @@ -261,8 +261,8 @@ suite('Application Diagnostics - Upgrade Code Runner', () => { .setup((e) => e.packageJSON) .returns(() => ({ featureFlags: { - usingNewPythonInterpreterPathApiV2: true - } + usingNewPythonInterpreterPathApiV2: true, + }, })); workspaceService .setup((w) => w.getConfiguration('code-runner', resource)) diff --git a/src/test/application/diagnostics/commands/execVSCCommands.unit.test.ts b/src/test/application/diagnostics/commands/execVSCCommands.unit.test.ts index 56f9e51e0051..24881c71833b 100644 --- a/src/test/application/diagnostics/commands/execVSCCommands.unit.test.ts +++ b/src/test/application/diagnostics/commands/execVSCCommands.unit.test.ts @@ -29,7 +29,7 @@ suite('Application Diagnostics - Exec VSC Commands', () => { const command = commandFactory.createCommand(diagnostic.object, { type: 'executeVSCCommand', - options: 'editor.action.formatDocument' + options: 'editor.action.formatDocument', }); expect(command).to.be.instanceOf(ExecuteVSCCommand); }); @@ -43,7 +43,7 @@ suite('Application Diagnostics - Exec VSC Commands', () => { const command = commandFactory.createCommand(diagnostic.object, { type: 'executeVSCCommand', - options: 'editor.action.formatDocument' + options: 'editor.action.formatDocument', }); await command.invoke(); diff --git a/src/test/application/diagnostics/commands/factory.unit.test.ts b/src/test/application/diagnostics/commands/factory.unit.test.ts index a8e534408ad6..82db96aa3dec 100644 --- a/src/test/application/diagnostics/commands/factory.unit.test.ts +++ b/src/test/application/diagnostics/commands/factory.unit.test.ts @@ -24,7 +24,7 @@ suite('Application Diagnostics - Commands Factory', () => { const command = commandFactory.createCommand(diagnostic.object, { type: 'ignore', - options: DiagnosticScope.Global + options: DiagnosticScope.Global, }); expect(command).to.be.instanceOf(IgnoreDiagnosticCommand); }); diff --git a/src/test/application/diagnostics/commands/ignore.unit.test.ts b/src/test/application/diagnostics/commands/ignore.unit.test.ts index 65eb73c16d12..a73747df05ac 100644 --- a/src/test/application/diagnostics/commands/ignore.unit.test.ts +++ b/src/test/application/diagnostics/commands/ignore.unit.test.ts @@ -9,7 +9,7 @@ import { DiagnosticScope, IDiagnostic, IDiagnosticCommand, - IDiagnosticFilterService + IDiagnosticFilterService, } from '../../../../client/application/diagnostics/types'; import { IServiceContainer } from '../../../../client/ioc/types'; diff --git a/src/test/application/diagnostics/filter.unit.test.ts b/src/test/application/diagnostics/filter.unit.test.ts index fbd23e7390da..58ef59e5c810 100644 --- a/src/test/application/diagnostics/filter.unit.test.ts +++ b/src/test/application/diagnostics/filter.unit.test.ts @@ -22,8 +22,8 @@ suite('Application Diagnostics - Filter', () => { name: 'Workspace', scope: DiagnosticScope.WorkspaceFolder, state: () => workspaceState, - otherState: () => globalState - } + otherState: () => globalState, + }, ].forEach((item) => { let serviceContainer: typemoq.IMock; let filterService: IDiagnosticFilterService; @@ -39,16 +39,16 @@ suite('Application Diagnostics - Filter', () => { .setup((f) => f.createGlobalPersistentState( typemoq.It.isValue(FilterKeys.GlobalDiagnosticFilter), - typemoq.It.isValue([]) - ) + typemoq.It.isValue([]), + ), ) .returns(() => globalState.object); stateFactory .setup((f) => f.createWorkspacePersistentState( typemoq.It.isValue(FilterKeys.WorkspaceDiagnosticFilter), - typemoq.It.isValue([]) - ) + typemoq.It.isValue([]), + ), ) .returns(() => workspaceState.object); serviceContainer diff --git a/src/test/application/diagnostics/promptHandler.unit.test.ts b/src/test/application/diagnostics/promptHandler.unit.test.ts index 0f9b33017a73..cace7c0bbe44 100644 --- a/src/test/application/diagnostics/promptHandler.unit.test.ts +++ b/src/test/application/diagnostics/promptHandler.unit.test.ts @@ -10,13 +10,13 @@ import * as typemoq from 'typemoq'; import { DiagnosticSeverity } from 'vscode'; import { DiagnosticCommandPromptHandlerService, - MessageCommandPrompt + MessageCommandPrompt, } from '../../../client/application/diagnostics/promptHandler'; import { DiagnosticScope, IDiagnostic, IDiagnosticCommand, - IDiagnosticHandlerService + IDiagnosticHandlerService, } from '../../../client/application/diagnostics/types'; import { IApplicationShell } from '../../../client/common/application/types'; import { getNamesAndValues } from '../../../client/common/utils/enum'; @@ -44,7 +44,7 @@ suite('Application Diagnostics - PromptHandler', () => { scope: DiagnosticScope.Global, severity: severity.value, resource: undefined, - invokeHandler: 'default' + invokeHandler: 'default', }; switch (severity.value) { case DiagnosticSeverity.Error: { @@ -77,7 +77,7 @@ suite('Application Diagnostics - PromptHandler', () => { scope: DiagnosticScope.Global, severity: severity.value, resource: undefined, - invokeHandler: 'default' + invokeHandler: 'default', }; let onCloseHandlerInvoked = false; const options: MessageCommandPrompt = { @@ -85,7 +85,7 @@ suite('Application Diagnostics - PromptHandler', () => { message: 'Custom Message', onClose: () => { onCloseHandlerInvoked = true; - } + }, }; switch (severity.value) { @@ -95,8 +95,8 @@ suite('Application Diagnostics - PromptHandler', () => { a.showErrorMessage( typemoq.It.isValue(options.message!), typemoq.It.isValue('Yes'), - typemoq.It.isValue('No') - ) + typemoq.It.isValue('No'), + ), ) .returns(() => Promise.resolve('Yes')) .verifiable(typemoq.Times.once()); @@ -108,8 +108,8 @@ suite('Application Diagnostics - PromptHandler', () => { a.showWarningMessage( typemoq.It.isValue(options.message!), typemoq.It.isValue('Yes'), - typemoq.It.isValue('No') - ) + typemoq.It.isValue('No'), + ), ) .returns(() => Promise.resolve('Yes')) .verifiable(typemoq.Times.once()); @@ -121,8 +121,8 @@ suite('Application Diagnostics - PromptHandler', () => { a.showInformationMessage( typemoq.It.isValue(options.message!), typemoq.It.isValue('Yes'), - typemoq.It.isValue('No') - ) + typemoq.It.isValue('No'), + ), ) .returns(() => Promise.resolve('Yes')) .verifiable(typemoq.Times.once()); @@ -141,11 +141,11 @@ suite('Application Diagnostics - PromptHandler', () => { scope: DiagnosticScope.Global, severity: severity.value, resource: undefined, - invokeHandler: 'default' + invokeHandler: 'default', }; const options: MessageCommandPrompt = { commandPrompts: [{ prompt: 'Yes' }, { prompt: 'No' }], - message: 'Custom Message' + message: 'Custom Message', }; switch (severity.value) { @@ -155,8 +155,8 @@ suite('Application Diagnostics - PromptHandler', () => { a.showErrorMessage( typemoq.It.isValue(options.message!), typemoq.It.isValue('Yes'), - typemoq.It.isValue('No') - ) + typemoq.It.isValue('No'), + ), ) .verifiable(typemoq.Times.once()); break; @@ -167,8 +167,8 @@ suite('Application Diagnostics - PromptHandler', () => { a.showWarningMessage( typemoq.It.isValue(options.message!), typemoq.It.isValue('Yes'), - typemoq.It.isValue('No') - ) + typemoq.It.isValue('No'), + ), ) .verifiable(typemoq.Times.once()); break; @@ -179,8 +179,8 @@ suite('Application Diagnostics - PromptHandler', () => { a.showInformationMessage( typemoq.It.isValue(options.message!), typemoq.It.isValue('Yes'), - typemoq.It.isValue('No') - ) + typemoq.It.isValue('No'), + ), ) .verifiable(typemoq.Times.once()); break; @@ -197,15 +197,15 @@ suite('Application Diagnostics - PromptHandler', () => { scope: DiagnosticScope.Global, severity: severity.value, resource: undefined, - invokeHandler: 'default' + invokeHandler: 'default', }; const command = typemoq.Mock.ofType(); const options: MessageCommandPrompt = { commandPrompts: [ { prompt: 'Yes', command: command.object }, - { prompt: 'No', command: command.object } + { prompt: 'No', command: command.object }, ], - message: 'Custom Message' + message: 'Custom Message', }; command.setup((c) => c.invoke()).verifiable(typemoq.Times.once()); @@ -216,8 +216,8 @@ suite('Application Diagnostics - PromptHandler', () => { a.showErrorMessage( typemoq.It.isValue(options.message!), typemoq.It.isValue('Yes'), - typemoq.It.isValue('No') - ) + typemoq.It.isValue('No'), + ), ) .returns(() => Promise.resolve('Yes')) .verifiable(typemoq.Times.once()); @@ -229,8 +229,8 @@ suite('Application Diagnostics - PromptHandler', () => { a.showWarningMessage( typemoq.It.isValue(options.message!), typemoq.It.isValue('Yes'), - typemoq.It.isValue('No') - ) + typemoq.It.isValue('No'), + ), ) .returns(() => Promise.resolve('Yes')) .verifiable(typemoq.Times.once()); @@ -242,8 +242,8 @@ suite('Application Diagnostics - PromptHandler', () => { a.showInformationMessage( typemoq.It.isValue(options.message!), typemoq.It.isValue('Yes'), - typemoq.It.isValue('No') - ) + typemoq.It.isValue('No'), + ), ) .returns(() => Promise.resolve('Yes')) .verifiable(typemoq.Times.once()); diff --git a/src/test/application/diagnostics/serviceRegistry.unit.test.ts b/src/test/application/diagnostics/serviceRegistry.unit.test.ts index f174d1591ca1..e1c44dbfc949 100644 --- a/src/test/application/diagnostics/serviceRegistry.unit.test.ts +++ b/src/test/application/diagnostics/serviceRegistry.unit.test.ts @@ -8,39 +8,39 @@ import { IExtensionSingleActivationService, LanguageServerType } from '../../../ import { ApplicationDiagnostics } from '../../../client/application/diagnostics/applicationDiagnostics'; import { EnvironmentPathVariableDiagnosticsService, - EnvironmentPathVariableDiagnosticsServiceId + EnvironmentPathVariableDiagnosticsServiceId, } from '../../../client/application/diagnostics/checks/envPathVariable'; import { InvalidLaunchJsonDebuggerService, - InvalidLaunchJsonDebuggerServiceId + InvalidLaunchJsonDebuggerServiceId, } from '../../../client/application/diagnostics/checks/invalidLaunchJsonDebugger'; import { InvalidPythonPathInDebuggerService, - InvalidPythonPathInDebuggerServiceId + InvalidPythonPathInDebuggerServiceId, } from '../../../client/application/diagnostics/checks/invalidPythonPathInDebugger'; import { LSNotSupportedDiagnosticService, - LSNotSupportedDiagnosticServiceId + LSNotSupportedDiagnosticServiceId, } from '../../../client/application/diagnostics/checks/lsNotSupported'; import { InvalidMacPythonInterpreterService, - InvalidMacPythonInterpreterServiceId + InvalidMacPythonInterpreterServiceId, } from '../../../client/application/diagnostics/checks/macPythonInterpreter'; import { PowerShellActivationHackDiagnosticsService, - PowerShellActivationHackDiagnosticsServiceId + PowerShellActivationHackDiagnosticsServiceId, } from '../../../client/application/diagnostics/checks/powerShellActivation'; import { InvalidPythonInterpreterService, - InvalidPythonInterpreterServiceId + InvalidPythonInterpreterServiceId, } from '../../../client/application/diagnostics/checks/pythonInterpreter'; import { PythonPathDeprecatedDiagnosticService, - PythonPathDeprecatedDiagnosticServiceId + PythonPathDeprecatedDiagnosticServiceId, } from '../../../client/application/diagnostics/checks/pythonPathDeprecated'; import { UpgradeCodeRunnerDiagnosticService, - UpgradeCodeRunnerDiagnosticServiceId + UpgradeCodeRunnerDiagnosticServiceId, } from '../../../client/application/diagnostics/checks/upgradeCodeRunner'; import { DiagnosticsCommandFactory } from '../../../client/application/diagnostics/commands/factory'; import { IDiagnosticsCommandFactory } from '../../../client/application/diagnostics/commands/types'; @@ -48,13 +48,13 @@ import { DiagnosticFilterService } from '../../../client/application/diagnostics import { DiagnosticCommandPromptHandlerService, DiagnosticCommandPromptHandlerServiceId, - MessageCommandPrompt + MessageCommandPrompt, } from '../../../client/application/diagnostics/promptHandler'; import { registerTypes } from '../../../client/application/diagnostics/serviceRegistry'; import { IDiagnosticFilterService, IDiagnosticHandlerService, - IDiagnosticsService + IDiagnosticsService, } from '../../../client/application/diagnostics/types'; import { JoinMailingListPrompt } from '../../../client/application/misc/joinMailingListPrompt'; import { IApplicationDiagnostics } from '../../../client/application/types'; @@ -70,90 +70,90 @@ suite('Application Diagnostics - Register classes in IOC Container', () => { registerTypes(instance(serviceManager), LanguageServerType.Microsoft); verify( - serviceManager.addSingleton(IDiagnosticFilterService, DiagnosticFilterService) + serviceManager.addSingleton(IDiagnosticFilterService, DiagnosticFilterService), ); verify( serviceManager.addSingleton>( IDiagnosticHandlerService, DiagnosticCommandPromptHandlerService, - DiagnosticCommandPromptHandlerServiceId - ) + DiagnosticCommandPromptHandlerServiceId, + ), ); verify( serviceManager.addSingleton( IDiagnosticsService, EnvironmentPathVariableDiagnosticsService, - EnvironmentPathVariableDiagnosticsServiceId - ) + EnvironmentPathVariableDiagnosticsServiceId, + ), ); verify( serviceManager.addSingleton( IDiagnosticsService, InvalidLaunchJsonDebuggerService, - InvalidLaunchJsonDebuggerServiceId - ) + InvalidLaunchJsonDebuggerServiceId, + ), ); verify( serviceManager.addSingleton( IDiagnosticsService, UpgradeCodeRunnerDiagnosticService, - UpgradeCodeRunnerDiagnosticServiceId - ) + UpgradeCodeRunnerDiagnosticServiceId, + ), ); verify( serviceManager.addSingleton( IDiagnosticsService, InvalidPythonInterpreterService, - InvalidPythonInterpreterServiceId - ) + InvalidPythonInterpreterServiceId, + ), ); verify( serviceManager.addSingleton( IDiagnosticsService, InvalidPythonPathInDebuggerService, - InvalidPythonPathInDebuggerServiceId - ) + InvalidPythonPathInDebuggerServiceId, + ), ); verify( serviceManager.addSingleton( IDiagnosticsService, LSNotSupportedDiagnosticService, - LSNotSupportedDiagnosticServiceId - ) + LSNotSupportedDiagnosticServiceId, + ), ); verify( serviceManager.addSingleton( IDiagnosticsService, PowerShellActivationHackDiagnosticsService, - PowerShellActivationHackDiagnosticsServiceId - ) + PowerShellActivationHackDiagnosticsServiceId, + ), ); verify( serviceManager.addSingleton( IDiagnosticsService, InvalidMacPythonInterpreterService, - InvalidMacPythonInterpreterServiceId - ) + InvalidMacPythonInterpreterServiceId, + ), ); verify( serviceManager.addSingleton( IDiagnosticsService, PythonPathDeprecatedDiagnosticService, - PythonPathDeprecatedDiagnosticServiceId - ) + PythonPathDeprecatedDiagnosticServiceId, + ), ); verify( serviceManager.addSingleton( IDiagnosticsCommandFactory, - DiagnosticsCommandFactory - ) + DiagnosticsCommandFactory, + ), ); verify(serviceManager.addSingleton(IApplicationDiagnostics, ApplicationDiagnostics)); verify( serviceManager.addSingleton( IExtensionSingleActivationService, - JoinMailingListPrompt - ) + JoinMailingListPrompt, + ), ); }); }); diff --git a/src/test/application/diagnostics/sourceMapSupportService.unit.test.ts b/src/test/application/diagnostics/sourceMapSupportService.unit.test.ts index 4556b63d38e7..779d3e88172e 100644 --- a/src/test/application/diagnostics/sourceMapSupportService.unit.test.ts +++ b/src/test/application/diagnostics/sourceMapSupportService.unit.test.ts @@ -28,17 +28,17 @@ suite('Diagnostisc - Source Maps', () => { instance(commandManager), [], instance(configService), - undefined as any + undefined as any, ); when( - configService.updateSetting('diagnostics.sourceMapsEnabled', true, undefined, ConfigurationTarget.Global) + configService.updateSetting('diagnostics.sourceMapsEnabled', true, undefined, ConfigurationTarget.Global), ).thenResolve(); when(commandManager.executeCommand('workbench.action.reloadWindow')).thenResolve(); await service.enable(); verify( - configService.updateSetting('diagnostics.sourceMapsEnabled', true, undefined, ConfigurationTarget.Global) + configService.updateSetting('diagnostics.sourceMapsEnabled', true, undefined, ConfigurationTarget.Global), ).once(); verify(commandManager.executeCommand('workbench.action.reloadWindow')).once(); }); @@ -67,17 +67,17 @@ suite('Diagnostisc - Source Maps', () => { })(instance(commandManager), [], instance(configService), instance(shell)); when( - configService.updateSetting('diagnostics.sourceMapsEnabled', true, undefined, ConfigurationTarget.Global) + configService.updateSetting('diagnostics.sourceMapsEnabled', true, undefined, ConfigurationTarget.Global), ).thenResolve(); when(shell.showWarningMessage(anything(), anything())).thenResolve( - Diagnostics.enableSourceMapsAndReloadVSC() as any + Diagnostics.enableSourceMapsAndReloadVSC() as any, ); when(commandManager.executeCommand('workbench.action.reloadWindow')).thenResolve(); await service.onEnable(); verify( - configService.updateSetting('diagnostics.sourceMapsEnabled', true, undefined, ConfigurationTarget.Global) + configService.updateSetting('diagnostics.sourceMapsEnabled', true, undefined, ConfigurationTarget.Global), ).once(); verify(commandManager.executeCommand('workbench.action.reloadWindow')).once(); }); diff --git a/src/test/application/misc/joinMailingListPrompt.unit.test.ts b/src/test/application/misc/joinMailingListPrompt.unit.test.ts index 97f69f84a7f7..056b14b0a2b4 100644 --- a/src/test/application/misc/joinMailingListPrompt.unit.test.ts +++ b/src/test/application/misc/joinMailingListPrompt.unit.test.ts @@ -41,7 +41,7 @@ suite('Join Mailing list Prompt Tests', () => { instance(factory), instance(experimentService), instance(browserService), - instance(applicationEnvironment) + instance(applicationEnvironment), ); sendTelemetryStub = ImportMock.mockFunction(telemetry, 'sendTelemetryEvent'); @@ -111,18 +111,18 @@ suite('Join Mailing list Prompt Tests', () => { when(appShell.showInformationMessage(anything(), Common.bannerLabelYes(), Common.bannerLabelNo())).thenResolve( // tslint:disable-next-line: no-any - Common.bannerLabelYes() as any + Common.bannerLabelYes() as any, ); await joinMailingList.activate(); assert.ok(sendTelemetryStub.calledWithExactly(EventName.JOIN_MAILING_LIST_PROMPT_DISPLAYED)); verify( - browserService.launch('https://aka.ms/python-vscode-mailinglist?m=test.sessionId&utm_source=vscode') + browserService.launch('https://aka.ms/python-vscode-mailinglist?m=test.sessionId&utm_source=vscode'), ).once(); verify(storage.updateValue(true)).once(); assert.ok( - sendTelemetryStub.calledWithExactly(EventName.JOIN_MAILING_LIST_PROMPT, undefined, { selection: 'Yes' }) + sendTelemetryStub.calledWithExactly(EventName.JOIN_MAILING_LIST_PROMPT, undefined, { selection: 'Yes' }), ); }); test('Show any variant, but user clicks "No"', async () => { @@ -132,7 +132,7 @@ suite('Join Mailing list Prompt Tests', () => { when(appShell.showInformationMessage(anything(), Common.bannerLabelYes(), Common.bannerLabelNo())).thenResolve( // tslint:disable-next-line: no-any - Common.bannerLabelNo() as any + Common.bannerLabelNo() as any, ); await joinMailingList.activate(); @@ -140,7 +140,7 @@ suite('Join Mailing list Prompt Tests', () => { assert.ok(sendTelemetryStub.calledWithExactly(EventName.JOIN_MAILING_LIST_PROMPT_DISPLAYED)); verify(storage.updateValue(true)).once(); assert.ok( - sendTelemetryStub.calledWithExactly(EventName.JOIN_MAILING_LIST_PROMPT, undefined, { selection: 'No' }) + sendTelemetryStub.calledWithExactly(EventName.JOIN_MAILING_LIST_PROMPT, undefined, { selection: 'No' }), ); }); test('Show any variant, but user clicks close', async () => { @@ -149,7 +149,7 @@ suite('Join Mailing list Prompt Tests', () => { when(experimentService.getExperimentValue(JoinMailingListPromptVariants.variant1)).thenResolve('Sample value'); when(appShell.showInformationMessage(anything(), Common.bannerLabelYes(), Common.bannerLabelNo())).thenResolve( - undefined + undefined, ); await joinMailingList.activate(); @@ -157,7 +157,9 @@ suite('Join Mailing list Prompt Tests', () => { assert.ok(sendTelemetryStub.calledWithExactly(EventName.JOIN_MAILING_LIST_PROMPT_DISPLAYED)); verify(storage.updateValue(true)).once(); assert.ok( - sendTelemetryStub.calledWithExactly(EventName.JOIN_MAILING_LIST_PROMPT, undefined, { selection: undefined }) + sendTelemetryStub.calledWithExactly(EventName.JOIN_MAILING_LIST_PROMPT, undefined, { + selection: undefined, + }), ); }); }); diff --git a/src/test/common.ts b/src/test/common.ts index abe001f0c2fd..68354f76faa8 100644 --- a/src/test/common.ts +++ b/src/test/common.ts @@ -36,7 +36,7 @@ export enum OSType { Unknown = 'Unknown', Windows = 'Windows', OSX = 'OSX', - Linux = 'Linux' + Linux = 'Linux', } export type PythonSettingKeys = @@ -76,7 +76,7 @@ export async function updateSetting( setting: PythonSettingKeys, value: {} | undefined, resource: Uri | undefined, - configTarget: ConfigurationTarget + configTarget: ConfigurationTarget, ) { const vscode = require('vscode') as typeof import('vscode'); const settings = vscode.workspace.getConfiguration('python', { uri: resource, languageId: 'python' } || null); @@ -172,7 +172,7 @@ export function getExtensionSettings(resource: Uri | undefined): IPythonSettings } public async setWorkspaceInterpreter( _resource: Uri, - _interpreter: PythonEnvironment | undefined + _interpreter: PythonEnvironment | undefined, ): Promise { return; } @@ -221,7 +221,7 @@ async function setAutoSaveDelay(resource: string | Uri | undefined, config: Conf async function setPythonPathInWorkspace( resource: string | Uri | undefined, config: ConfigurationTarget, - pythonPath?: string + pythonPath?: string, ) { const vscode = require('vscode') as typeof import('vscode'); if (config === vscode.ConfigurationTarget.WorkspaceFolder && !IS_MULTI_ROOT_TEST) { @@ -242,7 +242,7 @@ async function restoreGlobalPythonPathSetting(): Promise { const pythonConfig = vscode.workspace.getConfiguration('python', (null as any) as Uri); await Promise.all([ pythonConfig.update('pythonPath', undefined, true), - pythonConfig.update('defaultInterpreterPath', undefined, true) + pythonConfig.update('defaultInterpreterPath', undefined, true), ]); await disposePythonSettings(); } @@ -427,7 +427,7 @@ export async function isPythonVersionInProcess(procService?: IProcessService, .. return isVersionInList(currentPyVersion, ...versions); } else { console.error( - `Failed to determine the current Python version when comparing against list [${versions.join(', ')}].` + `Failed to determine the current Python version when comparing against list [${versions.join(', ')}].`, ); return false; } @@ -460,7 +460,7 @@ export async function isPythonVersion(...versions: string[]): Promise { return isVersionInList(currentPyVersion, ...versions); } else { console.error( - `Failed to determine the current Python version when comparing against list [${versions.join(', ')}].` + `Failed to determine the current Python version when comparing against list [${versions.join(', ')}].`, ); return false; } @@ -476,7 +476,7 @@ export async function unzip(zipFile: string, targetFolder: string): Promise((resolve, reject) => { const zip = new StreamZip({ file: zipFile, - storeEntries: true + storeEntries: true, }); zip.on('ready', async () => { zip.extract('extension', targetFolder, (err: any) => { @@ -502,7 +502,7 @@ export async function unzip(zipFile: string, targetFolder: string): Promise Promise, timeoutMs: number, - errorMessage: string + errorMessage: string, ): Promise { return new Promise(async (resolve, reject) => { const timeout = setTimeout(() => { @@ -678,14 +678,14 @@ export class TestEventHandler implements IDisposable await waitForCondition( async () => this.count === numberOfTimesFired, waitPeriod, - `${this.eventNameForErrorMessages} event fired ${this.count}, expected ${numberOfTimesFired}` + `${this.eventNameForErrorMessages} event fired ${this.count}, expected ${numberOfTimesFired}`, ); } public async assertFiredAtLeast(numberOfTimesFired: number, waitPeriod: number = 2_000): Promise { await waitForCondition( async () => this.count >= numberOfTimesFired, waitPeriod, - `${this.eventNameForErrorMessages} event fired ${this.count}, expected at least ${numberOfTimesFired}.` + `${this.eventNameForErrorMessages} event fired ${this.count}, expected at least ${numberOfTimesFired}.`, ); } public atIndex(index: number): T { @@ -704,7 +704,7 @@ export class TestEventHandler implements IDisposable export function createEventHandler( obj: T, eventName: K, - dispoables: IDisposable[] = [] + dispoables: IDisposable[] = [], ): T[K] extends Event ? TestEventHandler : TestEventHandler { // tslint:disable-next-line: no-any return new TestEventHandler(obj[eventName] as any, eventName as string, dispoables) as any; diff --git a/src/test/common/configSettings.test.ts b/src/test/common/configSettings.test.ts index fb50c191e434..1c7ec681bd4d 100644 --- a/src/test/common/configSettings.test.ts +++ b/src/test/common/configSettings.test.ts @@ -32,7 +32,7 @@ suite('Configuration Settings', () => { assert.equal( settingValue.toUpperCase(), pythonSettingValue.toUpperCase(), - `Setting ${key} not the same` + `Setting ${key} not the same`, ); } else if (key === 'workspaceSymbols' && IS_WINDOWS) { const workspaceSettings = (pythonSettingValue as {}) as IWorkspaceSymbolSettings; @@ -40,7 +40,7 @@ suite('Configuration Settings', () => { assert.equal( workspaceSettings.tagFilePath.toUpperCase(), workspaceSttings.tagFilePath.toUpperCase(), - `Setting ${key} not the same` + `Setting ${key} not the same`, ); const workspaceSettingsWithoutPath = { ...workspaceSettings }; @@ -50,7 +50,7 @@ suite('Configuration Settings', () => { assert.deepEqual( workspaceSettingsWithoutPath, pythonSettingValueWithoutPath, - `Setting ${key} not the same` + `Setting ${key} not the same`, ); } }); diff --git a/src/test/common/configSettings/configSettings.pythonPath.unit.test.ts b/src/test/common/configSettings/configSettings.pythonPath.unit.test.ts index e83a69742aee..3e536be4ffaa 100644 --- a/src/test/common/configSettings/configSettings.pythonPath.unit.test.ts +++ b/src/test/common/configSettings/configSettings.pythonPath.unit.test.ts @@ -147,7 +147,7 @@ suite('Python Settings - pythonPath', () => { workspaceService.object, experimentsManager.object, interpreterPathService.object, - interpreterSecurityService.object + interpreterSecurityService.object, ); experimentsManager .setup((e) => e.inExperiment(DeprecatePythonPath.experiment)) @@ -180,7 +180,7 @@ suite('Python Settings - pythonPath', () => { workspaceService.object, experimentsManager.object, interpreterPathService.object, - interpreterSecurityService.object + interpreterSecurityService.object, ); experimentsManager .setup((e) => e.inExperiment(DeprecatePythonPath.experiment)) @@ -205,7 +205,7 @@ suite('Python Settings - pythonPath', () => { new MockAutoSelectionService(), workspaceService.object, experimentsManager.object, - interpreterPathService.object + interpreterPathService.object, ); const pythonPath = 'This is the new API python Path'; pythonSettings.setup((p) => p.get(typemoq.It.isValue('pythonPath'))).verifiable(typemoq.Times.never()); @@ -235,7 +235,7 @@ suite('Python Settings - pythonPath', () => { new MockAutoSelectionService(), workspaceService.object, experimentsManager.object, - interpreterPathService.object + interpreterPathService.object, ); const pythonPath = 'This is the settings python Path'; pythonSettings diff --git a/src/test/common/configSettings/configSettings.unit.test.ts b/src/test/common/configSettings/configSettings.unit.test.ts index da5712b80b0d..37e43650083f 100644 --- a/src/test/common/configSettings/configSettings.unit.test.ts +++ b/src/test/common/configSettings/configSettings.unit.test.ts @@ -24,7 +24,7 @@ import { ISortImportSettings, ITerminalSettings, ITestingSettings, - IWorkspaceSymbolSettings + IWorkspaceSymbolSettings, } from '../../../client/common/types'; import { noop } from '../../../client/common/utils/misc'; import * as EnvFileTelemetry from '../../../client/telemetry/envFileTelemetry'; @@ -67,7 +67,7 @@ suite('Python Settings', async () => { 'poetryPath', 'insidersChannel', 'defaultInterpreterPath', - 'jediPath' + 'jediPath', ]) { config .setup((c) => c.get(name)) @@ -141,7 +141,7 @@ suite('Python Settings', async () => { 'envFile', 'poetryPath', 'insidersChannel', - 'defaultInterpreterPath' + 'defaultInterpreterPath', ].forEach(async (settingName) => { testIfValueIsUpdated(settingName, 'stringValue'); }); @@ -151,7 +151,7 @@ suite('Python Settings', async () => { ['downloadLanguageServer', 'autoUpdateLanguageServer', 'globalModuleInstallation', 'useIsolation'].forEach( async (settingName) => { testIfValueIsUpdated(settingName, true); - } + }, ); }); @@ -222,7 +222,7 @@ suite('Python Settings', async () => { expected.experiments = { enabled, optInto: [], - optOutFrom: [] + optOutFrom: [], }; initializeConfig(expected); config @@ -252,7 +252,7 @@ suite('Python Settings', async () => { blackPath: 'two', yapfArgs: ['5', '6'], yapfPath: 'three', - provider: '' + provider: '', }; expected.formatting.blackPath = 'spam'; initializeConfig(expected); @@ -279,7 +279,7 @@ suite('Python Settings', async () => { blackPath: path.join('~', 'two'), yapfArgs: [], yapfPath: path.join('~', 'three'), - provider: '' + provider: '', }; expected.formatting.blackPath = 'spam'; initializeConfig(expected); diff --git a/src/test/common/configuration/service.test.ts b/src/test/common/configuration/service.test.ts index 5bbd24a9fa8d..28044c76e72d 100644 --- a/src/test/common/configuration/service.test.ts +++ b/src/test/common/configuration/service.test.ts @@ -28,7 +28,7 @@ suite('Configuration Service', () => { dispose(): Promise { disposed = true; return Promise.resolve(); - } + }, }; asyncRegistry.push(disposable); await asyncRegistry.dispose(); diff --git a/src/test/common/configuration/service.unit.test.ts b/src/test/common/configuration/service.unit.test.ts index 887a0779acf7..a04418a1b321 100644 --- a/src/test/common/configuration/service.unit.test.ts +++ b/src/test/common/configuration/service.unit.test.ts @@ -13,7 +13,7 @@ import { DeprecatePythonPath } from '../../../client/common/experiments/groups'; import { IExperimentsManager, IInterpreterPathService } from '../../../client/common/types'; import { IInterpreterAutoSeletionProxyService, - IInterpreterSecurityService + IInterpreterSecurityService, } from '../../../client/interpreter/autoSelection/types'; import { IServiceContainer } from '../../../client/ioc/types'; @@ -33,7 +33,7 @@ suite('Configuration Service', () => { .returns(() => ({ uri: resource, index: 0, - name: '0' + name: '0', })); interpreterPathService = TypeMoq.Mock.ofType(); serviceContainer = TypeMoq.Mock.ofType(); @@ -145,7 +145,7 @@ suite('Configuration Service', () => { 'setting', 'workspaceFolderValue', resource, - ConfigurationTarget.WorkspaceFolder + ConfigurationTarget.WorkspaceFolder, ); workspaceConfig.verifyAll(); @@ -167,7 +167,7 @@ suite('Configuration Service', () => { 'setting', 'newWorkspaceFolderValue', resource, - ConfigurationTarget.WorkspaceFolder + ConfigurationTarget.WorkspaceFolder, ); workspaceConfig.verifyAll(); @@ -188,7 +188,7 @@ suite('Configuration Service', () => { 'pythonPath', 'newWorkspaceFolderValue', resource, - ConfigurationTarget.WorkspaceFolder + ConfigurationTarget.WorkspaceFolder, ); interpreterPathService.verifyAll(); diff --git a/src/test/common/dotnet/compatibilityService.unit.test.ts b/src/test/common/dotnet/compatibilityService.unit.test.ts index eb6289ec41c5..f65112b0a8a9 100644 --- a/src/test/common/dotnet/compatibilityService.unit.test.ts +++ b/src/test/common/dotnet/compatibilityService.unit.test.ts @@ -33,7 +33,7 @@ suite('DOT.NET', () => { instance(macService), instance(winService), instance(linuxService), - instance(platformService) + instance(platformService), ); when(platformService.osType).thenReturn(osType.value); diff --git a/src/test/common/dotnet/serviceRegistry.unit.test.ts b/src/test/common/dotnet/serviceRegistry.unit.test.ts index d03d6113d7cc..13e6735ea3c6 100644 --- a/src/test/common/dotnet/serviceRegistry.unit.test.ts +++ b/src/test/common/dotnet/serviceRegistry.unit.test.ts @@ -27,36 +27,36 @@ suite('Common Dotnet Service Registry', () => { verify( serviceManager.addSingleton( IDotNetCompatibilityService, - DotNetCompatibilityService - ) + DotNetCompatibilityService, + ), ).once(); verify( serviceManager.addSingleton( IOSDotNetCompatibilityService, MacDotNetCompatibilityService, - OSType.OSX - ) + OSType.OSX, + ), ).once(); verify( serviceManager.addSingleton( IOSDotNetCompatibilityService, WindowsDotNetCompatibilityService, - OSType.Windows - ) + OSType.Windows, + ), ).once(); verify( serviceManager.addSingleton( IOSDotNetCompatibilityService, LinuxDotNetCompatibilityService, - OSType.Linux - ) + OSType.Linux, + ), ).once(); verify( serviceManager.addSingleton( IOSDotNetCompatibilityService, UnknownOSDotNetCompatibilityService, - OSType.Unknown - ) + OSType.Unknown, + ), ).once(); }); }); diff --git a/src/test/common/experiments/manager.unit.test.ts b/src/test/common/experiments/manager.unit.test.ts index fc7fec8f4e1e..9f093f0231c8 100644 --- a/src/test/common/experiments/manager.unit.test.ts +++ b/src/test/common/experiments/manager.unit.test.ts @@ -20,7 +20,7 @@ import { ExperimentsManager, experimentStorageKey, isDownloadedStorageValidKey, - oldExperimentSalts + oldExperimentSalts, } from '../../../client/common/experiments/manager'; import { HttpClient } from '../../../client/common/net/httpClient'; import { PersistentStateFactory } from '../../../client/common/persistentState'; @@ -32,7 +32,7 @@ import { IHttpClient, IOutputChannel, IPersistentState, - IPersistentStateFactory + IPersistentStateFactory, } from '../../../client/common/types'; import { createDeferred, createDeferredFromPromise } from '../../../client/common/utils/async'; import { sleep } from '../../common'; @@ -71,13 +71,13 @@ suite('A/B experiments', () => { when(configurationService.getSettings(undefined)).thenReturn(instance(settings)); fs = mock(FileSystem); when( - persistentStateFactory.createGlobalPersistentState(isDownloadedStorageValidKey, false, anything()) + persistentStateFactory.createGlobalPersistentState(isDownloadedStorageValidKey, false, anything()), ).thenReturn(isDownloadedStorageValid.object); when(persistentStateFactory.createGlobalPersistentState(experimentStorageKey, undefined as any)).thenReturn( - experimentStorage.object + experimentStorage.object, ); when( - persistentStateFactory.createGlobalPersistentState(downloadedExperimentStorageKey, undefined as any) + persistentStateFactory.createGlobalPersistentState(downloadedExperimentStorageKey, undefined as any), ).thenReturn(downloadedExperimentsStorage.object); expManager = new ExperimentsManager( instance(persistentStateFactory), @@ -86,7 +86,7 @@ suite('A/B experiments', () => { instance(appEnvironment), output.object, instance(fs), - instance(configurationService) + instance(configurationService), ); }); @@ -96,7 +96,7 @@ suite('A/B experiments', () => { async function testInitialization( downloadError: boolean = false, - experimentsDownloaded: any = [{ name: 'experiment1', salt: 'salt', min: 90, max: 100 }] + experimentsDownloaded: any = [{ name: 'experiment1', salt: 'salt', min: 90, max: 100 }], ) { if (downloadError) { when(httpClient.getJSON(configUri, false)).thenReject(new Error('Kaboom')); @@ -202,7 +202,7 @@ suite('A/B experiments', () => { instance(appEnvironment), output.object, instance(fs), - instance(configurationService) + instance(configurationService), ); await expManager.activate(); @@ -228,7 +228,7 @@ suite('A/B experiments', () => { instance(appEnvironment), output.object, instance(fs), - instance(configurationService) + instance(configurationService), ); expManager._enabled = enabled; @@ -261,7 +261,7 @@ suite('A/B experiments', () => { instance(appEnvironment), output.object, instance(fs), - instance(configurationService) + instance(configurationService), ); assert.isFalse(expManager._activated()); @@ -286,7 +286,7 @@ suite('A/B experiments', () => { instance(appEnvironment), output.object, instance(fs), - instance(configurationService) + instance(configurationService), ); const promise = expManager.activate(); @@ -325,7 +325,7 @@ suite('A/B experiments', () => { test('When latest experiments are not available, but experiment storage contains experiments, then experiment storage is not updated', async () => { const doBestEffortToPopulateExperiments = sinon.stub( ExperimentsManager.prototype, - 'doBestEffortToPopulateExperiments' + 'doBestEffortToPopulateExperiments', ); doBestEffortToPopulateExperiments.callsFake(() => Promise.resolve(false)); expManager = new ExperimentsManager( @@ -335,7 +335,7 @@ suite('A/B experiments', () => { instance(appEnvironment), output.object, instance(fs), - instance(configurationService) + instance(configurationService), ); downloadedExperimentsStorage @@ -366,7 +366,7 @@ suite('A/B experiments', () => { test('When best effort to populate experiments succeeds, function updateStorage() returns', async () => { const doBestEffortToPopulateExperiments = sinon.stub( ExperimentsManager.prototype, - 'doBestEffortToPopulateExperiments' + 'doBestEffortToPopulateExperiments', ); doBestEffortToPopulateExperiments.callsFake(() => Promise.resolve(true)); expManager = new ExperimentsManager( @@ -376,7 +376,7 @@ suite('A/B experiments', () => { instance(appEnvironment), output.object, instance(fs), - instance(configurationService) + instance(configurationService), ); downloadedExperimentsStorage @@ -403,7 +403,7 @@ suite('A/B experiments', () => { test('When latest experiments are not available, experiment storage is empty, but if local experiments file is not valid, experiment storage is not updated', async () => { const doBestEffortToPopulateExperiments = sinon.stub( ExperimentsManager.prototype, - 'doBestEffortToPopulateExperiments' + 'doBestEffortToPopulateExperiments', ); doBestEffortToPopulateExperiments.callsFake(() => Promise.resolve(false)); expManager = new ExperimentsManager( @@ -413,7 +413,7 @@ suite('A/B experiments', () => { instance(appEnvironment), output.object, instance(fs), - instance(configurationService) + instance(configurationService), ); downloadedExperimentsStorage .setup((n) => n.value) @@ -454,7 +454,7 @@ suite('A/B experiments', () => { test('When latest experiments are not available, and experiment storage is empty, then experiment storage is updated using local experiments file given experiments are valid', async () => { const doBestEffortToPopulateExperiments = sinon.stub( ExperimentsManager.prototype, - 'doBestEffortToPopulateExperiments' + 'doBestEffortToPopulateExperiments', ); doBestEffortToPopulateExperiments.callsFake(() => Promise.resolve(false)); expManager = new ExperimentsManager( @@ -464,7 +464,7 @@ suite('A/B experiments', () => { instance(appEnvironment), output.object, instance(fs), - instance(configurationService) + instance(configurationService), ); downloadedExperimentsStorage .setup((n) => n.value) @@ -508,7 +508,7 @@ suite('A/B experiments', () => { setup(() => { const doBestEffortToPopulateExperiments = sinon.stub( ExperimentsManager.prototype, - 'doBestEffortToPopulateExperiments' + 'doBestEffortToPopulateExperiments', ); doBestEffortToPopulateExperiments.callsFake(() => Promise.resolve(false)); expManager = new ExperimentsManager( @@ -518,7 +518,7 @@ suite('A/B experiments', () => { instance(appEnvironment), output.object, instance(fs), - instance(configurationService) + instance(configurationService), ); }); test('If checking the existence of config file fails', async () => { @@ -649,7 +649,7 @@ suite('A/B experiments', () => { experimentStorage.verifyAll(); downloadedExperimentsStorage.verifyAll(); }); - } + }, ); const testsForInExperiment = [ @@ -658,9 +658,9 @@ suite('A/B experiments', () => { experimentName: 'imaginary experiment', userExperiments: [ { name: 'experiment1', salt: 'salt', min: 79, max: 94 }, - { name: 'experiment2', salt: 'salt', min: 19, max: 30 } + { name: 'experiment2', salt: 'salt', min: 19, max: 30 }, ], - expectedResult: false + expectedResult: false, }, { testName: @@ -668,10 +668,10 @@ suite('A/B experiments', () => { experimentName: 'experiment1', userExperiments: [ { name: 'experiment1', salt: 'salt', min: 79, max: 94 }, - { name: 'experiment2', salt: 'salt', min: 19, max: 30 } + { name: 'experiment2', salt: 'salt', min: 19, max: 30 }, ], - expectedResult: true - } + expectedResult: true, + }, ]; testsForInExperiment.forEach((testParams) => { @@ -679,7 +679,7 @@ suite('A/B experiments', () => { expManager.userExperiments = testParams.userExperiments; expect(expManager.inExperiment(testParams.experimentName)).to.equal( testParams.expectedResult, - 'Incorrectly identified' + 'Incorrectly identified', ); }); }); @@ -689,30 +689,30 @@ suite('A/B experiments', () => { { testName: 'Returns true if hash modulo output is in range', hash: 1181, - expectedResult: true + expectedResult: true, }, { testName: 'Returns false if hash modulo is less than min', hash: 967, - expectedResult: false + expectedResult: false, }, { testName: 'Returns false if hash modulo is more than max', hash: 3297, - expectedResult: false + expectedResult: false, }, { testName: 'If checking if user is in range fails with error, throw error', hash: 3297, error: true, - expectedResult: false + expectedResult: false, }, { testName: 'If machine ID is bogus, throw error', hash: 3297, machineIdError: true, - expectedResult: false - } + expectedResult: false, + }, ]; suite('Function IsUserInRange()', () => { @@ -730,7 +730,7 @@ suite('A/B experiments', () => { when(crypto.createHash(anything(), 'number', anything())).thenReturn(testParams.hash); expect(expManager.isUserInRange(79, 94, 'salt')).to.equal( testParams.expectedResult, - 'Incorrectly identified' + 'Incorrectly identified', ); } }); @@ -757,7 +757,7 @@ suite('A/B experiments', () => { 'ShowExtensionSurveyPrompt', 'ShowPlayIcon', 'AlwaysDisplayTestExplorer', - 'LS' + 'LS', ]; assert.deepEqual(expectedOldExperimentSalts, oldExperimentSalts); }); @@ -767,37 +767,37 @@ suite('A/B experiments', () => { { testName: 'User experiments list is empty if experiment storage value is not an array', experimentStorageValue: undefined, - expectedResult: [] + expectedResult: [], }, { testName: 'User experiments list is empty if experiment storage value is an empty array', experimentStorageValue: [], - expectedResult: [] + expectedResult: [], }, { testName: 'User experiments list does not contain any experiments if user has requested to opt out of all experiments', experimentStorageValue: [ { name: 'experiment1 - control', salt: 'salt', min: 79, max: 94 }, - { name: 'experiment2 - control', salt: 'salt', min: 80, max: 90 } + { name: 'experiment2 - control', salt: 'salt', min: 80, max: 90 }, ], hash: 8187, experimentsOptedOutFrom: ['All'], - expectedResult: [] + expectedResult: [], }, { testName: 'User experiments list contains all experiments if user has requested to opt into all experiments', experimentStorageValue: [ { name: 'experiment1 - control', salt: 'salt', min: 79, max: 94 }, - { name: 'experiment2 - control', salt: 'salt', min: 80, max: 90 } + { name: 'experiment2 - control', salt: 'salt', min: 80, max: 90 }, ], hash: 8187, experimentsOptedInto: ['All'], expectedResult: [ { name: 'experiment1 - control', salt: 'salt', min: 79, max: 94 }, - { name: 'experiment2 - control', salt: 'salt', min: 80, max: 90 } - ] + { name: 'experiment2 - control', salt: 'salt', min: 80, max: 90 }, + ], }, { testName: @@ -805,73 +805,73 @@ suite('A/B experiments', () => { experimentStorageValue: [{ name: 'experiment2 - control', salt: 'salt', min: 19, max: 30 }], hash: 8187, experimentsOptedInto: ['experiment2 - control'], - expectedResult: [] + expectedResult: [], }, { testName: 'User experiments list contains the experiment if user has requested to opt out of a control group but user is in experiment range', experimentStorageValue: [ { name: 'experiment1 - control', salt: 'salt', min: 79, max: 94 }, - { name: 'experiment2 - control', salt: 'salt', min: 19, max: 30 } + { name: 'experiment2 - control', salt: 'salt', min: 19, max: 30 }, ], hash: 8187, experimentsOptedOutFrom: ['experiment1 - control'], - expectedResult: [{ name: 'experiment1 - control', salt: 'salt', min: 79, max: 94 }] + expectedResult: [{ name: 'experiment1 - control', salt: 'salt', min: 79, max: 94 }], }, { testName: 'User experiments list does not contains the experiment if user has opted out of experiment even though user is in experiment range', experimentStorageValue: [ { name: 'experiment1', salt: 'salt', min: 79, max: 94 }, - { name: 'experiment2', salt: 'salt', min: 19, max: 30 } + { name: 'experiment2', salt: 'salt', min: 19, max: 30 }, ], hash: 8187, experimentsOptedOutFrom: ['experiment1'], - expectedResult: [] + expectedResult: [], }, { testName: 'User experiments list contains the experiment if user has opted into the experiment even though user is not in experiment range', experimentStorageValue: [ { name: 'experiment1', salt: 'salt', min: 79, max: 94 }, - { name: 'experiment2', salt: 'salt', min: 19, max: 30 } + { name: 'experiment2', salt: 'salt', min: 19, max: 30 }, ], hash: 8187, experimentsOptedInto: ['experiment1'], - expectedResult: [{ name: 'experiment1', salt: 'salt', min: 79, max: 94 }] + expectedResult: [{ name: 'experiment1', salt: 'salt', min: 79, max: 94 }], }, { testName: 'User experiments list contains the experiment user has opened into and not the control experiment even if user is in the control experiment range', experimentStorageValue: [ { name: 'control', salt: 'salt', min: 0, max: 100 }, - { name: 'experiment', salt: 'salt', min: 0, max: 0 } + { name: 'experiment', salt: 'salt', min: 0, max: 0 }, ], hash: 8187, experimentsOptedInto: ['experiment'], - expectedResult: [{ name: 'experiment', salt: 'salt', min: 0, max: 0 }] + expectedResult: [{ name: 'experiment', salt: 'salt', min: 0, max: 0 }], }, { testName: 'User experiments list does not contain the experiment if user has both opted in and out of an experiment', experimentStorageValue: [ { name: 'experiment1', salt: 'salt', min: 79, max: 94 }, - { name: 'experiment2', salt: 'salt', min: 19, max: 30 } + { name: 'experiment2', salt: 'salt', min: 19, max: 30 }, ], hash: 8187, experimentsOptedInto: ['experiment1'], experimentsOptedOutFrom: ['experiment1'], - expectedResult: [] + expectedResult: [], }, { testName: 'Otherwise user experiments list contains the experiment if user is in experiment range', experimentStorageValue: [ { name: 'experiment1', salt: 'salt', min: 79, max: 94 }, - { name: 'experiment2', salt: 'salt', min: 19, max: 30 } + { name: 'experiment2', salt: 'salt', min: 19, max: 30 }, ], hash: 8187, - expectedResult: [{ name: 'experiment1', salt: 'salt', min: 79, max: 94 }] - } + expectedResult: [{ name: 'experiment1', salt: 'salt', min: 79, max: 94 }], + }, ]; suite('Function populateUserExperiments', async () => { @@ -898,55 +898,55 @@ suite('A/B experiments', () => { { testName: 'If experiments are not an array, return false', experiments: undefined, - expectedResult: false + expectedResult: false, }, { testName: 'If any experiment have `min` field missing, return false', experiments: [ { name: 'experiment1', salt: 'salt', max: 94 }, - { name: 'experiment2', salt: 'salt', min: 19, max: 30 } + { name: 'experiment2', salt: 'salt', min: 19, max: 30 }, ], - expectedResult: false + expectedResult: false, }, { testName: 'If any experiment have `max` field missing, return false', experiments: [ { name: 'experiment1', salt: 'salt', min: 79 }, - { name: 'experiment2', salt: 'salt', min: 19, max: 30 } + { name: 'experiment2', salt: 'salt', min: 19, max: 30 }, ], - expectedResult: false + expectedResult: false, }, { testName: 'If any experiment have `salt` field missing, return false', experiments: [ { name: 'experiment1', min: 79, max: 94 }, - { name: 'experiment2', salt: 'salt', min: 19, max: 30 } + { name: 'experiment2', salt: 'salt', min: 19, max: 30 }, ], - expectedResult: false + expectedResult: false, }, { testName: 'If any experiment have `name` field missing, return false', experiments: [ { salt: 'salt', min: 79, max: 94 }, - { name: 'experiment2', salt: 'salt', min: 19, max: 30 } + { name: 'experiment2', salt: 'salt', min: 19, max: 30 }, ], - expectedResult: false + expectedResult: false, }, { testName: 'If all experiments contain all the fields in type `ABExperiment`, return true', experiments: [ { name: 'experiment1', salt: 'salt', min: 79, max: 94 }, - { name: 'experiment2', salt: 'salt', min: 19, max: 30 } + { name: 'experiment2', salt: 'salt', min: 19, max: 30 }, ], - expectedResult: true - } + expectedResult: true, + }, ]; suite('Function areExperimentsValid()', () => { testsForAreExperimentsValid.forEach((testParams) => { test(testParams.testName, () => { expect(expManager.areExperimentsValid(testParams.experiments as any)).to.equal( - testParams.expectedResult + testParams.expectedResult, ); }); }); @@ -968,7 +968,7 @@ suite('A/B experiments', () => { output.object, instance(fs), instance(configurationService), - timeout + timeout, ); // Download set to complete in 50 ms, timeout is of 150 ms, i.e download will complete within timeout @@ -992,7 +992,7 @@ suite('A/B experiments', () => { output.object, instance(fs), instance(configurationService), - timeout + timeout, ); // Download set to complete in 200 ms, timeout is of 100 ms, i.e download will complete within timeout @@ -1013,7 +1013,7 @@ suite('A/B experiments', () => { instance(appEnvironment), output.object, instance(fs), - instance(configurationService) + instance(configurationService), ); const result = await expManager.doBestEffortToPopulateExperiments(); @@ -1036,7 +1036,7 @@ suite('A/B experiments', () => { .returns(() => Promise.resolve(undefined)) .verifiable(TypeMoq.Times.once()); when(httpClient.getJSON(configUri, false)).thenResolve([ - { name: 'experiment1', salt: 'salt', min: 90, max: 100 } + { name: 'experiment1', salt: 'salt', min: 90, max: 100 }, ]); await expManager.downloadAndStoreExperiments(experimentStorage.object); diff --git a/src/test/common/experiments/service.unit.test.ts b/src/test/common/experiments/service.unit.test.ts index 3f9f055274a3..6be34a08985d 100644 --- a/src/test/common/experiments/service.unit.test.ts +++ b/src/test/common/experiments/service.unit.test.ts @@ -44,8 +44,8 @@ suite('Experimentation service', () => { experiments: { enabled, optInto, - optOutFrom - } + optOutFrom, + }, // tslint:disable-next-line: no-any } as any); } @@ -68,7 +68,7 @@ suite('Experimentation service', () => { instance(configurationService), instance(appEnvironment), globalMemento, - outputChannel + outputChannel, ); sinon.assert.calledWithExactly( @@ -77,7 +77,7 @@ suite('Experimentation service', () => { extensionVersion, tasClient.TargetPopulation.Public, sinon.match.any, - globalMemento + globalMemento, ); }); @@ -92,7 +92,7 @@ suite('Experimentation service', () => { instance(configurationService), instance(appEnvironment), globalMemento, - outputChannel + outputChannel, ); sinon.assert.calledWithExactly( @@ -101,7 +101,7 @@ suite('Experimentation service', () => { extensionVersion, tasClient.TargetPopulation.Insiders, sinon.match.any, - globalMemento + globalMemento, ); }); @@ -115,7 +115,7 @@ suite('Experimentation service', () => { instance(configurationService), instance(appEnvironment), globalMemento, - outputChannel + outputChannel, ); assert.deepEqual(experimentService._optInto, ['Foo - experiment']); @@ -130,7 +130,7 @@ suite('Experimentation service', () => { instance(configurationService), instance(appEnvironment), globalMemento, - outputChannel + outputChannel, ); assert.deepEqual(experimentService._optOutFrom, ['Foo - experiment']); @@ -149,7 +149,7 @@ suite('Experimentation service', () => { instance(configurationService), instance(appEnvironment), instance(globalMemento), - outputChannel + outputChannel, ); const output = `${Experiments.inGroup().format('pythonExperiment')}\n`; @@ -173,7 +173,7 @@ suite('Experimentation service', () => { isCachedFlightEnabledStub = sinon.stub().returns(Promise.resolve(true)); sinon.stub(tasClient, 'getExperimentationService').returns({ - isCachedFlightEnabled: isCachedFlightEnabledStub + isCachedFlightEnabled: isCachedFlightEnabledStub, // tslint:disable-next-line: no-any } as any); @@ -191,7 +191,7 @@ suite('Experimentation service', () => { instance(configurationService), instance(appEnvironment), globalMemento, - outputChannel + outputChannel, ); const result = await experimentService.inExperiment(experiment); @@ -207,7 +207,7 @@ suite('Experimentation service', () => { instance(configurationService), instance(appEnvironment), globalMemento, - outputChannel + outputChannel, ); const result = await experimentService.inExperiment(experiment); @@ -223,7 +223,7 @@ suite('Experimentation service', () => { instance(configurationService), instance(appEnvironment), globalMemento, - outputChannel + outputChannel, ); const result = await experimentService.inExperiment(experiment); @@ -231,7 +231,7 @@ suite('Experimentation service', () => { assert.equal(telemetryEvents.length, 1); assert.deepEqual(telemetryEvents[0], { eventName: EventName.PYTHON_EXPERIMENTS_OPT_IN_OUT, - properties: { expNameOptedInto: experiment } + properties: { expNameOptedInto: experiment }, }); sinon.assert.notCalled(isCachedFlightEnabledStub); }); @@ -243,7 +243,7 @@ suite('Experimentation service', () => { instance(configurationService), instance(appEnvironment), globalMemento, - outputChannel + outputChannel, ); const result = await experimentService.inExperiment(experiment); @@ -251,7 +251,7 @@ suite('Experimentation service', () => { assert.equal(telemetryEvents.length, 1); assert.deepEqual(telemetryEvents[0], { eventName: EventName.PYTHON_EXPERIMENTS_OPT_IN_OUT, - properties: { expNameOptedInto: experiment } + properties: { expNameOptedInto: experiment }, }); sinon.assert.notCalled(isCachedFlightEnabledStub); }); @@ -263,7 +263,7 @@ suite('Experimentation service', () => { instance(configurationService), instance(appEnvironment), globalMemento, - outputChannel + outputChannel, ); const result = await experimentService.inExperiment(experiment); @@ -271,7 +271,7 @@ suite('Experimentation service', () => { assert.equal(telemetryEvents.length, 1); assert.deepEqual(telemetryEvents[0], { eventName: EventName.PYTHON_EXPERIMENTS_OPT_IN_OUT, - properties: { expNameOptedOutOf: experiment } + properties: { expNameOptedOutOf: experiment }, }); sinon.assert.notCalled(isCachedFlightEnabledStub); }); @@ -283,7 +283,7 @@ suite('Experimentation service', () => { instance(configurationService), instance(appEnvironment), globalMemento, - outputChannel + outputChannel, ); const result = await experimentService.inExperiment(experiment); @@ -291,7 +291,7 @@ suite('Experimentation service', () => { assert.equal(telemetryEvents.length, 1); assert.deepEqual(telemetryEvents[0], { eventName: EventName.PYTHON_EXPERIMENTS_OPT_IN_OUT, - properties: { expNameOptedOutOf: experiment } + properties: { expNameOptedOutOf: experiment }, }); sinon.assert.notCalled(isCachedFlightEnabledStub); }); @@ -304,7 +304,7 @@ suite('Experimentation service', () => { setup(() => { getTreatmentVariableAsyncStub = sinon.stub().returns(Promise.resolve('value')); sinon.stub(tasClient, 'getExperimentationService').returns({ - getTreatmentVariableAsync: getTreatmentVariableAsyncStub + getTreatmentVariableAsync: getTreatmentVariableAsyncStub, // tslint:disable-next-line: no-any } as any); @@ -318,7 +318,7 @@ suite('Experimentation service', () => { instance(configurationService), instance(appEnvironment), globalMemento, - outputChannel + outputChannel, ); const result = await experimentService.getExperimentValue(experiment); @@ -333,7 +333,7 @@ suite('Experimentation service', () => { instance(configurationService), instance(appEnvironment), globalMemento, - outputChannel + outputChannel, ); const result = await experimentService.getExperimentValue(experiment); @@ -348,7 +348,7 @@ suite('Experimentation service', () => { instance(configurationService), instance(appEnvironment), globalMemento, - outputChannel + outputChannel, ); const result = await experimentService.getExperimentValue(experiment); @@ -363,7 +363,7 @@ suite('Experimentation service', () => { instance(configurationService), instance(appEnvironment), globalMemento, - outputChannel + outputChannel, ); const result = await experimentService.getExperimentValue(experiment); diff --git a/src/test/common/experiments/telemetry.unit.test.ts b/src/test/common/experiments/telemetry.unit.test.ts index d49ba5599c71..a6fd8b5ef7ab 100644 --- a/src/test/common/experiments/telemetry.unit.test.ts +++ b/src/test/common/experiments/telemetry.unit.test.ts @@ -47,8 +47,8 @@ suite('Experimentation telemetry', () => { eventName: event, properties: { foo: 'one', - bar: 'two' - } + bar: 'two', + }, }); }); diff --git a/src/test/common/featureDeprecationManager.unit.test.ts b/src/test/common/featureDeprecationManager.unit.test.ts index 2f3b48a61eb2..2cf583f9e787 100644 --- a/src/test/common/featureDeprecationManager.unit.test.ts +++ b/src/test/common/featureDeprecationManager.unit.test.ts @@ -24,21 +24,21 @@ suite('Feature Deprecation Manager Tests', () => { .setup((a) => a.createGlobalPersistentState( TypeMoq.It.isValue('SHOW_DEPRECATED_FEATURE_PROMPT_BUILD_WORKSPACE_SYMBOLS'), - TypeMoq.It.isValue(true) - ) + TypeMoq.It.isValue(true), + ), ) .returns(() => persistentBool.object) .verifiable(TypeMoq.Times.once()); const popupMgr: TypeMoq.IMock = TypeMoq.Mock.ofType(); popupMgr .setup((p) => - p.showInformationMessage(TypeMoq.It.isAnyString(), TypeMoq.It.isAnyString(), TypeMoq.It.isAnyString()) + p.showInformationMessage(TypeMoq.It.isAnyString(), TypeMoq.It.isAnyString(), TypeMoq.It.isAnyString()), ) .returns( (_val) => new Promise((resolve, _reject) => { resolve('Learn More'); - }) + }), ); const cmdDisposable: TypeMoq.IMock = TypeMoq.Mock.ofType(); const cmdManager: TypeMoq.IMock = TypeMoq.Mock.ofType(); @@ -47,8 +47,8 @@ suite('Feature Deprecation Manager Tests', () => { c.registerCommand( TypeMoq.It.isValue('python.buildWorkspaceSymbols'), TypeMoq.It.isAny(), - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => cmdDisposable.object) .verifiable(TypeMoq.Times.atLeastOnce()); @@ -65,7 +65,7 @@ suite('Feature Deprecation Manager Tests', () => { persistentState.object, cmdManager.object, workspace.object, - popupMgr.object + popupMgr.object, ); featureDepMgr.initialize(); @@ -91,7 +91,7 @@ suite('Feature Deprecation Manager Tests', () => { { valueInSetting: [], expectedValue: false }, { valueInSetting: ['1'], expectedValue: true }, { valueInSetting: [1], expectedValue: true }, - { valueInSetting: [{}], expectedValue: true } + { valueInSetting: [{}], expectedValue: true }, ]; for (const config of testConfigs) { @@ -114,7 +114,7 @@ suite('Feature Deprecation Manager Tests', () => { { valueInSetting: 'true', expectedValue: true, valuesToLookFor: ['true', true] }, { valueInSetting: true, expectedValue: true, valuesToLookFor: ['true', true] }, { valueInSetting: 'false', expectedValue: true, valuesToLookFor: ['false', false] }, - { valueInSetting: false, expectedValue: true, valuesToLookFor: ['false', false] } + { valueInSetting: false, expectedValue: true, valuesToLookFor: ['false', false] }, ]; for (const config of testConfigs) { diff --git a/src/test/common/insidersBuild/downloadChannelRules.unit.test.ts b/src/test/common/insidersBuild/downloadChannelRules.unit.test.ts index 285e0df9d422..98ff2dd7dd3b 100644 --- a/src/test/common/insidersBuild/downloadChannelRules.unit.test.ts +++ b/src/test/common/insidersBuild/downloadChannelRules.unit.test.ts @@ -14,7 +14,7 @@ import { ExtensionInsidersWeeklyChannelRule, frequencyForDailyInsidersCheck, frequencyForWeeklyInsidersCheck, - lastLookUpTimeKey + lastLookUpTimeKey, } from '../../../client/common/insidersBuild/downloadChannelRules'; import { PersistentStateFactory } from '../../../client/common/persistentState'; import { IPersistentState, IPersistentStateFactory } from '../../../client/common/types'; @@ -39,7 +39,7 @@ suite('Download channel rules - ExtensionInsidersDailyChannelRule', () => { persistentStateFactory = mock(PersistentStateFactory); lastLookUpTime = TypeMoq.Mock.ofType>(); when(persistentStateFactory.createGlobalPersistentState(lastLookUpTimeKey, -1)).thenReturn( - lastLookUpTime.object + lastLookUpTime.object, ); insidersDailyChannelRule = new ExtensionInsidersDailyChannelRule(instance(persistentStateFactory)); }); @@ -104,7 +104,7 @@ suite('Download channel rules - ExtensionInsidersWeeklyChannelRule', () => { persistentStateFactory = mock(PersistentStateFactory); lastLookUpTime = TypeMoq.Mock.ofType>(); when(persistentStateFactory.createGlobalPersistentState(lastLookUpTimeKey, -1)).thenReturn( - lastLookUpTime.object + lastLookUpTime.object, ); insidersWeeklyChannelRule = new ExtensionInsidersWeeklyChannelRule(instance(persistentStateFactory)); }); diff --git a/src/test/common/insidersBuild/downloadChannelService.unit.test.ts b/src/test/common/insidersBuild/downloadChannelService.unit.test.ts index f3cce07d5c56..ab7578ecdd12 100644 --- a/src/test/common/insidersBuild/downloadChannelService.unit.test.ts +++ b/src/test/common/insidersBuild/downloadChannelService.unit.test.ts @@ -14,7 +14,7 @@ import { WorkspaceService } from '../../../client/common/application/workspace'; import { ConfigurationService } from '../../../client/common/configuration/service'; import { ExtensionChannelService, - insidersChannelSetting + insidersChannelSetting, } from '../../../client/common/insidersBuild/downloadChannelService'; import { ExtensionChannels } from '../../../client/common/insidersBuild/types'; import { IConfigurationService } from '../../../client/common/types'; @@ -43,22 +43,22 @@ suite('Download channel service', () => { { testName: "Get channel returns 'off' if settings value is set to 'off'", settings: 'off', - expectedResult: 'off' + expectedResult: 'off', }, { testName: "Get channel returns 'weekly' if settings value is set to 'weekly'", settings: 'weekly', - expectedResult: 'weekly' + expectedResult: 'weekly', }, { testName: "Get channel returns 'daily' if settings value is set to 'daily'", settings: 'daily', - expectedResult: 'daily' - } + expectedResult: 'daily', + }, ].forEach((testParams) => { test(testParams.testName, async () => { when(configService.getSettings()).thenReturn({ - insidersChannel: testParams.settings as ExtensionChannels + insidersChannel: testParams.settings as ExtensionChannels, } as any); const result = channelService.getChannel(); expect(result).to.equal(testParams.expectedResult); @@ -108,18 +108,18 @@ suite('Download channel service', () => { test('Update channel updates configuration settings', async () => { const value = 'Random'; when( - configService.updateSetting(insidersChannelSetting, value, undefined, ConfigurationTarget.Global) + configService.updateSetting(insidersChannelSetting, value, undefined, ConfigurationTarget.Global), ).thenResolve(undefined); await channelService.updateChannel(value as any); verify( - configService.updateSetting(insidersChannelSetting, value, undefined, ConfigurationTarget.Global) + configService.updateSetting(insidersChannelSetting, value, undefined, ConfigurationTarget.Global), ).once(); }); test('Update channel throws error when updates configuration settings fails', async () => { const value = 'Random'; when( - configService.updateSetting(insidersChannelSetting, value, undefined, ConfigurationTarget.Global) + configService.updateSetting(insidersChannelSetting, value, undefined, ConfigurationTarget.Global), ).thenThrow(new Error('Kaboom')); const promise = channelService.updateChannel(value as any); await expect(promise).to.eventually.be.rejectedWith('Kaboom'); diff --git a/src/test/common/insidersBuild/insidersExtensionPrompt.unit.test.ts b/src/test/common/insidersBuild/insidersExtensionPrompt.unit.test.ts index 6a39697fb6d0..fbad6d6426c4 100644 --- a/src/test/common/insidersBuild/insidersExtensionPrompt.unit.test.ts +++ b/src/test/common/insidersBuild/insidersExtensionPrompt.unit.test.ts @@ -13,7 +13,7 @@ import { IApplicationShell, ICommandManager } from '../../../client/common/appli import { ExtensionChannelService } from '../../../client/common/insidersBuild/downloadChannelService'; import { InsidersExtensionPrompt, - insidersPromptStateKey + insidersPromptStateKey, } from '../../../client/common/insidersBuild/insidersExtensionPrompt'; import { ExtensionChannel, IExtensionChannelService } from '../../../client/common/insidersBuild/types'; import { PersistentStateFactory } from '../../../client/common/persistentState'; @@ -35,13 +35,13 @@ suite('Insiders Extension prompt', () => { cmdManager = mock(CommandManager); hasUserBeenNotifiedState = TypeMoq.Mock.ofType>(); when(persistentState.createGlobalPersistentState(insidersPromptStateKey, false)).thenReturn( - hasUserBeenNotifiedState.object + hasUserBeenNotifiedState.object, ); insidersPrompt = new InsidersExtensionPrompt( instance(appShell), instance(extensionChannelService), instance(cmdManager), - instance(persistentState) + instance(persistentState), ); }); @@ -49,10 +49,10 @@ suite('Insiders Extension prompt', () => { const prompts = [ ExtensionChannels.yesWeekly(), ExtensionChannels.yesDaily(), - ExtensionSurveyBanner.bannerLabelNo() + ExtensionSurveyBanner.bannerLabelNo(), ]; when(appShell.showInformationMessage(ExtensionChannels.promptMessage(), ...prompts)).thenResolve( - ExtensionChannels.yesDaily() as any + ExtensionChannels.yesDaily() as any, ); when(cmdManager.executeCommand('workbench.action.reloadWindow')).thenResolve(); when(extensionChannelService.updateChannel(ExtensionChannel.daily)).thenResolve(); @@ -71,10 +71,10 @@ suite('Insiders Extension prompt', () => { const prompts = [ ExtensionChannels.yesWeekly(), ExtensionChannels.yesDaily(), - ExtensionSurveyBanner.bannerLabelNo() + ExtensionSurveyBanner.bannerLabelNo(), ]; when(appShell.showInformationMessage(ExtensionChannels.promptMessage(), ...prompts)).thenResolve( - ExtensionChannels.yesWeekly() as any + ExtensionChannels.yesWeekly() as any, ); when(cmdManager.executeCommand('workbench.action.reloadWindow')).thenResolve(); when(extensionChannelService.updateChannel(ExtensionChannel.weekly)).thenResolve(); @@ -93,10 +93,10 @@ suite('Insiders Extension prompt', () => { const prompts = [ ExtensionChannels.yesWeekly(), ExtensionChannels.yesDaily(), - ExtensionSurveyBanner.bannerLabelNo() + ExtensionSurveyBanner.bannerLabelNo(), ]; when(appShell.showInformationMessage(ExtensionChannels.promptMessage(), ...prompts)).thenResolve( - ExtensionSurveyBanner.bannerLabelNo() as any + ExtensionSurveyBanner.bannerLabelNo() as any, ); when(cmdManager.executeCommand('workbench.action.reloadWindow')).thenResolve(); when(extensionChannelService.updateChannel(anything())).thenResolve(); @@ -115,10 +115,10 @@ suite('Insiders Extension prompt', () => { const prompts = [ ExtensionChannels.yesWeekly(), ExtensionChannels.yesDaily(), - ExtensionSurveyBanner.bannerLabelNo() + ExtensionSurveyBanner.bannerLabelNo(), ]; when(appShell.showInformationMessage(ExtensionChannels.promptMessage(), ...prompts)).thenResolve( - undefined as any + undefined as any, ); when(cmdManager.executeCommand('workbench.action.reloadWindow')).thenResolve(); when(extensionChannelService.updateChannel(anything())).thenResolve(); @@ -135,7 +135,7 @@ suite('Insiders Extension prompt', () => { test('Do not do anything if no option is selected in the reload prompt', async () => { when( - appShell.showInformationMessage(ExtensionChannels.reloadToUseInsidersMessage(), Common.reload()) + appShell.showInformationMessage(ExtensionChannels.reloadToUseInsidersMessage(), Common.reload()), ).thenResolve(undefined); when(cmdManager.executeCommand('workbench.action.reloadWindow')).thenResolve(); await insidersPrompt.promptToReload(); @@ -145,7 +145,7 @@ suite('Insiders Extension prompt', () => { test("Reload windows if 'Reload' option is selected in the reload prompt", async () => { when( - appShell.showInformationMessage(ExtensionChannels.reloadToUseInsidersMessage(), Common.reload()) + appShell.showInformationMessage(ExtensionChannels.reloadToUseInsidersMessage(), Common.reload()), ).thenResolve(Common.reload() as any); when(cmdManager.executeCommand('workbench.action.reloadWindow')).thenResolve(); await insidersPrompt.promptToReload(); diff --git a/src/test/common/insidersBuild/insidersExtensionService.unit.test.ts b/src/test/common/insidersBuild/insidersExtensionService.unit.test.ts index 96e4dfb396ca..8a4ba7abcc23 100644 --- a/src/test/common/insidersBuild/insidersExtensionService.unit.test.ts +++ b/src/test/common/insidersBuild/insidersExtensionService.unit.test.ts @@ -22,7 +22,7 @@ import { ExtensionChannels, IExtensionChannelRule, IExtensionChannelService, - IInsiderExtensionPrompt + IInsiderExtensionPrompt, } from '../../../client/common/insidersBuild/types'; import { InsidersBuildInstaller } from '../../../client/common/installer/extensionBuildInstaller'; import { IExtensionBuildInstaller } from '../../../client/common/installer/types'; @@ -55,7 +55,7 @@ suite('Insiders Extension Service - Handle channel', () => { instance(cmdManager), instance(serviceContainer), instance(insidersInstaller), - [] + [], ); }); @@ -79,7 +79,7 @@ suite('Insiders Extension Service - Handle channel', () => { test('If insiders is required to be installed, handling channel installs the build and prompts user', async () => { const channelRule = TypeMoq.Mock.ofType(); when(serviceContainer.get(IExtensionChannelRule, 'weekly')).thenReturn( - channelRule.object + channelRule.object, ); channelRule .setup((c) => c.shouldLookForInsidersBuild(false)) @@ -139,7 +139,7 @@ suite('Insiders Extension Service - Activation', () => { instance(cmdManager), instance(serviceContainer), instance(insidersInstaller), - [] + [], ); when(extensionChannelService.getChannel()).thenReturn('daily'); when(extensionChannelService.isChannelUsingDefaultConfiguration).thenReturn(false); @@ -165,7 +165,7 @@ suite('Insiders Extension Service - Activation', () => { instance(cmdManager), instance(serviceContainer), instance(insidersInstaller), - [] + [], ); when(extensionChannelService.getChannel()).thenReturn('daily'); when(extensionChannelService.isChannelUsingDefaultConfiguration).thenReturn(false); @@ -192,7 +192,7 @@ suite('Insiders Extension Service - Activation', () => { instance(cmdManager), instance(serviceContainer), instance(insidersInstaller), - [] + [], ); when(extensionChannelService.getChannel()).thenReturn('daily'); when(extensionChannelService.isChannelUsingDefaultConfiguration).thenReturn(false); @@ -242,7 +242,7 @@ suite('Insiders Extension Service - Function handleEdgeCases()', () => { cmdManager.object, serviceContainer.object, insidersInstaller.object, - [] + [], ); insidersPrompt @@ -293,9 +293,9 @@ suite('Insiders Extension Service - Function handleEdgeCases()', () => { // prompt to enroll vscodeChannel: 'insiders', hasUserBeenNotified: false, - isChannelUsingDefaultConfiguration: true + isChannelUsingDefaultConfiguration: true, }, - true + true, ); await insidersExtensionService.handleEdgeCases(true); @@ -310,40 +310,40 @@ suite('Insiders Extension Service - Function handleEdgeCases()', () => { installChannel: 'daily', // skip enroll vscodeChannel: 'insiders', - hasUserBeenNotified: true + hasUserBeenNotified: true, }, { installChannel: 'daily', // skip enroll vscodeChannel: 'insiders', hasUserBeenNotified: false, - isChannelUsingDefaultConfiguration: false + isChannelUsingDefaultConfiguration: false, }, { installChannel: 'daily', // skip enroll - vscodeChannel: 'stable' + vscodeChannel: 'stable', }, { installChannel: 'off', // skip enroll vscodeChannel: 'insiders', - hasUserBeenNotified: true + hasUserBeenNotified: true, }, { installChannel: 'off', isChannelUsingDefaultConfiguration: true, // skip enroll vscodeChannel: 'insiders', - hasUserBeenNotified: true + hasUserBeenNotified: true, }, { // skip re-enroll installChannel: 'off', isChannelUsingDefaultConfiguration: true, // skip enroll - vscodeChannel: 'stable' - } + vscodeChannel: 'stable', + }, ]; setup(() => { @@ -362,7 +362,7 @@ suite('Insiders Extension Service - Function handleEdgeCases()', () => { setState(testParams, false); await insidersExtensionService.handleEdgeCases( - testParams.isChannelUsingDefaultConfiguration || testParams.installChannel === 'off' + testParams.isChannelUsingDefaultConfiguration || testParams.installChannel === 'off', ); verifyAll(); @@ -404,7 +404,7 @@ suite('Insiders Extension Service - Function registerCommandsAndHandlers()', () instance(cmdManager), instance(serviceContainer), instance(insidersInstaller), - [] + [], ); }); diff --git a/src/test/common/installer.test.ts b/src/test/common/installer.test.ts index 960ecc668164..f7b14df39931 100644 --- a/src/test/common/installer.test.ts +++ b/src/test/common/installer.test.ts @@ -21,7 +21,7 @@ import { ICustomEditorService, IDebugService, IDocumentManager, - IWorkspaceService + IWorkspaceService, } from '../../client/common/application/types'; import { WorkspaceService } from '../../client/common/application/workspace'; import { AsyncDisposableRegistry } from '../../client/common/asyncDisposableRegistry'; @@ -34,7 +34,7 @@ import { FeatureDeprecationManager } from '../../client/common/featureDeprecatio import { ExtensionInsidersDailyChannelRule, ExtensionInsidersOffChannelRule, - ExtensionInsidersWeeklyChannelRule + ExtensionInsidersWeeklyChannelRule, } from '../../client/common/insidersBuild/downloadChannelRules'; import { ExtensionChannelService } from '../../client/common/insidersBuild/downloadChannelService'; import { InsidersExtensionPrompt } from '../../client/common/insidersBuild/insidersExtensionPrompt'; @@ -43,7 +43,7 @@ import { ExtensionChannel, IExtensionChannelRule, IExtensionChannelService, - IInsiderExtensionPrompt + IInsiderExtensionPrompt, } from '../../client/common/insidersBuild/types'; import { InstallationChannelManager } from '../../client/common/installer/channelManager'; import { ProductInstaller } from '../../client/common/installer/productInstaller'; @@ -53,14 +53,14 @@ import { LinterProductPathService, RefactoringLibraryProductPathService, TensorBoardProductPathService, - TestFrameworkProductPathService + TestFrameworkProductPathService, } from '../../client/common/installer/productPath'; import { ProductService } from '../../client/common/installer/productService'; import { IInstallationChannelManager, IModuleInstaller, IProductPathService, - IProductService + IProductService, } from '../../client/common/installer/types'; import { InterpreterPathService } from '../../client/common/interpreterPathService'; import { BrowserService } from '../../client/common/net/browser'; @@ -93,7 +93,7 @@ import { ITerminalActivator, ITerminalHelper, ITerminalServiceFactory, - TerminalActivationProviders + TerminalActivationProviders, } from '../../client/common/terminal/types'; import { IAsyncDisposableRegistry, @@ -116,7 +116,7 @@ import { IsWindows, ModuleNamePurpose, Product, - ProductType + ProductType, } from '../../client/common/types'; import { createDeferred } from '../../client/common/utils/async'; import { getNamesAndValues } from '../../client/common/utils/enum'; @@ -166,16 +166,16 @@ suite('Installer', () => { ioc.serviceManager.addSingleton(ICurrentProcess, CurrentProcess); ioc.serviceManager.addSingleton( IInstallationChannelManager, - InstallationChannelManager + InstallationChannelManager, ); ioc.serviceManager.addSingletonInstance( ICommandManager, - TypeMoq.Mock.ofType().object + TypeMoq.Mock.ofType().object, ); ioc.serviceManager.addSingletonInstance( IApplicationShell, - TypeMoq.Mock.ofType().object + TypeMoq.Mock.ofType().object, ); ioc.serviceManager.addSingleton(IConfigurationService, ConfigurationService); ioc.serviceManager.addSingleton(IWorkspaceService, WorkspaceService); @@ -187,32 +187,32 @@ suite('Installer', () => { ioc.serviceManager.addSingleton( IProductPathService, CTagsProductPathService, - ProductType.WorkspaceSymbols + ProductType.WorkspaceSymbols, ); ioc.serviceManager.addSingleton( IProductPathService, FormatterProductPathService, - ProductType.Formatter + ProductType.Formatter, ); ioc.serviceManager.addSingleton( IProductPathService, LinterProductPathService, - ProductType.Linter + ProductType.Linter, ); ioc.serviceManager.addSingleton( IProductPathService, TestFrameworkProductPathService, - ProductType.TestFramework + ProductType.TestFramework, ); ioc.serviceManager.addSingleton( IProductPathService, RefactoringLibraryProductPathService, - ProductType.RefactoringLibrary + ProductType.RefactoringLibrary, ); ioc.serviceManager.addSingleton( IProductPathService, TensorBoardProductPathService, - ProductType.TensorBoard + ProductType.TensorBoard, ); ioc.serviceManager.addSingleton(IActiveResourceService, ActiveResourceService); @@ -232,7 +232,7 @@ suite('Installer', () => { ioc.serviceManager.addSingleton(ITerminalActivator, TerminalActivator); ioc.serviceManager.addSingleton( ITerminalActivationHandler, - PowershellTerminalActivationFailedHandler + PowershellTerminalActivationFailedHandler, ); ioc.serviceManager.addSingleton(ICryptoUtils, CryptoUtils); ioc.serviceManager.addSingleton(IExperimentsManager, ExperimentsManager); @@ -242,31 +242,31 @@ suite('Installer', () => { ioc.serviceManager.addSingleton( ITerminalActivationCommandProvider, Bash, - TerminalActivationProviders.bashCShellFish + TerminalActivationProviders.bashCShellFish, ); ioc.serviceManager.addSingleton( ITerminalActivationCommandProvider, CommandPromptAndPowerShell, - TerminalActivationProviders.commandPromptAndPowerShell + TerminalActivationProviders.commandPromptAndPowerShell, ); ioc.serviceManager.addSingleton( ITerminalActivationCommandProvider, PyEnvActivationCommandProvider, - TerminalActivationProviders.pyenv + TerminalActivationProviders.pyenv, ); ioc.serviceManager.addSingleton( ITerminalActivationCommandProvider, CondaActivationCommandProvider, - TerminalActivationProviders.conda + TerminalActivationProviders.conda, ); ioc.serviceManager.addSingleton( ITerminalActivationCommandProvider, PipEnvActivationCommandProvider, - TerminalActivationProviders.pipenv + TerminalActivationProviders.pipenv, ); ioc.serviceManager.addSingleton( IFeatureDeprecationManager, - FeatureDeprecationManager + FeatureDeprecationManager, ); ioc.serviceManager.addSingleton(IAsyncDisposableRegistry, AsyncDisposableRegistry); @@ -280,31 +280,31 @@ suite('Installer', () => { ioc.serviceManager.addSingleton(IInsiderExtensionPrompt, InsidersExtensionPrompt); ioc.serviceManager.addSingleton( IExtensionSingleActivationService, - InsidersExtensionService + InsidersExtensionService, ); ioc.serviceManager.addSingleton( IExtensionSingleActivationService, - ReloadVSCodeCommandHandler + ReloadVSCodeCommandHandler, ); ioc.serviceManager.addSingleton(IExtensionChannelService, ExtensionChannelService); ioc.serviceManager.addSingleton( IExtensionChannelRule, ExtensionInsidersOffChannelRule, - ExtensionChannel.off + ExtensionChannel.off, ); ioc.serviceManager.addSingleton( IExtensionChannelRule, ExtensionInsidersDailyChannelRule, - ExtensionChannel.daily + ExtensionChannel.daily, ); ioc.serviceManager.addSingleton( IExtensionChannelRule, ExtensionInsidersWeeklyChannelRule, - ExtensionChannel.weekly + ExtensionChannel.weekly, ); ioc.serviceManager.addSingleton( IExtensionSingleActivationService, - DebugSessionTelemetry + DebugSessionTelemetry, ); ioc.serviceManager.addSingleton(ICustomEditorService, CustomEditorService); } @@ -337,11 +337,11 @@ suite('Installer', () => { } ioc.serviceManager.addSingletonInstance( IModuleInstaller, - new MockModuleInstaller('one', false) + new MockModuleInstaller('one', false), ); ioc.serviceManager.addSingletonInstance( IModuleInstaller, - new MockModuleInstaller('two', true) + new MockModuleInstaller('two', true), ); ioc.serviceManager.addSingletonInstance(ITerminalHelper, instance(mock(TerminalHelper))); if (prod.value === Product.ctags || prod.value === Product.unittest || prod.value === Product.isort) { @@ -375,11 +375,11 @@ suite('Installer', () => { } ioc.serviceManager.addSingletonInstance( IModuleInstaller, - new MockModuleInstaller('one', false) + new MockModuleInstaller('one', false), ); ioc.serviceManager.addSingletonInstance( IModuleInstaller, - new MockModuleInstaller('two', true) + new MockModuleInstaller('two', true), ); ioc.serviceManager.addSingletonInstance(ITerminalHelper, instance(mock(TerminalHelper))); if (prod.value === Product.unittest || prod.value === Product.ctags || prod.value === Product.isort) { diff --git a/src/test/common/installer/channelManager.unit.test.ts b/src/test/common/installer/channelManager.unit.test.ts index 678dc86205d5..28693e6a2c02 100644 --- a/src/test/common/installer/channelManager.unit.test.ts +++ b/src/test/common/installer/channelManager.unit.test.ts @@ -111,7 +111,7 @@ suite('InstallationChannelManager - getInstallationChannel()', () => { const selection = { label: 'some label', description: '', - installer: moduleInstaller2.object + installer: moduleInstaller2.object, }; appShell .setup((a) => a.showQuickPick(TypeMoq.It.isAny(), TypeMoq.It.isAny())) @@ -218,7 +218,7 @@ suite('InstallationChannelManager - showNoInstallersMessage()', () => { test('If active interpreter is Conda, show conda prompt', async () => { const activeInterpreter = { - envType: EnvironmentType.Conda + envType: EnvironmentType.Conda, }; const appShell = TypeMoq.Mock.ofType(); serviceContainer @@ -243,7 +243,7 @@ suite('InstallationChannelManager - showNoInstallersMessage()', () => { test('If active interpreter is not Conda, show pip prompt', async () => { const activeInterpreter = { - envType: EnvironmentType.Pipenv + envType: EnvironmentType.Pipenv, }; const appShell = TypeMoq.Mock.ofType(); serviceContainer @@ -271,18 +271,18 @@ suite('InstallationChannelManager - showNoInstallersMessage()', () => { { osName: 'Windows', isWindows: true, - isMac: false + isMac: false, }, { osName: 'Linux', isWindows: false, - isMac: false + isMac: false, }, { osName: 'MacOS', isWindows: false, - isMac: true - } + isMac: true, + }, ].forEach((testParams) => { const expectedURL = `https://www.bing.com/search?q=Install Pip ${testParams.osName} ${ interpreterType === EnvironmentType.Conda ? 'Conda' : '' @@ -293,7 +293,7 @@ suite('InstallationChannelManager - showNoInstallersMessage()', () => { interpreterType === EnvironmentType.Conda ? 'Conda' : 'not Conda' }`, async () => { const activeInterpreter = { - envType: interpreterType + envType: interpreterType, }; const appShell = TypeMoq.Mock.ofType(); const platformService = TypeMoq.Mock.ofType(); @@ -331,7 +331,7 @@ suite('InstallationChannelManager - showNoInstallersMessage()', () => { }); test("If 'Search for help' is not selected in error prompt, don't open URL", async () => { const activeInterpreter = { - envType: EnvironmentType.Conda + envType: EnvironmentType.Conda, }; const appShell = TypeMoq.Mock.ofType(); const platformService = TypeMoq.Mock.ofType(); diff --git a/src/test/common/installer/condaInstaller.unit.test.ts b/src/test/common/installer/condaInstaller.unit.test.ts index 28f955e03a7d..48e666baebe0 100644 --- a/src/test/common/installer/condaInstaller.unit.test.ts +++ b/src/test/common/installer/condaInstaller.unit.test.ts @@ -93,7 +93,7 @@ suite('Common - Conda Installer', () => { const condaPath = 'some Conda Path'; const condaEnv: CondaEnvironmentInfo = { name: 'Hello', - path: 'Some Path' + path: 'Some Path', }; when(configService.getSettings(uri)).thenReturn(instance(settings)); @@ -112,7 +112,7 @@ suite('Common - Conda Installer', () => { const condaPath = 'some Conda Path'; const condaEnv: CondaEnvironmentInfo = { name: '', - path: 'Some Path' + path: 'Some Path', }; when(configService.getSettings(uri)).thenReturn(instance(settings)); @@ -124,7 +124,7 @@ suite('Common - Conda Installer', () => { assert.deepEqual(execInfo, { args: ['install', '--prefix', condaEnv.path.fileToCommandArgument(), 'abc', '-y'], - execPath: condaPath + execPath: condaPath, }); }); }); diff --git a/src/test/common/installer/extensionBuildInstaller.unit.test.ts b/src/test/common/installer/extensionBuildInstaller.unit.test.ts index 13676a9658f8..374776e5877c 100644 --- a/src/test/common/installer/extensionBuildInstaller.unit.test.ts +++ b/src/test/common/installer/extensionBuildInstaller.unit.test.ts @@ -18,7 +18,7 @@ import { developmentBuildUri, InsidersBuildInstaller, StableBuildInstaller, - vsixFileExtension + vsixFileExtension, } from '../../../client/common/installer/extensionBuildInstaller'; import { FileDownloader } from '../../../client/common/net/fileDownloader'; import { FileSystem } from '../../../client/common/platform/fileSystem'; @@ -48,7 +48,7 @@ suite('Extension build installer - Stable build installer', async () => { when(output.append(ExtensionChannels.installingStableMessage())).thenReturn(); when(output.appendLine(ExtensionChannels.installationCompleteMessage())).thenReturn(); when(cmdManager.executeCommand('workbench.extensions.installExtension', PVSC_EXTENSION_ID)).thenResolve( - undefined + undefined, ); when(appShell.withProgressCustomIcon(anything(), anything())).thenCall((_, cb) => cb(progressReporter)); await stableBuildInstaller.install(); @@ -82,7 +82,7 @@ suite('Extension build installer - Insiders build installer', async () => { instance(fileDownloader), instance(fs), instance(cmdManager), - instance(appShell) + instance(appShell), ); }); test('Installing Insiders build downloads and installs Insiders', async () => { @@ -90,7 +90,7 @@ suite('Extension build installer - Insiders build installer', async () => { const options = { extension: vsixFileExtension, outputChannel: output, - progressMessagePrefix: ExtensionChannels.downloadingInsidersMessage() + progressMessagePrefix: ExtensionChannels.downloadingInsidersMessage(), }; when(output.append(ExtensionChannels.installingInsidersMessage())).thenReturn(); when(output.appendLine(ExtensionChannels.startingDownloadOutputMessage())).thenReturn(); @@ -101,7 +101,7 @@ suite('Extension build installer - Insiders build installer', async () => { expect(downloadOptions.extension).to.equal(options.extension, 'Incorrect file extension'); expect(downloadOptions.progressMessagePrefix).to.equal(options.progressMessagePrefix); return Promise.resolve(vsixFilePath); - } + }, ); when(appShell.withProgressCustomIcon(anything(), anything())).thenCall((_, cb) => cb(progressReporter)); when(cmdManager.executeCommand('workbench.extensions.installExtension', anything())).thenCall((_, cb) => { diff --git a/src/test/common/installer/installer.invalidPath.unit.test.ts b/src/test/common/installer/installer.invalidPath.unit.test.ts index b9ba35d11685..e20e56dc0e9c 100644 --- a/src/test/common/installer/installer.invalidPath.unit.test.ts +++ b/src/test/common/installer/installer.invalidPath.unit.test.ts @@ -95,7 +95,7 @@ suite('Module Installer - Invalid Paths', () => { productPathService .setup((p) => - p.getExecutableNameFromSettings(TypeMoq.It.isAny(), TypeMoq.It.isValue(resource)) + p.getExecutableNameFromSettings(TypeMoq.It.isAny(), TypeMoq.It.isValue(resource)), ) .returns(() => pathToExecutable) .verifiable(TypeMoq.Times.atLeast(isExecutableAModule ? 0 : 1)); @@ -119,8 +119,8 @@ suite('Module Installer - Invalid Paths', () => { .setup((ps) => ps.createGlobalPersistentState( TypeMoq.It.isAnyString(), - TypeMoq.It.isValue(undefined) - ) + TypeMoq.It.isValue(undefined), + ), ) .returns(() => persistValue.object); await installer.promptToInstall(product.value, resource); diff --git a/src/test/common/installer/installer.unit.test.ts b/src/test/common/installer/installer.unit.test.ts index 2f8aebd91407..082278a28866 100644 --- a/src/test/common/installer/installer.unit.test.ts +++ b/src/test/common/installer/installer.unit.test.ts @@ -23,7 +23,7 @@ import { CTagsInstaller, FormatterInstaller, LinterInstaller, - ProductInstaller + ProductInstaller, } from '../../../client/common/installer/productInstaller'; import { ProductNames } from '../../../client/common/installer/productNames'; import { LinterProductPathService } from '../../../client/common/installer/productPath'; @@ -32,7 +32,7 @@ import { IInstallationChannelManager, IModuleInstaller, IProductPathService, - IProductService + IProductService, } from '../../../client/common/installer/types'; import { IPlatformService } from '../../../client/common/platform/types'; import { @@ -40,7 +40,7 @@ import { IProcessService, IProcessServiceFactory, IPythonExecutionFactory, - IPythonExecutionService + IPythonExecutionService, } from '../../../client/common/process/types'; import { ITerminalService, ITerminalServiceFactory } from '../../../client/common/terminal/types'; import { @@ -53,7 +53,7 @@ import { IPersistentStateFactory, ModuleNamePurpose, Product, - ProductType + ProductType, } from '../../../client/common/types'; import { createDeferred, Deferred } from '../../../client/common/utils/async'; import { getNamesAndValues } from '../../../client/common/utils/enum'; @@ -176,7 +176,7 @@ suite('Module Installer only', () => { resource ? 'With a resource' : 'without a resource' })`, async () => { app.setup((a) => - a.showErrorMessage(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + a.showErrorMessage(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ).verifiable(TypeMoq.Times.never()); const getProductType = sinon.stub(ProductService.prototype, 'getProductType'); // tslint:disable-next-line: no-any @@ -204,8 +204,8 @@ suite('Module Installer only', () => { outputChannel .setup((o) => o.appendLine( - 'Install Universal Ctags Win32 to enable support for Workspace Symbols' - ) + 'Install Universal Ctags Win32 to enable support for Workspace Symbols', + ), ) .returns(() => undefined) .verifiable(TypeMoq.Times.once()); @@ -271,7 +271,7 @@ suite('Module Installer only', () => { resource ? 'With a resource' : 'without a resource' }), install module and return response`, async () => { app.setup((a) => - a.showErrorMessage(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + a.showErrorMessage(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns(() => Promise.resolve('Yes')) .verifiable(TypeMoq.Times.once()); @@ -286,7 +286,7 @@ suite('Module Installer only', () => { resource ? 'With a resource' : 'without a resource' }), return ignore response`, async () => { app.setup((a) => - a.showErrorMessage(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + a.showErrorMessage(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns(() => Promise.resolve('No')) .verifiable(TypeMoq.Times.once()); @@ -333,8 +333,8 @@ suite('Module Installer only', () => { TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => { return promptDeferred!.promise; @@ -347,8 +347,8 @@ suite('Module Installer only', () => { .setup((ps) => ps.createGlobalPersistentState( TypeMoq.It.isAnyString(), - TypeMoq.It.isValue(undefined) - ) + TypeMoq.It.isValue(undefined), + ), ) .returns(() => persistVal.object); @@ -385,8 +385,8 @@ suite('Module Installer only', () => { TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve(undefined)) .verifiable(TypeMoq.Times.exactly(3)); @@ -397,8 +397,8 @@ suite('Module Installer only', () => { .setup((ps) => ps.createGlobalPersistentState( TypeMoq.It.isAnyString(), - TypeMoq.It.isValue(undefined) - ) + TypeMoq.It.isValue(undefined), + ), ) .returns(() => persistVal.object); @@ -423,8 +423,8 @@ suite('Module Installer only', () => { TypeMoq.It.isAnyString(), TypeMoq.It.isValue('Install'), TypeMoq.It.isValue('Select Linter'), - TypeMoq.It.isValue('Do not show again') - ) + TypeMoq.It.isValue('Do not show again'), + ), ) .returns(async () => { return 'Do not show again'; @@ -448,8 +448,8 @@ suite('Module Installer only', () => { .setup((ps) => ps.createGlobalPersistentState( TypeMoq.It.isAnyString(), - TypeMoq.It.isValue(undefined) - ) + TypeMoq.It.isValue(undefined), + ), ) .returns(() => { return persistVal.object; @@ -481,8 +481,8 @@ suite('Module Installer only', () => { a.showErrorMessage( TypeMoq.It.isAnyString(), TypeMoq.It.isValue('Install'), - TypeMoq.It.isValue('Select Linter') - ) + TypeMoq.It.isValue('Select Linter'), + ), ) .returns(async () => { return undefined; @@ -493,8 +493,8 @@ suite('Module Installer only', () => { TypeMoq.It.isAnyString(), TypeMoq.It.isValue('Install'), TypeMoq.It.isValue('Select Linter'), - TypeMoq.It.isValue('Do not show again') - ) + TypeMoq.It.isValue('Do not show again'), + ), ) .returns(async () => { return undefined; @@ -517,8 +517,8 @@ suite('Module Installer only', () => { .setup((ps) => ps.createGlobalPersistentState( TypeMoq.It.isAnyString(), - TypeMoq.It.isValue(undefined) - ) + TypeMoq.It.isValue(undefined), + ), ) .returns(() => { return persistVal.object; @@ -538,7 +538,7 @@ suite('Module Installer only', () => { })`, async () => { const moduleName = installer.translateProductToModuleName( product.value, - ModuleNamePurpose.install + ModuleNamePurpose.install, ); moduleInstaller @@ -546,8 +546,8 @@ suite('Module Installer only', () => { m.installModule( TypeMoq.It.isValue(moduleName), TypeMoq.It.isValue(resource), - TypeMoq.It.isValue(undefined) - ) + TypeMoq.It.isValue(undefined), + ), ) .returns(() => Promise.reject(new Error('UnitTesting'))); @@ -559,9 +559,9 @@ suite('Module Installer only', () => { m.installModule( TypeMoq.It.isValue(moduleName), TypeMoq.It.isValue(resource), - TypeMoq.It.isValue(undefined) + TypeMoq.It.isValue(undefined), ), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); } }); @@ -571,7 +571,7 @@ suite('Module Installer only', () => { }) if installation channel is not defined`, async () => { const moduleName = installer.translateProductToModuleName( product.value, - ModuleNamePurpose.install + ModuleNamePurpose.install, ); moduleInstaller @@ -579,8 +579,8 @@ suite('Module Installer only', () => { m.installModule( TypeMoq.It.isValue(moduleName), TypeMoq.It.isValue(resource), - TypeMoq.It.isValue(undefined) - ) + TypeMoq.It.isValue(undefined), + ), ) .returns(() => Promise.reject(new Error('UnitTesting'))); installationChannel.reset(); @@ -599,7 +599,7 @@ suite('Module Installer only', () => { } (${resource ? 'With a resource' : 'without a resource'})`, async () => { const moduleName = installer.translateProductToModuleName( product.value, - ModuleNamePurpose.install + ModuleNamePurpose.install, ); moduleInstaller @@ -607,8 +607,8 @@ suite('Module Installer only', () => { m.installModule( TypeMoq.It.isValue(moduleName), TypeMoq.It.isValue(resource), - TypeMoq.It.isValue(undefined) - ) + TypeMoq.It.isValue(undefined), + ), ) .returns(() => Promise.reject(new Error('UnitTesting'))); @@ -620,9 +620,9 @@ suite('Module Installer only', () => { m.installModule( TypeMoq.It.isValue(moduleName), TypeMoq.It.isValue(resource), - TypeMoq.It.isValue(undefined) + TypeMoq.It.isValue(undefined), ), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); } }); @@ -701,7 +701,7 @@ suite('Module Installer only', () => { .setup((p) => (p as any).then) .returns(() => undefined); const executionResult: ExecutionResult = { - stdout: 'output' + stdout: 'output', }; processService .setup((p) => p.exec(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())) @@ -767,8 +767,8 @@ suite('Module Installer only', () => { TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve(undefined)) .verifiable(TypeMoq.Times.never()); @@ -779,8 +779,8 @@ suite('Module Installer only', () => { .setup((ps) => ps.createGlobalPersistentState( TypeMoq.It.isAnyString(), - TypeMoq.It.isValue(undefined) - ) + TypeMoq.It.isValue(undefined), + ), ) .returns(() => persistVal.object); @@ -827,7 +827,7 @@ suite('Module Installer only', () => { when(serviceContainer.get(IApplicationShell)).thenReturn(instance(appShell)); when(serviceContainer.get(IConfigurationService)).thenReturn( - instance(configService) + instance(configService), ); when(serviceContainer.get(IWorkspaceService)).thenReturn(instance(workspaceService)); when(serviceContainer.get(IProductService)).thenReturn(instance(productService)); @@ -847,8 +847,8 @@ suite('Module Installer only', () => { `Formatter autopep8 is not installed. Install?`, 'Yes', 'Use black', - 'Use yapf' - ) + 'Use yapf', + ), // tslint:disable-next-line: no-any ).thenReturn(undefined as any); @@ -859,8 +859,8 @@ suite('Module Installer only', () => { `Formatter autopep8 is not installed. Install?`, 'Yes', 'Use black', - 'Use yapf' - ) + 'Use yapf', + ), ).once(); expect(response).to.equal(InstallerResponse.Ignore); }); @@ -875,8 +875,8 @@ suite('Module Installer only', () => { `Formatter autopep8 is not installed. Install?`, 'Yes', 'Use black', - 'Use yapf' - ) + 'Use yapf', + ), // tslint:disable-next-line: no-any ).thenReturn('Yes' as any); const response = await installer.promptToInstallImplementation(product, resource); @@ -886,8 +886,8 @@ suite('Module Installer only', () => { `Formatter autopep8 is not installed. Install?`, 'Yes', 'Use black', - 'Use yapf' - ) + 'Use yapf', + ), ).once(); expect(response).to.equal(InstallerResponse.Installed); assert.ok(install.calledOnceWith(product, resource, undefined)); @@ -903,8 +903,8 @@ suite('Module Installer only', () => { `Formatter autopep8 is not installed. Install?`, 'Yes', 'Use black', - 'Use yapf' - ) + 'Use yapf', + ), // tslint:disable-next-line: no-any ).thenReturn('Use black' as any); when(configService.updateSetting('formatting.provider', 'black', resource)).thenResolve(); @@ -916,8 +916,8 @@ suite('Module Installer only', () => { `Formatter autopep8 is not installed. Install?`, 'Yes', 'Use black', - 'Use yapf' - ) + 'Use yapf', + ), ).once(); expect(response).to.equal(InstallerResponse.Installed); verify(configService.updateSetting('formatting.provider', 'black', resource)).once(); @@ -934,8 +934,8 @@ suite('Module Installer only', () => { `Formatter autopep8 is not installed. Install?`, 'Yes', 'Use black', - 'Use yapf' - ) + 'Use yapf', + ), // tslint:disable-next-line: no-any ).thenReturn('Use yapf' as any); when(configService.updateSetting('formatting.provider', 'yapf', resource)).thenResolve(); @@ -947,8 +947,8 @@ suite('Module Installer only', () => { `Formatter autopep8 is not installed. Install?`, 'Yes', 'Use black', - 'Use yapf' - ) + 'Use yapf', + ), ).once(); expect(response).to.equal(InstallerResponse.Installed); verify(configService.updateSetting('formatting.provider', 'yapf', resource)).once(); @@ -999,7 +999,7 @@ suite('Module Installer only', () => { when(serviceContainer.get(IApplicationShell)).thenReturn(instance(appShell)); when(serviceContainer.get(IConfigurationService)).thenReturn( - instance(configService) + instance(configService), ); when(serviceContainer.get(IWorkspaceService)).thenReturn(instance(workspaceService)); when(serviceContainer.get(IProductService)).thenReturn(instance(productService)); @@ -1011,7 +1011,7 @@ suite('Module Installer only', () => { when(serviceContainer.get(ILinterManager)).thenReturn(instance(linterManager)); when(serviceContainer.get(IProductPathService, ProductType.Linter)).thenReturn( - instance(productPathService) + instance(productPathService), ); installer = new LinterInstallerTest(instance(serviceContainer), outputChannel.object); @@ -1030,7 +1030,7 @@ suite('Module Installer only', () => { await installer.promptToInstallImplementation(product, resource); verify( - appShell.showErrorMessage(`Linter ${productName} is not installed.`, 'Install', options[0], options[1]) + appShell.showErrorMessage(`Linter ${productName} is not installed.`, 'Install', options[0], options[1]), ).once(); }); test('Ensure select linter command is invoked', async () => { @@ -1038,7 +1038,7 @@ suite('Module Installer only', () => { const options = ['Select Linter', 'Do not show again']; const productName = ProductNames.get(product)!; when( - appShell.showErrorMessage(`Linter ${productName} is not installed.`, 'Install', options[0], options[1]) + appShell.showErrorMessage(`Linter ${productName} is not installed.`, 'Install', options[0], options[1]), // tslint:disable-next-line:no-any ).thenResolve('Select Linter' as any); when(cmdManager.executeCommand(Commands.Set_Linter)).thenResolve(undefined); @@ -1046,7 +1046,7 @@ suite('Module Installer only', () => { const response = await installer.promptToInstallImplementation(product, resource); verify( - appShell.showErrorMessage(`Linter ${productName} is not installed.`, 'Install', options[0], options[1]) + appShell.showErrorMessage(`Linter ${productName} is not installed.`, 'Install', options[0], options[1]), ).once(); verify(cmdManager.executeCommand(Commands.Set_Linter)).once(); expect(response).to.be.equal(InstallerResponse.Ignore); @@ -1056,7 +1056,7 @@ suite('Module Installer only', () => { const options = ['Select Linter', 'Do not show again']; const productName = ProductNames.get(product)!; when( - appShell.showErrorMessage(`Linter ${productName} is not installed.`, 'Install', options[0], options[1]) + appShell.showErrorMessage(`Linter ${productName} is not installed.`, 'Install', options[0], options[1]), // tslint:disable-next-line:no-any ).thenResolve('Install' as any); when(cmdManager.executeCommand(Commands.Set_Linter)).thenResolve(undefined); @@ -1073,9 +1073,9 @@ suite('Module Installer only', () => { when(workspaceService.getConfiguration('python')).thenReturn( new MockWorkspaceConfiguration({ 'linting.pylintEnabled': { - globalValue: true - } - }) + globalValue: true, + }, + }), ); const product = Product.pylint; @@ -1086,7 +1086,7 @@ suite('Module Installer only', () => { verify(experimentsService.inExperiment(LinterInstallationPromptVariants.noPrompt)).never(); verify( - appShell.showErrorMessage(`Linter ${productName} is not installed.`, 'Install', options[0], options[1]) + appShell.showErrorMessage(`Linter ${productName} is not installed.`, 'Install', options[0], options[1]), ).once(); }); @@ -1094,13 +1094,13 @@ suite('Module Installer only', () => { when(workspaceService.getConfiguration('python')).thenReturn( new MockWorkspaceConfiguration({ 'linting.pylintPath': { - globalValue: 'path/to/something' - } - }) + globalValue: 'path/to/something', + }, + }), ); when(productService.getProductType(Product.pylint)).thenReturn(ProductType.Linter); when(productPathService.getExecutableNameFromSettings(Product.pylint, resource)).thenReturn( - 'path/to/something' + 'path/to/something', ); when(experimentsService.inExperiment(LinterInstallationPromptVariants.flake8First)).thenResolve(true); installer.isModuleExecutable = false; @@ -1115,18 +1115,18 @@ suite('Module Installer only', () => { Linters.installMessage(), Linters.installPylint(), Linters.installFlake8(), - Common.doNotShowAgain() - ) + Common.doNotShowAgain(), + ), ).never(); verify( - appShell.showErrorMessage(`Linter ${productName} is not installed.`, 'Install', options[0], options[1]) + appShell.showErrorMessage(`Linter ${productName} is not installed.`, 'Install', options[0], options[1]), ).never(); verify( appShell.showErrorMessage( `Path to the ${productName} linter is invalid (path/to/something)`, options[0], - options[1] - ) + options[1], + ), ).once(); }); @@ -1140,7 +1140,7 @@ suite('Module Installer only', () => { verify(experimentsService.inExperiment(LinterInstallationPromptVariants.noPrompt)).once(); verify( - appShell.showErrorMessage(`Linter ${productName} is not installed.`, 'Install', options[0], options[1]) + appShell.showErrorMessage(`Linter ${productName} is not installed.`, 'Install', options[0], options[1]), ).never(); expect(response).to.be.equal(InstallerResponse.Ignore); }); @@ -1157,8 +1157,8 @@ suite('Module Installer only', () => { Linters.installMessage(), Linters.installPylint(), Linters.installFlake8(), - Common.doNotShowAgain() - ) + Common.doNotShowAgain(), + ), ).once(); }); @@ -1174,8 +1174,8 @@ suite('Module Installer only', () => { Linters.installMessage(), Linters.installFlake8(), Linters.installPylint(), - Common.doNotShowAgain() - ) + Common.doNotShowAgain(), + ), ).once(); }); }); diff --git a/src/test/common/installer/moduleInstaller.unit.test.ts b/src/test/common/installer/moduleInstaller.unit.test.ts index 73ad8ded6dfa..9b22cb26f033 100644 --- a/src/test/common/installer/moduleInstaller.unit.test.ts +++ b/src/test/common/installer/moduleInstaller.unit.test.ts @@ -18,7 +18,7 @@ import { OutputChannel, ProgressLocation, Uri, - WorkspaceConfiguration + WorkspaceConfiguration, } from 'vscode'; import { IApplicationShell, IWorkspaceService } from '../../../client/common/application/types'; import { STANDARD_OUTPUT_CHANNEL } from '../../../client/common/constants'; @@ -37,7 +37,7 @@ import { IOutputChannel, IPythonSettings, ModuleNamePurpose, - Product + Product, } from '../../../client/common/types'; import { getNamesAndValues } from '../../../client/common/utils/enum'; import { Products } from '../../../client/common/utils/localize'; @@ -111,7 +111,7 @@ suite('Module Installer', () => { test('Show error message if sudo exec fails with error', async () => { const error = 'Error message'; const sudoPromptMock = { - exec: (_command: any, _options: any, callBackFn: Function) => callBackFn(error, 'stdout', 'stderr') + exec: (_command: any, _options: any, callBackFn: Function) => callBackFn(error, 'stdout', 'stderr'), }; rewiremock.enable(); rewiremock('sudo-prompt').with(sudoPromptMock); @@ -132,7 +132,7 @@ suite('Module Installer', () => { test('Show stdout if sudo exec succeeds', async () => { const stdout = 'stdout'; const sudoPromptMock = { - exec: (_command: any, _options: any, callBackFn: Function) => callBackFn(undefined, stdout, undefined) + exec: (_command: any, _options: any, callBackFn: Function) => callBackFn(undefined, stdout, undefined), }; rewiremock.enable(); rewiremock('sudo-prompt').with(sudoPromptMock); @@ -156,7 +156,7 @@ suite('Module Installer', () => { test('Show stderr if sudo exec gives a warning with stderr', async () => { const stderr = 'stderr'; const sudoPromptMock = { - exec: (_command: any, _options: any, callBackFn: Function) => callBackFn(undefined, undefined, stderr) + exec: (_command: any, _options: any, callBackFn: Function) => callBackFn(undefined, undefined, stderr), }; rewiremock.enable(); rewiremock('sudo-prompt').with(sudoPromptMock); @@ -191,7 +191,7 @@ suite('Module Installer', () => { { name: 'My-Env01', path: '' }, { name: '', path: path.join('conda', 'path') }, { name: 'My-Env01 With Spaces', path: '' }, - { name: '', path: path.join('conda with spaces', 'path') } + { name: '', path: path.join('conda with spaces', 'path') }, ] : []; [undefined, ...condaEnvs].forEach((condaEnvInfo) => { @@ -233,7 +233,7 @@ suite('Module Installer', () => { installationChannel = TypeMoq.Mock.ofType(); serviceContainer .setup((c) => - c.get(TypeMoq.It.isValue(IInstallationChannelManager), TypeMoq.It.isAny()) + c.get(TypeMoq.It.isValue(IInstallationChannelManager), TypeMoq.It.isAny()), ) .returns(() => installationChannel.object); @@ -276,7 +276,7 @@ suite('Module Installer', () => { .returns(() => workspaceService.object); const http = TypeMoq.Mock.ofType(); http.setup((h) => h.get(TypeMoq.It.isValue('proxy'), TypeMoq.It.isAny())).returns( - () => proxyServer + () => proxyServer, ); workspaceService .setup((w) => w.getConfiguration(TypeMoq.It.isValue('http'))) @@ -306,8 +306,8 @@ suite('Module Installer', () => { t.sendCommand( TypeMoq.It.isValue(command), TypeMoq.It.isValue(expectedArgs), - TypeMoq.It.isValue(undefined) - ) + TypeMoq.It.isValue(undefined), + ), ) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.once()); @@ -335,7 +335,7 @@ suite('Module Installer', () => { ...proxyArgs, 'install', '-U', - '"pylint<2.0.0"' + '"pylint<2.0.0"', ]; await installModuleAndVerifyCommand(pythonPath, expectedArgs); }); @@ -378,7 +378,7 @@ suite('Module Installer', () => { ...proxyArgs, 'install', '-U', - 'pylint' + 'pylint', ]; await installModuleAndVerifyCommand(pythonPath, expectedArgs); }); @@ -422,11 +422,11 @@ suite('Module Installer', () => { pythonSettings.setup((p) => p.globalModuleInstallation).returns(() => true); const elevatedInstall = sinon.stub( TestModuleInstaller.prototype, - 'elevatedInstall' + 'elevatedInstall', ); elevatedInstall.returns(); fs.setup((f) => f.isDirReadonly(path.dirname(pythonPath))).returns(() => - Promise.resolve(true) + Promise.resolve(true), ); try { await installer.installModule(product.name, resource); @@ -445,7 +445,7 @@ suite('Module Installer', () => { setActiveInterpreter(info.object); pythonSettings.setup((p) => p.globalModuleInstallation).returns(() => true); fs.setup((f) => f.isDirReadonly(path.dirname(pythonPath))).returns(() => - Promise.resolve(false) + Promise.resolve(false), ); const args = [isolated, 'executionInfo']; terminalService @@ -489,12 +489,12 @@ suite('Module Installer', () => { pythonSettings.setup((p) => p.globalModuleInstallation).returns(() => true); const elevatedInstall = sinon.stub( TestModuleInstaller.prototype, - 'elevatedInstall' + 'elevatedInstall', ); elevatedInstall.returns(); const err = new Error('oops!'); fs.setup((f) => f.isDirReadonly(path.dirname(pythonPath))).returns(() => - Promise.reject(err) + Promise.reject(err), ); try { @@ -510,7 +510,7 @@ suite('Module Installer', () => { const options = { location: ProgressLocation.Notification, cancellable: true, - title: Products.installingModule().format(product.name) + title: Products.installingModule().format(product.name), }; appShell .setup((a) => a.withProgress(TypeMoq.It.isAny(), TypeMoq.It.isAny())) @@ -521,7 +521,7 @@ suite('Module Installer', () => { await installer.installModule( product.name, resource, - new CancellationTokenSource().token + new CancellationTokenSource().token, ); } catch (ex) { noop(); @@ -588,7 +588,7 @@ suite('Module Installer', () => { function generatePythonInterpreterVersions() { const versions: SemVer[] = ['2.7.0-final', '3.4.0-final', '3.5.0-final', '3.6.0-final', '3.7.0-final'].map( - (ver) => new SemVer(ver) + (ver) => new SemVer(ver), ); return versions.map((version) => { const info = TypeMoq.Mock.ofType(); diff --git a/src/test/common/installer/pipEnvInstaller.unit.test.ts b/src/test/common/installer/pipEnvInstaller.unit.test.ts index fc3a0b1d94bf..ab516537bd21 100644 --- a/src/test/common/installer/pipEnvInstaller.unit.test.ts +++ b/src/test/common/installer/pipEnvInstaller.unit.test.ts @@ -35,7 +35,7 @@ suite('PipEnv installer', async () => { test('If InterpreterUri is Pipenv interpreter, method isSupported() returns true', async () => { const interpreter = { - envType: EnvironmentType.Pipenv + envType: EnvironmentType.Pipenv, }; // tslint:disable-next-line: no-any const result = await pipEnvInstaller.isSupported(interpreter as any); @@ -44,7 +44,7 @@ suite('PipEnv installer', async () => { test('If InterpreterUri is Python interpreter but not of type Pipenv, method isSupported() returns false', async () => { const interpreter = { - envType: EnvironmentType.Conda + envType: EnvironmentType.Conda, }; // tslint:disable-next-line: no-any const result = await pipEnvInstaller.isSupported(interpreter as any); @@ -58,8 +58,8 @@ suite('PipEnv installer', async () => { .returns(() => Promise.resolve([ TypeMoq.Mock.ofType().object, - TypeMoq.Mock.ofType().object - ]) + TypeMoq.Mock.ofType().object, + ]), ); const result = await pipEnvInstaller.isSupported(resource); expect(result).to.equal(true, 'Should be true'); diff --git a/src/test/common/installer/pipInstaller.unit.test.ts b/src/test/common/installer/pipInstaller.unit.test.ts index de27c0b4e938..06200cedbd74 100644 --- a/src/test/common/installer/pipInstaller.unit.test.ts +++ b/src/test/common/installer/pipInstaller.unit.test.ts @@ -35,7 +35,7 @@ suite('Pip installer', async () => { test('If InterpreterUri is Python interpreter, Python execution factory is called with the correct arguments', async () => { const pythonExecutionService = TypeMoq.Mock.ofType(); const interpreter = { - path: 'pythonPath' + path: 'pythonPath', }; pythonExecutionFactory .setup((p) => p.create(TypeMoq.It.isAny())) diff --git a/src/test/common/installer/poetryInstaller.unit.test.ts b/src/test/common/installer/poetryInstaller.unit.test.ts index 2f72b40e97dc..345b5151e675 100644 --- a/src/test/common/installer/poetryInstaller.unit.test.ts +++ b/src/test/common/installer/poetryInstaller.unit.test.ts @@ -45,7 +45,7 @@ suite('Module Installer - Poetry', () => { instance(workspaceService), instance(configurationService), instance(fileSystem), - instance(processServiceFactory) + instance(processServiceFactory), ); }); diff --git a/src/test/common/installer/productPath.unit.test.ts b/src/test/common/installer/productPath.unit.test.ts index ec47b88dd2c6..2e48d4972bef 100644 --- a/src/test/common/installer/productPath.unit.test.ts +++ b/src/test/common/installer/productPath.unit.test.ts @@ -18,7 +18,7 @@ import { FormatterProductPathService, LinterProductPathService, RefactoringLibraryProductPathService, - TestFrameworkProductPathService + TestFrameworkProductPathService, } from '../../../client/common/installer/productPath'; import { ProductService } from '../../../client/common/installer/productService'; import { IProductService } from '../../../client/common/installer/types'; @@ -31,7 +31,7 @@ import { IWorkspaceSymbolSettings, ModuleNamePurpose, Product, - ProductType + ProductType, } from '../../../client/common/types'; import { getNamesAndValues } from '../../../client/common/utils/enum'; import { IFormatterHelper } from '../../../client/formatters/types'; @@ -67,7 +67,7 @@ suite('Product Path', () => { productInstaller = new ProductInstaller( serviceContainer.object, - TypeMoq.Mock.ofType().object + TypeMoq.Mock.ofType().object, ); const pythonSettings = TypeMoq.Mock.ofType(); pythonSettings.setup((p) => p.formatting).returns(() => formattingSettings.object); @@ -135,7 +135,7 @@ suite('Product Path', () => { .returns(() => { return { pathName: 'autopep8Path', - argsName: 'autopep8Args' + argsName: 'autopep8Args', }; }) .verifiable(TypeMoq.Times.once()); @@ -183,7 +183,7 @@ suite('Product Path', () => { const value = productPathService.getExecutableNameFromSettings(product.value, resource); const moduleName = productInstaller.translateProductToModuleName( product.value, - ModuleNamePurpose.run + ModuleNamePurpose.run, ); expect(value).to.be.equal(moduleName); }); @@ -222,7 +222,7 @@ suite('Product Path', () => { return { argsName: 'autoTestDiscoverOnSaveEnabled', enabledName: 'autoTestDiscoverOnSaveEnabled', - pathName: 'nosetestPath' + pathName: 'nosetestPath', }; }) .verifiable(TypeMoq.Times.once()); @@ -250,7 +250,7 @@ suite('Product Path', () => { return { argsName: 'autoTestDiscoverOnSaveEnabled', enabledName: 'autoTestDiscoverOnSaveEnabled', - pathName: undefined + pathName: undefined, }; }) .verifiable(TypeMoq.Times.once()); @@ -258,7 +258,7 @@ suite('Product Path', () => { const value = productPathService.getExecutableNameFromSettings(product.value, resource); const moduleName = productInstaller.translateProductToModuleName( product.value, - ModuleNamePurpose.run + ModuleNamePurpose.run, ); expect(value).to.be.equal(moduleName); testHelper.verifyAll(); diff --git a/src/test/common/installer/serviceRegistry.unit.test.ts b/src/test/common/installer/serviceRegistry.unit.test.ts index fb4740aac587..2cc02576e290 100644 --- a/src/test/common/installer/serviceRegistry.unit.test.ts +++ b/src/test/common/installer/serviceRegistry.unit.test.ts @@ -17,7 +17,7 @@ import { FormatterProductPathService, LinterProductPathService, RefactoringLibraryProductPathService, - TestFrameworkProductPathService + TestFrameworkProductPathService, } from '../../../client/common/installer/productPath'; import { ProductService } from '../../../client/common/installer/productService'; import { registerTypes } from '../../../client/common/installer/serviceRegistry'; @@ -28,7 +28,7 @@ import { INSIDERS_INSTALLER, IProductPathService, IProductService, - STABLE_INSTALLER + STABLE_INSTALLER, } from '../../../client/common/installer/types'; import { ProductType } from '../../../client/common/types'; import { ServiceManager } from '../../../client/ioc/serviceManager'; @@ -50,22 +50,22 @@ suite('Common installer Service Registry', () => { verify( serviceManager.addSingleton( IInstallationChannelManager, - InstallationChannelManager - ) + InstallationChannelManager, + ), ).once(); verify( serviceManager.addSingleton( IExtensionBuildInstaller, StableBuildInstaller, - STABLE_INSTALLER - ) + STABLE_INSTALLER, + ), ).once(); verify( serviceManager.addSingleton( IExtensionBuildInstaller, InsidersBuildInstaller, - INSIDERS_INSTALLER - ) + INSIDERS_INSTALLER, + ), ).once(); verify(serviceManager.addSingleton(IProductService, ProductService)).once(); @@ -73,36 +73,36 @@ suite('Common installer Service Registry', () => { serviceManager.addSingleton( IProductPathService, CTagsProductPathService, - ProductType.WorkspaceSymbols - ) + ProductType.WorkspaceSymbols, + ), ).once(); verify( serviceManager.addSingleton( IProductPathService, FormatterProductPathService, - ProductType.Formatter - ) + ProductType.Formatter, + ), ).once(); verify( serviceManager.addSingleton( IProductPathService, LinterProductPathService, - ProductType.Linter - ) + ProductType.Linter, + ), ).once(); verify( serviceManager.addSingleton( IProductPathService, TestFrameworkProductPathService, - ProductType.TestFramework - ) + ProductType.TestFramework, + ), ).once(); verify( serviceManager.addSingleton( IProductPathService, RefactoringLibraryProductPathService, - ProductType.RefactoringLibrary - ) + ProductType.RefactoringLibrary, + ), ).once(); verify(serviceManager.addSingleton(IWebviewPanelProvider, WebviewPanelProvider)).once(); }); diff --git a/src/test/common/interpreterPathService.unit.test.ts b/src/test/common/interpreterPathService.unit.test.ts index ad4aa91b1e4c..0415b3ff0286 100644 --- a/src/test/common/interpreterPathService.unit.test.ts +++ b/src/test/common/interpreterPathService.unit.test.ts @@ -12,7 +12,7 @@ import { Event, EventEmitter, Uri, - WorkspaceConfiguration + WorkspaceConfiguration, } from 'vscode'; import { IWorkspaceService } from '../../client/common/application/types'; import { @@ -20,7 +20,7 @@ import { InterpreterPathService, isGlobalSettingCopiedKey, workspaceFolderKeysForWhichTheCopyIsDone_Key, - workspaceKeysForWhichTheCopyIsDone_Key + workspaceKeysForWhichTheCopyIsDone_Key, } from '../../client/common/interpreterPathService'; import { FileSystemPaths } from '../../client/common/platform/fs-paths'; import { InterpreterConfigurationScope, IPersistentState, IPersistentStateFactory } from '../../client/common/types'; @@ -42,7 +42,7 @@ suite('Interpreter Path Service', async () => { .returns(() => ({ uri: resource, name: 'Workspacefolder', - index: 0 + index: 0, })); workspaceService.setup((w) => w.getWorkspaceFolder(resourceOutsideOfWorkspace)).returns(() => undefined); persistentStateFactory = TypeMoq.Mock.ofType(); @@ -57,15 +57,15 @@ suite('Interpreter Path Service', async () => { test('Ensure execution of method copyOldInterpreterStorageValuesToNew() goes as expected', async () => { const _copyWorkspaceFolderValueToNewStorage = sinon.stub( InterpreterPathService.prototype, - '_copyWorkspaceFolderValueToNewStorage' + '_copyWorkspaceFolderValueToNewStorage', ); const _copyWorkspaceValueToNewStorage = sinon.stub( InterpreterPathService.prototype, - '_copyWorkspaceValueToNewStorage' + '_copyWorkspaceValueToNewStorage', ); const _moveGlobalSettingValueToNewStorage = sinon.stub( InterpreterPathService.prototype, - '_moveGlobalSettingValueToNewStorage' + '_moveGlobalSettingValueToNewStorage', ); const workspaceConfig = TypeMoq.Mock.ofType(); workspaceService.setup((w) => w.getConfiguration('python', resource)).returns(() => workspaceConfig.object); @@ -76,9 +76,9 @@ suite('Interpreter Path Service', async () => { ({ globalValue: 'globalPythonPath', workspaceFolderValue: 'workspaceFolderPythonPath', - workspaceValue: 'workspacePythonPath' + workspaceValue: 'workspacePythonPath', // tslint:disable-next-line: no-any - } as any) + } as any), ); interpreterPathService = new InterpreterPathService(persistentStateFactory.object, workspaceService.object, []); @@ -248,9 +248,9 @@ suite('Interpreter Path Service', async () => { .returns( () => ({ - globalValue: interpreterPath + globalValue: interpreterPath, // tslint:disable-next-line: no-any - } as any) + } as any), ); workspaceConfig .setup((w) => w.update('defaultInterpreterPath', interpreterPath, true)) @@ -270,9 +270,9 @@ suite('Interpreter Path Service', async () => { .returns( () => ({ - globalValue: 'storedValue' + globalValue: 'storedValue', // tslint:disable-next-line: no-any - } as any) + } as any), ); workspaceConfig .setup((w) => w.update('defaultInterpreterPath', interpreterPath, true)) @@ -458,9 +458,9 @@ suite('Interpreter Path Service', async () => { .returns( () => ({ - globalValue: 'default/path/to/interpreter' + globalValue: 'default/path/to/interpreter', // tslint:disable-next-line: no-any - } as any) + } as any), ); const persistentState = TypeMoq.Mock.ofType>(); workspaceService.setup((w) => w.workspaceFolders).returns(() => undefined); @@ -473,7 +473,7 @@ suite('Interpreter Path Service', async () => { assert.deepEqual(settings, { globalValue: 'default/path/to/interpreter', workspaceFolderValue: undefined, - workspaceValue: undefined + workspaceValue: undefined, }); persistentStateFactory.verifyAll(); @@ -491,9 +491,9 @@ suite('Interpreter Path Service', async () => { .returns( () => ({ - globalValue: 'default/path/to/interpreter' + globalValue: 'default/path/to/interpreter', // tslint:disable-next-line: no-any - } as any) + } as any), ); const workspaceFolderPersistentState = TypeMoq.Mock.ofType>(); workspaceService.setup((w) => w.workspaceFolders).returns(() => undefined); @@ -510,7 +510,7 @@ suite('Interpreter Path Service', async () => { assert.deepEqual(settings, { globalValue: 'default/path/to/interpreter', workspaceFolderValue: 'workspaceFolderValue', - workspaceValue: 'workspaceFolderValue' + workspaceValue: 'workspaceFolderValue', }); }); @@ -528,16 +528,16 @@ suite('Interpreter Path Service', async () => { .returns( () => ({ - globalValue: 'default/path/to/interpreter' + globalValue: 'default/path/to/interpreter', // tslint:disable-next-line: no-any - } as any) + } as any), ); const workspaceFolderPersistentState = TypeMoq.Mock.ofType>(); const workspacePersistentState = TypeMoq.Mock.ofType>(); workspaceService.setup((w) => w.workspaceFolders).returns(() => undefined); persistentStateFactory .setup((p) => - p.createGlobalPersistentState(expectedWorkspaceFolderSettingKey, undefined) + p.createGlobalPersistentState(expectedWorkspaceFolderSettingKey, undefined), ) .returns(() => workspaceFolderPersistentState.object); persistentStateFactory @@ -551,7 +551,7 @@ suite('Interpreter Path Service', async () => { assert.deepEqual(settings, { globalValue: 'default/path/to/interpreter', workspaceFolderValue: 'workspaceFolderValue', - workspaceValue: 'workspaceValue' + workspaceValue: 'workspaceValue', }); }); @@ -559,7 +559,7 @@ suite('Interpreter Path Service', async () => { interpreterPathService.inspect = () => ({ globalValue: 'default/path/to/interpreter', workspaceFolderValue: 'workspaceFolderValue', - workspaceValue: 'workspaceValue' + workspaceValue: 'workspaceValue', }); const settingValue = interpreterPathService.get(resource); expect(settingValue).to.equal('workspaceFolderValue'); @@ -569,7 +569,7 @@ suite('Interpreter Path Service', async () => { interpreterPathService.inspect = () => ({ globalValue: 'default/path/to/interpreter', workspaceFolderValue: undefined, - workspaceValue: 'workspaceValue' + workspaceValue: 'workspaceValue', }); const settingValue = interpreterPathService.get(resource); expect(settingValue).to.equal('workspaceValue'); @@ -579,7 +579,7 @@ suite('Interpreter Path Service', async () => { interpreterPathService.inspect = () => ({ globalValue: 'default/path/to/interpreter', workspaceFolderValue: undefined, - workspaceValue: 'workspaceValue' + workspaceValue: 'workspaceValue', }); const settingValue = interpreterPathService.get(resource); expect(settingValue).to.equal('workspaceValue'); @@ -589,7 +589,7 @@ suite('Interpreter Path Service', async () => { interpreterPathService.inspect = () => ({ globalValue: 'default/path/to/interpreter', workspaceFolderValue: undefined, - workspaceValue: undefined + workspaceValue: undefined, }); const settingValue = interpreterPathService.get(resource); expect(settingValue).to.equal('default/path/to/interpreter'); @@ -599,7 +599,7 @@ suite('Interpreter Path Service', async () => { interpreterPathService.inspect = () => ({ globalValue: undefined, workspaceFolderValue: undefined, - workspaceValue: undefined + workspaceValue: undefined, }); const settingValue = interpreterPathService.get(resource); expect(settingValue).to.equal('python'); diff --git a/src/test/common/moduleInstaller.test.ts b/src/test/common/moduleInstaller.test.ts index cb6025e05063..a26ad76e7093 100644 --- a/src/test/common/moduleInstaller.test.ts +++ b/src/test/common/moduleInstaller.test.ts @@ -29,7 +29,7 @@ import { IDebugService, IDocumentManager, IJupyterExtensionDependencyManager, - IWorkspaceService + IWorkspaceService, } from '../../client/common/application/types'; import { WorkspaceService } from '../../client/common/application/workspace'; import { AsyncDisposableRegistry } from '../../client/common/asyncDisposableRegistry'; @@ -42,7 +42,7 @@ import { FeatureDeprecationManager } from '../../client/common/featureDeprecatio import { ExtensionInsidersDailyChannelRule, ExtensionInsidersOffChannelRule, - ExtensionInsidersWeeklyChannelRule + ExtensionInsidersWeeklyChannelRule, } from '../../client/common/insidersBuild/downloadChannelRules'; import { ExtensionChannelService } from '../../client/common/insidersBuild/downloadChannelService'; import { InsidersExtensionPrompt } from '../../client/common/insidersBuild/insidersExtensionPrompt'; @@ -51,7 +51,7 @@ import { ExtensionChannel, IExtensionChannelRule, IExtensionChannelService, - IInsiderExtensionPrompt + IInsiderExtensionPrompt, } from '../../client/common/insidersBuild/types'; import { CondaInstaller } from '../../client/common/installer/condaInstaller'; import { PipEnvInstaller } from '../../client/common/installer/pipEnvInstaller'; @@ -92,7 +92,7 @@ import { ITerminalHelper, ITerminalService, ITerminalServiceFactory, - TerminalActivationProviders + TerminalActivationProviders, } from '../../client/common/terminal/types'; import { IAsyncDisposableRegistry, @@ -113,7 +113,7 @@ import { IPersistentStateFactory, IPythonSettings, IRandom, - IsWindows + IsWindows, } from '../../client/common/types'; import { IMultiStepInputFactory, MultiStepInputFactory } from '../../client/common/utils/multiStepInput'; import { Architecture } from '../../client/common/utils/platform'; @@ -123,7 +123,7 @@ import { IInterpreterLocatorService, IInterpreterService, INTERPRETER_LOCATOR_SERVICE, - PIPENV_SERVICE + PIPENV_SERVICE, } from '../../client/interpreter/contracts'; import { IServiceContainer } from '../../client/ioc/types'; import { JupyterExtensionDependencyManager } from '../../client/jupyter/jupyterExtensionDependencyManager'; @@ -150,7 +150,7 @@ const info: PythonEnvironment = { envType: EnvironmentType.Unknown, version: new SemVer('0.0.0-alpha'), sysPrefix: '', - sysVersion: '' + sysVersion: '', }; suite('Module Installer', () => { @@ -202,7 +202,7 @@ suite('Module Installer', () => { .returns(() => mockTerminalService.object); ioc.serviceManager.addSingletonInstance( ITerminalServiceFactory, - mockTerminalFactory.object + mockTerminalFactory.object, ); ioc.serviceManager.addSingleton(IModuleInstaller, PipInstaller); @@ -238,7 +238,7 @@ suite('Module Installer', () => { ioc.serviceManager.addSingleton(IApplicationEnvironment, ApplicationEnvironment); ioc.serviceManager.addSingleton( IJupyterExtensionDependencyManager, - JupyterExtensionDependencyManager + JupyterExtensionDependencyManager, ); ioc.serviceManager.addSingleton(IBrowserService, BrowserService); ioc.serviceManager.addSingleton(IHttpClient, HttpClient); @@ -248,7 +248,7 @@ suite('Module Installer', () => { ioc.serviceManager.addSingleton(ITerminalActivator, TerminalActivator); ioc.serviceManager.addSingleton( ITerminalActivationHandler, - PowershellTerminalActivationFailedHandler + PowershellTerminalActivationFailedHandler, ); ioc.serviceManager.addSingleton(ICryptoUtils, CryptoUtils); ioc.serviceManager.addSingleton(IExperimentsManager, ExperimentsManager); @@ -257,36 +257,36 @@ suite('Module Installer', () => { ioc.serviceManager.addSingleton( ITerminalActivationCommandProvider, Bash, - TerminalActivationProviders.bashCShellFish + TerminalActivationProviders.bashCShellFish, ); ioc.serviceManager.addSingleton( ITerminalActivationCommandProvider, CommandPromptAndPowerShell, - TerminalActivationProviders.commandPromptAndPowerShell + TerminalActivationProviders.commandPromptAndPowerShell, ); ioc.serviceManager.addSingleton( ITerminalActivationCommandProvider, PyEnvActivationCommandProvider, - TerminalActivationProviders.pyenv + TerminalActivationProviders.pyenv, ); ioc.serviceManager.addSingleton( ITerminalActivationCommandProvider, CondaActivationCommandProvider, - TerminalActivationProviders.conda + TerminalActivationProviders.conda, ); ioc.serviceManager.addSingleton( ITerminalActivationCommandProvider, PipEnvActivationCommandProvider, - TerminalActivationProviders.pipenv + TerminalActivationProviders.pipenv, ); ioc.serviceManager.addSingleton( IFeatureDeprecationManager, - FeatureDeprecationManager + FeatureDeprecationManager, ); ioc.serviceManager.addSingleton( IAsyncDisposableRegistry, - AsyncDisposableRegistry + AsyncDisposableRegistry, ); ioc.serviceManager.addSingleton(IMultiStepInputFactory, MultiStepInputFactory); ioc.serviceManager.addSingleton(IImportTracker, ImportTracker); @@ -298,34 +298,34 @@ suite('Module Installer', () => { ioc.serviceManager.addSingleton(IInsiderExtensionPrompt, InsidersExtensionPrompt); ioc.serviceManager.addSingleton( IExtensionSingleActivationService, - InsidersExtensionService + InsidersExtensionService, ); ioc.serviceManager.addSingleton( IExtensionSingleActivationService, - ReloadVSCodeCommandHandler + ReloadVSCodeCommandHandler, ); ioc.serviceManager.addSingleton( IExtensionChannelService, - ExtensionChannelService + ExtensionChannelService, ); ioc.serviceManager.addSingleton( IExtensionChannelRule, ExtensionInsidersOffChannelRule, - ExtensionChannel.off + ExtensionChannel.off, ); ioc.serviceManager.addSingleton( IExtensionChannelRule, ExtensionInsidersDailyChannelRule, - ExtensionChannel.daily + ExtensionChannel.daily, ); ioc.serviceManager.addSingleton( IExtensionChannelRule, ExtensionInsidersWeeklyChannelRule, - ExtensionChannel.weekly + ExtensionChannel.weekly, ); ioc.serviceManager.addSingleton( IExtensionSingleActivationService, - DebugSessionTelemetry + DebugSessionTelemetry, ); ioc.serviceManager.addSingleton(ICustomEditorService, CustomEditorService); } @@ -335,7 +335,7 @@ suite('Module Installer', () => { 'linting.pylintEnabled', true, rootWorkspaceUri, - ConfigurationTarget.Workspace + ConfigurationTarget.Workspace, ); } async function getCurrentPythonPath(): Promise { @@ -352,7 +352,7 @@ suite('Module Installer', () => { test('Ensure pip is supported and conda is not', async () => { ioc.serviceManager.addSingletonInstance( IModuleInstaller, - new MockModuleInstaller('mock', true) + new MockModuleInstaller('mock', true), ); const mockInterpreterLocator = TypeMoq.Mock.ofType(); mockInterpreterLocator @@ -361,12 +361,12 @@ suite('Module Installer', () => { ioc.serviceManager.rebindInstance( IInterpreterLocatorService, mockInterpreterLocator.object, - INTERPRETER_LOCATOR_SERVICE + INTERPRETER_LOCATOR_SERVICE, ); ioc.serviceManager.rebindInstance( IInterpreterLocatorService, TypeMoq.Mock.ofType().object, - PIPENV_SERVICE + PIPENV_SERVICE, ); ioc.serviceManager.addSingletonInstance(ITerminalHelper, instance(mock(TerminalHelper))); @@ -400,7 +400,7 @@ suite('Module Installer', () => { test('Ensure pip is supported', async () => { ioc.serviceManager.addSingletonInstance( IModuleInstaller, - new MockModuleInstaller('mock', true) + new MockModuleInstaller('mock', true), ); const pythonPath = await getCurrentPythonPath(); const mockInterpreterLocator = TypeMoq.Mock.ofType(); @@ -416,19 +416,19 @@ suite('Module Installer', () => { envName: '', path: pythonPath, envType: EnvironmentType.Conda, - version: new SemVer('1.0.0') - } - ]) + version: new SemVer('1.0.0'), + }, + ]), ); ioc.serviceManager.rebindInstance( IInterpreterLocatorService, mockInterpreterLocator.object, - INTERPRETER_LOCATOR_SERVICE + INTERPRETER_LOCATOR_SERVICE, ); ioc.serviceManager.rebindInstance( IInterpreterLocatorService, TypeMoq.Mock.ofType().object, - PIPENV_SERVICE + PIPENV_SERVICE, ); ioc.serviceManager.addSingletonInstance(ITerminalHelper, instance(mock(TerminalHelper))); @@ -501,18 +501,18 @@ suite('Module Installer', () => { ioc.serviceManager.rebindInstance( IInterpreterLocatorService, mockInterpreterLocator.object, - INTERPRETER_LOCATOR_SERVICE + INTERPRETER_LOCATOR_SERVICE, ); ioc.serviceManager.rebindInstance( IInterpreterLocatorService, TypeMoq.Mock.ofType().object, - PIPENV_SERVICE + PIPENV_SERVICE, ); const interpreter: PythonEnvironment = { ...info, envType: EnvironmentType.Unknown, - path: PYTHON_PATH + path: PYTHON_PATH, }; interpreterService .setup((x) => x.getActiveInterpreter(TypeMoq.It.isAny())) @@ -542,7 +542,7 @@ suite('Module Installer', () => { mockTerminalFactory.verifyAll(); expect(argsSent.join(' ')).equal( `${isolated} pip install -U ${moduleName} --user`, - 'Invalid command sent to terminal for installation.' + 'Invalid command sent to terminal for installation.', ); }); @@ -555,12 +555,12 @@ suite('Module Installer', () => { ioc.serviceManager.rebindInstance( IInterpreterLocatorService, mockInterpreterLocator.object, - INTERPRETER_LOCATOR_SERVICE + INTERPRETER_LOCATOR_SERVICE, ); ioc.serviceManager.rebindInstance( IInterpreterLocatorService, TypeMoq.Mock.ofType().object, - PIPENV_SERVICE + PIPENV_SERVICE, ); const moduleName = 'xyz'; @@ -583,7 +583,7 @@ suite('Module Installer', () => { mockTerminalFactory.verifyAll(); expect(argsSent.join(' ')).equal( `${isolated} pip install -U ${moduleName}`, - 'Invalid command sent to terminal for installation.' + 'Invalid command sent to terminal for installation.', ); }); @@ -592,12 +592,12 @@ suite('Module Installer', () => { mockInterpreterLocator .setup((p) => p.getInterpreters(TypeMoq.It.isAny())) .returns(() => - Promise.resolve([{ ...info, path: 'interpreterPath', envType: EnvironmentType.VirtualEnv }]) + Promise.resolve([{ ...info, path: 'interpreterPath', envType: EnvironmentType.VirtualEnv }]), ); ioc.serviceManager.rebindInstance( IInterpreterLocatorService, mockInterpreterLocator.object, - PIPENV_SERVICE + PIPENV_SERVICE, ); const moduleName = 'xyz'; @@ -622,7 +622,7 @@ suite('Module Installer', () => { expect(command!).equal('pipenv', 'Invalid command sent to terminal for installation.'); expect(argsSent.join(' ')).equal( `install ${moduleName} --dev`, - 'Invalid command arguments sent to terminal for installation.' + 'Invalid command arguments sent to terminal for installation.', ); }); }); diff --git a/src/test/common/net/fileDownloader.unit.test.ts b/src/test/common/net/fileDownloader.unit.test.ts index 5d9a50733003..eceec2066e47 100644 --- a/src/test/common/net/fileDownloader.unit.test.ts +++ b/src/test/common/net/fileDownloader.unit.test.ts @@ -59,7 +59,7 @@ class DelayedReadMemoryStream extends Readable { constructor( private readonly totalKb: number, private readonly delayMs: number, - private readonly kbPerIteration: number + private readonly kbPerIteration: number, ) { super(); } @@ -133,7 +133,7 @@ suite('File Downloader', () => { const promise = fileDownloader.downloadFileWithStatusBarProgress(uri, 'hello', tmpFilePath.filePath); await expect(promise).to.eventually.be.rejectedWith( - 'Failed with status 500, null, Uri https://python.extension/package.json' + 'Failed with status 500, null, Uri https://python.extension/package.json', ); }); test('Error is throw if unable to write to the file stream', async () => { @@ -185,7 +185,7 @@ suite('File Downloader', () => { .reply(200, () => [ 200, new DelayedReadMemoryStream(1024 * totalKb, 5, 1024 * 10), - { 'content-length': 1024 * totalKb } + { 'content-length': 1024 * totalKb }, ]); const progressReportStub = sinon.stub(); const progressReporter: Progress = { report: progressReportStub }; @@ -216,7 +216,7 @@ suite('File Downloader', () => { 'Downloading-something', downloadedKb.toFixed(), totalKb.toFixed(), - percentage.toString() + percentage.toString(), ); } }); @@ -252,7 +252,7 @@ suite('File Downloader', () => { await fileDownloader.downloadFile('file to download', { progressMessagePrefix: '', extension: '.pdf', - outputChannel: outputChannel + outputChannel: outputChannel, }); verify(outputChannel.appendLine(Http.downloadingFile().format('file to download'))); diff --git a/src/test/common/net/httpClient.unit.test.ts b/src/test/common/net/httpClient.unit.test.ts index 33f30c4a1176..1731c91f570f 100644 --- a/src/test/common/net/httpClient.unit.test.ts +++ b/src/test/common/net/httpClient.unit.test.ts @@ -51,18 +51,18 @@ suite('Http Client', () => { { name: 'Throw error if request returns with download error', returnedArgs: ['downloadError', { statusCode: 201 }, undefined], - expectedErrorMessage: 'downloadError' + expectedErrorMessage: 'downloadError', }, { name: 'Throw error if request does not return with status code 200', returnedArgs: [undefined, { statusCode: 201, statusMessage: 'wrongStatus' }, undefined], - expectedErrorMessage: 'Failed with status 201, wrongStatus, Uri downloadUri' + expectedErrorMessage: 'Failed with status 201, wrongStatus, Uri downloadUri', }, { name: 'If strict is set to true, and parsing fails, throw error', returnedArgs: [undefined, { statusCode: 200 }, '[{ "strictJSON" : true,, }]'], - strict: true - } + strict: true, + }, ].forEach(async (testParams) => { test(testParams.name, async () => { const requestMock = (_uri: any, _requestOptions: any, callBackFn: Function) => @@ -81,7 +81,7 @@ suite('Http Client', () => { } expect(ex).to.equal( testParams.expectedErrorMessage, - 'Promise rejected with the wrong error message' + 'Promise rejected with the wrong error message', ); } } @@ -95,20 +95,20 @@ suite('Http Client', () => { "If strict is set to false, and jsonc parsing returns error codes, then log errors and don't throw, return json", returnedArgs: [undefined, { statusCode: 200 }, '[{ "strictJSON" : false,, }]'], strict: false, - expectedJSON: [{ strictJSON: false }] + expectedJSON: [{ strictJSON: false }], }, { name: 'Return expected json if strict is set to true and parsing is successful', returnedArgs: [undefined, { statusCode: 200 }, '[{ "strictJSON" : true }]'], strict: true, - expectedJSON: [{ strictJSON: true }] + expectedJSON: [{ strictJSON: true }], }, { name: 'Return expected json if strict is set to false and parsing is successful', returnedArgs: [undefined, { statusCode: 200 }, '[{ //Comment \n "strictJSON" : false }]'], strict: false, - expectedJSON: [{ strictJSON: false }] - } + expectedJSON: [{ strictJSON: false }], + }, ].forEach(async (testParams) => { test(testParams.name, async () => { const requestMock = (_uri: any, _requestOptions: any, callBackFn: Function) => diff --git a/src/test/common/nuget/azureBobStoreRepository.functional.test.ts b/src/test/common/nuget/azureBobStoreRepository.functional.test.ts index 2afb1b94b680..17906d7e4d97 100644 --- a/src/test/common/nuget/azureBobStoreRepository.functional.test.ts +++ b/src/test/common/nuget/azureBobStoreRepository.functional.test.ts @@ -46,7 +46,7 @@ suite('Nuget Azure Storage Repository', () => { serviceContainer.object, azureBlobStorageAccount, defaultStorageChannel, - azureCDNBlobStorageAccount + azureCDNBlobStorageAccount, ); }); @@ -60,7 +60,7 @@ suite('Nuget Azure Storage Repository', () => { const lsPackageService = new DotNetLanguageServerPackageService( serviceContainer.object, appEnv.object, - platformService + platformService, ); const packageName = lsPackageService.getNugetPackageName(); const packages = await repo.getPackages(packageName, undefined); diff --git a/src/test/common/nuget/azureBobStoreRepository.unit.test.ts b/src/test/common/nuget/azureBobStoreRepository.unit.test.ts index f29e12e42dcc..20710d853ce4 100644 --- a/src/test/common/nuget/azureBobStoreRepository.unit.test.ts +++ b/src/test/common/nuget/azureBobStoreRepository.unit.test.ts @@ -45,7 +45,7 @@ suite('Nuget Azure Storage Repository', () => { p: string, // tslint:disable-next-line:no-any t: any, - cb: ErrorOrResult + cb: ErrorOrResult, ) { this.calls.push([c, p, t]); const result: BlobService.ListBlobsResult = { entries: this.results! }; @@ -58,7 +58,7 @@ suite('Nuget Azure Storage Repository', () => { ['https://az', true, 'https://az'], ['https://az', false, 'http://az'], ['http://az', true, 'http://az'], - ['http://az', false, 'http://az'] + ['http://az', false, 'http://az'], ]; for (const [uri, setting, expected] of tests) { test(`Get all packages ("${uri}" / ${setting})`, async () => { @@ -74,7 +74,7 @@ suite('Nuget Azure Storage Repository', () => { blobstore.results = [ { name: 'Azarath' } as BlobService.BlobResult, { name: 'Metrion' } as BlobService.BlobResult, - { name: 'Zinthos' } as BlobService.BlobResult + { name: 'Zinthos' } as BlobService.BlobResult, ]; // tslint:enable:no-object-literal-type-assertion const version = new SemVer('1.1.1'); @@ -90,7 +90,7 @@ suite('Nuget Azure Storage Repository', () => { async (uriArg) => { actualURI = uriArg; return blobstore; - } + }, ); const packages = await repo.getPackages(packageName, undefined); @@ -98,7 +98,7 @@ suite('Nuget Azure Storage Repository', () => { expect(packages).to.deep.equal([ { package: 'Azarath', uri: 'eggs/spam/Azarath', version: version }, { package: 'Metrion', uri: 'eggs/spam/Metrion', version: version }, - { package: 'Zinthos', uri: 'eggs/spam/Zinthos', version: version } + { package: 'Zinthos', uri: 'eggs/spam/Zinthos', version: version }, ]); expect(actualURI).to.equal(expected); expect(blobstore.calls).to.deep.equal([['spam', packageName, undefined]], 'failed'); diff --git a/src/test/common/nuget/nugetService.unit.test.ts b/src/test/common/nuget/nugetService.unit.test.ts index 3437db24178d..049efcbd5fa1 100644 --- a/src/test/common/nuget/nugetService.unit.test.ts +++ b/src/test/common/nuget/nugetService.unit.test.ts @@ -21,13 +21,13 @@ suite('Nuget Service', () => { const service = new NugetService(); expect(service.getVersionFromPackageFileName('Something-xyz.0.0.1.nupkg').compare(parse('0.0.1')!)).to.equal( 0, - 'incorrect' + 'incorrect', ); expect( - service.getVersionFromPackageFileName('Something-xyz.0.0.1.1234.nupkg').compare(parse('0.0.1-1234')!) + service.getVersionFromPackageFileName('Something-xyz.0.0.1.1234.nupkg').compare(parse('0.0.1-1234')!), ).to.equal(0, 'incorrect'); expect( - service.getVersionFromPackageFileName('Something-xyz.0.0.1-preview.nupkg').compare(parse('0.0.1-preview')!) + service.getVersionFromPackageFileName('Something-xyz.0.0.1-preview.nupkg').compare(parse('0.0.1-preview')!), ).to.equal(0, 'incorrect'); }); }); diff --git a/src/test/common/platform/errors.unit.test.ts b/src/test/common/platform/errors.unit.test.ts index d565bc817218..d99675a6e157 100644 --- a/src/test/common/platform/errors.unit.test.ts +++ b/src/test/common/platform/errors.unit.test.ts @@ -10,7 +10,7 @@ import { isFileIsDirError, isFileNotFoundError, isNoPermissionsError, - isNotDirError + isNotDirError, } from '../../../client/common/platform/errors'; import { SystemError } from './utils'; @@ -23,7 +23,7 @@ suite('FileSystem - errors', () => { [vscode.FileSystemError.FileExists(filename), false], [new SystemError('ENOENT', 'stat', ''), true], [new SystemError('EEXIST', '???', ''), false], - [new Error(filename), undefined] + [new Error(filename), undefined], ]; tests.map(([err, expected]) => { test(`${err} -> ${expected}`, () => { @@ -40,7 +40,7 @@ suite('FileSystem - errors', () => { [vscode.FileSystemError.FileNotFound(filename), false], [new SystemError('EEXIST', '???', ''), true], [new SystemError('ENOENT', 'stat', ''), false], - [new Error(filename), undefined] + [new Error(filename), undefined], ]; tests.map(([err, expected]) => { test(`${err} -> ${expected}`, () => { @@ -57,7 +57,7 @@ suite('FileSystem - errors', () => { [vscode.FileSystemError.FileNotFound(filename), false], [new SystemError('EISDIR', '???', ''), true], [new SystemError('ENOENT', 'stat', ''), false], - [new Error(filename), undefined] + [new Error(filename), undefined], ]; tests.map(([err, expected]) => { test(`${err} -> ${expected}`, () => { @@ -74,7 +74,7 @@ suite('FileSystem - errors', () => { [vscode.FileSystemError.FileNotFound(filename), false], [new SystemError('ENOTDIR', '???', ''), true], [new SystemError('ENOENT', 'stat', ''), false], - [new Error(filename), undefined] + [new Error(filename), undefined], ]; tests.map(([err, expected]) => { test(`${err} -> ${expected}`, () => { @@ -91,7 +91,7 @@ suite('FileSystem - errors', () => { [vscode.FileSystemError.FileNotFound(filename), false], [new SystemError('EACCES', '???', ''), true], [new SystemError('ENOENT', 'stat', ''), false], - [new Error(filename), undefined] + [new Error(filename), undefined], ]; tests.map(([err, expected]) => { test(`${err} -> ${expected}`, () => { diff --git a/src/test/common/platform/filesystem.functional.test.ts b/src/test/common/platform/filesystem.functional.test.ts index 55e96b7aaa5d..2b29a0a12675 100644 --- a/src/test/common/platform/filesystem.functional.test.ts +++ b/src/test/common/platform/filesystem.functional.test.ts @@ -18,7 +18,7 @@ import { FSFixture, SUPPORTS_SOCKETS, SUPPORTS_SYMLINKS, - WINDOWS + WINDOWS, } from './utils'; // tslint:disable:no-require-imports no-var-requires @@ -410,7 +410,7 @@ suite('FileSystem - utils', () => { await fix.createFile('x/y/z/spam.py'), await fix.createFile('x/y/z/spam.pyc'), await fix.createFile('x/y/z/spam.so'), - await fix.createDirectory('x/y/z/spam.data') + await fix.createDirectory('x/y/z/spam.data'), ]; // non-matches await fix.createFile('x/spam.py'); @@ -689,7 +689,7 @@ suite('FileSystem', () => { await fix.createFile('x/y/z/spam.py'), await fix.createFile('x/y/z/spam.pyc'), await fix.createFile('x/y/z/spam.so'), - await fix.createDirectory('x/y/z/spam.data') + await fix.createDirectory('x/y/z/spam.data'), ]; // non-matches await fix.createFile('x/spam.py'); @@ -709,7 +709,7 @@ suite('FileSystem', () => { const dir = await fix.resolve(`x/y/z`); const expected: string[] = [ await fix.createFile('x/y/z/spam.py'), - await fix.createFile('x/y/z/.net.py') + await fix.createFile('x/y/z/.net.py'), ]; // non-matches await fix.createFile('x/spam.py'); diff --git a/src/test/common/platform/filesystem.test.ts b/src/test/common/platform/filesystem.test.ts index 1f11200e1e77..b089594f79de 100644 --- a/src/test/common/platform/filesystem.test.ts +++ b/src/test/common/platform/filesystem.test.ts @@ -17,7 +17,7 @@ import { FSFixture, SUPPORTS_SOCKETS, SUPPORTS_SYMLINKS, - WINDOWS + WINDOWS, } from './utils'; // Note: all functional tests that do not trigger the VS Code "fs" API @@ -490,21 +490,21 @@ suite('FileSystem - raw', () => { [script, FileType.File], [file3, FileType.File], [file2, FileType.File], - [subdir, FileType.Directory] + [subdir, FileType.Directory], ]; if (SUPPORTS_SYMLINKS) { // a symlink to a file (source not directly in listed dir) const symlink1 = await fix.createSymlink( 'x/y/z/info.py', // Link to an ignored file. - await fix.createFile('x/_info.py', '') // source + await fix.createFile('x/_info.py', ''), // source ); expected.push([symlink1, FileType.SymbolicLink | FileType.File]); // a symlink to a directory (source not directly in listed dir) const symlink4 = await fix.createSymlink( 'x/y/z/static_files', - await fix.resolve('x/y/z/w/data') // source + await fix.resolve('x/y/z/w/data'), // source ); expected.push([symlink4, FileType.SymbolicLink | FileType.Directory]); @@ -526,12 +526,12 @@ suite('FileSystem - raw', () => { // a symlink to a socket const symlink3 = await fix.createSymlink( 'x/y/z/ipc.sck', - sock // source + sock, // source ); expected.push( // TODO (https://github.com/microsoft/vscode/issues/90032): // VS Code gets symlinks to "unknown" files wrong: - [symlink3, FileType.SymbolicLink | FileType.File] + [symlink3, FileType.SymbolicLink | FileType.File], //[symlink3, FileType.SymbolicLink] ); } @@ -547,20 +547,20 @@ suite('FileSystem - raw', () => { // VS Code ignores broken symlinks currently... await fix.createSymlink( 'x/y/z/broken', - DOES_NOT_EXIST // source + DOES_NOT_EXIST, // source ); // a symlink outside the listed dir (to a file inside the dir) await fix.createSymlink( 'my-script.py', // Link to a listed file. - script // source (__main__.py) + script, // source (__main__.py) ); // a symlink in a subdir (to a file outside the dir) await fix.createSymlink( 'x/y/z/w/__init__.py', - await fix.createFile('x/__init__.py', '') // source + await fix.createFile('x/__init__.py', ''), // source ); } @@ -864,7 +864,7 @@ suite('FileSystem - utils', () => { expect(entries.sort()).to.deep.equal([ [file, FileType.File], - [subdir, FileType.Directory] + [subdir, FileType.Directory], ]); }); }); @@ -1037,7 +1037,7 @@ suite('FileSystem', () => { expect(entries.sort()).to.deep.equal([ [file, FileType.File], - [subdir, FileType.Directory] + [subdir, FileType.Directory], ]); }); }); @@ -1202,7 +1202,7 @@ suite('FileSystem', () => { const dirname = await fix.createDirectory('x/y/z/scripts'); const expected = [ await fix.createDirectory('x/y/z/scripts/w'), // subdir1 - await fix.createDirectory('x/y/z/scripts/v') // subdir2 + await fix.createDirectory('x/y/z/scripts/v'), // subdir2 ]; if (SUPPORTS_SYMLINKS) { // a symlink to a directory (source is outside listed dir) @@ -1243,7 +1243,7 @@ suite('FileSystem', () => { const expected = [ await fix.createFile('x/y/z/scripts/spam.py'), // file1 await fix.createFile('x/y/z/scripts/eggs.py'), // file2 - await fix.createFile('x/y/z/scripts/data.json') // file3 + await fix.createFile('x/y/z/scripts/data.json'), // file3 ]; if (SUPPORTS_SYMLINKS) { const symlinkFileSource = await fix.createFile('x/info.py'); diff --git a/src/test/common/platform/filesystem.unit.test.ts b/src/test/common/platform/filesystem.unit.test.ts index 00e0ca55c9e3..78df3515461d 100644 --- a/src/test/common/platform/filesystem.unit.test.ts +++ b/src/test/common/platform/filesystem.unit.test.ts @@ -16,7 +16,7 @@ import { IRawFileSystem, ITempFileSystem, ReadStream, - WriteStream + WriteStream, } from '../../../client/common/platform/types'; // tslint:disable:max-func-body-length chai-vague-errors @@ -79,7 +79,7 @@ suite('Raw FileSystem', () => { // Since it's a mock we can just use it for all 3 values. raw.object, raw.object, - raw.object + raw.object, ); }); function verifyAll() { @@ -166,7 +166,7 @@ suite('Raw FileSystem', () => { { kind: 'file', filetype: FileType.File }, { kind: 'dir', filetype: FileType.Directory }, { kind: 'symlink', filetype: FileType.SymbolicLink }, - { kind: 'unknown', filetype: FileType.Unknown } + { kind: 'unknown', filetype: FileType.Unknown }, ].forEach((testData) => { test(`wraps the low-level function (filetype: ${testData.kind}`, async () => { const filename = 'x/y/z/spam.py'; @@ -174,7 +174,7 @@ suite('Raw FileSystem', () => { type: testData.filetype, size: 10, ctime: 101, - mtime: 102 + mtime: 102, //tslint:disable-next-line:no-any } as any; const old = createMockLegacyStat(); @@ -317,7 +317,7 @@ suite('Raw FileSystem', () => { .returns(() => Promise.reject(err)); raw.setup((r) => r.stat(Uri(tgt))) // It's a symlink. .returns(() => - Promise.resolve(({ type: FileType.SymbolicLink | FileType.Directory } as unknown) as FileStat) + Promise.resolve(({ type: FileType.SymbolicLink | FileType.Directory } as unknown) as FileStat), ); raw.setup((r) => r.rename(Uri(src), Uri(tgt), { overwrite: true })) // expect the specific filename .returns(() => Promise.resolve()); @@ -499,7 +499,7 @@ suite('Raw FileSystem', () => { suite('rmFile', () => { const opts = { recursive: false, - useTrash: false + useTrash: false, }; test('wraps the low-level function', async () => { @@ -548,7 +548,7 @@ suite('Raw FileSystem', () => { suite('rmdir', () => { const opts = { recursive: true, - useTrash: false + useTrash: false, }; test('directory is empty', async () => { @@ -578,7 +578,7 @@ suite('Raw FileSystem', () => { ['dev1', FileType.Unknown], ['w', FileType.Directory], ['spam.py', FileType.File], - ['other', FileType.SymbolicLink | FileType.File] + ['other', FileType.SymbolicLink | FileType.File], ]; raw.setup((r) => r.readDirectory(TypeMoq.It.isAny())) // The dir is not empty. .returns(() => Promise.resolve(entries)); @@ -605,7 +605,7 @@ suite('Raw FileSystem', () => { suite('rmtree', () => { const opts = { recursive: true, - useTrash: false + useTrash: false, }; test('wraps the low-level function', async () => { @@ -640,7 +640,7 @@ suite('Raw FileSystem', () => { ['dev1', FileType.Unknown], ['w', FileType.Directory], ['spam.py', FileType.File], - ['other', FileType.SymbolicLink | FileType.File] + ['other', FileType.SymbolicLink | FileType.File], ]; const expected = actual.map(([basename, filetype]) => { const filename = `x/y/z/spam/${basename}`; @@ -687,7 +687,7 @@ suite('Raw FileSystem', () => { type: FileType.Unknown, size: 10, ctime: 101, - mtime: 102 + mtime: 102, //tslint:disable-next-line:no-any } as any; const lstat = createMockLegacyStat(); @@ -704,7 +704,7 @@ suite('Raw FileSystem', () => { [ { kind: 'file', filetype: FileType.File }, - { kind: 'dir', filetype: FileType.Directory } + { kind: 'dir', filetype: FileType.Directory }, ].forEach((testData) => { test(`wraps the low-level function (filetype: ${testData.kind})`, async () => { const filename = 'x/y/z/spam.py'; @@ -712,7 +712,7 @@ suite('Raw FileSystem', () => { type: testData.filetype, size: 10, ctime: 101, - mtime: 102 + mtime: 102, //tslint:disable-next-line:no-any } as any; const lstat = createMockLegacyStat(); @@ -734,7 +734,7 @@ suite('Raw FileSystem', () => { [ { kind: 'file', filetype: FileType.File }, { kind: 'dir', filetype: FileType.Directory }, - { kind: 'unknown', filetype: FileType.Unknown } + { kind: 'unknown', filetype: FileType.Unknown }, ].forEach((testData) => { test(`wraps the low-level function (filetype: ${testData.kind} symlink)`, async () => { const filename = 'x/y/z/spam.py'; @@ -742,7 +742,7 @@ suite('Raw FileSystem', () => { type: testData.filetype | FileType.SymbolicLink, size: 10, ctime: 101, - mtime: 102 + mtime: 102, //tslint:disable-next-line:no-any } as any; const lstat = createMockLegacyStat(); @@ -868,7 +868,7 @@ suite('FileSystemUtils', () => { deps.object, // paths deps.object, // tempFS (data: string) => deps.object.getHash(data), - (pat: string, options?: { cwd: string }) => deps.object.globFile(pat, options) + (pat: string, options?: { cwd: string }) => deps.object.globFile(pat, options), ); }); function verifyAll() { @@ -1217,7 +1217,7 @@ suite('FileSystemUtils', () => { ['x/y/z/spam/dev1', FileType.Unknown], ['x/y/z/spam/w', FileType.Directory], ['x/y/z/spam/spam.py', FileType.File], - ['x/y/z/spam/other', FileType.SymbolicLink | FileType.File] + ['x/y/z/spam/other', FileType.SymbolicLink | FileType.File], ]; deps.setup((d) => d.listdir(dirname)) // Full results get returned from RawFileSystem.listdir(). .returns(() => Promise.resolve(expected)); @@ -1297,13 +1297,13 @@ suite('FileSystemUtils', () => { ['x/y/z/spam/v', FileType.Directory], ['x/y/z/spam/eggs.py', FileType.File], ['x/y/z/spam/other1', FileType.SymbolicLink | FileType.File], - ['x/y/z/spam/other2', FileType.SymbolicLink | FileType.Directory] + ['x/y/z/spam/other2', FileType.SymbolicLink | FileType.Directory], ]; const expected = [ // only entries with FileType.Directory 'x/y/z/spam/w', 'x/y/z/spam/v', - 'x/y/z/spam/other2' + 'x/y/z/spam/other2', ]; deps.setup((d) => d.listdir(dirname)) // Full results get returned from RawFileSystem.listdir(). .returns(() => Promise.resolve(entries)); @@ -1325,13 +1325,13 @@ suite('FileSystemUtils', () => { ['x/y/z/spam/v', FileType.Directory], ['x/y/z/spam/eggs.py', FileType.File], ['x/y/z/spam/other1', FileType.SymbolicLink | FileType.File], - ['x/y/z/spam/other2', FileType.SymbolicLink | FileType.Directory] + ['x/y/z/spam/other2', FileType.SymbolicLink | FileType.Directory], ]; const expected = [ // only entries with FileType.File 'x/y/z/spam/spam.py', 'x/y/z/spam/eggs.py', - 'x/y/z/spam/other1' + 'x/y/z/spam/other1', ]; deps.setup((d) => d.listdir(filename)) // Full results get returned from RawFileSystem.listdir(). .returns(() => Promise.resolve(entries)); @@ -1438,7 +1438,7 @@ suite('FileSystemUtils', () => { 'x/y/z/spam.py', 'x/y/z/spam.pyc', 'x/y/z/spam.so', - 'x/y/z/spam.data' + 'x/y/z/spam.data', ]; deps.setup((d) => d.globFile(pattern, undefined)) // found some .returns(() => Promise.resolve(expected)); @@ -1458,7 +1458,7 @@ suite('FileSystemUtils', () => { 'x/y/z/spam.py', 'x/y/z/spam.pyc', 'x/y/z/spam.so', - 'x/y/z/spam.data' + 'x/y/z/spam.data', ]; deps.setup((d) => d.globFile(pattern, { cwd: cwd })) // found some .returns(() => Promise.resolve(expected)); diff --git a/src/test/common/platform/fs-paths.functional.test.ts b/src/test/common/platform/fs-paths.functional.test.ts index 3e3925a0ea0c..5a982a79a18b 100644 --- a/src/test/common/platform/fs-paths.functional.test.ts +++ b/src/test/common/platform/fs-paths.functional.test.ts @@ -110,7 +110,7 @@ suite('FileSystem - Paths', () => { // Be explicit here to ensure our assumptions are correct // about the relationship between "sep" and "join()". path.sep === '\\' ? 'y\\z' : 'y/z', - 'spam.py' + 'spam.py', ); expect(result).to.equal(expected); diff --git a/src/test/common/platform/fs-paths.unit.test.ts b/src/test/common/platform/fs-paths.unit.test.ts index bfd588efdd49..2f5570be8e97 100644 --- a/src/test/common/platform/fs-paths.unit.test.ts +++ b/src/test/common/platform/fs-paths.unit.test.ts @@ -35,7 +35,7 @@ suite('FileSystem - Path Utils', () => { // It's simpler to just use one mock for all 3 dependencies. deps.object, deps.object, - deps.object + deps.object, ); }); function verifyAll() { @@ -64,7 +64,7 @@ suite('FileSystem - Path Utils', () => { // no upper-case 'c:\\users\\peter smith\\my documents\\test.txt', // some upper-case - 'c:\\USERS\\Peter Smith\\my documents\\test.TXT' + 'c:\\USERS\\Peter Smith\\my documents\\test.TXT', ].forEach((path1) => { test(`True if paths are identical (type: ${item.name}) - ${path1}`, () => { path1 = setNormCase(path1, 2); diff --git a/src/test/common/platform/fs-temp.unit.test.ts b/src/test/common/platform/fs-temp.unit.test.ts index 62d5d8932498..3e7860ac4198 100644 --- a/src/test/common/platform/fs-temp.unit.test.ts +++ b/src/test/common/platform/fs-temp.unit.test.ts @@ -12,7 +12,7 @@ interface IDeps { file( config: { postfix?: string; mode?: number }, // tslint:disable-next-line:no-any - callback?: (err: any, path: string, fd: number, cleanupCallback: () => void) => void + callback?: (err: any, path: string, fd: number, cleanupCallback: () => void) => void, ): void; } diff --git a/src/test/common/platform/platformService.functional.test.ts b/src/test/common/platform/platformService.functional.test.ts index 9a5c0b893db8..25d64835b3c2 100644 --- a/src/test/common/platform/platformService.functional.test.ts +++ b/src/test/common/platform/platformService.functional.test.ts @@ -73,7 +73,7 @@ suite('PlatformService', () => { expect(result).to.be.equal( hostReports64Bit, - `arch() reports '${arch()}', PlatformService.is64bit reports ${result}.` + `arch() reports '${arch()}', PlatformService.is64bit reports ${result}.`, ); }); diff --git a/src/test/common/platform/utils.ts b/src/test/common/platform/utils.ts index 89d98e61274f..3e3badc72454 100644 --- a/src/test/common/platform/utils.ts +++ b/src/test/common/platform/utils.ts @@ -37,7 +37,7 @@ export const SUPPORTS_SOCKETS = (() => { } const tmp = tmpMod.dirSync({ prefix: 'pyvsc-test-', - unsafeCleanup: true // for non-empty dir + unsafeCleanup: true, // for non-empty dir }); const filename = path.join(tmp.name, 'test.sock'); try { @@ -178,7 +178,7 @@ export class FSFixture extends CleanupFixture { const tempDir = tmpMod.dirSync({ prefix: 'pyvsc-fs-tests-', - unsafeCleanup: true + unsafeCleanup: true, }); this.tempDir = tempDir.name; diff --git a/src/test/common/process/execFactory.test.ts b/src/test/common/process/execFactory.test.ts index d1d0400c55c3..c6f487d27558 100644 --- a/src/test/common/process/execFactory.test.ts +++ b/src/test/common/process/execFactory.test.ts @@ -52,7 +52,7 @@ suite('PythonExecutableService', () => { .returns(() => Promise.resolve(undefined)); envActivationService .setup((e) => - e.getActivatedEnvironmentVariables(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + e.getActivatedEnvironmentVariables(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns(() => Promise.resolve(undefined)); serviceContainer diff --git a/src/test/common/process/logger.unit.test.ts b/src/test/common/process/logger.unit.test.ts index d6c0706c57c7..0b6e6a76b44e 100644 --- a/src/test/common/process/logger.unit.test.ts +++ b/src/test/common/process/logger.unit.test.ts @@ -55,7 +55,7 @@ suite('ProcessLogger suite', () => { const expectedResult = `> test --foo --bar "import test"\n${Logging.currentWorkingDirectory()} ${path.join( 'debug', - 'path' + 'path', )}\n`; expect(outputResult).to.equal(expectedResult, 'Output string is incorrect: Home directory is not tildified'); }); @@ -67,7 +67,7 @@ suite('ProcessLogger suite', () => { const expectedResult = `> test --foo --bar \'import test\'\n${Logging.currentWorkingDirectory()} ${path.join( 'debug', - 'path' + 'path', )}\n`; expect(outputResult).to.equal(expectedResult, 'Output string is incorrect: Home directory is not tildified'); }); @@ -80,7 +80,7 @@ suite('ProcessLogger suite', () => { const expectedResult = `> test --foo --bar\n${Logging.currentWorkingDirectory()} ${path.join( '~', 'debug', - 'path' + 'path', )}\n`; expect(outputResult).to.equal(expectedResult, 'Output string is incorrect: Home directory is not tildified'); }); @@ -103,7 +103,7 @@ suite('ProcessLogger suite', () => { const expectedResult = `> ${path.join('~', 'test')} --foo --bar\n`; expect(outputResult).to.equal( expectedResult, - 'Output string is incorrect: Working directory line should not be displayed' + 'Output string is incorrect: Working directory line should not be displayed', ); }); @@ -115,7 +115,7 @@ suite('ProcessLogger suite', () => { const expectedResult = `> ${path.join('~', 'test')} --foo --bar\n`; expect(outputResult).to.equal( expectedResult, - 'Output string is incorrect: Working directory line should not be displayed' + 'Output string is incorrect: Working directory line should not be displayed', ); }); }); diff --git a/src/test/common/process/proc.exec.test.ts b/src/test/common/process/proc.exec.test.ts index 816a6db55ac4..6fb654890635 100644 --- a/src/test/common/process/proc.exec.test.ts +++ b/src/test/common/process/proc.exec.test.ts @@ -65,7 +65,7 @@ suite('ProcessService Observable', () => { 'print("2")', 'sys.stdout.flush()', 'time.sleep(1)', - 'print("3")' + 'print("3")', ]; const result = await procService.exec(pythonPath, ['-c', pythonCode.join(';')]); const outputs = ['1', '2', '3']; @@ -92,7 +92,7 @@ suite('ProcessService Observable', () => { 'sys.stdout.write("2")', 'sys.stdout.flush()', 'time.sleep(1)', - 'sys.stdout.write("3")' + 'sys.stdout.write("3")', ]; const result = await procService.exec(pythonPath, ['-c', pythonCode.join(';')]); const outputs = ['123']; @@ -117,13 +117,13 @@ suite('ProcessService Observable', () => { 'sys.stdout.flush()', 'time.sleep(10)', 'print("2")', - 'sys.stdout.flush()' + 'sys.stdout.flush()', ]; const cancellationToken = new CancellationTokenSource(); setTimeout(() => cancellationToken.cancel(), 3000); const result = await procService.exec(pythonPath, ['-c', pythonCode.join(';')], { - token: cancellationToken.token + token: cancellationToken.token, }); expect(result).not.to.be.an('undefined', 'result is undefined'); @@ -158,7 +158,7 @@ suite('ProcessService Observable', () => { 'sys.stdout.flush()', 'time.sleep(1)', 'sys.stderr.write("c")', - 'sys.stderr.flush()' + 'sys.stderr.flush()', ]; const result = await procService.exec(pythonPath, ['-c', pythonCode.join(';')]); const expectedStdout = ['1', '2', '3']; @@ -200,7 +200,7 @@ suite('ProcessService Observable', () => { 'sys.stdout.flush()', 'time.sleep(1)', 'sys.stderr.write("c")', - 'sys.stderr.flush()' + 'sys.stderr.flush()', ]; const result = await procService.exec(pythonPath, ['-c', pythonCode.join(';')], { mergeStdOutErr: true }); const expectedOutput = ['1a2b3c']; @@ -252,7 +252,7 @@ suite('ProcessService Observable', () => { test('variables can be changed after the fact', async () => { const procService = new ProcessService(new BufferDecoder(), process.env); let result = await procService.exec(pythonPath, ['-c', `import os;print(os.environ.get("MY_TEST_VARIABLE"))`], { - extraVariables: { MY_TEST_VARIABLE: 'foo' } + extraVariables: { MY_TEST_VARIABLE: 'foo' }, }); expect(result).not.to.be.an('undefined', 'result is undefined'); diff --git a/src/test/common/process/proc.observable.test.ts b/src/test/common/process/proc.observable.test.ts index 8ebfdec3148b..35acae8846b3 100644 --- a/src/test/common/process/proc.observable.test.ts +++ b/src/test/common/process/proc.observable.test.ts @@ -37,7 +37,7 @@ suite('ProcessService', () => { 'time.sleep(2)', 'print("3")', 'sys.stdout.flush()', - 'time.sleep(2)' + 'time.sleep(2)', ]; const result = procService.execObservable(pythonPath, ['-c', pythonCode.join(';')]); const outputs = ['1', '2', '3']; @@ -58,7 +58,7 @@ suite('ProcessService', () => { } }, done, - done + done, ); }); @@ -82,7 +82,7 @@ suite('ProcessService', () => { 'time.sleep(2)', 'sys.stdout.write("3")', 'sys.stdout.flush()', - 'time.sleep(2)' + 'time.sleep(2)', ]; const result = procService.execObservable(pythonPath, ['-c', pythonCode.join(';')]); const outputs = ['1', '2', '3']; @@ -103,7 +103,7 @@ suite('ProcessService', () => { } }, done, - done + done, ); }); @@ -119,11 +119,11 @@ suite('ProcessService', () => { 'time.sleep(10)', 'print("2")', 'sys.stdout.flush()', - 'time.sleep(2)' + 'time.sleep(2)', ]; const cancellationToken = new CancellationTokenSource(); const result = procService.execObservable(pythonPath, ['-c', pythonCode.join(';')], { - token: cancellationToken.token + token: cancellationToken.token, }); const def = createDeferred(); @@ -150,7 +150,7 @@ suite('ProcessService', () => { } else { def.reject('Program terminated even before cancelling it.'); } - } + }, ); }); @@ -166,11 +166,11 @@ suite('ProcessService', () => { 'time.sleep(10)', 'print("2")', 'sys.stdout.flush()', - 'time.sleep(2)' + 'time.sleep(2)', ]; const cancellationToken = new CancellationTokenSource(); const result = procService.execObservable(pythonPath, ['-c', pythonCode.join(';')], { - token: cancellationToken.token + token: cancellationToken.token, }); let procKilled = false; @@ -195,7 +195,7 @@ suite('ProcessService', () => { () => { const errorMsg = procKilled ? undefined : 'Program terminated even before killing it.'; done(errorMsg); - } + }, ); }); @@ -223,7 +223,7 @@ suite('ProcessService', () => { 'time.sleep(2)', 'sys.stderr.write("c")', 'sys.stderr.flush()', - 'time.sleep(2)' + 'time.sleep(2)', ]; const result = procService.execObservable(pythonPath, ['-c', pythonCode.join(';')]); const outputs = [ @@ -232,7 +232,7 @@ suite('ProcessService', () => { { out: '2', source: 'stdout' }, { out: 'b', source: 'stderr' }, { out: '3', source: 'stdout' }, - { out: 'c', source: 'stderr' } + { out: 'c', source: 'stderr' }, ]; expect(result).not.to.be.an('undefined', 'result is undefined'); @@ -249,7 +249,7 @@ suite('ProcessService', () => { expect(output.source).to.be.equal(expectedOutput.source, 'Expected sopurce is incorrect'); }, done, - done + done, ); }); @@ -277,7 +277,7 @@ suite('ProcessService', () => { }, () => { done("Completed, when we're expecting an error to be thrown."); - } + }, ); }); @@ -296,7 +296,7 @@ suite('ProcessService', () => { }, () => { done("Completed, when we're expecting an error to be thrown."); - } + }, ); }); @@ -310,7 +310,7 @@ suite('ProcessService', () => { done(`Output received, when we\'re not expecting any, ${JSON.stringify(output)}`); }, done, - done + done, ); }); }); diff --git a/src/test/common/process/processFactory.unit.test.ts b/src/test/common/process/processFactory.unit.test.ts index 5c124ebab808..c9d9c1f9803b 100644 --- a/src/test/common/process/processFactory.unit.test.ts +++ b/src/test/common/process/processFactory.unit.test.ts @@ -31,14 +31,14 @@ suite('Process - ProcessServiceFactory', () => { when( processService.on('exec', () => { return; - }) + }), ).thenReturn(processService); disposableRegistry = []; factory = new ProcessServiceFactory( instance(envVariablesProvider), instance(processLogger), instance(bufferDecoder), - disposableRegistry + disposableRegistry, ); }); diff --git a/src/test/common/process/pythonEnvironment.unit.test.ts b/src/test/common/process/pythonEnvironment.unit.test.ts index a4035e1c1af8..dbf580222b3a 100644 --- a/src/test/common/process/pythonEnvironment.unit.test.ts +++ b/src/test/common/process/pythonEnvironment.unit.test.ts @@ -12,7 +12,7 @@ import { IFileSystem } from '../../../client/common/platform/types'; import { createCondaEnv, createPythonEnv, - createWindowsStoreEnv + createWindowsStoreEnv, } from '../../../client/common/process/pythonEnvironment'; import { IProcessService, StdErrError } from '../../../client/common/process/types'; import { Architecture } from '../../../client/common/utils/platform'; @@ -37,7 +37,7 @@ suite('PythonEnvironment', () => { versionInfo: [3, 7, 5, 'candidate'], sysPrefix: '/path/of/sysprefix/versions/3.7.5rc1', version: '3.7.5rc1 (default, Oct 18 2019, 14:48:48) \n[Clang 11.0.0 (clang-1100.0.33.8)]', - is64Bit: true + is64Bit: true, }; processService @@ -51,7 +51,7 @@ suite('PythonEnvironment', () => { path: pythonPath, version: new SemVer('3.7.5-candidate'), sysPrefix: json.sysPrefix, - sysVersion: undefined + sysVersion: undefined, }; expect(result).to.deep.equal(expectedResult, 'Incorrect value returned by getInterpreterInformation().'); @@ -62,7 +62,7 @@ suite('PythonEnvironment', () => { versionInfo: [3, 7, 5], sysPrefix: '/path/of/sysprefix/versions/3.7.5rc1', version: '3.7.5rc1 (default, Oct 18 2019, 14:48:48) \n[Clang 11.0.0 (clang-1100.0.33.8)]', - is64Bit: true + is64Bit: true, }; processService @@ -76,12 +76,12 @@ suite('PythonEnvironment', () => { path: pythonPath, version: new SemVer('3.7.5'), sysPrefix: json.sysPrefix, - sysVersion: undefined + sysVersion: undefined, }; expect(result).to.deep.equal( expectedResult, - 'Incorrect value returned by getInterpreterInformation() with truncated versionInfo.' + 'Incorrect value returned by getInterpreterInformation() with truncated versionInfo.', ); }); @@ -90,7 +90,7 @@ suite('PythonEnvironment', () => { versionInfo: [3, 7, 5, 'candidate'], sysPrefix: '/path/of/sysprefix/versions/3.7.5rc1', version: '3.7.5rc1 (default, Oct 18 2019, 14:48:48) \n[Clang 11.0.0 (clang-1100.0.33.8)]', - is64Bit: false + is64Bit: false, }; processService @@ -104,12 +104,12 @@ suite('PythonEnvironment', () => { path: pythonPath, version: new SemVer('3.7.5-candidate'), sysPrefix: json.sysPrefix, - sysVersion: undefined + sysVersion: undefined, }; expect(result).to.deep.equal( expectedResult, - 'Incorrect value returned by getInterpreterInformation() for x86b architecture.' + 'Incorrect value returned by getInterpreterInformation() for x86b architecture.', ); }); @@ -124,7 +124,7 @@ suite('PythonEnvironment', () => { expect(result).to.equal( undefined, - 'getInterpreterInfo() should return undefined because interpreterInfo timed out.' + 'getInterpreterInfo() should return undefined because interpreterInfo timed out.', ); }); @@ -224,7 +224,7 @@ suite('PythonEnvironment', () => { expect(result).to.deep.equal( { command: pythonPath, args, python: [pythonPath], pythonExecutable: pythonPath }, - 'getExecutionInfo should return pythonPath and the command and execution arguments as is' + 'getExecutionInfo should return pythonPath and the command and execution arguments as is', ); }); }); @@ -251,7 +251,7 @@ suite('CondaEnvironment', () => { command: condaFile, args: ['run', '-n', condaInfo.name, 'python', ...args], python: [condaFile, 'run', '-n', condaInfo.name, 'python'], - pythonExecutable: 'python' + pythonExecutable: 'python', }); }); @@ -265,7 +265,7 @@ suite('CondaEnvironment', () => { command: condaFile, args: ['run', '-p', condaInfo.path, 'python', ...args], python: [condaFile, 'run', '-p', condaInfo.path, 'python'], - pythonExecutable: 'python' + pythonExecutable: 'python', }); }); diff --git a/src/test/common/process/pythonExecutionFactory.unit.test.ts b/src/test/common/process/pythonExecutionFactory.unit.test.ts index 50bf4d211e40..2fb356a55ba9 100644 --- a/src/test/common/process/pythonExecutionFactory.unit.test.ts +++ b/src/test/common/process/pythonExecutionFactory.unit.test.ts @@ -21,7 +21,7 @@ import { IProcessLogger, IProcessService, IProcessServiceFactory, - IPythonExecutionService + IPythonExecutionService, } from '../../../client/common/process/types'; import { IConfigurationService, IDisposableRegistry } from '../../../client/common/types'; import { Architecture } from '../../../client/common/utils/platform'; @@ -43,7 +43,7 @@ const pythonInterpreter: PythonEnvironment = { sysVersion: '1.0.0.0', sysPrefix: 'Python', envType: EnvironmentType.Unknown, - architecture: Architecture.x64 + architecture: Architecture.x64, }; function title(resource?: Uri, interpreter?: PythonEnvironment) { @@ -54,7 +54,7 @@ async function verifyCreateActivated( factory: PythonExecutionFactory, activationHelper: IEnvironmentActivationService, resource?: Uri, - interpreter?: PythonEnvironment + interpreter?: PythonEnvironment, ): Promise { when(activationHelper.getActivatedEnvironmentVariables(resource, anything(), anything())).thenResolve(); @@ -70,7 +70,7 @@ suite('Process - PythonExecutionFactory', () => { { resource: undefined, interpreter: undefined }, { resource: undefined, interpreter: pythonInterpreter }, { resource: Uri.parse('x'), interpreter: undefined }, - { resource: Uri.parse('x'), interpreter: pythonInterpreter } + { resource: Uri.parse('x'), interpreter: pythonInterpreter }, ].forEach((item) => { const resource = item.resource; const interpreter = item.interpreter; @@ -102,22 +102,22 @@ suite('Process - PythonExecutionFactory', () => { .setup((p) => p.on('exec', () => { return; - }) + }), ) .returns(() => processService.object); processService.setup((p: any) => p.then).returns(() => undefined); interpreterService = mock(InterpreterService); when(interpreterService.getInterpreterDetails(anything())).thenResolve({ - version: { major: 3 } + version: { major: 3 }, } as any); const serviceContainer = mock(ServiceContainer); when(serviceContainer.get(IDisposableRegistry)).thenReturn([]); when(serviceContainer.get(IProcessLogger)).thenReturn(processLogger); when(serviceContainer.get(IInterpreterService)).thenReturn( - instance(interpreterService) + instance(interpreterService), ); when(serviceContainer.tryGet(IInterpreterService)).thenReturn( - instance(interpreterService) + instance(interpreterService), ); factory = new PythonExecutionFactory( instance(serviceContainer), @@ -126,7 +126,7 @@ suite('Process - PythonExecutionFactory', () => { instance(configService), instance(condaService), instance(bufferDecoder), - instance(windowsStoreInterpreter) + instance(windowsStoreInterpreter), ); }); teardown(() => sinon.restore()); @@ -191,7 +191,7 @@ suite('Process - PythonExecutionFactory', () => { const pythonSettings = mock(PythonSettings); when(activationHelper.getActivatedEnvironmentVariables(resource, anything(), anything())).thenResolve({ - x: '1' + x: '1', }); when(pythonSettings.pythonPath).thenReturn('HELLO'); when(configService.getSettings(resource)).thenReturn(instance(pythonSettings)); @@ -236,7 +236,7 @@ suite('Process - PythonExecutionFactory', () => { when(condaService.getCondaVersion()).thenResolve(new SemVer(CONDA_RUN_VERSION)); when(condaService.getCondaEnvironment(pythonPath)).thenResolve({ name: 'foo', - path: 'path/to/foo/env' + path: 'path/to/foo/env', }); when(condaService.getCondaFile()).thenResolve('conda'); @@ -282,13 +282,13 @@ suite('Process - PythonExecutionFactory', () => { when(processFactory.create(resource)).thenResolve(processService.object); when(pythonSettings.pythonPath).thenReturn(pythonPath); when(activationHelper.getActivatedEnvironmentVariables(resource, anything(), anything())).thenResolve({ - x: '1' + x: '1', }); when(configService.getSettings(resource)).thenReturn(instance(pythonSettings)); when(condaService.getCondaVersion()).thenResolve(new SemVer(CONDA_RUN_VERSION)); when(condaService.getCondaEnvironment(anyString())).thenResolve({ name: 'foo', - path: 'path/to/foo/env' + path: 'path/to/foo/env', }); when(condaService.getCondaFile()).thenResolve('conda'); @@ -319,7 +319,7 @@ suite('Process - PythonExecutionFactory', () => { const pythonSettings = mock(PythonSettings); when(activationHelper.getActivatedEnvironmentVariables(resource, anything(), anything())).thenResolve({ - x: '1' + x: '1', }); when(pythonSettings.pythonPath).thenReturn(pythonPath); when(configService.getSettings(resource)).thenReturn(instance(pythonSettings)); @@ -342,7 +342,7 @@ suite('Process - PythonExecutionFactory', () => { const pythonPath = 'path/to/python'; when(condaService.getCondaEnvironment(pythonPath)).thenResolve({ name: 'foo', - path: 'path/to/foo/env' + path: 'path/to/foo/env', }); when(condaService.getCondaVersion()).thenResolve(new SemVer(CONDA_RUN_VERSION)); when(condaService.getCondaFile()).thenResolve('conda'); @@ -360,7 +360,7 @@ suite('Process - PythonExecutionFactory', () => { when(processFactory.create(resource)).thenResolve(processService.object); when(condaService.getCondaEnvironment(pythonPath)).thenResolve({ name: 'foo', - path: 'path/to/foo/env' + path: 'path/to/foo/env', }); when(condaService.getCondaVersion()).thenResolve(new SemVer(CONDA_RUN_VERSION)); when(condaService.getCondaFile()).thenResolve('conda'); @@ -383,7 +383,7 @@ suite('Process - PythonExecutionFactory', () => { expect(result).to.be.equal( undefined, - 'createCondaExecutionService should return undefined if not in a conda environment' + 'createCondaExecutionService should return undefined if not in a conda environment', ); verify(condaService.getCondaVersion()).once(); verify(condaService.getCondaEnvironment(pythonPath)).once(); @@ -398,7 +398,7 @@ suite('Process - PythonExecutionFactory', () => { expect(result).to.be.equal( undefined, - 'createCondaExecutionService should return undefined if not in a conda environment' + 'createCondaExecutionService should return undefined if not in a conda environment', ); verify(condaService.getCondaVersion()).once(); verify(condaService.getCondaEnvironment(pythonPath)).once(); diff --git a/src/test/common/process/pythonProc.simple.multiroot.test.ts b/src/test/common/process/pythonProc.simple.multiroot.test.ts index 7df62d4a805a..68e1127e10d6 100644 --- a/src/test/common/process/pythonProc.simple.multiroot.test.ts +++ b/src/test/common/process/pythonProc.simple.multiroot.test.ts @@ -60,13 +60,13 @@ suite('PythonExecutableService', () => { 'envFile', 'someInvalidFile.env', workspace4PyFile, - ConfigurationTarget.WorkspaceFolder + ConfigurationTarget.WorkspaceFolder, ); pythonExecFactory = serviceContainer.get(IPythonExecutionFactory); const pythonExecService = await pythonExecFactory.create({ resource: workspace4PyFile }); const promise = pythonExecService.exec([workspace4PyFile.fsPath], { cwd: path.dirname(workspace4PyFile.fsPath), - throwOnStdErr: true + throwOnStdErr: true, }); await expect(promise).to.eventually.be.rejectedWith(StdErrError); @@ -84,7 +84,7 @@ suite('PythonExecutableService', () => { const pythonExecService = await pythonExecFactory.create({ resource: workspace4PyFile }); const promise = pythonExecService.exec([workspace4PyFile.fsPath], { cwd: path.dirname(workspace4PyFile.fsPath), - throwOnStdErr: true + throwOnStdErr: true, }); await expect(promise).to.eventually.have.property('stdout', `Hello${EOL}`); @@ -104,7 +104,7 @@ suite('PythonExecutableService', () => { const randomModuleIsInstalled = pythonExecService.isModuleInstalled(randomModuleName); await expect(randomModuleIsInstalled).to.eventually.equal( false, - `Random module '${randomModuleName}' is installed` + `Random module '${randomModuleName}' is installed`, ); }); diff --git a/src/test/common/process/pythonProcess.unit.test.ts b/src/test/common/process/pythonProcess.unit.test.ts index 646ad8473c05..847e90580f0b 100644 --- a/src/test/common/process/pythonProcess.unit.test.ts +++ b/src/test/common/process/pythonProcess.unit.test.ts @@ -36,7 +36,7 @@ suite('PythonProcessService', () => { out: {} as any, dispose: () => { noop(); - } + }, }; processService.setup((p) => p.execObservable(pythonPath, args, options)).returns(() => observable); const env = createPythonEnv(pythonPath, processService.object, fileSystem.object); @@ -59,7 +59,7 @@ suite('PythonProcessService', () => { out: {} as any, dispose: () => { noop(); - } + }, }; processService.setup((p) => p.execObservable(pythonPath, expectedArgs, options)).returns(() => observable); const env = createPythonEnv(pythonPath, processService.object, fileSystem.object); diff --git a/src/test/common/process/pythonToolService.unit.test.ts b/src/test/common/process/pythonToolService.unit.test.ts index ff83e1ead8f7..1894dbb87a28 100644 --- a/src/test/common/process/pythonToolService.unit.test.ts +++ b/src/test/common/process/pythonToolService.unit.test.ts @@ -18,7 +18,7 @@ import { IProcessServiceFactory, IPythonExecutionFactory, IPythonExecutionService, - ObservableExecutionResult + ObservableExecutionResult, } from '../../../client/common/process/types'; import { ExecutionInfo } from '../../../client/common/types'; import { ServiceContainer } from '../../../client/ioc/container'; @@ -35,10 +35,10 @@ suite('Process - Python tool execution service', () => { out: {} as any, dispose: () => { noop(); - } + }, }; const executionResult: ExecutionResult = { - stdout: 'output' + stdout: 'output', }; let pythonService: IPythonExecutionService; @@ -68,7 +68,7 @@ suite('Process - Python tool execution service', () => { const serviceContainer = mock(ServiceContainer); when(serviceContainer.get(IPythonExecutionFactory)).thenReturn( - instance(executionFactory) + instance(executionFactory), ); when(serviceContainer.get(IProcessServiceFactory)).thenReturn(instance(processFactory)); @@ -80,7 +80,7 @@ suite('Process - Python tool execution service', () => { const executionInfo: ExecutionInfo = { execPath: 'foo', moduleName: 'moduleOne', - args: ['-a', 'b', '-c'] + args: ['-a', 'b', '-c'], }; const promise = executionService.execObservable(executionInfo, options, resource); @@ -93,7 +93,7 @@ suite('Process - Python tool execution service', () => { const executionInfo: ExecutionInfo = { execPath: 'foo', moduleName: 'moduleOne', - args: ['-a', 'b', '-c'] + args: ['-a', 'b', '-c'], }; const result = await executionService.execObservable(executionInfo, options, resource); @@ -107,7 +107,7 @@ suite('Process - Python tool execution service', () => { const executionInfo: ExecutionInfo = { execPath: 'foo', moduleName: '', - args: ['-a', 'b', '-c'] + args: ['-a', 'b', '-c'], }; const result = await executionService.execObservable(executionInfo, options, resource); @@ -120,7 +120,7 @@ suite('Process - Python tool execution service', () => { const options = {}; const executionInfo: ExecutionInfo = { execPath: 'foo', - args: ['-a', 'b', '-c'] + args: ['-a', 'b', '-c'], }; const result = await executionService.execObservable(executionInfo, options, resource); @@ -134,7 +134,7 @@ suite('Process - Python tool execution service', () => { const executionInfo: ExecutionInfo = { execPath: 'foo', moduleName: 'moduleOne', - args: ['-a', 'b', '-c'] + args: ['-a', 'b', '-c'], }; const promise = executionService.exec(executionInfo, options, resource); @@ -147,7 +147,7 @@ suite('Process - Python tool execution service', () => { const executionInfo: ExecutionInfo = { execPath: 'foo', moduleName: 'moduleOne', - args: ['-a', 'b', '-c'] + args: ['-a', 'b', '-c'], }; const result = await executionService.exec(executionInfo, options, resource); @@ -161,7 +161,7 @@ suite('Process - Python tool execution service', () => { const executionInfo: ExecutionInfo = { execPath: 'foo', moduleName: '', - args: ['-a', 'b', '-c'] + args: ['-a', 'b', '-c'], }; const result = await executionService.exec(executionInfo, options, resource); @@ -174,7 +174,7 @@ suite('Process - Python tool execution service', () => { const options = {}; const executionInfo: ExecutionInfo = { execPath: 'foo', - args: ['-a', 'b', '-c'] + args: ['-a', 'b', '-c'], }; const result = await executionService.exec(executionInfo, options, resource); diff --git a/src/test/common/process/serviceRegistry.unit.test.ts b/src/test/common/process/serviceRegistry.unit.test.ts index 6f8b3d63d902..1ee0a3ddb59f 100644 --- a/src/test/common/process/serviceRegistry.unit.test.ts +++ b/src/test/common/process/serviceRegistry.unit.test.ts @@ -13,7 +13,7 @@ import { IBufferDecoder, IProcessServiceFactory, IPythonExecutionFactory, - IPythonToolExecutionService + IPythonToolExecutionService, } from '../../../client/common/process/types'; import { ServiceManager } from '../../../client/ioc/serviceManager'; import { IServiceManager } from '../../../client/ioc/types'; @@ -29,16 +29,16 @@ suite('Common Process Service Registry', () => { registerTypes(instance(serviceManager)); verify(serviceManager.addSingleton(IBufferDecoder, BufferDecoder)).once(); verify( - serviceManager.addSingleton(IProcessServiceFactory, ProcessServiceFactory) + serviceManager.addSingleton(IProcessServiceFactory, ProcessServiceFactory), ).once(); verify( - serviceManager.addSingleton(IPythonExecutionFactory, PythonExecutionFactory) + serviceManager.addSingleton(IPythonExecutionFactory, PythonExecutionFactory), ).once(); verify( serviceManager.addSingleton( IPythonToolExecutionService, - PythonToolExecutionService - ) + PythonToolExecutionService, + ), ).once(); }); }); diff --git a/src/test/common/serviceRegistry.unit.test.ts b/src/test/common/serviceRegistry.unit.test.ts index 4f17da9efc5a..1f2dece8f27c 100644 --- a/src/test/common/serviceRegistry.unit.test.ts +++ b/src/test/common/serviceRegistry.unit.test.ts @@ -26,7 +26,7 @@ import { IDocumentManager, ILanguageService, ITerminalManager, - IWorkspaceService + IWorkspaceService, } from '../../client/common/application/types'; import { WorkspaceService } from '../../client/common/application/workspace'; import { AsyncDisposableRegistry } from '../../client/common/asyncDisposableRegistry'; @@ -38,7 +38,7 @@ import { FeatureDeprecationManager } from '../../client/common/featureDeprecatio import { ExtensionInsidersDailyChannelRule, ExtensionInsidersOffChannelRule, - ExtensionInsidersWeeklyChannelRule + ExtensionInsidersWeeklyChannelRule, } from '../../client/common/insidersBuild/downloadChannelRules'; import { ExtensionChannelService } from '../../client/common/insidersBuild/downloadChannelService'; import { InsidersExtensionPrompt } from '../../client/common/insidersBuild/insidersExtensionPrompt'; @@ -47,7 +47,7 @@ import { ExtensionChannel, IExtensionChannelRule, IExtensionChannelService, - IInsiderExtensionPrompt + IInsiderExtensionPrompt, } from '../../client/common/insidersBuild/types'; import { ProductInstaller } from '../../client/common/installer/productInstaller'; import { InterpreterPathService } from '../../client/common/interpreterPathService'; @@ -79,7 +79,7 @@ import { ITerminalActivator, ITerminalHelper, ITerminalServiceFactory, - TerminalActivationProviders + TerminalActivationProviders, } from '../../client/common/terminal/types'; import { IAsyncDisposableRegistry, @@ -96,7 +96,7 @@ import { IInterpreterPathService, IPathUtils, IPersistentStateFactory, - IRandom + IRandom, } from '../../client/common/types'; import { IMultiStepInputFactory, MultiStepInputFactory } from '../../client/common/utils/multiStepInput'; import { Random } from '../../client/common/utils/random'; @@ -141,7 +141,7 @@ suite('Common - Service Registry', () => { [ ITerminalActivationCommandProvider, CommandPromptAndPowerShell, - TerminalActivationProviders.commandPromptAndPowerShell + TerminalActivationProviders.commandPromptAndPowerShell, ], [ITerminalActivationCommandProvider, CondaActivationCommandProvider, TerminalActivationProviders.conda], [ITerminalActivationCommandProvider, PipEnvActivationCommandProvider, TerminalActivationProviders.pipenv], @@ -158,15 +158,15 @@ suite('Common - Service Registry', () => { [IExtensionChannelService, ExtensionChannelService], [IExtensionChannelRule, ExtensionInsidersOffChannelRule, ExtensionChannel.off], [IExtensionChannelRule, ExtensionInsidersDailyChannelRule, ExtensionChannel.daily], - [IExtensionChannelRule, ExtensionInsidersWeeklyChannelRule, ExtensionChannel.weekly] + [IExtensionChannelRule, ExtensionInsidersWeeklyChannelRule, ExtensionChannel.weekly], ].forEach((mapping) => { if (mapping.length === 2) { serviceManager .setup((s) => s.addSingleton( typemoq.It.isValue(mapping[0] as any), - typemoq.It.is((value) => mapping[1] === value) - ) + typemoq.It.is((value) => mapping[1] === value), + ), ) .verifiable(typemoq.Times.atLeastOnce()); } else { @@ -175,8 +175,8 @@ suite('Common - Service Registry', () => { s.addSingleton( typemoq.It.isValue(mapping[0] as any), typemoq.It.isAny(), - typemoq.It.isValue(mapping[2] as any) - ) + typemoq.It.isValue(mapping[2] as any), + ), ) .callback((_, cls) => expect(cls).to.equal(mapping[1])) .verifiable(typemoq.Times.once()); diff --git a/src/test/common/socketCallbackHandler.test.ts b/src/test/common/socketCallbackHandler.test.ts index 70b5b3f04c74..50874f3714c9 100644 --- a/src/test/common/socketCallbackHandler.test.ts +++ b/src/test/common/socketCallbackHandler.test.ts @@ -39,7 +39,7 @@ class MockSocketCallbackHandler extends SocketCallbackHandler { const stringBuffer = new Buffer(message); const buffer = Buffer.concat([ Buffer.concat([new Buffer('U'), uint64be.encode(stringBuffer.byteLength)]), - stringBuffer + stringBuffer, ]); this.stream.Write(buffer); } @@ -137,7 +137,7 @@ class MockSocketClient { const errorMessage = `Received unknown command '${cmdId}'`; const errorBuffer = Buffer.concat([ Buffer.concat([new Buffer('A'), uint64be.encode(errorMessage.length)]), - new Buffer(errorMessage) + new Buffer(errorMessage), ]); this.SocketStream.Write(errorBuffer); return; @@ -148,7 +148,7 @@ class MockSocketClient { const messageBuffer = new Buffer(message); const pongBuffer = Buffer.concat([ Buffer.concat([new Buffer('U'), uint64be.encode(messageBuffer.byteLength)]), - messageBuffer + messageBuffer, ]); this.SocketStream.Write(pongBuffer); } catch (ex) { @@ -157,7 +157,7 @@ class MockSocketClient { const errorMessage = `Fatal error in handling data at socket client. Error: ${ex.message}`; const errorBuffer = Buffer.concat([ Buffer.concat([new Buffer('A'), uint64be.encode(errorMessage.length)]), - new Buffer(errorMessage) + new Buffer(errorMessage), ]); this.SocketStream.Write(errorBuffer); } @@ -314,7 +314,7 @@ suite('SocketCallbackHandler', () => { }); test('Succesful Handshake with specific port', async () => { const availablePort = await new Promise((resolve, reject) => - getFreePort({ host: 'localhost' }).then(resolve, reject) + getFreePort({ host: 'localhost' }).then(resolve, reject), ); const port = await socketServer.Start({ port: availablePort, host: 'localhost' }); diff --git a/src/test/common/socketStream.test.ts b/src/test/common/socketStream.test.ts index 13d3082dcd96..4965e2095a38 100644 --- a/src/test/common/socketStream.test.ts +++ b/src/test/common/socketStream.test.ts @@ -83,7 +83,7 @@ suite('SocketStream', () => { const stringBuffer = new Buffer(message); const buffer = Buffer.concat([ Buffer.concat([new Buffer('U'), uint64be.encode(stringBuffer.byteLength)]), - stringBuffer + stringBuffer, ]); // tslint:disable-next-line:no-any const stream = new SocketStream((socket as any) as net.Socket, buffer); diff --git a/src/test/common/terminals/activation.bash.unit.test.ts b/src/test/common/terminals/activation.bash.unit.test.ts index b14415e3aab2..a23977ef07ff 100644 --- a/src/test/common/terminals/activation.bash.unit.test.ts +++ b/src/test/common/terminals/activation.bash.unit.test.ts @@ -18,7 +18,7 @@ suite('Terminal Environment Activation (bash)', () => { [ 'usr/bin/python', 'usr/bin/env with spaces/env more/python', - 'c:\\users\\windows paths\\conda\\python.exe' + 'c:\\users\\windows paths\\conda\\python.exe', ].forEach((pythonPath) => { const hasSpaces = pythonPath.indexOf(' ') > 0; const suiteTitle = hasSpaces @@ -89,14 +89,14 @@ suite('Terminal Environment Activation (bash)', () => { case TerminalShellType.fish: { expect(supported).to.be.equal( true, - `${shellType.name} shell not supported (it should be)` + `${shellType.name} shell not supported (it should be)`, ); break; } default: { expect(supported).to.be.equal( false, - `${shellType.name} incorrectly supported (should not be)` + `${shellType.name} incorrectly supported (should not be)`, ); // No point proceeding with other tests. return; @@ -117,7 +117,7 @@ suite('Terminal Environment Activation (bash)', () => { expect(command).to.be.deep.equal( [`source ${pathToScriptFile.fileToCommandArgument()}`.trim()], - 'Invalid command' + 'Invalid command', ); } else { expect(command).to.be.equal(undefined, 'Command should be undefined'); @@ -125,7 +125,7 @@ suite('Terminal Environment Activation (bash)', () => { }); }); }); - } + }, ); }); }); diff --git a/src/test/common/terminals/activation.commandPrompt.unit.test.ts b/src/test/common/terminals/activation.commandPrompt.unit.test.ts index 56d1239caf72..09e7b82e2723 100644 --- a/src/test/common/terminals/activation.commandPrompt.unit.test.ts +++ b/src/test/common/terminals/activation.commandPrompt.unit.test.ts @@ -18,7 +18,7 @@ suite('Terminal Environment Activation (cmd/powershell)', () => { [ 'c:/programfiles/python/python', 'c:/program files/python/python', - 'c:\\users\\windows paths\\conda\\python.exe' + 'c:\\users\\windows paths\\conda\\python.exe', ].forEach((pythonPath) => { const hasSpaces = pythonPath.indexOf(' ') > 0; const resource = Uri.file('a'); @@ -64,21 +64,21 @@ suite('Terminal Environment Activation (cmd/powershell)', () => { case TerminalShellType.powershell: { expect(supported).to.be.equal( true, - `${shellType.name} shell not supported (it should be)` + `${shellType.name} shell not supported (it should be)`, ); break; } default: { expect(supported).to.be.equal( false, - `${shellType.name} incorrectly supported (should not be)` + `${shellType.name} incorrectly supported (should not be)`, ); } } }); }); }); - } + }, ); suite('and script file is activate.bat', () => { @@ -203,7 +203,7 @@ suite('Terminal Environment Activation (cmd/powershell)', () => { expect(command).to.be.deep.equal( [], - 'Invalid command (running powershell files are not supported on command prompt)' + 'Invalid command (running powershell files are not supported on command prompt)', ); }); @@ -219,7 +219,7 @@ suite('Terminal Environment Activation (cmd/powershell)', () => { expect(command).to.be.deep.equal( [`& ${pathToScriptFile.fileToCommandArgument()}`.trim()], - 'Invalid command' + 'Invalid command', ); }); @@ -235,7 +235,7 @@ suite('Terminal Environment Activation (cmd/powershell)', () => { expect(command).to.be.deep.equal( [`& ${pathToScriptFile.fileToCommandArgument()}`.trim()], - 'Invalid command' + 'Invalid command', ); }); }); diff --git a/src/test/common/terminals/activation.conda.unit.test.ts b/src/test/common/terminals/activation.conda.unit.test.ts index 6d3483cd50e0..ad06ff85aa22 100644 --- a/src/test/common/terminals/activation.conda.unit.test.ts +++ b/src/test/common/terminals/activation.conda.unit.test.ts @@ -24,7 +24,7 @@ import { IConfigurationService, IDisposableRegistry, IPythonSettings, - ITerminalSettings + ITerminalSettings, } from '../../../client/common/types'; import { getNamesAndValues } from '../../../client/common/utils/enum'; import { ICondaService } from '../../../client/interpreter/contracts'; @@ -101,7 +101,7 @@ suite('Terminal Environment Activation conda', () => { mock(CommandPromptAndPowerShell), mock(PyEnvActivationCommandProvider), mock(PipEnvActivationCommandProvider), - [] + [], ); }); teardown(() => { @@ -125,7 +125,7 @@ suite('Terminal Environment Activation conda', () => { const provider = new CondaActivationCommandProvider( condaService.object, platformService.object, - configService.object + configService.object, ); const activationCommands = await provider.getActivationCommands(undefined, TerminalShellType.fish); @@ -143,8 +143,8 @@ suite('Terminal Environment Activation conda', () => { .returns(() => Promise.resolve({ name: envName, - path: path.dirname(pythonPath) - }) + path: path.dirname(pythonPath), + }), ); condaService.setup((c) => c.getCondaFile()).returns(() => Promise.resolve(condaPath)); condaService.setup((c) => c.getCondaVersion()).returns(() => Promise.resolve(parse('4.3.1', true)!)); @@ -153,7 +153,7 @@ suite('Terminal Environment Activation conda', () => { const provider = new CondaActivationCommandProvider( condaService.object, platformService.object, - configService.object + configService.object, ); const activationCommands = await provider.getActivationCommands(undefined, TerminalShellType.bash); @@ -171,8 +171,8 @@ suite('Terminal Environment Activation conda', () => { .returns(() => Promise.resolve({ name: envName, - path: path.dirname(pythonPath) - }) + path: path.dirname(pythonPath), + }), ); condaService.setup((c) => c.getCondaFile()).returns(() => Promise.resolve(condaPath)); condaService.setup((c) => c.getCondaVersion()).returns(() => Promise.resolve(parse('4.4.0', true)!)); @@ -181,7 +181,7 @@ suite('Terminal Environment Activation conda', () => { const provider = new CondaActivationCommandProvider( condaService.object, platformService.object, - configService.object + configService.object, ); const activationCommands = await provider.getActivationCommands(undefined, TerminalShellType.bash); @@ -197,43 +197,43 @@ suite('Terminal Environment Activation conda', () => { 'Activation provides correct activation commands (windows) after 4.4.0 given interpreter path is provided, with no spaces in env name', envName: environmentName, expectedResult: ['path/to/activate', 'conda activate Env'], - isWindows: true + isWindows: true, }, { testName: 'Activation provides correct activation commands (non-windows) after 4.4.0 given interpreter path is provided, with no spaces in env name', envName: environmentName, expectedResult: ['source path/to/activate', 'conda activate Env'], - isWindows: false + isWindows: false, }, { testName: 'Activation provides correct activation commands (windows) after 4.4.0 given interpreter path is provided, with spaces in env name', envName: environmentNameHasSpaces, expectedResult: ['path/to/activate', 'conda activate "Env with spaces"'], - isWindows: true + isWindows: true, }, { testName: 'Activation provides correct activation commands (non-windows) after 4.4.0 given interpreter path is provided, with spaces in env name', envName: environmentNameHasSpaces, expectedResult: ['source path/to/activate', 'conda activate "Env with spaces"'], - isWindows: false + isWindows: false, }, { testName: 'Activation provides correct activation commands (windows) after 4.4.0 given interpreter path is provided, and no env name', envName: '', expectedResult: ['path/to/activate', `conda activate .`], - isWindows: true + isWindows: true, }, { testName: 'Activation provides correct activation commands (non-windows) after 4.4.0 given interpreter path is provided, and no env name', envName: '', expectedResult: ['source path/to/activate', `conda activate .`], - isWindows: false - } + isWindows: false, + }, ]; testsForActivationUsingInterpreterPath.forEach((testParams) => { @@ -246,8 +246,8 @@ suite('Terminal Environment Activation conda', () => { .returns(() => Promise.resolve({ name: testParams.envName, - path: path.dirname(pythonPath) - }) + path: path.dirname(pythonPath), + }), ); condaService.setup((c) => c.getCondaVersion()).returns(() => Promise.resolve(parse('4.4.0', true)!)); condaService @@ -257,7 +257,7 @@ suite('Terminal Environment Activation conda', () => { const provider = new CondaActivationCommandProvider( condaService.object, platformService.object, - configService.object + configService.object, ); const activationCommands = await provider.getActivationCommands(undefined, TerminalShellType.bash); @@ -271,7 +271,7 @@ suite('Terminal Environment Activation conda', () => { isLinux: boolean, pythonPath: string, shellType: TerminalShellType, - envName: string + envName: string, ) { platformService.setup((p) => p.isLinux).returns(() => isLinux); platformService.setup((p) => p.isWindows).returns(() => isWindows); @@ -285,7 +285,7 @@ suite('Terminal Environment Activation conda', () => { const activationCommands = await new CondaActivationCommandProvider( condaService.object, platformService.object, - configService.object + configService.object, ).getActivationCommands(undefined, shellType); let expectedActivationCommand: string[] | undefined; const expectEnvActivatePath = path.dirname(pythonPath); @@ -371,7 +371,7 @@ suite('Terminal Environment Activation conda', () => { isWindows: boolean, isOsx: boolean, isLinux: boolean, - pythonPath: string + pythonPath: string, ) { platformService.setup((p) => p.isLinux).returns(() => isLinux); platformService.setup((p) => p.isWindows).returns(() => isWindows); @@ -385,7 +385,7 @@ suite('Terminal Environment Activation conda', () => { const expectedActivationCommand = isWindows ? ['activate EnvA'] : ['source activate EnvA']; const activationCommands = await terminalHelper.getEnvironmentActivationCommands( TerminalShellType.bash, - undefined + undefined, ); expect(activationCommands).to.deep.equal(expectedActivationCommand, 'Incorrect Activation command'); } @@ -402,7 +402,7 @@ suite('Terminal Environment Activation conda', () => { const pythonPath = path.join('users', 'xyz', '.conda', 'envs', 'enva', 'bin', 'python'); fileSystem .setup((f) => - f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta'))) + f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta'))), ) .returns(() => Promise.resolve(true)); await expectCondaActivationCommand(false, false, true, pythonPath); @@ -412,7 +412,7 @@ suite('Terminal Environment Activation conda', () => { const pythonPath = path.join('users', 'xyz', '.conda', 'envs', 'enva', 'bin', 'python'); fileSystem .setup((f) => - f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta'))) + f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta'))), ) .returns(() => Promise.resolve(true)); await expectCondaActivationCommand(false, true, false, pythonPath); @@ -438,7 +438,7 @@ suite('Terminal Environment Activation conda', () => { const activationCommands = await terminalHelper.getEnvironmentActivationCommands( TerminalShellType.bash, - undefined + undefined, ); expect(activationCommands).to.deep.equal(expectedActivationCommand, 'Incorrect Activation command'); @@ -447,7 +447,7 @@ suite('Terminal Environment Activation conda', () => { isWindows: boolean, isOsx: boolean, isLinux: boolean, - pythonPath: string + pythonPath: string, ) { platformService.setup((p) => p.isLinux).returns(() => isLinux); platformService.setup((p) => p.isWindows).returns(() => isWindows); @@ -462,7 +462,7 @@ suite('Terminal Environment Activation conda', () => { const expectedActivationCommand = ['mock command']; const activationCommands = await terminalHelper.getEnvironmentActivationCommands( TerminalShellType.bash, - undefined + undefined, ); expect(activationCommands).to.deep.equal(expectedActivationCommand, 'Incorrect Activation command'); } @@ -479,7 +479,7 @@ suite('Terminal Environment Activation conda', () => { const pythonPath = path.join('users', 'xyz', '.conda', 'envs', 'enva', 'python'); fileSystem .setup((f) => - f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta'))) + f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta'))), ) .returns(() => Promise.resolve(true)); await expectActivationCommandIfCondaDetectionFails(false, true, false, pythonPath); @@ -489,7 +489,7 @@ suite('Terminal Environment Activation conda', () => { const pythonPath = path.join('users', 'xyz', '.conda', 'envs', 'enva', 'python'); fileSystem .setup((f) => - f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta'))) + f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta'))), ) .returns(() => Promise.resolve(true)); await expectActivationCommandIfCondaDetectionFails(false, false, true, pythonPath); @@ -513,7 +513,7 @@ suite('Terminal Environment Activation conda', () => { const activationCommands = await terminalHelper.getEnvironmentActivationCommands( TerminalShellType.bash, - undefined + undefined, ); expect(activationCommands).to.equal(undefined, 'Incorrect Activation command'); }); @@ -537,7 +537,7 @@ suite('Terminal Environment Activation conda', () => { envName: 'TesterEnv', expectedResult: ['conda activate TesterEnv'], expectedRawCmd: `${path.join(windowsTestPath, 'activate')}`, - terminalKind: TerminalShellType.powershell + terminalKind: TerminalShellType.powershell, }, { testName: 'Activation uses full path with spaces on windows for powershell', @@ -545,7 +545,7 @@ suite('Terminal Environment Activation conda', () => { envName: 'TesterEnv', expectedResult: ['conda activate TesterEnv'], expectedRawCmd: `"${path.join(windowsTestPathSpaces, 'activate')}"`, - terminalKind: TerminalShellType.powershell + terminalKind: TerminalShellType.powershell, }, { testName: 'Activation uses full path on windows under powershell, environment name has spaces', @@ -553,7 +553,7 @@ suite('Terminal Environment Activation conda', () => { envName: 'The Tester Environment', expectedResult: ['conda activate "The Tester Environment"'], expectedRawCmd: `${path.join(windowsTestPath, 'activate')}`, - terminalKind: TerminalShellType.powershell + terminalKind: TerminalShellType.powershell, }, { testName: 'Activation uses full path on windows for powershell-core', @@ -561,7 +561,7 @@ suite('Terminal Environment Activation conda', () => { envName: 'TesterEnv', expectedResult: ['conda activate TesterEnv'], expectedRawCmd: `${path.join(windowsTestPath, 'activate')}`, - terminalKind: TerminalShellType.powershellCore + terminalKind: TerminalShellType.powershellCore, }, { testName: 'Activation uses full path with spaces on windows for powershell-core', @@ -569,7 +569,7 @@ suite('Terminal Environment Activation conda', () => { envName: 'TesterEnv', expectedResult: ['conda activate TesterEnv'], expectedRawCmd: `"${path.join(windowsTestPathSpaces, 'activate')}"`, - terminalKind: TerminalShellType.powershellCore + terminalKind: TerminalShellType.powershellCore, }, { testName: 'Activation uses full path on windows for powershell-core, environment name has spaces', @@ -577,7 +577,7 @@ suite('Terminal Environment Activation conda', () => { envName: 'The Tester Environment', expectedResult: ['conda activate "The Tester Environment"'], expectedRawCmd: `${path.join(windowsTestPath, 'activate')}`, - terminalKind: TerminalShellType.powershellCore + terminalKind: TerminalShellType.powershellCore, }, { testName: 'Activation uses full path on windows for cmd.exe', @@ -585,7 +585,7 @@ suite('Terminal Environment Activation conda', () => { envName: 'TesterEnv', expectedResult: [`${path.join(windowsTestPath, 'activate')} TesterEnv`], expectedRawCmd: `${path.join(windowsTestPath, 'activate')}`, - terminalKind: TerminalShellType.commandPrompt + terminalKind: TerminalShellType.commandPrompt, }, { testName: 'Activation uses full path with spaces on windows for cmd.exe', @@ -593,7 +593,7 @@ suite('Terminal Environment Activation conda', () => { envName: 'TesterEnv', expectedResult: [`"${path.join(windowsTestPathSpaces, 'activate')}" TesterEnv`], expectedRawCmd: `"${path.join(windowsTestPathSpaces, 'activate')}"`, - terminalKind: TerminalShellType.commandPrompt + terminalKind: TerminalShellType.commandPrompt, }, { testName: 'Activation uses full path on windows for cmd.exe, environment name has spaces', @@ -601,8 +601,8 @@ suite('Terminal Environment Activation conda', () => { envName: 'The Tester Environment', expectedResult: [`${path.join(windowsTestPath, 'activate')} "The Tester Environment"`], expectedRawCmd: `${path.join(windowsTestPath, 'activate')}`, - terminalKind: TerminalShellType.commandPrompt - } + terminalKind: TerminalShellType.commandPrompt, + }, ]; testsForWindowsActivation.forEach((testParams: WindowsActivationTestParams) => { @@ -623,7 +623,7 @@ suite('Terminal Environment Activation conda', () => { const tstCmdProvider = new CondaActivationCommandProvider( condaSrv.object, platformService.object, - configService.object + configService.object, ); let result: string[] | undefined; diff --git a/src/test/common/terminals/activation.unit.test.ts b/src/test/common/terminals/activation.unit.test.ts index b8ef12607395..ec81e1a77f75 100644 --- a/src/test/common/terminals/activation.unit.test.ts +++ b/src/test/common/terminals/activation.unit.test.ts @@ -34,7 +34,7 @@ suite('Terminal Auto Activation', () => { processId: Promise.resolve(0), sendText: noop, show: noop, - exitStatus: { code: 0 } + exitStatus: { code: 0 }, }; terminalManager = mock(TerminalManager); activator = mock(TerminalActivator); @@ -44,7 +44,7 @@ suite('Terminal Auto Activation', () => { instance(terminalManager), [], instance(activator), - instance(activeResourceService) + instance(activeResourceService), ); }); @@ -77,7 +77,7 @@ suite('Terminal Auto Activation', () => { processId: Promise.resolve(0), sendText: noop, show: noop, - exitStatus: { code: 0 } + exitStatus: { code: 0 }, }; type EventHandler = (e: Terminal) => void; let handler: undefined | EventHandler; diff --git a/src/test/common/terminals/activator/base.unit.test.ts b/src/test/common/terminals/activator/base.unit.test.ts index 79f1c121cdb4..19c32dde2e4e 100644 --- a/src/test/common/terminals/activator/base.unit.test.ts +++ b/src/test/common/terminals/activator/base.unit.test.ts @@ -28,14 +28,14 @@ suite('Terminal Base Activator', () => { { commandCount: 1, preserveFocus: false }, { commandCount: 2, preserveFocus: false }, { commandCount: 1, preserveFocus: true }, - { commandCount: 1, preserveFocus: true } + { commandCount: 1, preserveFocus: true }, ].forEach((item) => { const titleSuffix = `(${item.commandCount} activation command, and preserve focus in terminal is ${item.preserveFocus})`; const activationCommands = item.commandCount === 1 ? ['CMD1'] : ['CMD1', 'CMD2']; test(`Terminal is activated ${titleSuffix}`, async () => { helper .setup((h) => - h.getEnvironmentActivationCommands(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + h.getEnvironmentActivationCommands(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns(() => Promise.resolve(activationCommands)); const terminal = TypeMoq.Mock.ofType(); @@ -58,7 +58,7 @@ suite('Terminal Base Activator', () => { test(`Terminal is activated only once ${titleSuffix}`, async () => { helper .setup((h) => - h.getEnvironmentActivationCommands(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + h.getEnvironmentActivationCommands(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns(() => Promise.resolve(activationCommands)); const terminal = TypeMoq.Mock.ofType(); @@ -83,7 +83,7 @@ suite('Terminal Base Activator', () => { test(`Terminal is activated only once ${titleSuffix} (even when not waiting)`, async () => { helper .setup((h) => - h.getEnvironmentActivationCommands(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + h.getEnvironmentActivationCommands(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns(() => Promise.resolve(activationCommands)); const terminal = TypeMoq.Mock.ofType(); @@ -102,7 +102,7 @@ suite('Terminal Base Activator', () => { const activated = await Promise.all([ activator.activateEnvironmentInTerminal(terminal.object, { preserveFocus: item.preserveFocus }), activator.activateEnvironmentInTerminal(terminal.object, { preserveFocus: item.preserveFocus }), - activator.activateEnvironmentInTerminal(terminal.object, { preserveFocus: item.preserveFocus }) + activator.activateEnvironmentInTerminal(terminal.object, { preserveFocus: item.preserveFocus }), ]); terminal.verifyAll(); diff --git a/src/test/common/terminals/activator/index.unit.test.ts b/src/test/common/terminals/activator/index.unit.test.ts index e9b1a1e0050e..471c063af311 100644 --- a/src/test/common/terminals/activator/index.unit.test.ts +++ b/src/test/common/terminals/activator/index.unit.test.ts @@ -10,7 +10,7 @@ import { TerminalActivator } from '../../../../client/common/terminal/activator' import { ITerminalActivationHandler, ITerminalActivator, - ITerminalHelper + ITerminalHelper, } from '../../../../client/common/terminal/types'; import { IConfigurationService, IPythonSettings, ITerminalSettings } from '../../../../client/common/types'; @@ -31,7 +31,7 @@ suite('Terminal Activator', () => { .setup((c) => c.getSettings(TypeMoq.It.isAny())) .returns(() => { return ({ - terminal: terminalSettings.object + terminal: terminalSettings.object, } as unknown) as IPythonSettings; }); activator = new (class extends TerminalActivator { @@ -43,7 +43,7 @@ suite('Terminal Activator', () => { async function testActivationAndHandlers( activationSuccessful: boolean, activateEnvironmentSetting: boolean, - hidden: boolean = false + hidden: boolean = false, ) { terminalSettings .setup((b) => b.activateEnvironment) @@ -59,8 +59,8 @@ suite('Terminal Activator', () => { TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), - TypeMoq.It.isValue(activationSuccessful) - ) + TypeMoq.It.isValue(activationSuccessful), + ), ) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.exactly(activationSuccessful ? 1 : 0)); @@ -70,8 +70,8 @@ suite('Terminal Activator', () => { TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), - TypeMoq.It.isValue(activationSuccessful) - ) + TypeMoq.It.isValue(activationSuccessful), + ), ) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.exactly(activationSuccessful ? 1 : 0)); @@ -79,7 +79,7 @@ suite('Terminal Activator', () => { const terminal = TypeMoq.Mock.ofType(); const activated = await activator.activateEnvironmentInTerminal(terminal.object, { preserveFocus: activationSuccessful, - hideFromUser: hidden + hideFromUser: hidden, }); assert.equal(activated, activationSuccessful); diff --git a/src/test/common/terminals/activator/powerShellFailedHandler.unit.test.ts b/src/test/common/terminals/activator/powerShellFailedHandler.unit.test.ts index 0ca229c07dee..cd7aca92dda7 100644 --- a/src/test/common/terminals/activator/powerShellFailedHandler.unit.test.ts +++ b/src/test/common/terminals/activator/powerShellFailedHandler.unit.test.ts @@ -11,7 +11,7 @@ import { PowershellTerminalActivationFailedHandler } from '../../../../client/co import { ITerminalActivationHandler, ITerminalHelper, - TerminalShellType + TerminalShellType, } from '../../../../client/common/terminal/types'; import { getNamesAndValues } from '../../../../client/common/utils/enum'; @@ -27,7 +27,7 @@ suite('Terminal Activation Powershell Failed Handler', () => { isWindows: boolean, activatedSuccessfully: boolean, shellType: TerminalShellType, - cmdPromptHasActivationCommands: boolean + cmdPromptHasActivationCommands: boolean, ) { platform.setup((p) => p.isWindows).returns(() => isWindows); helper.setup((p) => p.identifyTerminalShell(TypeMoq.It.isAny())).returns(() => shellType); @@ -36,8 +36,8 @@ suite('Terminal Activation Powershell Failed Handler', () => { .setup((h) => h.getEnvironmentActivationCommands( TypeMoq.It.isValue(TerminalShellType.commandPrompt), - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve(cmdPromptCommands)); @@ -49,7 +49,7 @@ suite('Terminal Activation Powershell Failed Handler', () => { TypeMoq.Mock.ofType().object, undefined, false, - activatedSuccessfully + activatedSuccessfully, ); } @@ -78,7 +78,7 @@ suite('Terminal Activation Powershell Failed Handler', () => { psHandler = new PowershellTerminalActivationFailedHandler( helper.object, platform.object, - diagnosticService.object + diagnosticService.object, ); }); const isPs = @@ -94,15 +94,15 @@ suite('Terminal Activation Powershell Failed Handler', () => { isWindows, activatedSuccessfully, shell.value, - hasCommandPromptActivations + hasCommandPromptActivations, ); helper.verifyAll(); diagnosticService.verifyAll(); }); - } + }, ); }); - } + }, ); }); }); diff --git a/src/test/common/terminals/commandPrompt.unit.test.ts b/src/test/common/terminals/commandPrompt.unit.test.ts index 2a240967d2b8..acea3f5f35a9 100644 --- a/src/test/common/terminals/commandPrompt.unit.test.ts +++ b/src/test/common/terminals/commandPrompt.unit.test.ts @@ -9,7 +9,7 @@ import * as TypeMoq from 'typemoq'; import { ConfigurationTarget } from 'vscode'; import { getCommandPromptLocation, - useCommandPromptAsDefaultShell + useCommandPromptAsDefaultShell, } from '../../../client/common/terminal/commandPrompt'; import { IConfigurationService, ICurrentProcess } from '../../../client/common/types'; @@ -60,8 +60,8 @@ suite('Terminal Command Prompt', () => { TypeMoq.It.isValue('integrated.shell.windows'), TypeMoq.It.isValue(cmdPromptPath), TypeMoq.It.isAny(), - TypeMoq.It.isValue(ConfigurationTarget.Global) - ) + TypeMoq.It.isValue(ConfigurationTarget.Global), + ), ) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.once()); diff --git a/src/test/common/terminals/environmentActivationProviders/pipEnvActivationProvider.unit.test.ts b/src/test/common/terminals/environmentActivationProviders/pipEnvActivationProvider.unit.test.ts index effae6004575..cc35cd75788a 100644 --- a/src/test/common/terminals/environmentActivationProviders/pipEnvActivationProvider.unit.test.ts +++ b/src/test/common/terminals/environmentActivationProviders/pipEnvActivationProvider.unit.test.ts @@ -39,7 +39,7 @@ suite('Terminals Activation - Pipenv', () => { instance(interpreterService), pipenvService.object, instance(workspaceService), - instance(fs) + instance(fs), ); pipenvService.setup((p) => p.executable).returns(() => pipenvExecFile); @@ -56,11 +56,11 @@ suite('Terminals Activation - Pipenv', () => { }); test('No commands for an interpreter that is not Pipenv', async () => { const nonPipInterpreterTypes = getNamesAndValues(EnvironmentType).filter( - (t) => t.value !== EnvironmentType.Pipenv + (t) => t.value !== EnvironmentType.Pipenv, ); for (const interpreterType of nonPipInterpreterTypes) { when(interpreterService.getActiveInterpreter(resource)).thenResolve({ - type: interpreterType + type: interpreterType, } as any); for (const shell of getNamesAndValues(TerminalShellType)) { @@ -72,7 +72,7 @@ suite('Terminals Activation - Pipenv', () => { }); test('pipenv shell is returned for pipenv interpeter', async () => { when(interpreterService.getActiveInterpreter(resource)).thenResolve({ - envType: EnvironmentType.Pipenv + envType: EnvironmentType.Pipenv, } as any); for (const shell of getNamesAndValues(TerminalShellType)) { @@ -84,7 +84,7 @@ suite('Terminals Activation - Pipenv', () => { test('pipenv is properly escaped', async () => { pipenvExecFile = 'my pipenv'; when(interpreterService.getActiveInterpreter(resource)).thenResolve({ - envType: EnvironmentType.Pipenv + envType: EnvironmentType.Pipenv, } as any); for (const shell of getNamesAndValues(TerminalShellType)) { diff --git a/src/test/common/terminals/environmentActivationProviders/terminalActivation.testvirtualenvs.ts b/src/test/common/terminals/environmentActivationProviders/terminalActivation.testvirtualenvs.ts index 978bfb312708..5b20c2b689a3 100644 --- a/src/test/common/terminals/environmentActivationProviders/terminalActivation.testvirtualenvs.ts +++ b/src/test/common/terminals/environmentActivationProviders/terminalActivation.testvirtualenvs.ts @@ -18,7 +18,7 @@ import { setGlobalInterpreterPath, setPythonPathInWorkspaceRoot, updateSetting, - waitForCondition + waitForCondition, } from '../../../common'; import { EXTENSION_ROOT_DIR_FOR_TESTS, TEST_TIMEOUT } from '../../../constants'; import { sleep } from '../../../core'; @@ -31,7 +31,7 @@ suite('Activation of Environments in Terminal', () => { 'src', 'testMultiRootWkspc', 'smokeTests', - 'testExecInTerminal.py' + 'testExecInTerminal.py', ); let outputFile = ''; let outputFileCounter = 0; @@ -53,7 +53,7 @@ suite('Activation of Environments in Terminal', () => { const defaultShell = { Windows: '', Linux: '', - MacOS: '' + MacOS: '', }; let terminalSettings: any; let pythonSettings: any; @@ -75,7 +75,7 @@ suite('Activation of Environments in Terminal', () => { 'src', 'testMultiRootWkspc', 'smokeTests', - `testExecInTerminal_${outputFileCounter}.log` + `testExecInTerminal_${outputFileCounter}.log`, ); outputFileCounter += 1; outputFilesCreated.push(outputFile); @@ -99,12 +99,12 @@ suite('Activation of Environments in Terminal', () => { 'terminal.activateEnvironment', undefined, vscode.workspace.workspaceFolders![0].uri, - vscode.ConfigurationTarget.WorkspaceFolder + vscode.ConfigurationTarget.WorkspaceFolder, ); await terminalSettings.update( 'integrated.shell.windows', defaultShell.Windows, - vscode.ConfigurationTarget.Global + vscode.ConfigurationTarget.Global, ); await terminalSettings.update('integrated.shell.linux', defaultShell.Linux, vscode.ConfigurationTarget.Global); await pythonSettings.update('condaPath', undefined, vscode.ConfigurationTarget.Workspace); @@ -128,7 +128,7 @@ suite('Activation of Environments in Terminal', () => { consoleInitWaitMs: number, pythonFile: string, logFile: string, - logFileCreationWaitMs: number + logFileCreationWaitMs: number, ): Promise { const terminal = vscode.window.createTerminal(); await sleep(consoleInitWaitMs); @@ -151,7 +151,7 @@ suite('Activation of Environments in Terminal', () => { 'terminal.activateEnvironment', true, vscode.workspace.workspaceFolders![0].uri, - vscode.ConfigurationTarget.WorkspaceFolder + vscode.ConfigurationTarget.WorkspaceFolder, ); if (experiments.inExperiment(DeprecatePythonPath.experiment)) { await setGlobalInterpreterPath(envPath); @@ -167,7 +167,7 @@ suite('Activation of Environments in Terminal', () => { 'terminal.activateEnvironment', false, vscode.workspace.workspaceFolders![0].uri, - vscode.ConfigurationTarget.WorkspaceFolder + vscode.ConfigurationTarget.WorkspaceFolder, ); const content = await openTerminalAndAwaitCommandContent(waitTimeForActivation, file, outputFile, 5_000); expect(fileSystem.arePathsSame(content, PYTHON_PATH)).to.equal(false, 'Environment not activated'); @@ -190,7 +190,7 @@ suite('Activation of Environments in Terminal', () => { await terminalSettings.update( 'integrated.shell.windows', 'C:\\Windows\\System32\\cmd.exe', - vscode.ConfigurationTarget.Global + vscode.ConfigurationTarget.Global, ); await pythonSettings.update('condaPath', envPaths.condaExecPath, vscode.ConfigurationTarget.Workspace); await testActivation(envPaths.condaPath); diff --git a/src/test/common/terminals/factory.unit.test.ts b/src/test/common/terminals/factory.unit.test.ts index 1aeee9263f53..d998ef1d650a 100644 --- a/src/test/common/terminals/factory.unit.test.ts +++ b/src/test/common/terminals/factory.unit.test.ts @@ -69,7 +69,7 @@ suite('Terminal Service Factory', () => { const defaultInstance = factory.getTerminalService(); expect(defaultInstance instanceof SynchronousTerminalService).to.equal( true, - 'Not an instance of Terminal service' + 'Not an instance of Terminal service', ); const notSameAsDefaultInstance = factory.getTerminalService(undefined, 'New Title') === defaultInstance; @@ -134,7 +134,7 @@ suite('Terminal Service Factory', () => { terminalForFile1A.terminalService === terminalForFileB.terminalService; expect(terminalsForWorkspaceABAreDifferent).to.equal( false, - 'Instances should be different for different workspaces' + 'Instances should be different for different workspaces', ); }); }); diff --git a/src/test/common/terminals/helper.unit.test.ts b/src/test/common/terminals/helper.unit.test.ts index 8393f59b50fa..ee132614b3f0 100644 --- a/src/test/common/terminals/helper.unit.test.ts +++ b/src/test/common/terminals/helper.unit.test.ts @@ -22,7 +22,7 @@ import { TerminalNameShellDetector } from '../../../client/common/terminal/shell import { IShellDetector, ITerminalActivationCommandProvider, - TerminalShellType + TerminalShellType, } from '../../../client/common/terminal/types'; import { IConfigurationService } from '../../../client/common/types'; import { getNamesAndValues } from '../../../client/common/utils/enum'; @@ -54,7 +54,7 @@ suite('Terminal Service helpers', () => { sysVersion: '1.0.0.0', sysPrefix: 'Python', envType: EnvironmentType.Unknown, - architecture: Architecture.x64 + architecture: Architecture.x64, }; function doSetup() { @@ -81,7 +81,7 @@ suite('Terminal Service helpers', () => { instance(cmdActivationProvider), instance(pyenvActivationProvider), instance(pipenvActivationProvider), - [instance(mockDetector)] + [instance(mockDetector)], ); } teardown(() => shellDetectorIdentifyTerminalShell.restore()); @@ -185,13 +185,13 @@ suite('Terminal Service helpers', () => { function ensureCondaIsSupported( isSupported: boolean, pythonPath: string, - condaActivationCommands: string[] + condaActivationCommands: string[], ) { when(pythonSettings.pythonPath).thenReturn(pythonPath); when(pythonSettings.terminal).thenReturn({ activateEnvironment: true } as any); when(condaService.isCondaEnvironment(pythonPath)).thenResolve(isSupported); when(condaActivationProvider.getActivationCommands(resource, anything())).thenResolve( - condaActivationCommands + condaActivationCommands, ); } test('Activation command must return conda activation command if interpreter is conda', async () => { @@ -217,7 +217,7 @@ suite('Terminal Service helpers', () => { const cmd = await helper.getEnvironmentActivationCommands( ('someShell' as any) as TerminalShellType, - resource + resource, ); expect(cmd).to.equal(undefined, 'Command must be undefined'); @@ -257,7 +257,7 @@ suite('Terminal Service helpers', () => { ensureCondaIsSupported(false, pythonPath, []); when(pipenvActivationProvider.getActivationCommands(resource, anything())).thenResolve( - expectCommand + expectCommand, ); when(pipenvActivationProvider.isShellSupported(anything())).thenReturn(true); @@ -334,7 +334,7 @@ suite('Terminal Service helpers', () => { const cmd = await helper.getEnvironmentActivationShellCommands( resource, item.value, - interpreter + interpreter, ); expect(cmd).to.equal(undefined, 'Command must be undefined'); } @@ -356,7 +356,7 @@ suite('Terminal Service helpers', () => { const cmd = await helper.getEnvironmentActivationShellCommands( resource, shellToExpect, - interpreter + interpreter, ); expect(cmd).to.equal(undefined, 'Command must be undefined'); diff --git a/src/test/common/terminals/pyenvActivationProvider.unit.test.ts b/src/test/common/terminals/pyenvActivationProvider.unit.test.ts index 4da4479b3662..404425791580 100644 --- a/src/test/common/terminals/pyenvActivationProvider.unit.test.ts +++ b/src/test/common/terminals/pyenvActivationProvider.unit.test.ts @@ -53,7 +53,7 @@ suite('Terminal Environment Activation pyenv', () => { sysPrefix: '', version: new SemVer('1.1.1-alpha'), sysVersion: '', - envType: EnvironmentType.Unknown + envType: EnvironmentType.Unknown, }; interpreterService .setup((i) => i.getActiveInterpreter(TypeMoq.It.isAny())) @@ -71,7 +71,7 @@ suite('Terminal Environment Activation pyenv', () => { sysPrefix: '', version: new SemVer('1.1.1-alpha'), sysVersion: '', - envType: EnvironmentType.Pyenv + envType: EnvironmentType.Pyenv, }; interpreterService .setup((i) => i.getActiveInterpreter(TypeMoq.It.isAny())) @@ -90,7 +90,7 @@ suite('Terminal Environment Activation pyenv', () => { version: new SemVer('1.1.1-alpha'), sysVersion: '', envType: EnvironmentType.Pyenv, - envName: 'my env name' + envName: 'my env name', }; interpreterService .setup((i) => i.getActiveInterpreter(TypeMoq.It.isAny())) @@ -100,7 +100,7 @@ suite('Terminal Environment Activation pyenv', () => { const activationCommands = await activationProvider.getActivationCommands(undefined, TerminalShellType.bash); expect(activationCommands).to.deep.equal( [`pyenv shell "${intepreterInfo.envName}"`], - 'Invalid Activation command' + 'Invalid Activation command', ); }); }); diff --git a/src/test/common/terminals/service.unit.test.ts b/src/test/common/terminals/service.unit.test.ts index 901c0eb63697..f9237673a0c7 100644 --- a/src/test/common/terminals/service.unit.test.ts +++ b/src/test/common/terminals/service.unit.test.ts @@ -97,7 +97,7 @@ suite('Terminal Service', () => { terminal.verify((t) => t.show(TypeMoq.It.isValue(true)), TypeMoq.Times.exactly(2)); terminal.verify( (t) => t.sendText(TypeMoq.It.isValue(commandToExpect), TypeMoq.It.isValue(true)), - TypeMoq.Times.exactly(1) + TypeMoq.Times.exactly(1), ); }); diff --git a/src/test/common/terminals/serviceRegistry.unit.test.ts b/src/test/common/terminals/serviceRegistry.unit.test.ts index 8bc7e1670016..0f1b8d313eed 100644 --- a/src/test/common/terminals/serviceRegistry.unit.test.ts +++ b/src/test/common/terminals/serviceRegistry.unit.test.ts @@ -18,7 +18,7 @@ import { ICodeExecutionHelper, ICodeExecutionManager, ICodeExecutionService, - ITerminalAutoActivation + ITerminalAutoActivation, } from '../../../client/terminals/types'; suite('Common Terminal Service Registry', () => { @@ -38,27 +38,27 @@ suite('Common Terminal Service Registry', () => { serviceManager.addSingleton( ICodeExecutionService, DjangoShellCodeExecutionProvider, - 'djangoShell' - ) + 'djangoShell', + ), ).once(); verify( serviceManager.addSingleton( ICodeExecutionService, TerminalCodeExecutionProvider, - 'standard' - ) + 'standard', + ), ).once(); verify(serviceManager.addSingleton(ICodeExecutionService, ReplProvider, 'repl')).once(); verify( - serviceManager.addSingleton(ITerminalAutoActivation, TerminalAutoActivation) + serviceManager.addSingleton(ITerminalAutoActivation, TerminalAutoActivation), ).once(); verify( serviceManager.addSingleton( IExtensionSingleActivationService, - ExtensionActivationForTerminalActivation - ) + ExtensionActivationForTerminalActivation, + ), ).once(); }); }); diff --git a/src/test/common/terminals/shellDetector.unit.test.ts b/src/test/common/terminals/shellDetector.unit.test.ts index 8afa2b18ba4a..cc311163af1b 100644 --- a/src/test/common/terminals/shellDetector.unit.test.ts +++ b/src/test/common/terminals/shellDetector.unit.test.ts @@ -28,7 +28,7 @@ suite('Shell Detector', () => { [OSType.Linux]: TerminalShellType.bash, [OSType.OSX]: TerminalShellType.bash, [OSType.Windows]: TerminalShellType.commandPrompt, - [OSType.Unknown]: TerminalShellType.other + [OSType.Unknown]: TerminalShellType.other, }; const sandbox = sinon.createSandbox(); setup(() => (platformService = mock(PlatformService))); @@ -65,7 +65,7 @@ suite('Shell Detector', () => { const userEnvDetector = new UserEnvironmentShellDetector(mock(MockProcess), instance(platformService)); const settingsDetector = new SettingsShellDetector( instance(mock(WorkspaceService)), - instance(platformService) + instance(platformService), ); const detectors = [settingsDetector, userEnvDetector, nameDetector, vscEnvDetector]; const shellDetector = new ShellDetector(instance(platformService), detectors); @@ -131,7 +131,7 @@ suite('Shell Detector', () => { const shellDetector = new ShellDetector(instance(platformService), [ instance(detector1), instance(detector2), - instance(detector3) + instance(detector3), ]); const shell = shellDetector.identifyTerminalShell(); @@ -160,7 +160,7 @@ suite('Shell Detector', () => { instance(detector1), instance(detector2), instance(detector3), - instance(detector4) + instance(detector4), ]); const shell = shellDetector.identifyTerminalShell(); @@ -190,7 +190,7 @@ suite('Shell Detector', () => { instance(detector1), instance(detector2), instance(detector3), - instance(detector4) + instance(detector4), ]); const shell = shellDetector.identifyTerminalShell(); diff --git a/src/test/common/terminals/shellDetectors/shellDetectors.unit.test.ts b/src/test/common/terminals/shellDetectors/shellDetectors.unit.test.ts index 7abd0c28d74e..e7c86b2a15cd 100644 --- a/src/test/common/terminals/shellDetectors/shellDetectors.unit.test.ts +++ b/src/test/common/terminals/shellDetectors/shellDetectors.unit.test.ts @@ -53,7 +53,7 @@ suite('Shell Detectors', () => { shellIdentificationSource: 'default', terminalProvided: false, hasCustomShell: undefined, - hasShellInEnv: undefined + hasShellInEnv: undefined, }; setup(() => { @@ -67,7 +67,7 @@ suite('Shell Detectors', () => { expect(new VSCEnvironmentShellDetector(instance(appEnv)).priority).to.equal(3); expect(new SettingsShellDetector(instance(workspaceService), instance(platformService)).priority).to.equal(2); expect(new UserEnvironmentShellDetector(instance(currentProcess), instance(platformService)).priority).to.equal( - 1 + 1, ); }); test('Test identification of Terminal Shells (base class method)', async () => { @@ -75,7 +75,7 @@ suite('Shell Detectors', () => { shellPathsAndIdentification.forEach((shellType, shellPath) => { expect(shellDetector.identifyShellFromShellPath(shellPath)).to.equal( shellType, - `Incorrect Shell Type for path '${shellPath}'` + `Incorrect Shell Type for path '${shellPath}'`, ); }); }); @@ -84,13 +84,13 @@ suite('Shell Detectors', () => { shellPathsAndIdentification.forEach((shellType, shellPath) => { expect(shellDetector.identify(telemetryProperties, { name: shellPath } as any)).to.equal( shellType, - `Incorrect Shell Type for name '${shellPath}'` + `Incorrect Shell Type for name '${shellPath}'`, ); }); expect(shellDetector.identify(telemetryProperties, undefined)).to.equal( undefined, - 'Should be undefined when there is no temrinal' + 'Should be undefined when there is no temrinal', ); }); test('Identify shell based on VSC Environment', async () => { @@ -99,14 +99,14 @@ suite('Shell Detectors', () => { when(appEnv.shell).thenReturn(shellPath); expect(shellDetector.identify(telemetryProperties, { name: shellPath } as any)).to.equal( shellType, - `Incorrect Shell Type from identifyShellByTerminalName, for path '${shellPath}'` + `Incorrect Shell Type from identifyShellByTerminalName, for path '${shellPath}'`, ); }); when(appEnv.shell).thenReturn(undefined as any); expect(shellDetector.identify(telemetryProperties, undefined)).to.equal( undefined, - 'Should be undefined when vscode.env.shell is undefined' + 'Should be undefined when vscode.env.shell is undefined', ); }); test('Identify shell based on VSC Settings', async () => { @@ -116,7 +116,7 @@ suite('Shell Detectors', () => { shellDetector.getTerminalShellPath = () => shellPath; expect(shellDetector.identify(telemetryProperties, {} as any)).to.equal( shellType, - `Incorrect Shell Type for path '${shellPath}'` + `Incorrect Shell Type for path '${shellPath}'`, ); }); }); @@ -146,7 +146,7 @@ suite('Shell Detectors', () => { shellDetector.getDefaultPlatformShell = () => shellPath; expect(shellDetector.identify(telemetryProperties, {} as any)).to.equal( shellType, - `Incorrect Shell Type for path '${shellPath}'` + `Incorrect Shell Type for path '${shellPath}'`, ); }); }); diff --git a/src/test/common/terminals/synchronousTerminalService.unit.test.ts b/src/test/common/terminals/synchronousTerminalService.unit.test.ts index 082eeb1953ca..1239a880b180 100644 --- a/src/test/common/terminals/synchronousTerminalService.unit.test.ts +++ b/src/test/common/terminals/synchronousTerminalService.unit.test.ts @@ -107,8 +107,8 @@ suite('Terminal Service (synchronous)', () => { verify( terminalService.sendCommand( 'python', - deepEqual([isolated, shellExecFile, 'cmd', '1', '2', tmpFile.filePath.fileToCommandArgument()]) - ) + deepEqual([isolated, shellExecFile, 'cmd', '1', '2', tmpFile.filePath.fileToCommandArgument()]), + ), ).once(); }).timeout(1_000); test('run sendCommand in terminalService should complete when command completes', async () => { @@ -143,8 +143,8 @@ suite('Terminal Service (synchronous)', () => { verify( terminalService.sendCommand( 'python', - deepEqual([isolated, shellExecFile, 'cmd', '1', '2', tmpFile.filePath.fileToCommandArgument()]) - ) + deepEqual([isolated, shellExecFile, 'cmd', '1', '2', tmpFile.filePath.fileToCommandArgument()]), + ), ).once(); }).timeout(2_000); }); diff --git a/src/test/common/utils/async.unit.test.ts b/src/test/common/utils/async.unit.test.ts index 9202035a625f..14f7c3667043 100644 --- a/src/test/common/utils/async.unit.test.ts +++ b/src/test/common/utils/async.unit.test.ts @@ -303,7 +303,7 @@ suite('chain async iterators', () => { // We don't need anything special here. { value: 'foo' }, { value: 'bar' }, - { value: 'baz' } + { value: 'baz' }, ]; const it = (async function* () { yield* expected; diff --git a/src/test/common/utils/cacheUtils.unit.test.ts b/src/test/common/utils/cacheUtils.unit.test.ts index b6859a82342d..e9f14b23fb77 100644 --- a/src/test/common/utils/cacheUtils.unit.test.ts +++ b/src/test/common/utils/cacheUtils.unit.test.ts @@ -17,16 +17,16 @@ type CacheUtilsTestScenario = { const scenariosToTest: CacheUtilsTestScenario[] = [ { scenarioDesc: 'simple string', - dataToStore: 'hello' + dataToStore: 'hello', }, { scenarioDesc: 'undefined', - dataToStore: undefined + dataToStore: undefined, }, { scenarioDesc: 'object', - dataToStore: { date: new Date(), hello: 1234 } - } + dataToStore: { date: new Date(), hello: 1234 }, + }, ]; class TestInMemoryInterpreterSpecificCache extends InMemoryInterpreterSpecificCache< @@ -108,14 +108,14 @@ suite('Common Utils - CacheUtils', () => { }, inspect: () => { return { globalValue: pythonPath }; - } + }, }; }, getWorkspaceFolder: () => { return; - } + }, }, - Uri: Uri + Uri: Uri, } as any; } scenariosToTest.forEach((scenario: CacheUtilsTestScenario) => { @@ -181,21 +181,21 @@ suite('Common Utils - CacheUtils', () => { expect(cache.hasData).to.be.equal(true, 'Must have data after waiting for 10ms'); expect(cache.data).to.be.deep.equal( scenario.dataToStore, - 'Data should be intact and unchanged in cache after 10ms' + 'Data should be intact and unchanged in cache after 10ms', ); cache.simulatedElapsedMs = 50; expect(cache.hasData).to.be.equal(true, 'Must have data after waiting 50ms'); expect(cache.data).to.be.deep.equal( scenario.dataToStore, - 'Data should be intact and unchanged in cache after 50ms' + 'Data should be intact and unchanged in cache after 50ms', ); cache.simulatedElapsedMs = 110; expect(cache.hasData).to.be.equal(false, 'Must not have data after waiting 110ms'); expect(cache.data).to.be.deep.equal( undefined, - 'Must not have data stored after 100ms timeout expires.' + 'Must not have data stored after 100ms timeout expires.', ); }); test(`Data is stored in cache (with workspaces): ${scenario.scenarioDesc}`, () => { @@ -224,7 +224,7 @@ suite('Common Utils - CacheUtils', () => { 10000, [anotherResource], undefined, - vsc + vsc, ); expect(cache.hasData).to.be.equal(false, 'Must not have any data'); @@ -250,7 +250,7 @@ suite('Common Utils - CacheUtils', () => { 10000, [anotherResource], undefined, - vsc + vsc, ); expect(cache.hasData).to.be.equal(false, 'Must not have any data'); @@ -270,7 +270,7 @@ suite('Common Utils - CacheUtils', () => { const anotherResource = Uri.parse('b'); (vsc.workspace as any).workspaceFolders = [ { index: 0, name: '1', uri: Uri.parse('wkfolder1') }, - { index: 1, name: '2', uri: Uri.parse('wkfolder2') } + { index: 1, name: '2', uri: Uri.parse('wkfolder2') }, ]; vsc.workspace.getWorkspaceFolder = (res) => { const index = res.fsPath === resource.fsPath ? 0 : 1; @@ -282,7 +282,7 @@ suite('Common Utils - CacheUtils', () => { 10000, [anotherResource], undefined, - vsc + vsc, ); expect(cache.hasData).to.be.equal(false, 'Must not have any data'); diff --git a/src/test/common/utils/decorators.unit.test.ts b/src/test/common/utils/decorators.unit.test.ts index 8ff3c81c0ca6..f6562ece6458 100644 --- a/src/test/common/utils/decorators.unit.test.ts +++ b/src/test/common/utils/decorators.unit.test.ts @@ -103,7 +103,7 @@ suite('Common Utils - Decorators', function () { } expect(Math.abs(difference)).to.be.lessThan( expectedDelay * 0.05, - `Actual delay ${actualDelay}, expected delay ${expectedDelay}, not within 5% of accuracy` + `Actual delay ${actualDelay}, expected delay ${expectedDelay}, not within 5% of accuracy`, ); } // tslint:disable-next-line: max-classes-per-file diff --git a/src/test/common/utils/localize.functional.test.ts b/src/test/common/utils/localize.functional.test.ts index 9cb0f02ed540..e1e27762cc2c 100644 --- a/src/test/common/utils/localize.functional.test.ts +++ b/src/test/common/utils/localize.functional.test.ts @@ -55,7 +55,7 @@ suite('Localization', () => { assert.equal( val, 'Can you please take 2 minutes to tell us how the Python extension is working for you?', - 'LanguageService string doesnt match' + 'LanguageService string doesnt match', ); done(); }); @@ -72,7 +72,7 @@ suite('Localization', () => { test('key found for locale', (done) => { addLocale('spam', { 'debug.selectConfigurationTitle': '???', - 'Common.gotIt': '!!!' + 'Common.gotIt': '!!!', }); setLocale('spam'); @@ -86,7 +86,7 @@ suite('Localization', () => { test('key not found for locale (default used)', (done) => { addLocale('spam', { - 'debug.selectConfigurationTitle': '???' + 'debug.selectConfigurationTitle': '???', }); setLocale('spam'); diff --git a/src/test/common/utils/regexp.unit.test.ts b/src/test/common/utils/regexp.unit.test.ts index 26613230d7ac..3f886b655283 100644 --- a/src/test/common/utils/regexp.unit.test.ts +++ b/src/test/common/utils/regexp.unit.test.ts @@ -30,15 +30,15 @@ suite('Utils for regular expressions - verboseRegExp()', () => { [ `spam eggs`, - 'spameggs' + 'spameggs', ], // empty [' ', '(?:)'], [ ` `, - '(?:)' - ] + '(?:)', + ], ]; for (const [pat, expected] of whitespaceTests) { test(`whitespace removed ("${pat}")`, () => { @@ -61,7 +61,7 @@ suite('Utils for regular expressions - verboseRegExp()', () => { '', ` `, - ' ' + ' ', ]; for (const pat of emptyPatterns) { test(`no pattern ("${pat}")`, () => { diff --git a/src/test/common/utils/text.unit.test.ts b/src/test/common/utils/text.unit.test.ts index a26a1fbeadb0..178d2ba3b847 100644 --- a/src/test/common/utils/text.unit.test.ts +++ b/src/test/common/utils/text.unit.test.ts @@ -23,12 +23,12 @@ suite('parseRange()', () => { '1:3-', new Range( new Position(1, 3), - new Position(0, 0) // ??? - ) + new Position(0, 0), // ??? + ), ], ['1:3', new Range(new Position(1, 3), new Position(1, 3))], ['', new Range(new Position(0, 0), new Position(0, 0))], - ['3-1', new Range(new Position(3, 0), new Position(1, 0))] + ['3-1', new Range(new Position(3, 0), new Position(1, 0))], ]; for (const [raw, expected] of tests) { const result = parseRange(raw); @@ -64,7 +64,7 @@ suite('parseRange()', () => { 'a-b', 'a', 'a:1', - 'a:b' + 'a:b', ]; for (const raw of tests) { expect(() => parseRange(raw)).to.throw(); @@ -77,7 +77,7 @@ suite('parsePosition()', () => { const tests: [string, Position][] = [ ['1:5', new Position(1, 5)], ['1', new Position(1, 0)], - ['', new Position(0, 0)] + ['', new Position(0, 0)], ]; for (const [raw, expected] of tests) { const result = parsePosition(raw); diff --git a/src/test/common/utils/version.unit.test.ts b/src/test/common/utils/version.unit.test.ts index 2a2878dcd6eb..679e2f7b7524 100644 --- a/src/test/common/utils/version.unit.test.ts +++ b/src/test/common/utils/version.unit.test.ts @@ -10,7 +10,7 @@ import { ParseResult, parseVersionInfo, validateVersionInfo, - VersionInfo + VersionInfo, } from '../../../client/common/utils/version'; const NOT_USED = {}; @@ -27,7 +27,7 @@ function ver( minor: any = NOT_USED, micro: any = NOT_USED, // tslint:enable:no-any - unnormalized?: Unnormalized + unnormalized?: Unnormalized, ): VersionInfo { if (minor === NOT_USED) { minor = -1; @@ -39,7 +39,7 @@ function ver( major: (major as unknown) as number, minor: (minor as unknown) as number, micro: (micro as unknown) as number, - raw: undefined + raw: undefined, }; if (unnormalized !== undefined) { // tslint:disable-next-line:no-any @@ -59,12 +59,12 @@ function res( micro: number, // These are the remainder of the ParseResult: before: string, - after: string + after: string, ): ParseResult { return { before, after, - version: ver(major, minor, micro) + version: ver(major, minor, micro), }; } @@ -75,13 +75,13 @@ const VERSIONS: [VersionInfo, string][] = [ [ver(-1, -1, -1), ''], [ver(2, 7, 11), '2.7.11'], [ver(3, 11, 1), '3.11.1'], - [ver(0, 0, 0), '0.0.0'] + [ver(0, 0, 0), '0.0.0'], ]; const INVALID: VersionInfo[] = [ ver(undefined, undefined, undefined), ver(null, null, null), ver({}, {}, {}), - ver('x', 'y', 'z') + ver('x', 'y', 'z'), ]; suite('common utils - getVersionString', () => { @@ -101,7 +101,7 @@ suite('common utils - isVersionEmpty', () => { // normalization failed: ver(-1, -1, -1, unnorm('oops', 'uh-oh', "I've got a bad feeling about this")), // not normalized by still empty - ver(-10, -10, -10) + ver(-10, -10, -10), ].forEach((data: VersionInfo) => { const info = data; test(`empty: ${info}`, () => { @@ -119,7 +119,7 @@ suite('common utils - isVersionEmpty', () => { // 0 is not empty: ver(0, 0, 0), ver(0, 0, -1), - ver(0, -1, -1) + ver(0, -1, -1), ].forEach((data: VersionInfo) => { const info = data; test(`not empty: ${info.major}.${info.minor}.${info.micro}`, () => { @@ -186,7 +186,7 @@ suite('common utils - normalizeVersionInfo', () => { [ver(3, 4, '1'), ver(3, 4, 1)], [ver(3, 4, '0'), ver(3, 4, 0)], [ver(3, 4, '-1'), ver(3, 4, -1)], - [ver(3, 4, '-5'), ver(3, 4, -1)] + [ver(3, 4, '-5'), ver(3, 4, -1)], ].forEach((data) => { const [info, expected] = data; // tslint:disable-next-line:no-any @@ -209,7 +209,7 @@ suite('common utils - normalizeVersionInfo', () => { [ver(3, 4, ' '), unnorm('', '', 'string not numeric')], [ver(3, 4, 'foo'), unnorm('', '', 'string not numeric')], [ver(3, 4, {}), unnorm('', '', 'unsupported type')], - [ver(3, 4, []), unnorm('', '', 'unsupported type')] + [ver(3, 4, []), unnorm('', '', 'unsupported type')], ] as [VersionInfo, Unnormalized][]).forEach((data) => { const [info, unnormalized] = data; const expected = { ...info }; @@ -239,7 +239,7 @@ suite('common utils - validateVersionInfo', () => { ver(3, 4, -1), ver(3, -1, -1), // unnormalized but still valid: - ver(3, -7, -11) + ver(3, -7, -11), ].forEach((info) => { test(`as-is: [${info.major}, ${info.minor}, ${info.micro}]`, () => { validateVersionInfo(info); @@ -262,7 +262,7 @@ suite('common utils - validateVersionInfo', () => { ver(-1, 4, -1), ver(-1, 4, 5), // missing minor: - ver(3, -1, 5) + ver(3, -1, 5), ].forEach((info) => { test(`missing parts: [${info.major}.${info.minor}.${info.micro}]`, () => { assert.throws(() => validateVersionInfo(info)); @@ -274,7 +274,7 @@ suite('common utils - validateVersionInfo', () => { 'string not numeric', 'missing', 'unsupported type', - 'oops!' + 'oops!', ].forEach((errMsg) => { const raw = unnorm('', '', errMsg); const info = ver(3, 4, -1, raw); @@ -300,7 +300,7 @@ suite('common utils - parseVersionInfo', () => { '2.b7', '2-b.7', '2.7rc1', - '' + '', ]; for (const verStr of BOGUS) { test(`invalid - '${verStr}'`, () => { @@ -327,12 +327,12 @@ suite('common utils - parseVersionInfo', () => { ['3.8.1-alpha2', res(3, 8, 1, '', '-alpha2')], [ '3.7.5 (default, Nov 7 2019, 10:50:52) \\n[GCC 8.3.0]', - res(3, 7, 5, '', ' (default, Nov 7 2019, 10:50:52) \\n[GCC 8.3.0]') + res(3, 7, 5, '', ' (default, Nov 7 2019, 10:50:52) \\n[GCC 8.3.0]'), ], ['python2', res(2, -1, -1, 'python', '')], // without the "before" the following won't match. ['python2.a', res(2, -1, -1, 'python', '.a')], - ['python2.b7', res(2, -1, -1, 'python', '.b7')] + ['python2.b7', res(2, -1, -1, 'python', '.b7')], ] as [string, ParseResult][]).forEach((data) => { const [verStr, result] = data; if (verStr === '') { diff --git a/src/test/common/utils/workerPool.functional.test.ts b/src/test/common/utils/workerPool.functional.test.ts index 310d174aaeea..04039e9b5518 100644 --- a/src/test/common/utils/workerPool.functional.test.ts +++ b/src/test/common/utils/workerPool.functional.test.ts @@ -56,7 +56,7 @@ suite('Process Queue', () => { assert.deepEqual(reasons, [ Error('Queue stopped processing'), Error('Queue stopped processing'), - Error('Queue stopped processing') + Error('Queue stopped processing'), ]); }); diff --git a/src/test/common/variables/envVarsProvider.multiroot.test.ts b/src/test/common/variables/envVarsProvider.multiroot.test.ts index 127b91e48ca5..a00858b53891 100644 --- a/src/test/common/variables/envVarsProvider.multiroot.test.ts +++ b/src/test/common/variables/envVarsProvider.multiroot.test.ts @@ -55,11 +55,11 @@ suite('Multiroot Environment Variables Provider', () => { when(mockEnvironmentActivationService.getActivatedEnvironmentVariables(anything())).thenResolve(); when(mockEnvironmentActivationService.getActivatedEnvironmentVariables(anything(), anything())).thenResolve(); when( - mockEnvironmentActivationService.getActivatedEnvironmentVariables(anything(), anything(), anything()) + mockEnvironmentActivationService.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thenResolve(); ioc.serviceManager.rebindInstance( IEnvironmentActivationService, - instance(mockEnvironmentActivationService) + instance(mockEnvironmentActivationService), ); clearCache(); return initializeTest(); @@ -90,7 +90,7 @@ suite('Multiroot Environment Variables Provider', () => { workspaceService, cfgService, mockProcess, - ioc.serviceContainer + ioc.serviceContainer, ); } @@ -135,7 +135,7 @@ suite('Multiroot Environment Variables Provider', () => { // On CI, it was seen that processVariable[variable] can contain spaces at the end, which causes tests to fail. So trim the strings before comparing. expect(vars[variable]?.trim()).to.equal( processVariables[variable]?.trim(), - 'Value of the variable is incorrect' + 'Value of the variable is incorrect', ); }); }); diff --git a/src/test/common/variables/envVarsService.test.ts b/src/test/common/variables/envVarsService.test.ts index dbacdb4887fe..f217c6410095 100644 --- a/src/test/common/variables/envVarsService.test.ts +++ b/src/test/common/variables/envVarsService.test.ts @@ -76,7 +76,7 @@ suite('Environment Variables Service', () => { test('Simple variable substitution is supported', async () => { const vars = await variablesService.parseFile(path.join(envFilesFolderPath, '.env6'), { - BINDIR: '/usr/bin' + BINDIR: '/usr/bin', }); expect(vars).to.not.equal(undefined, 'Variables is undefiend'); @@ -85,7 +85,7 @@ suite('Environment Variables Service', () => { expect(vars).to.have.property( 'PYTHONPATH', '/home/user/git/foobar/foo:/home/user/git/foobar/bar', - 'value is invalid' + 'value is invalid', ); expect(vars).to.have.property('PYTHON', '/usr/bin/python3', 'value is invalid'); }); diff --git a/src/test/common/variables/envVarsService.unit.test.ts b/src/test/common/variables/envVarsService.unit.test.ts index 0e1ae863478d..dc1445af8cc7 100644 --- a/src/test/common/variables/envVarsService.unit.test.ts +++ b/src/test/common/variables/envVarsService.unit.test.ts @@ -18,7 +18,7 @@ use(chaiAsPromised); type PathVar = 'Path' | 'PATH'; const PATHS = [ 'Path', // Windows - 'PATH' // non-Windows + 'PATH', // non-Windows ]; suite('Environment Variables Service', () => { @@ -32,7 +32,7 @@ suite('Environment Variables Service', () => { variablesService = new EnvironmentVariablesService( // This is the only place that the mocks are used. pathUtils.object, - fs.object + fs.object, ); }); function verifyAll() { @@ -91,7 +91,7 @@ suite('Environment Variables Service', () => { ` X1234PYEXTUNITTESTVAR=1234 PYTHONPATH=../workspace5 - ` + `, ); const vars = await variablesService.parseFile(filename); @@ -117,7 +117,7 @@ PYTHONPATH=/usr/one/three:/usr/one/four PATH=/usr/x:/usr/y # Windows Path variable Path=/usr/x:/usr/y - ` + `, ); const vars = await variablesService.parseFile(filename); @@ -140,7 +140,7 @@ Path=/usr/x:/usr/y REPO=/home/user/git/foobar\n\ PYTHONPATH=${REPO}/foo:${REPO}/bar\n\ PYTHON=${BINDIR}/python3\n\ - ' + ', // tslint:enable:no-invalid-template-strings ); @@ -152,7 +152,7 @@ PYTHON=${BINDIR}/python3\n\ expect(vars).to.have.property( 'PYTHONPATH', '/home/user/git/foobar/foo:/home/user/git/foobar/bar', - 'value is invalid' + 'value is invalid', ); expect(vars).to.have.property('PYTHON', '/usr/bin/python3', 'value is invalid'); verifyAll(); @@ -333,7 +333,7 @@ PYTHON=${BINDIR}/python3\n\ expect(vars).to.have.property( 'PYTHONPATH', `PYTHONPATH${path.delimiter}${pathToAppend}`, - 'Incorrect value' + 'Incorrect value', ); verifyAll(); }); @@ -520,7 +520,7 @@ EGGS=9012 # ... '\ REPO=/home/user/git/foobar \n\ PYTHONPATH=${REPO}/foo:${REPO}/bar \n\ - ' + ', ); expect(vars).to.not.equal(undefined, 'Variables is undefiend'); @@ -529,7 +529,7 @@ PYTHONPATH=${REPO}/foo:${REPO}/bar \n\ expect(vars).to.have.property( 'PYTHONPATH', '/home/user/git/foobar/foo:/home/user/git/foobar/bar', - 'value is invalid' + 'value is invalid', ); }); @@ -557,7 +557,7 @@ abcEGGSxyz=!!! \n\ HAM2="-- ${abc${SPAM}xyz} --"\n\ HAM3="-- ${${SPAM} --"\n\ HAM4="-- ${${SPAM}} ${EGGS} --"\n\ - ' + ', ); expect(vars).to.not.equal(undefined, 'Variables is undefiend'); @@ -581,7 +581,7 @@ HAM1=${} \n\ HAM2=${ \n\ HAM3=${SPAM+EGGS} \n\ HAM4=$SPAM \n\ - ' + ', ); expect(vars).to.not.equal(undefined, 'Variables is undefiend'); @@ -601,7 +601,7 @@ HAM4=$SPAM \n\ REPO=/home/user/git/foobar \n\ PYTHONPATH=${REPO}/foo \n\ PYTHONPATH=${PYTHONPATH}:${REPO}/bar \n\ - ' + ', ); expect(vars).to.not.equal(undefined, 'Variables is undefiend'); @@ -610,7 +610,7 @@ PYTHONPATH=${PYTHONPATH}:${REPO}/bar \n\ expect(vars).to.have.property( 'PYTHONPATH', '/home/user/git/foobar/foo:/home/user/git/foobar/bar', - 'value is invalid' + 'value is invalid', ); }); @@ -621,7 +621,7 @@ PYTHONPATH=${PYTHONPATH}:${REPO}/bar \n\ SPAM=1234 \n\ EGGS=\\${SPAM}/foo:\\${SPAM}/bar \n\ HAM=$ ... $$ \n\ - ' + ', ); expect(vars).to.not.equal(undefined, 'Variables is undefiend'); @@ -636,7 +636,7 @@ HAM=$ ... $$ \n\ const vars = parseEnvFile('\ PYTHONPATH=${REPO}/foo:${REPO}/bar \n\ ', { - REPO: '/home/user/git/foobar' + REPO: '/home/user/git/foobar', }); expect(vars).to.not.equal(undefined, 'Variables is undefiend'); @@ -644,7 +644,7 @@ PYTHONPATH=${REPO}/foo:${REPO}/bar \n\ expect(vars).to.have.property( 'PYTHONPATH', '/home/user/git/foobar/foo:/home/user/git/foobar/bar', - 'value is invalid' + 'value is invalid', ); }); diff --git a/src/test/common/variables/environmentVariablesProvider.unit.test.ts b/src/test/common/variables/environmentVariablesProvider.unit.test.ts index 5faa09400240..d8982d0c0a88 100644 --- a/src/test/common/variables/environmentVariablesProvider.unit.test.ts +++ b/src/test/common/variables/environmentVariablesProvider.unit.test.ts @@ -56,7 +56,7 @@ suite('Multiroot Environment Variables Provider', () => { instance(workspace), instance(configuration), instance(currentProcess), - instance(serviceContainer) + instance(serviceContainer), ); sinon.stub(EnvFileTelemetry, 'sendFileCreationTelemetry').returns(); @@ -79,7 +79,7 @@ suite('Multiroot Environment Variables Provider', () => { const changedEvent: ConfigurationChangeEvent = { affectsConfiguration(setting: string, uri?: Uri) { return setting === 'python.envFile' && uri!.fsPath === workspaceFolder1Uri.fsPath; - } + }, }; provider.configurationChanged(changedEvent); @@ -96,7 +96,7 @@ suite('Multiroot Environment Variables Provider', () => { const changedEvent: ConfigurationChangeEvent = { affectsConfiguration(_setting: string, _uri?: Uri) { return false; - } + }, }; provider.configurationChanged(changedEvent); @@ -109,7 +109,7 @@ suite('Multiroot Environment Variables Provider', () => { const changedEvent: ConfigurationChangeEvent = { affectsConfiguration(_setting: string, _uri?: Uri) { return true; - } + }, }; provider.configurationChanged(changedEvent); @@ -312,7 +312,7 @@ suite('Multiroot Environment Variables Provider', () => { instance(configuration), instance(currentProcess), instance(serviceContainer), - 100 + 100, ); const vars = await provider.getEnvironmentVariables(workspaceUri); diff --git a/src/test/common/variables/serviceRegistry.unit.test.ts b/src/test/common/variables/serviceRegistry.unit.test.ts index 55a3bbc2f2a4..541579c609f7 100644 --- a/src/test/common/variables/serviceRegistry.unit.test.ts +++ b/src/test/common/variables/serviceRegistry.unit.test.ts @@ -23,14 +23,14 @@ suite('Common variables Service Registry', () => { verify( serviceManager.addSingleton( IEnvironmentVariablesService, - EnvironmentVariablesService - ) + EnvironmentVariablesService, + ), ).once(); verify( serviceManager.addSingleton( IEnvironmentVariablesProvider, - EnvironmentVariablesProvider - ) + EnvironmentVariablesProvider, + ), ).once(); }); }); diff --git a/src/test/configuration/interpreterSelector/commands/resetInterpreter.unit.test.ts b/src/test/configuration/interpreterSelector/commands/resetInterpreter.unit.test.ts index 1e247f71a9ba..c1273ba0f864 100644 --- a/src/test/configuration/interpreterSelector/commands/resetInterpreter.unit.test.ts +++ b/src/test/configuration/interpreterSelector/commands/resetInterpreter.unit.test.ts @@ -30,7 +30,7 @@ suite('Reset Interpreter Command', () => { pythonPathUpdater.object, commandManager.object, appShell.object, - workspace.object + workspace.object, ); }); @@ -45,8 +45,8 @@ suite('Reset Interpreter Command', () => { TypeMoq.It.isValue(undefined), TypeMoq.It.isValue(ConfigurationTarget.Global), TypeMoq.It.isValue('ui'), - TypeMoq.It.isValue(undefined) - ) + TypeMoq.It.isValue(undefined), + ), ) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.once()); @@ -68,8 +68,8 @@ suite('Reset Interpreter Command', () => { TypeMoq.It.isValue(undefined), TypeMoq.It.isValue(ConfigurationTarget.WorkspaceFolder), TypeMoq.It.isValue('ui'), - TypeMoq.It.isValue(folder.uri) - ) + TypeMoq.It.isValue(folder.uri), + ), ) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.once()); @@ -86,17 +86,17 @@ suite('Reset Interpreter Command', () => { { label: 'one', description: path.dirname(folder1.uri.fsPath), - uri: folder1.uri + uri: folder1.uri, }, { label: 'two', description: path.dirname(folder2.uri.fsPath), - uri: folder2.uri + uri: folder2.uri, }, { label: Interpreters.entireWorkspace(), - uri: folder1.uri - } + uri: folder1.uri, + }, ]; appShell .setup((s) => s.showQuickPick(TypeMoq.It.isValue(expectedItems), TypeMoq.It.isAny())) @@ -104,8 +104,8 @@ suite('Reset Interpreter Command', () => { Promise.resolve({ label: 'two', description: path.dirname(folder2.uri.fsPath), - uri: folder2.uri - }) + uri: folder2.uri, + }), ) .verifiable(TypeMoq.Times.once()); pythonPathUpdater @@ -114,8 +114,8 @@ suite('Reset Interpreter Command', () => { TypeMoq.It.isValue(undefined), TypeMoq.It.isValue(ConfigurationTarget.WorkspaceFolder), TypeMoq.It.isValue('ui'), - TypeMoq.It.isValue(folder2.uri) - ) + TypeMoq.It.isValue(folder2.uri), + ), ) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.once()); @@ -132,25 +132,25 @@ suite('Reset Interpreter Command', () => { { label: 'one', description: path.dirname(folder1.uri.fsPath), - uri: folder1.uri + uri: folder1.uri, }, { label: 'two', description: path.dirname(folder2.uri.fsPath), - uri: folder2.uri + uri: folder2.uri, }, { label: Interpreters.entireWorkspace(), - uri: folder1.uri - } + uri: folder1.uri, + }, ]; appShell .setup((s) => s.showQuickPick(TypeMoq.It.isValue(expectedItems), TypeMoq.It.isAny())) .returns(() => Promise.resolve({ label: Interpreters.entireWorkspace(), - uri: folder1.uri - }) + uri: folder1.uri, + }), ) .verifiable(TypeMoq.Times.once()); pythonPathUpdater @@ -159,8 +159,8 @@ suite('Reset Interpreter Command', () => { TypeMoq.It.isValue(undefined), TypeMoq.It.isValue(ConfigurationTarget.Workspace), TypeMoq.It.isValue('ui'), - TypeMoq.It.isValue(folder1.uri) - ) + TypeMoq.It.isValue(folder1.uri), + ), ) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.once()); @@ -178,17 +178,17 @@ suite('Reset Interpreter Command', () => { { label: 'one', description: path.dirname(folder1.uri.fsPath), - uri: folder1.uri + uri: folder1.uri, }, { label: 'two', description: path.dirname(folder2.uri.fsPath), - uri: folder2.uri + uri: folder2.uri, }, { label: Interpreters.entireWorkspace(), - uri: folder1.uri - } + uri: folder1.uri, + }, ]; appShell @@ -197,7 +197,7 @@ suite('Reset Interpreter Command', () => { .verifiable(TypeMoq.Times.once()); pythonPathUpdater .setup((p) => - p.updatePythonPath(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + p.updatePythonPath(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.never()); diff --git a/src/test/configuration/interpreterSelector/commands/setInterpreter.unit.test.ts b/src/test/configuration/interpreterSelector/commands/setInterpreter.unit.test.ts index 64928d8fe24d..82ea85aefa5b 100644 --- a/src/test/configuration/interpreterSelector/commands/setInterpreter.unit.test.ts +++ b/src/test/configuration/interpreterSelector/commands/setInterpreter.unit.test.ts @@ -15,12 +15,12 @@ import { InterpreterQuickPickList, Interpreters } from '../../../../client/commo import { IMultiStepInput, IMultiStepInputFactory } from '../../../../client/common/utils/multiStepInput'; import { InterpreterStateArgs, - SetInterpreterCommand + SetInterpreterCommand, } from '../../../../client/interpreter/configuration/interpreterSelector/commands/setInterpreter'; import { IInterpreterQuickPickItem, IInterpreterSelector, - IPythonPathUpdaterServiceManager + IPythonPathUpdaterServiceManager, } from '../../../../client/interpreter/configuration/types'; // tslint:disable-next-line:max-func-body-length @@ -61,7 +61,7 @@ suite('Set Interpreter Command', () => { multiStepInputFactory.object, platformService.object, interpreterSelector.object, - workspace.object + workspace.object, ); }); @@ -78,18 +78,18 @@ suite('Set Interpreter Command', () => { label: '', path: 'This is the selected Python path', // tslint:disable-next-line: no-any - interpreter: {} as any + interpreter: {} as any, }; const expectedEnterInterpreterPathSuggestion = { label: InterpreterQuickPickList.enterPath.label(), detail: InterpreterQuickPickList.enterPath.detail(), - alwaysShow: true + alwaysShow: true, }; const currentPythonPath = 'python'; setup(() => { _enterOrBrowseInterpreterPath = sinon.stub( SetInterpreterCommand.prototype, - '_enterOrBrowseInterpreterPath' + '_enterOrBrowseInterpreterPath', ); _enterOrBrowseInterpreterPath.resolves(); interpreterSelector @@ -105,7 +105,7 @@ suite('Set Interpreter Command', () => { multiStepInputFactory.object, platformService.object, interpreterSelector.object, - workspace.object + workspace.object, ); }); teardown(() => { @@ -134,7 +134,7 @@ suite('Set Interpreter Command', () => { items: suggestions, activeItem: item, matchOnDetail: true, - matchOnDescription: true + matchOnDescription: true, }; multiStepInput .setup((i) => i.showQuickPick(expectedParameters)) @@ -173,8 +173,8 @@ suite('Set Interpreter Command', () => { assert( _enterOrBrowseInterpreterPath.calledOnceWith(multiStepInput.object, { path: undefined, - workspace: undefined - }) + workspace: undefined, + }), ); }); }); @@ -183,13 +183,13 @@ suite('Set Interpreter Command', () => { const items: QuickPickItem[] = [ { label: InterpreterQuickPickList.browsePath.label(), - detail: InterpreterQuickPickList.browsePath.detail() - } + detail: InterpreterQuickPickList.browsePath.detail(), + }, ]; const expectedParameters = { placeholder: InterpreterQuickPickList.enterPath.placeholder(), items, - acceptFilterBoxTextAsSelection: true + acceptFilterBoxTextAsSelection: true, }; test('Picker should be displayed with expected items', async () => { @@ -245,7 +245,7 @@ suite('Set Interpreter Command', () => { filters: filtersObject, openLabel: InterpreterQuickPickList.browsePath.openButtonLabel(), canSelectMany: false, - title: InterpreterQuickPickList.browsePath.title() + title: InterpreterQuickPickList.browsePath.title(), }; const multiStepInput = TypeMoq.Mock.ofType>(); multiStepInput @@ -270,7 +270,7 @@ suite('Set Interpreter Command', () => { filters: undefined, openLabel: InterpreterQuickPickList.browsePath.openButtonLabel(), canSelectMany: false, - title: InterpreterQuickPickList.browsePath.title() + title: InterpreterQuickPickList.browsePath.title(), }; multiStepInput .setup((i) => i.showQuickPick(TypeMoq.It.isAny())) @@ -294,7 +294,7 @@ suite('Set Interpreter Command', () => { label: '', path: 'This is the selected Python path', // tslint:disable-next-line: no-any - interpreter: {} as any + interpreter: {} as any, }; workspace.setup((w) => w.workspaceFolders).returns(() => undefined); @@ -305,7 +305,7 @@ suite('Set Interpreter Command', () => { run: (_: any, state: InterpreterStateArgs) => { state.path = selectedItem.path; return Promise.resolve(); - } + }, }; multiStepInputFactory .setup((f) => f.create()) @@ -317,8 +317,8 @@ suite('Set Interpreter Command', () => { TypeMoq.It.isValue(selectedItem.path), TypeMoq.It.isValue(ConfigurationTarget.Global), TypeMoq.It.isValue('ui'), - TypeMoq.It.isValue(undefined) - ) + TypeMoq.It.isValue(undefined), + ), ) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.once()); @@ -337,7 +337,7 @@ suite('Set Interpreter Command', () => { label: '', path: 'This is the selected Python path', // tslint:disable-next-line: no-any - interpreter: {} as any + interpreter: {} as any, }; const folder = { name: 'one', uri: Uri.parse('one'), index: 0 }; @@ -350,7 +350,7 @@ suite('Set Interpreter Command', () => { run: (_: any, state: InterpreterStateArgs) => { state.path = selectedItem.path; return Promise.resolve(); - } + }, }; multiStepInputFactory .setup((f) => f.create()) @@ -363,8 +363,8 @@ suite('Set Interpreter Command', () => { TypeMoq.It.isValue(selectedItem.path), TypeMoq.It.isValue(ConfigurationTarget.WorkspaceFolder), TypeMoq.It.isValue('ui'), - TypeMoq.It.isValue(folder.uri) - ) + TypeMoq.It.isValue(folder.uri), + ), ) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.once()); @@ -382,7 +382,7 @@ suite('Set Interpreter Command', () => { label: '', path: 'This is the selected Python path', // tslint:disable-next-line: no-any - interpreter: {} as any + interpreter: {} as any, }; workspace.setup((w) => w.workspaceFolders).returns(() => [folder1, folder2]); @@ -390,17 +390,17 @@ suite('Set Interpreter Command', () => { { label: 'one', description: path.dirname(folder1.uri.fsPath), - uri: folder1.uri + uri: folder1.uri, }, { label: 'two', description: path.dirname(folder2.uri.fsPath), - uri: folder2.uri + uri: folder2.uri, }, { label: Interpreters.entireWorkspace(), - uri: folder1.uri - } + uri: folder1.uri, + }, ]; interpreterSelector.setup((i) => i.getSuggestions(TypeMoq.It.isAny())).returns(() => Promise.resolve([])); @@ -410,7 +410,7 @@ suite('Set Interpreter Command', () => { run: (_: any, state: InterpreterStateArgs) => { state.path = selectedItem.path; return Promise.resolve(); - } + }, }; multiStepInputFactory .setup((f) => f.create()) @@ -422,8 +422,8 @@ suite('Set Interpreter Command', () => { Promise.resolve({ label: 'two', description: path.dirname(folder2.uri.fsPath), - uri: folder2.uri - }) + uri: folder2.uri, + }), ) .verifiable(TypeMoq.Times.once()); pythonPathUpdater @@ -432,8 +432,8 @@ suite('Set Interpreter Command', () => { TypeMoq.It.isValue(selectedItem.path), TypeMoq.It.isValue(ConfigurationTarget.WorkspaceFolder), TypeMoq.It.isValue('ui'), - TypeMoq.It.isValue(folder2.uri) - ) + TypeMoq.It.isValue(folder2.uri), + ), ) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.once()); @@ -452,7 +452,7 @@ suite('Set Interpreter Command', () => { label: '', path: 'This is the selected Python path', // tslint:disable-next-line: no-any - interpreter: {} as any + interpreter: {} as any, }; workspace.setup((w) => w.workspaceFolders).returns(() => [folder1, folder2]); @@ -460,17 +460,17 @@ suite('Set Interpreter Command', () => { { label: 'one', description: path.dirname(folder1.uri.fsPath), - uri: folder1.uri + uri: folder1.uri, }, { label: 'two', description: path.dirname(folder2.uri.fsPath), - uri: folder2.uri + uri: folder2.uri, }, { label: Interpreters.entireWorkspace(), - uri: folder1.uri - } + uri: folder1.uri, + }, ]; interpreterSelector @@ -481,7 +481,7 @@ suite('Set Interpreter Command', () => { run: (_: any, state: InterpreterStateArgs) => { state.path = selectedItem.path; return Promise.resolve(); - } + }, }; multiStepInputFactory .setup((f) => f.create()) @@ -492,8 +492,8 @@ suite('Set Interpreter Command', () => { .returns(() => Promise.resolve({ label: Interpreters.entireWorkspace(), - uri: folder1.uri - }) + uri: folder1.uri, + }), ) .verifiable(TypeMoq.Times.once()); pythonPathUpdater @@ -502,8 +502,8 @@ suite('Set Interpreter Command', () => { TypeMoq.It.isValue(selectedItem.path), TypeMoq.It.isValue(ConfigurationTarget.Workspace), TypeMoq.It.isValue('ui'), - TypeMoq.It.isValue(folder1.uri) - ) + TypeMoq.It.isValue(folder1.uri), + ), ) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.once()); @@ -527,17 +527,17 @@ suite('Set Interpreter Command', () => { { label: 'one', description: path.dirname(folder1.uri.fsPath), - uri: folder1.uri + uri: folder1.uri, }, { label: 'two', description: path.dirname(folder2.uri.fsPath), - uri: folder2.uri + uri: folder2.uri, }, { label: Interpreters.entireWorkspace(), - uri: folder1.uri - } + uri: folder1.uri, + }, ]; appShell @@ -546,7 +546,7 @@ suite('Set Interpreter Command', () => { .verifiable(TypeMoq.Times.once()); pythonPathUpdater .setup((p) => - p.updatePythonPath(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + p.updatePythonPath(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.never()); @@ -569,7 +569,7 @@ suite('Set Interpreter Command', () => { multiStepInputFactory.object, platformService.object, interpreterSelector.object, - workspace.object + workspace.object, ); let inputStep!: Function; pythonSettings.setup((p) => p.pythonPath).returns(() => 'python'); @@ -579,7 +579,7 @@ suite('Set Interpreter Command', () => { label: '', path: 'This is the selected Python path', // tslint:disable-next-line: no-any - interpreter: {} as any + interpreter: {} as any, }; workspace.setup((w) => w.workspaceFolders).returns(() => undefined); @@ -591,7 +591,7 @@ suite('Set Interpreter Command', () => { inputStep = inputStepArg; state.path = selectedItem.path; return Promise.resolve(); - } + }, }; multiStepInputFactory .setup((f) => f.create()) @@ -603,8 +603,8 @@ suite('Set Interpreter Command', () => { TypeMoq.It.isValue(selectedItem.path), TypeMoq.It.isValue(ConfigurationTarget.Global), TypeMoq.It.isValue('ui'), - TypeMoq.It.isValue(undefined) - ) + TypeMoq.It.isValue(undefined), + ), ) .returns(() => Promise.resolve()); diff --git a/src/test/configuration/interpreterSelector/interpreterSelector.unit.test.ts b/src/test/configuration/interpreterSelector/interpreterSelector.unit.test.ts index 020f8e6544da..327ae56c85e7 100644 --- a/src/test/configuration/interpreterSelector/interpreterSelector.unit.test.ts +++ b/src/test/configuration/interpreterSelector/interpreterSelector.unit.test.ts @@ -25,7 +25,7 @@ const info: PythonEnvironment = { envType: EnvironmentType.Unknown, version: new SemVer('1.0.0-alpha'), sysPrefix: '', - sysVersion: '' + sysVersion: '', }; class InterpreterQuickPickItem implements IInterpreterQuickPickItem { @@ -54,7 +54,7 @@ suite('Interpreters - selector', () => { // tslint:disable-next-line:no-unnecessary-override public async suggestionToQuickPickItem( suggestion: PythonEnvironment, - workspaceUri?: Uri + workspaceUri?: Uri, ): Promise { return super.suggestionToQuickPickItem(suggestion, workspaceUri); } @@ -82,7 +82,7 @@ suite('Interpreters - selector', () => { comparer.object, experimentsManager.object, interpreterSecurityService.object, - new PathUtils(false) + new PathUtils(false), ); }); @@ -93,7 +93,7 @@ suite('Interpreters - selector', () => { comparer.object, experimentsManager.object, interpreterSecurityService.object, - new PathUtils(isWindows) + new PathUtils(isWindows), ); const initial: PythonEnvironment[] = [ @@ -102,7 +102,7 @@ suite('Interpreters - selector', () => { { displayName: '2', path: 'c:/path2/path2', envType: EnvironmentType.Unknown }, { displayName: '2 (virtualenv)', path: 'c:/path2/path2', envType: EnvironmentType.VirtualEnv }, { displayName: '3', path: 'c:/path2/path2', envType: EnvironmentType.Unknown }, - { displayName: '4', path: 'c:/path4/path4', envType: EnvironmentType.Conda } + { displayName: '4', path: 'c:/path4/path4', envType: EnvironmentType.Conda }, ].map((item) => { return { ...info, ...item }; }); @@ -118,7 +118,7 @@ suite('Interpreters - selector', () => { new InterpreterQuickPickItem('2', 'c:/path2/path2'), new InterpreterQuickPickItem('2 (virtualenv)', 'c:/path2/path2'), new InterpreterQuickPickItem('3', 'c:/path2/path2'), - new InterpreterQuickPickItem('4', 'c:/path4/path4') + new InterpreterQuickPickItem('4', 'c:/path4/path4'), ]; assert.equal(actual.length, expected.length, 'Suggestion lengths are different.'); @@ -126,12 +126,12 @@ suite('Interpreters - selector', () => { assert.equal( actual[i].label, expected[i].label, - `Suggestion label is different at ${i}: exected '${expected[i].label}', found '${actual[i].label}'.` + `Suggestion label is different at ${i}: exected '${expected[i].label}', found '${actual[i].label}'.`, ); assert.equal( actual[i].path, expected[i].path, - `Suggestion path is different at ${i}: exected '${expected[i].path}', found '${actual[i].path}'.` + `Suggestion path is different at ${i}: exected '${expected[i].path}', found '${actual[i].path}'.`, ); } }); diff --git a/src/test/constants.ts b/src/test/constants.ts index 2e255ecec9d5..eaf1ff1e1d80 100644 --- a/src/test/constants.ts +++ b/src/test/constants.ts @@ -38,5 +38,5 @@ export const SMOKE_TEST_EXTENSIONS_DIR = path.join( EXTENSION_ROOT_DIR_FOR_TESTS, 'tmp', 'ext', - 'smokeTestExtensionsFolder' + 'smokeTestExtensionsFolder', ); diff --git a/src/test/debugger/common/protocolparser.test.ts b/src/test/debugger/common/protocolparser.test.ts index bb291ebd172a..117a58a7bc66 100644 --- a/src/test/debugger/common/protocolparser.test.ts +++ b/src/test/debugger/common/protocolparser.test.ts @@ -26,12 +26,12 @@ suite('Debugging - Protocol Parser', () => { }); stream.write( - 'Content-Length: 289\r\n\r\n{"command":"initialize","arguments":{"clientID":"vscode","adapterID":"pythonExperiment","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us"},"type":"request","seq":1}' + 'Content-Length: 289\r\n\r\n{"command":"initialize","arguments":{"clientID":"vscode","adapterID":"pythonExperiment","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us"},"type":"request","seq":1}', ); await expect(requestDetected).to.eventually.equal(true, 'request not parsed'); stream.write( - 'Content-Length: 265\r\n\r\n{"seq":1,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsEvaluateForHovers":false,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsSetVariable":true}}' + 'Content-Length: 265\r\n\r\n{"seq":1,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsEvaluateForHovers":false,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsSetVariable":true}}', ); await expect(responseDetected).to.eventually.equal(true, 'response not parsed'); @@ -51,7 +51,7 @@ suite('Debugging - Protocol Parser', () => { protocolParser.on('request_initialize', () => resolve(true)); }); stream.write( - 'Content-Length: 289\r\n\r\n{"command":"initialize","arguments":{"clientID":"vscode","adapterID":"pythonExperiment","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us"},"type":"request","seq":1}' + 'Content-Length: 289\r\n\r\n{"command":"initialize","arguments":{"clientID":"vscode","adapterID":"pythonExperiment","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us"},"type":"request","seq":1}', ); await expect(requestDetected).to.eventually.equal(true, 'request not parsed'); @@ -61,7 +61,7 @@ suite('Debugging - Protocol Parser', () => { protocolParser.on('response_initialize', () => responseDetected.resolve(true)); stream.write( - 'Content-Length: 265\r\n\r\n{"seq":1,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsEvaluateForHovers":false,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsSetVariable":true}}' + 'Content-Length: 265\r\n\r\n{"seq":1,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsEvaluateForHovers":false,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsSetVariable":true}}', ); // Wait for messages to go through and get parsed (unnecenssary, but add for testing edge cases). await sleep(1000); diff --git a/src/test/debugger/envVars.test.ts b/src/test/debugger/envVars.test.ts index 37eedf8d316d..c1cfebfaed35 100644 --- a/src/test/debugger/envVars.test.ts +++ b/src/test/debugger/envVars.test.ts @@ -11,7 +11,7 @@ import { ICurrentProcess, IPathUtils } from '../../client/common/types'; import { IEnvironmentVariablesService } from '../../client/common/variables/types'; import { DebugEnvironmentVariablesHelper, - IDebugEnvironmentVariablesService + IDebugEnvironmentVariablesService, } from '../../client/debugger/extension/configuration/resolvers/helper'; import { ConsoleType, LaunchRequestArguments } from '../../client/debugger/types'; import { isOs, OSType } from '../common'; @@ -63,7 +63,7 @@ suite('Resolving Environment Variables when Debugging', () => { pythonPath: '', args: [], envFile: '', - console + console, // tslint:disable-next-line:no-any } as any) as LaunchRequestArguments; @@ -106,7 +106,7 @@ suite('Resolving Environment Variables when Debugging', () => { args: [], envFile: '', console, - env + env, // tslint:disable-next-line:no-any } as any) as LaunchRequestArguments; @@ -148,7 +148,7 @@ suite('Resolving Environment Variables when Debugging', () => { async function testAppendingOfPaths( console: ConsoleType, expectedNumberOfVariables: number, - removePythonPath: boolean + removePythonPath: boolean, ) { if (removePythonPath && mockProcess.env.PYTHONPATH !== undefined) { delete mockProcess.env.PYTHONPATH; @@ -173,7 +173,7 @@ suite('Resolving Environment Variables when Debugging', () => { args: [], envFile: '', console, - env + env, } as any) as LaunchRequestArguments; const envVars = await debugEnvParser.getEnvironmentVariables(args); @@ -207,7 +207,7 @@ suite('Resolving Environment Variables when Debugging', () => { // All variables in current process must be in here expect(Object.keys(envVars).length).greaterThan( Object.keys(mockProcess.env).length, - 'Variables is not a subset' + 'Variables is not a subset', ); Object.keys(mockProcess.env).forEach((key) => { if (key === pathVariableName || key === 'PYTHONPATH') { @@ -215,7 +215,7 @@ suite('Resolving Environment Variables when Debugging', () => { } expect(mockProcess.env[key]).equal( envVars[key], - `Value for the environment variable '${key}' is incorrect.` + `Value for the environment variable '${key}' is incorrect.`, ); }); } diff --git a/src/test/debugger/extension/adapter/activator.unit.test.ts b/src/test/debugger/extension/adapter/activator.unit.test.ts index e449d3d7b2cb..33141c938430 100644 --- a/src/test/debugger/extension/adapter/activator.unit.test.ts +++ b/src/test/debugger/extension/adapter/activator.unit.test.ts @@ -19,7 +19,7 @@ import { IAttachProcessProviderFactory } from '../../../../client/debugger/exten import { IDebugAdapterDescriptorFactory, IDebugSessionLoggingFactory, - IOutdatedDebuggerPromptFactory + IOutdatedDebuggerPromptFactory, } from '../../../../client/debugger/extension/types'; import { clearTelemetryReporter } from '../../../../client/telemetry'; import { noop } from '../../../core'; @@ -38,7 +38,7 @@ suite('Debugging - Adapter Factory and logger Registration', () => { const configurationService = mock(ConfigurationService); when(configurationService.getSettings(undefined)).thenReturn(({ - experiments: { enabled: true } + experiments: { enabled: true }, // tslint:disable-next-line: no-any } as any) as IPythonSettings); attachFactory = mock(AttachProcessProviderFactory); @@ -54,7 +54,7 @@ suite('Debugging - Adapter Factory and logger Registration', () => { instance(loggingFactory), instance(debuggerPromptFactory), disposableRegistry, - instance(attachFactory) + instance(attachFactory), ); }); diff --git a/src/test/debugger/extension/adapter/adapter.test.ts b/src/test/debugger/extension/adapter/adapter.test.ts index 29baffc613bc..8df95bb90bd4 100644 --- a/src/test/debugger/extension/adapter/adapter.test.ts +++ b/src/test/debugger/extension/adapter/adapter.test.ts @@ -58,7 +58,7 @@ suite('Debugger Integration', () => { 'launch': ['launch a file', [...defaultScriptArgs, outFile]], // prettier-ignore 'attach': ['attach to a local port', defaultScriptArgs], - 'attach to PID': ['attach to a local PID', defaultScriptArgs] + 'attach to PID': ['attach to a local PID', defaultScriptArgs], // For now we do not worry about "test" debugging. }; diff --git a/src/test/debugger/extension/adapter/factory.unit.test.ts b/src/test/debugger/extension/adapter/factory.unit.test.ts index c5d49b5da81b..019a7a9b33ac 100644 --- a/src/test/debugger/extension/adapter/factory.unit.test.ts +++ b/src/test/debugger/extension/adapter/factory.unit.test.ts @@ -43,7 +43,7 @@ suite('Debugging - Adapter Factory', () => { sysPrefix: '', sysVersion: '', envType: EnvironmentType.Unknown, - version: new SemVer('3.7.4-test') + version: new SemVer('3.7.4-test'), }; const oldValueOfVSC_PYTHON_UNIT_TEST = process.env.VSC_PYTHON_UNIT_TEST; const oldValueOfVSC_PYTHON_CI_TEST = process.env.VSC_PYTHON_CI_TEST; @@ -67,7 +67,7 @@ suite('Debugging - Adapter Factory', () => { const configurationService = mock(ConfigurationService); when(configurationService.getSettings(undefined)).thenReturn(({ - experiments: { enabled: true } + experiments: { enabled: true }, // tslint:disable-next-line: no-any } as any) as IPythonSettings); @@ -97,7 +97,7 @@ suite('Debugging - Adapter Factory', () => { name: 'python', type: 'python', workspaceFolder, - customRequest: () => Promise.resolve() + customRequest: () => Promise.resolve(), }; } @@ -155,7 +155,7 @@ suite('Debugging - Adapter Factory', () => { const session = createSession({ request: 'attach', connect: { port: 5678, host: 'localhost' } }); const debugServer = new DebugAdapterServer( session.configuration.connect.port, - session.configuration.connect.host + session.configuration.connect.host, ); const descriptor = await factory.createDebugAdapterDescriptor(session, nodeExecutable); @@ -181,13 +181,13 @@ suite('Debugging - Adapter Factory', () => { port: undefined, processId: undefined, listen: undefined, - connect: undefined + connect: undefined, }); const promise = factory.createDebugAdapterDescriptor(session, nodeExecutable); await expect(promise).to.eventually.be.rejectedWith( - '"request":"attach" requires either "connect", "listen", or "processId"' + '"request":"attach" requires either "connect", "listen", or "processId"', ); }); @@ -196,7 +196,7 @@ suite('Debugging - Adapter Factory', () => { const debugExecutable = new DebugAdapterExecutable(pythonPath, [ debugAdapterPath, '--log-dir', - EXTENSION_ROOT_DIR + EXTENSION_ROOT_DIR, ]); const descriptor = await factory.createDebugAdapterDescriptor(session, nodeExecutable); diff --git a/src/test/debugger/extension/adapter/logging.unit.test.ts b/src/test/debugger/extension/adapter/logging.unit.test.ts index cae4d7b19328..d096311ddbbd 100644 --- a/src/test/debugger/extension/adapter/logging.unit.test.ts +++ b/src/test/debugger/extension/adapter/logging.unit.test.ts @@ -42,13 +42,13 @@ suite('Debugging - Session Logging', () => { configuration: { name: '', request: 'launch', - type: 'python' + type: 'python', }, id: id, name: 'python', type: 'python', workspaceFolder, - customRequest: () => Promise.resolve() + customRequest: () => Promise.resolve(), }; } diff --git a/src/test/debugger/extension/adapter/outdatedDebuggerPrompt.unit.test.ts b/src/test/debugger/extension/adapter/outdatedDebuggerPrompt.unit.test.ts index cb7643397552..57901dba54ec 100644 --- a/src/test/debugger/extension/adapter/outdatedDebuggerPrompt.unit.test.ts +++ b/src/test/debugger/extension/adapter/outdatedDebuggerPrompt.unit.test.ts @@ -27,20 +27,20 @@ suite('Debugging - Outdated Debugger Prompt tests.', () => { seq: 1, type: 'event', event: 'output', - body: { category: 'telemetry', output: 'ptvsd', data: { packageVersion: '4.3.2' } } + body: { category: 'telemetry', output: 'ptvsd', data: { packageVersion: '4.3.2' } }, }; const debugpyOutputEvent: DebugProtocol.OutputEvent = { seq: 1, type: 'event', event: 'output', - body: { category: 'telemetry', output: 'debugpy', data: { packageVersion: '1.0.0' } } + body: { category: 'telemetry', output: 'debugpy', data: { packageVersion: '1.0.0' } }, }; setup(() => { const configurationService = mock(ConfigurationService); when(configurationService.getSettings(undefined)).thenReturn(({ - experiments: { enabled: true } + experiments: { enabled: true }, // tslint:disable-next-line: no-any } as any) as IPythonSettings); @@ -58,13 +58,13 @@ suite('Debugging - Outdated Debugger Prompt tests.', () => { configuration: { name: '', request: 'launch', - type: 'python' + type: 'python', }, id: 'test1', name: 'python', type: 'python', workspaceFolder, - customRequest: () => Promise.resolve() + customRequest: () => Promise.resolve(), }; } @@ -137,21 +137,21 @@ suite('Debugging - Outdated Debugger Prompt tests.', () => { command: 'runInTerminal', arguments: { cwd: '', - args: [''] - } + args: [''], + }, }; const someEvent: DebugProtocol.ContinuedEvent = { seq: 1, type: 'event', event: 'continued', - body: { threadId: 1, allThreadsContinued: true } + body: { threadId: 1, allThreadsContinued: true }, }; // Notice that this is stdout, not telemetry event. const someOutputEvent: DebugProtocol.OutputEvent = { seq: 1, type: 'event', event: 'output', - body: { category: 'stdout', output: 'ptvsd' } + body: { category: 'stdout', output: 'ptvsd' }, }; [someRequest, someEvent, someOutputEvent].forEach((message) => { diff --git a/src/test/debugger/extension/adapter/remoteLaunchers.unit.test.ts b/src/test/debugger/extension/adapter/remoteLaunchers.unit.test.ts index f1782d5e0429..aa520f66faa6 100644 --- a/src/test/debugger/extension/adapter/remoteLaunchers.unit.test.ts +++ b/src/test/debugger/extension/adapter/remoteLaunchers.unit.test.ts @@ -14,13 +14,13 @@ suite('External debugpy Debugger Launcher', () => { { testName: 'When path to debugpy does not contains spaces', path: path.join('path', 'to', 'debugpy'), - expectedPath: 'path/to/debugpy' + expectedPath: 'path/to/debugpy', }, { testName: 'When path to debugpy contains spaces', path: path.join('path', 'to', 'debugpy', 'with spaces'), - expectedPath: '"path/to/debugpy/with spaces"' - } + expectedPath: '"path/to/debugpy/with spaces"', + }, ].forEach((testParams) => { suite(testParams.testName, async () => { test('Test remote debug launcher args (and do not wait for debugger to attach)', async () => { @@ -28,9 +28,9 @@ suite('External debugpy Debugger Launcher', () => { { host: 'something', port: 1234, - waitUntilDebuggerAttaches: false + waitUntilDebuggerAttaches: false, }, - testParams.path + testParams.path, ); const expectedArgs = [testParams.expectedPath, '--listen', 'something:1234']; expect(args).to.be.deep.equal(expectedArgs); @@ -40,9 +40,9 @@ suite('External debugpy Debugger Launcher', () => { { host: 'something', port: 1234, - waitUntilDebuggerAttaches: true + waitUntilDebuggerAttaches: true, }, - testParams.path + testParams.path, ); const expectedArgs = [testParams.expectedPath, '--listen', 'something:1234', '--wait-for-client']; expect(args).to.be.deep.equal(expectedArgs); diff --git a/src/test/debugger/extension/attachQuickPick/factory.unit.test.ts b/src/test/debugger/extension/attachQuickPick/factory.unit.test.ts index e74145bb26b2..7ed5a42a9d4a 100644 --- a/src/test/debugger/extension/attachQuickPick/factory.unit.test.ts +++ b/src/test/debugger/extension/attachQuickPick/factory.unit.test.ts @@ -38,7 +38,7 @@ suite('Attach to process - attach process provider factory', () => { instance(commandManager), instance(platformService), instance(processServiceFactory), - disposableRegistry + disposableRegistry, ); }); diff --git a/src/test/debugger/extension/attachQuickPick/provider.unit.test.ts b/src/test/debugger/extension/attachQuickPick/provider.unit.test.ts index 8ac667314944..26d65599fefb 100644 --- a/src/test/debugger/extension/attachQuickPick/provider.unit.test.ts +++ b/src/test/debugger/extension/attachQuickPick/provider.unit.test.ts @@ -49,7 +49,7 @@ suite('Attach to process - process provider', () => { detail: 'launchd', id: '1', processName: 'launchd', - commandLine: 'launchd' + commandLine: 'launchd', }, { label: 'syslogd', @@ -57,7 +57,7 @@ suite('Attach to process - process provider', () => { detail: 'syslogd', id: '41', processName: 'syslogd', - commandLine: 'syslogd' + commandLine: 'syslogd', }, { label: 'kextd', @@ -65,17 +65,21 @@ suite('Attach to process - process provider', () => { detail: 'kextd', id: '146', processName: 'kextd', - commandLine: 'kextd' - } + commandLine: 'kextd', + }, ]; when(processService.exec(PsProcessParser.psLinuxCommand.command, anything(), anything())).thenResolve({ - stdout: psOutput + stdout: psOutput, }); const attachItems = await provider._getInternalProcessEntries(); verify( - processService.exec(PsProcessParser.psLinuxCommand.command, PsProcessParser.psLinuxCommand.args, anything()) + processService.exec( + PsProcessParser.psLinuxCommand.command, + PsProcessParser.psLinuxCommand.args, + anything(), + ), ).once(); assert.deepEqual(attachItems, expectedOutput); }); @@ -94,7 +98,7 @@ suite('Attach to process - process provider', () => { detail: 'launchd', id: '1', processName: 'launchd', - commandLine: 'launchd' + commandLine: 'launchd', }, { label: 'syslogd', @@ -102,7 +106,7 @@ suite('Attach to process - process provider', () => { detail: 'syslogd', id: '41', processName: 'syslogd', - commandLine: 'syslogd' + commandLine: 'syslogd', }, { label: 'kextd', @@ -110,11 +114,11 @@ suite('Attach to process - process provider', () => { detail: 'kextd', id: '146', processName: 'kextd', - commandLine: 'kextd' - } + commandLine: 'kextd', + }, ]; when(processService.exec(PsProcessParser.psDarwinCommand.command, anything(), anything())).thenResolve({ - stdout: psOutput + stdout: psOutput, }); const attachItems = await provider._getInternalProcessEntries(); @@ -123,8 +127,8 @@ suite('Attach to process - process provider', () => { processService.exec( PsProcessParser.psDarwinCommand.command, PsProcessParser.psDarwinCommand.args, - anything() - ) + anything(), + ), ).once(); assert.deepEqual(attachItems, expectedOutput); }); @@ -151,7 +155,7 @@ ProcessId=5912\r detail: '', id: '4', processName: 'System', - commandLine: '' + commandLine: '', }, { label: 'sihost.exe', @@ -159,7 +163,7 @@ ProcessId=5912\r detail: 'sihost.exe', id: '5728', processName: 'sihost.exe', - commandLine: 'sihost.exe' + commandLine: 'sihost.exe', }, { label: 'svchost.exe', @@ -167,20 +171,20 @@ ProcessId=5912\r detail: 'C:\\WINDOWS\\system32\\svchost.exe -k UnistackSvcGroup -s CDPUserSvc', id: '5912', processName: 'svchost.exe', - commandLine: 'C:\\WINDOWS\\system32\\svchost.exe -k UnistackSvcGroup -s CDPUserSvc' - } + commandLine: 'C:\\WINDOWS\\system32\\svchost.exe -k UnistackSvcGroup -s CDPUserSvc', + }, ]; when(platformService.isMac).thenReturn(false); when(platformService.isLinux).thenReturn(false); when(platformService.isWindows).thenReturn(true); when(processService.exec(WmicProcessParser.wmicCommand.command, anything(), anything())).thenResolve({ - stdout: windowsOutput + stdout: windowsOutput, }); const attachItems = await provider._getInternalProcessEntries(); verify( - processService.exec(WmicProcessParser.wmicCommand.command, WmicProcessParser.wmicCommand.args, anything()) + processService.exec(WmicProcessParser.wmicCommand.command, WmicProcessParser.wmicCommand.args, anything()), ).once(); assert.deepEqual(attachItems, expectedOutput); }); @@ -216,7 +220,7 @@ ProcessId=5912\r detail: 'kextd', id: '146', processName: 'kextd', - commandLine: 'kextd' + commandLine: 'kextd', }, { label: 'launchd', @@ -224,7 +228,7 @@ ProcessId=5912\r detail: 'launchd', id: '1', processName: 'launchd', - commandLine: 'launchd' + commandLine: 'launchd', }, { label: 'syslogd', @@ -232,11 +236,11 @@ ProcessId=5912\r detail: 'syslogd', id: '41', processName: 'syslogd', - commandLine: 'syslogd' - } + commandLine: 'syslogd', + }, ]; when(processService.exec(PsProcessParser.psLinuxCommand.command, anything(), anything())).thenResolve({ - stdout: psOutput + stdout: psOutput, }); const output = await provider.getAttachItems(); @@ -259,7 +263,7 @@ ProcessId=5912\r detail: 'python', id: '96', processName: 'python', - commandLine: 'python' + commandLine: 'python', }, { label: 'python', @@ -267,7 +271,7 @@ ProcessId=5912\r detail: 'python script.py', id: '31896', processName: 'python', - commandLine: 'python script.py' + commandLine: 'python script.py', }, { label: 'kextd', @@ -275,7 +279,7 @@ ProcessId=5912\r detail: 'kextd', id: '146', processName: 'kextd', - commandLine: 'kextd' + commandLine: 'kextd', }, { label: 'launchd', @@ -283,7 +287,7 @@ ProcessId=5912\r detail: 'launchd', id: '1', processName: 'launchd', - commandLine: 'launchd' + commandLine: 'launchd', }, { label: 'syslogd', @@ -291,11 +295,11 @@ ProcessId=5912\r detail: 'syslogd', id: '41', processName: 'syslogd', - commandLine: 'syslogd' - } + commandLine: 'syslogd', + }, ]; when(processService.exec(PsProcessParser.psLinuxCommand.command, anything(), anything())).thenResolve({ - stdout: psOutput + stdout: psOutput, }); const output = await provider.getAttachItems(); @@ -334,7 +338,7 @@ ProcessId=5728\r detail: 'sihost.exe', id: '5728', processName: 'sihost.exe', - commandLine: 'sihost.exe' + commandLine: 'sihost.exe', }, { label: 'svchost.exe', @@ -342,7 +346,7 @@ ProcessId=5728\r detail: '', id: '5372', processName: 'svchost.exe', - commandLine: '' + commandLine: '', }, { label: 'System', @@ -350,11 +354,11 @@ ProcessId=5728\r detail: '', id: '4', processName: 'System', - commandLine: '' - } + commandLine: '', + }, ]; when(processService.exec(WmicProcessParser.wmicCommand.command, anything(), anything())).thenResolve({ - stdout: windowsOutput + stdout: windowsOutput, }); const output = await provider.getAttachItems(); @@ -401,7 +405,7 @@ ProcessId=8026\r id: '8026', processName: 'python.exe', commandLine: - 'C:\\Users\\Contoso\\AppData\\Local\\Programs\\Python\\Python37\\python.exe c:/Users/Contoso/Documents/foo_bar.py' + 'C:\\Users\\Contoso\\AppData\\Local\\Programs\\Python\\Python37\\python.exe c:/Users/Contoso/Documents/foo_bar.py', }, { label: 'python.exe', @@ -411,7 +415,7 @@ ProcessId=8026\r id: '6028', processName: 'python.exe', commandLine: - 'C:\\Users\\Contoso\\AppData\\Local\\Programs\\Python\\Python37\\python.exe c:/Users/Contoso/Documents/hello_world.py' + 'C:\\Users\\Contoso\\AppData\\Local\\Programs\\Python\\Python37\\python.exe c:/Users/Contoso/Documents/hello_world.py', }, { label: 'sihost.exe', @@ -419,7 +423,7 @@ ProcessId=8026\r detail: 'sihost.exe', id: '5728', processName: 'sihost.exe', - commandLine: 'sihost.exe' + commandLine: 'sihost.exe', }, { label: 'svchost.exe', @@ -427,7 +431,7 @@ ProcessId=8026\r detail: '', id: '5372', processName: 'svchost.exe', - commandLine: '' + commandLine: '', }, { label: 'svchost.exe', @@ -435,7 +439,7 @@ ProcessId=8026\r detail: 'C:\\WINDOWS\\system32\\svchost.exe -k UnistackSvcGroup -s CDPUserSvc', id: '5912', processName: 'svchost.exe', - commandLine: 'C:\\WINDOWS\\system32\\svchost.exe -k UnistackSvcGroup -s CDPUserSvc' + commandLine: 'C:\\WINDOWS\\system32\\svchost.exe -k UnistackSvcGroup -s CDPUserSvc', }, { label: 'System', @@ -443,11 +447,11 @@ ProcessId=8026\r detail: '', id: '4', processName: 'System', - commandLine: '' - } + commandLine: '', + }, ]; when(processService.exec(WmicProcessParser.wmicCommand.command, anything(), anything())).thenResolve({ - stdout: windowsOutput + stdout: windowsOutput, }); const output = await provider.getAttachItems(); diff --git a/src/test/debugger/extension/attachQuickPick/psProcessParser.unit.test.ts b/src/test/debugger/extension/attachQuickPick/psProcessParser.unit.test.ts index e7c8b629f956..f1ba54def229 100644 --- a/src/test/debugger/extension/attachQuickPick/psProcessParser.unit.test.ts +++ b/src/test/debugger/extension/attachQuickPick/psProcessParser.unit.test.ts @@ -26,7 +26,7 @@ suite('Attach to process - ps process parser (POSIX)', () => { detail: 'launchd', id: '1', processName: 'launchd', - commandLine: 'launchd' + commandLine: 'launchd', }, { label: 'syslogd', @@ -34,7 +34,7 @@ suite('Attach to process - ps process parser (POSIX)', () => { detail: 'syslogd', id: '41', processName: 'syslogd', - commandLine: 'syslogd' + commandLine: 'syslogd', }, { label: 'UserEventAgent', @@ -42,7 +42,7 @@ suite('Attach to process - ps process parser (POSIX)', () => { detail: 'UserEventAgent (System)', id: '42', processName: 'UserEventAgent', - commandLine: 'UserEventAgent (System)' + commandLine: 'UserEventAgent (System)', }, { label: 'uninstalld', @@ -50,7 +50,7 @@ suite('Attach to process - ps process parser (POSIX)', () => { detail: 'uninstalld', id: '45', processName: 'uninstalld', - commandLine: 'uninstalld' + commandLine: 'uninstalld', }, { label: 'kextd', @@ -58,7 +58,7 @@ suite('Attach to process - ps process parser (POSIX)', () => { detail: 'kextd', id: '146', processName: 'kextd', - commandLine: 'kextd' + commandLine: 'kextd', }, { label: 'python', @@ -66,8 +66,8 @@ suite('Attach to process - ps process parser (POSIX)', () => { detail: 'python script.py', id: '31896', processName: 'python', - commandLine: 'python script.py' - } + commandLine: 'python script.py', + }, ]; const output = PsProcessParser.parseProcesses(input); @@ -92,7 +92,7 @@ suite('Attach to process - ps process parser (POSIX)', () => { detail: 'launchd', id: '1', processName: 'launchd', - commandLine: 'launchd' + commandLine: 'launchd', }, { label: 'syslogd', @@ -100,7 +100,7 @@ suite('Attach to process - ps process parser (POSIX)', () => { detail: 'syslogd', id: '41', processName: 'syslogd', - commandLine: 'syslogd' + commandLine: 'syslogd', }, { label: 'UserEventAgent', @@ -108,7 +108,7 @@ suite('Attach to process - ps process parser (POSIX)', () => { detail: 'UserEventAgent (System)', id: '42', processName: 'UserEventAgent', - commandLine: 'UserEventAgent (System)' + commandLine: 'UserEventAgent (System)', }, { label: 'kextd', @@ -116,7 +116,7 @@ suite('Attach to process - ps process parser (POSIX)', () => { detail: 'kextd', id: '146', processName: 'kextd', - commandLine: 'kextd' + commandLine: 'kextd', }, { label: 'python', @@ -124,8 +124,8 @@ suite('Attach to process - ps process parser (POSIX)', () => { detail: 'python script.py', id: '31896', processName: 'python', - commandLine: 'python script.py' - } + commandLine: 'python script.py', + }, ]; const output = PsProcessParser.parseProcesses(input); @@ -150,7 +150,7 @@ suite('Attach to process - ps process parser (POSIX)', () => { detail: 'launchd', id: '1', processName: 'launchd', - commandLine: 'launchd' + commandLine: 'launchd', }, { label: 'syslogd', @@ -158,7 +158,7 @@ suite('Attach to process - ps process parser (POSIX)', () => { detail: 'syslogd', id: '41', processName: 'syslogd', - commandLine: 'syslogd' + commandLine: 'syslogd', }, { label: 'UserEventAgent', @@ -166,7 +166,7 @@ suite('Attach to process - ps process parser (POSIX)', () => { detail: 'UserEventAgent (System)', id: '42', processName: 'UserEventAgent', - commandLine: 'UserEventAgent (System)' + commandLine: 'UserEventAgent (System)', }, { label: 'kextd', @@ -174,7 +174,7 @@ suite('Attach to process - ps process parser (POSIX)', () => { detail: 'kextd', id: '146', processName: 'kextd', - commandLine: 'kextd' + commandLine: 'kextd', }, { label: 'python', @@ -182,8 +182,8 @@ suite('Attach to process - ps process parser (POSIX)', () => { detail: 'python script.py', id: '31896', processName: 'python', - commandLine: 'python script.py' - } + commandLine: 'python script.py', + }, ]; const output = PsProcessParser.parseProcesses(input); diff --git a/src/test/debugger/extension/attachQuickPick/wmicProcessParser.unit.test.ts b/src/test/debugger/extension/attachQuickPick/wmicProcessParser.unit.test.ts index df24c9579e62..5e7d3bb812f3 100644 --- a/src/test/debugger/extension/attachQuickPick/wmicProcessParser.unit.test.ts +++ b/src/test/debugger/extension/attachQuickPick/wmicProcessParser.unit.test.ts @@ -42,7 +42,7 @@ ProcessId=6028\r\n\ detail: '', id: '4', processName: 'System', - commandLine: '' + commandLine: '', }, { label: 'svchost.exe', @@ -50,7 +50,7 @@ ProcessId=6028\r\n\ detail: '', id: '5372', processName: 'svchost.exe', - commandLine: '' + commandLine: '', }, { label: 'sihost.exe', @@ -58,7 +58,7 @@ ProcessId=6028\r\n\ detail: 'sihost.exe', id: '5728', processName: 'sihost.exe', - commandLine: 'sihost.exe' + commandLine: 'sihost.exe', }, { label: 'svchost.exe', @@ -66,7 +66,7 @@ ProcessId=6028\r\n\ detail: 'C:\\WINDOWS\\system32\\svchost.exe -k UnistackSvcGroup -s CDPUserSvc', id: '5912', processName: 'svchost.exe', - commandLine: 'C:\\WINDOWS\\system32\\svchost.exe -k UnistackSvcGroup -s CDPUserSvc' + commandLine: 'C:\\WINDOWS\\system32\\svchost.exe -k UnistackSvcGroup -s CDPUserSvc', }, { label: 'python.exe', @@ -76,8 +76,8 @@ ProcessId=6028\r\n\ id: '6028', processName: 'python.exe', commandLine: - 'C:\\Users\\Contoso\\AppData\\Local\\Programs\\Python\\Python37\\python.exe c:/Users/Contoso/Documents/hello_world.py' - } + 'C:\\Users\\Contoso\\AppData\\Local\\Programs\\Python\\Python37\\python.exe c:/Users/Contoso/Documents/hello_world.py', + }, ]; const output = WmicProcessParser.parseProcesses(input); @@ -120,7 +120,7 @@ ProcessId=6028\r\n\ detail: '', id: '4', processName: 'System', - commandLine: '' + commandLine: '', }, { label: 'svchost.exe', @@ -128,7 +128,7 @@ ProcessId=6028\r\n\ detail: '', id: '5372', processName: 'svchost.exe', - commandLine: '' + commandLine: '', }, { label: 'sihost.exe', @@ -136,7 +136,7 @@ ProcessId=6028\r\n\ detail: 'sihost.exe', id: '5728', processName: 'sihost.exe', - commandLine: 'sihost.exe' + commandLine: 'sihost.exe', }, { label: 'svchost.exe', @@ -144,7 +144,7 @@ ProcessId=6028\r\n\ detail: 'C:\\WINDOWS\\system32\\svchost.exe -k UnistackSvcGroup -s CDPUserSvc', id: '5912', processName: 'svchost.exe', - commandLine: 'C:\\WINDOWS\\system32\\svchost.exe -k UnistackSvcGroup -s CDPUserSvc' + commandLine: 'C:\\WINDOWS\\system32\\svchost.exe -k UnistackSvcGroup -s CDPUserSvc', }, { label: 'python.exe', @@ -154,8 +154,8 @@ ProcessId=6028\r\n\ id: '6028', processName: 'python.exe', commandLine: - 'C:\\Users\\Contoso\\AppData\\Local\\Programs\\Python\\Python37\\python.exe c:/Users/Contoso/Documents/hello_world.py' - } + 'C:\\Users\\Contoso\\AppData\\Local\\Programs\\Python\\Python37\\python.exe c:/Users/Contoso/Documents/hello_world.py', + }, ]; const output = WmicProcessParser.parseProcesses(input); @@ -187,7 +187,7 @@ ProcessId=6028\r\n\ detail: '', id: '4', processName: 'System', - commandLine: '' + commandLine: '', }, { label: 'conhost.exe', @@ -195,7 +195,7 @@ ProcessId=6028\r\n\ detail: 'C:\\WINDOWS\\system32\\conhost.exe', id: '5912', processName: 'conhost.exe', - commandLine: 'C:\\WINDOWS\\system32\\conhost.exe' + commandLine: 'C:\\WINDOWS\\system32\\conhost.exe', }, { label: 'python.exe', @@ -205,8 +205,8 @@ ProcessId=6028\r\n\ id: '6028', processName: 'python.exe', commandLine: - 'C:\\Users\\Contoso\\AppData\\Local\\Programs\\Python\\Python37\\python.exe c:/Users/Contoso/Documents/hello_world.py' - } + 'C:\\Users\\Contoso\\AppData\\Local\\Programs\\Python\\Python37\\python.exe c:/Users/Contoso/Documents/hello_world.py', + }, ]; const output = WmicProcessParser.parseProcesses(input); diff --git a/src/test/debugger/extension/banner.unit.test.ts b/src/test/debugger/extension/banner.unit.test.ts index e8ec8824b5b0..56a687412a0b 100644 --- a/src/test/debugger/extension/banner.unit.test.ts +++ b/src/test/debugger/extension/banner.unit.test.ts @@ -14,7 +14,7 @@ import { IDisposableRegistry, IPersistentState, IPersistentStateFactory, - IRandom + IRandom, } from '../../../client/common/types'; import { DebuggerTypeName } from '../../../client/debugger/constants'; import { DebuggerBanner, PersistentStateKeys } from '../../../client/debugger/extension/banner'; @@ -54,26 +54,26 @@ suite('Debugging - Banner', () => { .setup((f) => f.createGlobalPersistentState( typemoq.It.isValue(PersistentStateKeys.DebuggerLaunchCounter), - typemoq.It.isAny() - ) + typemoq.It.isAny(), + ), ) .returns(() => launchCounterState.object); factory .setup((f) => - f.createGlobalPersistentState(typemoq.It.isValue(PersistentStateKeys.ShowBanner), typemoq.It.isAny()) + f.createGlobalPersistentState(typemoq.It.isValue(PersistentStateKeys.ShowBanner), typemoq.It.isAny()), ) .returns(() => showBannerState.object); factory .setup((f) => f.createGlobalPersistentState( typemoq.It.isValue(PersistentStateKeys.DebuggerLaunchThresholdCounter), - typemoq.It.isAny() - ) + typemoq.It.isAny(), + ), ) .returns(() => launchThresholdCounterState.object); factory .setup((f) => - f.createGlobalPersistentState(typemoq.It.isValue(PersistentStateKeys.UserSelected), typemoq.It.isAny()) + f.createGlobalPersistentState(typemoq.It.isValue(PersistentStateKeys.UserSelected), typemoq.It.isAny()), ) .returns(() => userSelectedState.object); @@ -102,8 +102,8 @@ suite('Debugging - Banner', () => { typemoq.It.isValue(message), typemoq.It.isValue(yes), typemoq.It.isValue(no), - typemoq.It.isValue(later) - ) + typemoq.It.isValue(later), + ), ) .returns(() => Promise.resolve(yes)); @@ -290,8 +290,8 @@ suite('Debugging - Banner', () => { typemoq.It.isValue(message), typemoq.It.isValue(yes), typemoq.It.isValue(no), - typemoq.It.isValue(later) - ) + typemoq.It.isValue(later), + ), ) .verifiable(typemoq.Times.once()); banner.initialize(); @@ -332,8 +332,8 @@ suite('Debugging - Banner', () => { typemoq.It.isValue(message), typemoq.It.isValue(yes), typemoq.It.isValue(no), - typemoq.It.isValue(later) - ) + typemoq.It.isValue(later), + ), ) .returns(() => Promise.resolve(undefined)) .verifiable(typemoq.Times.once()); diff --git a/src/test/debugger/extension/configuration/debugConfigurationService.unit.test.ts b/src/test/debugger/extension/configuration/debugConfigurationService.unit.test.ts index c945f55c4f4d..b3983812ba38 100644 --- a/src/test/debugger/extension/configuration/debugConfigurationService.unit.test.ts +++ b/src/test/debugger/extension/configuration/debugConfigurationService.unit.test.ts @@ -28,7 +28,7 @@ suite('Debugging - Configuration Service', () => { // tslint:disable-next-line:no-unnecessary-override public async pickDebugConfiguration( input: IMultiStepInput, - state: DebugConfigurationState + state: DebugConfigurationState, ) { return super.pickDebugConfiguration(input, state); } @@ -42,19 +42,19 @@ suite('Debugging - Configuration Service', () => { attachResolver.object, launchResolver.object, instance(providerFactory), - multiStepFactory.object + multiStepFactory.object, ); }); test('Should use attach resolver when passing attach config', async () => { const config = ({ - request: 'attach' + request: 'attach', } as any) as AttachRequestArguments; const folder = { name: '1', index: 0, uri: Uri.parse('1234') }; const expectedConfig = { yay: 1 }; attachResolver .setup((a) => - a.resolveDebugConfiguration(typemoq.It.isValue(folder), typemoq.It.isValue(config), typemoq.It.isAny()) + a.resolveDebugConfiguration(typemoq.It.isValue(folder), typemoq.It.isValue(config), typemoq.It.isAny()), ) .returns(() => Promise.resolve(expectedConfig as any)) .verifiable(typemoq.Times.once()); @@ -78,8 +78,8 @@ suite('Debugging - Configuration Service', () => { a.resolveDebugConfiguration( typemoq.It.isValue(folder), typemoq.It.isValue((config as any) as LaunchRequestArguments), - typemoq.It.isAny() - ) + typemoq.It.isAny(), + ), ) .returns(() => Promise.resolve(expectedConfig as any)) .verifiable(typemoq.Times.once()); @@ -127,7 +127,7 @@ suite('Debugging - Configuration Service', () => { run: (_: any, state: any) => { Object.assign(state.config, expectedConfig); return Promise.resolve(); - } + }, }; multiStepFactory .setup((f) => f.create()) @@ -144,7 +144,7 @@ suite('Debugging - Configuration Service', () => { }); test('Ensure `undefined` is returned if QuickPick is cancelled', async () => { const multiStepInput = { - run: () => Promise.resolve() + run: () => Promise.resolve(), }; const folder = { name: '1', index: 0, uri: Uri.parse('1234') }; multiStepFactory diff --git a/src/test/debugger/extension/configuration/launch.json/completionProvider.unit.test.ts b/src/test/debugger/extension/configuration/launch.json/completionProvider.unit.test.ts index 3108676e8c5f..3431ec05b927 100644 --- a/src/test/debugger/extension/configuration/launch.json/completionProvider.unit.test.ts +++ b/src/test/debugger/extension/configuration/launch.json/completionProvider.unit.test.ts @@ -13,7 +13,7 @@ import { Position, SnippetString, TextDocument, - Uri + Uri, } from 'vscode'; import { LanguageService } from '../../../../../client/common/application/languageService'; import { ILanguageService } from '../../../../../client/common/application/types'; @@ -32,10 +32,10 @@ suite('Debugging - launch.json Completion Provider', () => { test('Activation will register the completion provider', async () => { await completionProvider.activate(); verify( - languageService.registerCompletionItemProvider(deepEqual({ language: 'json' }), completionProvider) + languageService.registerCompletionItemProvider(deepEqual({ language: 'json' }), completionProvider), ).once(); verify( - languageService.registerCompletionItemProvider(deepEqual({ language: 'jsonc' }), completionProvider) + languageService.registerCompletionItemProvider(deepEqual({ language: 'jsonc' }), completionProvider), ).once(); }); test('Cannot provide completions for non launch.json files', () => { @@ -124,14 +124,14 @@ suite('Debugging - launch.json Completion Provider', () => { command: { command: 'python.SelectAndInsertDebugConfiguration', title: DebugConfigStrings.launchJsonCompletions.description(), - arguments: [document.object, position, token] + arguments: [document.object, position, token], }, documentation: DebugConfigStrings.launchJsonCompletions.description(), sortText: 'AAAA', preselect: true, kind: CompletionItemKind.Enum, label: DebugConfigStrings.launchJsonCompletions.label(), - insertText: new SnippetString() + insertText: new SnippetString(), }; assert.deepEqual(completions[0], expectedCompletionItem); diff --git a/src/test/debugger/extension/configuration/launch.json/updaterServer.unit.test.ts b/src/test/debugger/extension/configuration/launch.json/updaterServer.unit.test.ts index 6b62a3962f19..222865c1fe3f 100644 --- a/src/test/debugger/extension/configuration/launch.json/updaterServer.unit.test.ts +++ b/src/test/debugger/extension/configuration/launch.json/updaterServer.unit.test.ts @@ -15,7 +15,7 @@ import { WorkspaceService } from '../../../../../client/common/application/works import { PythonDebugConfigurationService } from '../../../../../client/debugger/extension/configuration/debugConfigurationService'; import { LaunchJsonUpdaterService, - LaunchJsonUpdaterServiceHelper + LaunchJsonUpdaterServiceHelper, } from '../../../../../client/debugger/extension/configuration/launch.json/updaterService'; import { IDebugConfigurationService } from '../../../../../client/debugger/extension/types'; @@ -42,7 +42,7 @@ suite('Debugging - launch.json Updater Service', () => { instance(commandManager), instance(workspace), instance(documentManager), - instance(debugConfigService) + instance(debugConfigService), ); }); teardown(() => sandbox.restore()); @@ -52,15 +52,15 @@ suite('Debugging - launch.json Updater Service', () => { [], instance(workspace), instance(documentManager), - instance(debugConfigService) + instance(debugConfigService), ); await service.activate(); verify( commandManager.registerCommand( 'python.SelectAndInsertDebugConfiguration', helper.selectAndInsertDebugConfig, - helper - ) + helper, + ), ); }); @@ -68,7 +68,7 @@ suite('Debugging - launch.json Updater Service', () => { const document = typemoq.Mock.ofType(); const config: LaunchJsonSchema = { version: '', - configurations: [] + configurations: [], }; document.setup((doc) => doc.getText(typemoq.It.isAny())).returns(() => JSON.stringify(config)); @@ -83,9 +83,9 @@ suite('Debugging - launch.json Updater Service', () => { { name: '', request: 'launch', - type: 'python' - } - ] + type: 'python', + }, + ], }; document.setup((doc) => doc.getText(typemoq.It.isAny())).returns(() => JSON.stringify(config)); @@ -100,9 +100,9 @@ suite('Debugging - launch.json Updater Service', () => { { name: '', request: 'launch', - type: 'python' - } - ] + type: 'python', + }, + ], }; document.setup((doc) => doc.getText(typemoq.It.isAny())).returns(() => JSON.stringify(config)); document.setup((doc) => doc.offsetAt(typemoq.It.isAny())).returns(() => 10); diff --git a/src/test/debugger/extension/configuration/providers/djangoLaunch.unit.test.ts b/src/test/debugger/extension/configuration/providers/djangoLaunch.unit.test.ts index 590b3d4c63d3..9accbc93adb3 100644 --- a/src/test/debugger/extension/configuration/providers/djangoLaunch.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/djangoLaunch.unit.test.ts @@ -45,7 +45,7 @@ suite('Debugging - Configuration Provider Django', () => { provider = new TestDjangoLaunchDebugConfigurationProvider( instance(fs), instance(workspaceService), - instance(pathUtils) + instance(pathUtils), ); }); test("getManagePyPath should return undefined if file doesn't exist", async () => { @@ -140,7 +140,7 @@ suite('Debugging - Configuration Provider Django', () => { request: 'launch', program: 'xyz.py', args: ['runserver'], - django: true + django: true, }; expect(state.config).to.be.deep.equal(config); @@ -160,7 +160,7 @@ suite('Debugging - Configuration Provider Django', () => { request: 'launch', program: 'hello', args: ['runserver'], - django: true + django: true, }; expect(state.config).to.be.deep.equal(config); @@ -183,7 +183,7 @@ suite('Debugging - Configuration Provider Django', () => { request: 'launch', program: defaultProgram, args: ['runserver'], - django: true + django: true, }; expect(state.config).to.be.deep.equal(config); diff --git a/src/test/debugger/extension/configuration/providers/fastapiLaunch.unit.test.ts b/src/test/debugger/extension/configuration/providers/fastapiLaunch.unit.test.ts index bbc3fa3665f6..b843fcb9a35f 100644 --- a/src/test/debugger/extension/configuration/providers/fastapiLaunch.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/fastapiLaunch.unit.test.ts @@ -62,7 +62,7 @@ suite('Debugging - Configuration Provider FastAPI', () => { request: 'launch', module: 'uvicorn', args: ['main:app'], - jinja: true + jinja: true, }; expect(state.config).to.be.deep.equal(config); @@ -82,7 +82,7 @@ suite('Debugging - Configuration Provider FastAPI', () => { request: 'launch', module: 'uvicorn', args: ['main:app'], - jinja: true + jinja: true, }; expect(state.config).to.be.deep.equal(config); diff --git a/src/test/debugger/extension/configuration/providers/fileLaunch.unit.test.ts b/src/test/debugger/extension/configuration/providers/fileLaunch.unit.test.ts index cb06defdeb9c..ec807fd2253e 100644 --- a/src/test/debugger/extension/configuration/providers/fileLaunch.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/fileLaunch.unit.test.ts @@ -29,7 +29,7 @@ suite('Debugging - Configuration Provider File', () => { request: 'launch', // tslint:disable-next-line:no-invalid-template-strings program: '${file}', - console: 'integratedTerminal' + console: 'integratedTerminal', }; expect(state.config).to.be.deep.equal(config); diff --git a/src/test/debugger/extension/configuration/providers/flaskLaunch.unit.test.ts b/src/test/debugger/extension/configuration/providers/flaskLaunch.unit.test.ts index 78a9ea4ef307..06ec778a8112 100644 --- a/src/test/debugger/extension/configuration/providers/flaskLaunch.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/flaskLaunch.unit.test.ts @@ -67,10 +67,10 @@ suite('Debugging - Configuration Provider Flask', () => { env: { FLASK_APP: 'xyz.py', FLASK_ENV: 'development', - FLASK_DEBUG: '0' + FLASK_DEBUG: '0', }, args: ['run', '--no-debugger'], - jinja: true + jinja: true, }; expect(state.config).to.be.deep.equal(config); @@ -92,10 +92,10 @@ suite('Debugging - Configuration Provider Flask', () => { env: { FLASK_APP: 'hello', FLASK_ENV: 'development', - FLASK_DEBUG: '0' + FLASK_DEBUG: '0', }, args: ['run', '--no-debugger'], - jinja: true + jinja: true, }; expect(state.config).to.be.deep.equal(config); @@ -117,10 +117,10 @@ suite('Debugging - Configuration Provider Flask', () => { env: { FLASK_APP: 'app.py', FLASK_ENV: 'development', - FLASK_DEBUG: '0' + FLASK_DEBUG: '0', }, args: ['run', '--no-debugger'], - jinja: true + jinja: true, }; expect(state.config).to.be.deep.equal(config); diff --git a/src/test/debugger/extension/configuration/providers/moduleLaunch.unit.test.ts b/src/test/debugger/extension/configuration/providers/moduleLaunch.unit.test.ts index b06f26311d23..8781c5f3bf2f 100644 --- a/src/test/debugger/extension/configuration/providers/moduleLaunch.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/moduleLaunch.unit.test.ts @@ -33,7 +33,7 @@ suite('Debugging - Configuration Provider Module', () => { name: DebugConfigStrings.module.snippet.name(), type: DebuggerTypeName, request: 'launch', - module: DebugConfigStrings.module.snippet.default() + module: DebugConfigStrings.module.snippet.default(), }; expect(state.config).to.be.deep.equal(config); @@ -51,7 +51,7 @@ suite('Debugging - Configuration Provider Module', () => { name: DebugConfigStrings.module.snippet.name(), type: DebuggerTypeName, request: 'launch', - module: 'hello' + module: 'hello', }; expect(state.config).to.be.deep.equal(config); diff --git a/src/test/debugger/extension/configuration/providers/pidAttach.unit.test.ts b/src/test/debugger/extension/configuration/providers/pidAttach.unit.test.ts index 0e25adab85d2..0e07023c9cb2 100644 --- a/src/test/debugger/extension/configuration/providers/pidAttach.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/pidAttach.unit.test.ts @@ -28,7 +28,7 @@ suite('Debugging - Configuration Provider File', () => { type: DebuggerTypeName, request: 'attach', // tslint:disable-next-line:no-invalid-template-strings - processId: '${command:pickProcess}' + processId: '${command:pickProcess}', }; expect(state.config).to.be.deep.equal(config); diff --git a/src/test/debugger/extension/configuration/providers/providerFactory.unit.test.ts b/src/test/debugger/extension/configuration/providers/providerFactory.unit.test.ts index 4e34a62551f6..79d36d3e5b57 100644 --- a/src/test/debugger/extension/configuration/providers/providerFactory.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/providerFactory.unit.test.ts @@ -27,7 +27,7 @@ suite('Debugging - Configuration Provider Factory', () => { mappedProviders.get(DebugConfigurationType.launchFile)!, mappedProviders.get(DebugConfigurationType.launchPyramid)!, mappedProviders.get(DebugConfigurationType.remoteAttach)!, - mappedProviders.get(DebugConfigurationType.pidAttach)! + mappedProviders.get(DebugConfigurationType.pidAttach)!, ); }); getNamesAndValues(DebugConfigurationType).forEach((item) => { diff --git a/src/test/debugger/extension/configuration/providers/pyramidLaunch.unit.test.ts b/src/test/debugger/extension/configuration/providers/pyramidLaunch.unit.test.ts index e0c5d656d401..f4847850ec5e 100644 --- a/src/test/debugger/extension/configuration/providers/pyramidLaunch.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/pyramidLaunch.unit.test.ts @@ -45,7 +45,7 @@ suite('Debugging - Configuration Provider Pyramid', () => { provider = new TestPyramidLaunchDebugConfigurationProvider( instance(fs), instance(workspaceService), - instance(pathUtils) + instance(pathUtils), ); }); test("getDevelopmentIniPath should return undefined if file doesn't exist", async () => { @@ -141,7 +141,7 @@ suite('Debugging - Configuration Provider Pyramid', () => { module: 'pyramid.scripts.pserve', args: ['xyz.ini'], pyramid: true, - jinja: true + jinja: true, }; expect(state.config).to.be.deep.equal(config); @@ -162,7 +162,7 @@ suite('Debugging - Configuration Provider Pyramid', () => { module: 'pyramid.scripts.pserve', args: ['hello'], pyramid: true, - jinja: true + jinja: true, }; expect(state.config).to.be.deep.equal(config); @@ -186,7 +186,7 @@ suite('Debugging - Configuration Provider Pyramid', () => { module: 'pyramid.scripts.pserve', args: [defaultIni], pyramid: true, - jinja: true + jinja: true, }; expect(state.config).to.be.deep.equal(config); diff --git a/src/test/debugger/extension/configuration/providers/remoteAttach.unit.test.ts b/src/test/debugger/extension/configuration/providers/remoteAttach.unit.test.ts index 0f7e8aedf807..3886ac0d5948 100644 --- a/src/test/debugger/extension/configuration/providers/remoteAttach.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/remoteAttach.unit.test.ts @@ -23,7 +23,7 @@ suite('Debugging - Configuration Provider Remote Attach', () => { // tslint:disable-next-line:no-unnecessary-override public async configurePort( i: MultiStepInput, - config: Partial + config: Partial, ) { return super.configurePort(i, config); } @@ -87,14 +87,14 @@ suite('Debugging - Configuration Provider Remote Attach', () => { request: 'attach', connect: { host: 'localhost', - port: 5678 + port: 5678, }, pathMappings: [ { localRoot: '${workspaceFolder}', - remoteRoot: '.' - } - ] + remoteRoot: '.', + }, + ], }; expect(state.config).to.be.deep.equal(config); @@ -122,14 +122,14 @@ suite('Debugging - Configuration Provider Remote Attach', () => { request: 'attach', connect: { host: 'Hello', - port: 9999 + port: 9999, }, pathMappings: [ { localRoot: '${workspaceFolder}', - remoteRoot: '.' - } - ] + remoteRoot: '.', + }, + ], }; expect(state.config).to.be.deep.equal(config); diff --git a/src/test/debugger/extension/configuration/resolvers/attach.unit.test.ts b/src/test/debugger/extension/configuration/resolvers/attach.unit.test.ts index 0d3355623467..08e5084ceac9 100644 --- a/src/test/debugger/extension/configuration/resolvers/attach.unit.test.ts +++ b/src/test/debugger/extension/configuration/resolvers/attach.unit.test.ts @@ -62,7 +62,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { workspaceService.object, documentManager.object, platformService.object, - configurationService.object + configurationService.object, ); }); @@ -99,16 +99,16 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const attach: Partial = { name: 'Python attach', type: 'python', - request: 'attach' + request: 'attach', }; async function resolveDebugConfiguration( workspaceFolder: WorkspaceFolder | undefined, - attachConfig: Partial + attachConfig: Partial, ) { let config = await debugProvider.resolveDebugConfiguration!( workspaceFolder, - attachConfig as DebugConfiguration + attachConfig as DebugConfiguration, ); if (config === undefined || config === null) { return config; @@ -129,7 +129,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { setupActiveEditor(pythonFile, PYTHON_LANGUAGE); const debugConfig = await resolveDebugConfiguration(workspaceFolder, { - request: 'attach' + request: 'attach', }); expect(Object.keys(debugConfig!)).to.have.lengthOf.above(3); @@ -144,7 +144,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { setupWorkspaces([]); const debugConfig = await resolveDebugConfiguration(undefined, { - request: 'attach' + request: 'attach', }); expect(Object.keys(debugConfig!)).to.have.lengthOf.least(3); @@ -158,7 +158,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { setupWorkspaces([]); const debugConfig = await resolveDebugConfiguration(undefined, { - request: 'attach' + request: 'attach', }); expect(Object.keys(debugConfig!)).to.have.lengthOf.least(3); @@ -174,7 +174,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { setupWorkspaces([]); const debugConfig = await resolveDebugConfiguration(undefined, { - request: 'attach' + request: 'attach', }); expect(Object.keys(debugConfig!)).to.have.lengthOf.least(3); @@ -191,7 +191,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { setupWorkspaces([defaultWorkspace]); const debugConfig = await resolveDebugConfiguration(undefined, { - request: 'attach' + request: 'attach', }); expect(Object.keys(debugConfig!)).to.have.lengthOf.least(3); @@ -208,7 +208,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(undefined, { ...attach, - connect: { host: 'localhost', port: 5678 } + connect: { host: 'localhost', port: 5678 }, }); expect(debugConfig).to.not.have.property('host', 'localhost'); @@ -222,7 +222,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(undefined, { ...attach, - listen: { host: 'localhost', port: 5678 } + listen: { host: 'localhost', port: 5678 }, } as AttachRequestArguments); expect(debugConfig).to.not.have.property('host', 'localhost'); @@ -238,7 +238,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const localRoot = `Debug_PythonPath_${new Date().toString()}`; const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...attach, - localRoot + localRoot, }); expect(debugConfig).to.have.property('localRoot', localRoot); @@ -256,7 +256,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...attach, localRoot, - host + host, }); expect(debugConfig).to.have.property('localRoot', localRoot); @@ -280,7 +280,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...attach, localRoot, - host + host, }); const pathMappings = (debugConfig as AttachRequestArguments).pathMappings; @@ -303,7 +303,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...attach, localRoot, - host + host, }); const pathMappings = (debugConfig as AttachRequestArguments).pathMappings; @@ -324,13 +324,13 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const localRoot = `Debug_PythonPath_${new Date().toString()}`; const debugPathMappings = [ - { localRoot: path.join('${workspaceFolder}', localRoot), remoteRoot: '/app/' } + { localRoot: path.join('${workspaceFolder}', localRoot), remoteRoot: '/app/' }, ]; const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...attach, localRoot, pathMappings: debugPathMappings, - host + host, }); const pathMappings = (debugConfig as AttachRequestArguments).pathMappings; @@ -351,13 +351,13 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const localRoot = `Debug_PythonPath_${new Date().toString()}`; const debugPathMappings = [ - { localRoot: path.join('${workspaceFolder}', localRoot), remoteRoot: '/app/' } + { localRoot: path.join('${workspaceFolder}', localRoot), remoteRoot: '/app/' }, ]; const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...attach, localRoot, pathMappings: debugPathMappings, - host + host, }); const pathMappings = (debugConfig as AttachRequestArguments).pathMappings; @@ -377,7 +377,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...attach, localRoot, - host + host, }); const pathMappings = (debugConfig as AttachRequestArguments).pathMappings; @@ -398,7 +398,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...attach, localRoot, - host + host, }); expect(debugConfig).to.have.property('localRoot', localRoot); @@ -419,7 +419,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...attach, localRoot, - remoteRoot + remoteRoot, }); expect(debugConfig!.pathMappings).to.be.lengthOf(1); @@ -438,7 +438,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...attach, localRoot, - remoteRoot + remoteRoot, }); expect(debugConfig!.pathMappings).to.be.lengthOf(1); @@ -455,7 +455,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const remoteRoot = `Debug_PythonPath_${new Date().toString()}`; const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...attach, - remoteRoot + remoteRoot, }); expect(debugConfig).to.have.property('remoteRoot', remoteRoot); @@ -471,7 +471,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const port = 12341234; const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...attach, - port + port, }); expect(debugConfig).to.have.property('port', port); @@ -489,7 +489,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const expectedDebugOptions = debugOptions.slice(); const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...attach, - debugOptions + debugOptions, }); expect(debugConfig).to.have.property('debugOptions').to.be.deep.equal(expectedDebugOptions); @@ -499,48 +499,48 @@ getInfoPerOS().forEach(([osName, osType, path]) => { { justMyCode: false, debugStdLib: true, - expectedResult: false + expectedResult: false, }, { justMyCode: false, debugStdLib: false, - expectedResult: false + expectedResult: false, }, { justMyCode: false, debugStdLib: undefined, - expectedResult: false + expectedResult: false, }, { justMyCode: true, debugStdLib: false, - expectedResult: true + expectedResult: true, }, { justMyCode: true, debugStdLib: true, - expectedResult: true + expectedResult: true, }, { justMyCode: true, debugStdLib: undefined, - expectedResult: true + expectedResult: true, }, { justMyCode: undefined, debugStdLib: false, - expectedResult: true + expectedResult: true, }, { justMyCode: undefined, debugStdLib: true, - expectedResult: false + expectedResult: false, }, { justMyCode: undefined, debugStdLib: undefined, - expectedResult: true - } + expectedResult: true, + }, ]; test('Ensure justMyCode property is correctly derived from debugStdLib', async () => { const activeFile = 'xyz.py'; @@ -558,7 +558,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { ...attach, debugOptions, justMyCode: testParams.justMyCode, - debugStdLib: testParams.debugStdLib + debugStdLib: testParams.debugStdLib, }); expect(debugConfig).to.have.property('justMyCode', testParams.expectedResult); }); diff --git a/src/test/debugger/extension/configuration/resolvers/base.unit.test.ts b/src/test/debugger/extension/configuration/resolvers/base.unit.test.ts index a953dd38090f..0a648579a34a 100644 --- a/src/test/debugger/extension/configuration/resolvers/base.unit.test.ts +++ b/src/test/debugger/extension/configuration/resolvers/base.unit.test.ts @@ -27,7 +27,7 @@ suite('Debugging - Config Resolver', () => { public resolveDebugConfiguration( _folder: WorkspaceFolder | undefined, _debugConfiguration: DebugConfiguration, - _token?: CancellationToken + _token?: CancellationToken, ): Promise { throw new Error('Not Implemented'); } @@ -35,7 +35,7 @@ suite('Debugging - Config Resolver', () => { public resolveDebugConfigurationWithSubstitutedVariables( _folder: WorkspaceFolder | undefined, _debugConfiguration: DebugConfiguration, - _token?: CancellationToken + _token?: CancellationToken, ): Promise { throw new Error('Not Implemented'); } @@ -50,7 +50,7 @@ suite('Debugging - Config Resolver', () => { public resolveAndUpdatePythonPath( workspaceFolder: Uri | undefined, - debugConfiguration: LaunchRequestArguments + debugConfiguration: LaunchRequestArguments, ): void { return super.resolveAndUpdatePythonPath(workspaceFolder, debugConfiguration); } @@ -85,7 +85,7 @@ suite('Debugging - Config Resolver', () => { instance(workspaceService), instance(documentManager), instance(platformService), - instance(configurationService) + instance(configurationService), ); }); @@ -145,9 +145,9 @@ suite('Debugging - Config Resolver', () => { [ { title: 'Should get directory of active program when there are not workspace folders', - workspaceFolders: undefined + workspaceFolders: undefined, }, - { title: 'Should get directory of active program when there are 0 workspace folders', workspaceFolders: [] } + { title: 'Should get directory of active program when there are 0 workspace folders', workspaceFolders: [] }, ].forEach((item) => { test(item.title, () => { const programPath = path.join('one', 'two', 'three.xyz'); @@ -215,7 +215,7 @@ suite('Debugging - Config Resolver', () => { }); test('pythonPath in debug config must point to pythonPath in settings if pythonPath in config is ${command:python.interpreterPath}', () => { const config = { - pythonPath: '${command:python.interpreterPath}' + pythonPath: '${command:python.interpreterPath}', }; const pythonPath = path.join('1', '2', '3'); @@ -231,7 +231,7 @@ suite('Debugging - Config Resolver', () => { '::1': true, '127.0.0.2': false, '156.1.2.3': false, - '::2': false + '::2': false, }; Object.keys(localHostTestMatrix).forEach((key) => { test(`Local host = ${localHostTestMatrix[key]} for ${key}`, () => { diff --git a/src/test/debugger/extension/configuration/resolvers/common.ts b/src/test/debugger/extension/configuration/resolvers/common.ts index 7c4af1600474..dae97134e3b0 100644 --- a/src/test/debugger/extension/configuration/resolvers/common.ts +++ b/src/test/debugger/extension/configuration/resolvers/common.ts @@ -22,7 +22,7 @@ interface IPathModule { type OSTestInfo = [ string, // os name OSType, - IPathModule + IPathModule, ]; // For each supported OS, provide a set of helpers to use in tests. diff --git a/src/test/debugger/extension/configuration/resolvers/launch.unit.test.ts b/src/test/debugger/extension/configuration/resolvers/launch.unit.test.ts index 0dc098964496..c677a1282b0a 100644 --- a/src/test/debugger/extension/configuration/resolvers/launch.unit.test.ts +++ b/src/test/debugger/extension/configuration/resolvers/launch.unit.test.ts @@ -84,7 +84,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { diagnosticsService.object, platformService.object, configService.object, - debugEnvHelper.object + debugEnvHelper.object, ); } @@ -109,16 +109,16 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const launch: LaunchRequestArguments = { name: 'Python launch', type: 'python', - request: 'launch' + request: 'launch', }; async function resolveDebugConfiguration( workspaceFolder: WorkspaceFolder | undefined, - launchConfig: Partial + launchConfig: Partial, ) { let config = await debugProvider.resolveDebugConfiguration!( workspaceFolder, - launchConfig as DebugConfiguration + launchConfig as DebugConfiguration, ); if (config === undefined || config === null) { return config; @@ -175,7 +175,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { setupActiveEditor(pythonFile, PYTHON_LANGUAGE); const debugConfig = await resolveDebugConfiguration(workspaceFolder, { - noDebug: true + noDebug: true, }); expect(Object.keys(debugConfig!)).to.have.lengthOf.above(3); @@ -305,7 +305,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const port = 12341234; const debugConfig = await resolveDebugConfiguration(workspaceFolder, { - port + port, }); expect(debugConfig).to.have.property('port', port); @@ -320,7 +320,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const localRoot = `Debug_PythonPath_${new Date().toString()}`; const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, - localRoot + localRoot, }); expect(debugConfig).to.have.property('localRoot', localRoot); @@ -335,7 +335,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const remoteRoot = `Debug_PythonPath_${new Date().toString()}`; const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, - remoteRoot + remoteRoot, }); expect(debugConfig).to.have.property('remoteRoot', remoteRoot); @@ -352,7 +352,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, localRoot, - remoteRoot + remoteRoot, }); expect(debugConfig!.pathMappings).to.be.equal(undefined, 'unexpected pathMappings'); @@ -366,11 +366,11 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const expected = { localRoot: `Debug_PythonPath_Local_Root_${new Date().toString()}`, - remoteRoot: `Debug_PythonPath_Remote_Root_${new Date().toString()}` + remoteRoot: `Debug_PythonPath_Remote_Root_${new Date().toString()}`, }; const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, - pathMappings: [expected] + pathMappings: [expected], }); const pathMappings = (debugConfig as LaunchRequestArguments).pathMappings; @@ -388,17 +388,17 @@ getInfoPerOS().forEach(([osName, osType, path]) => { pathMappings: [ { localRoot: '${workspaceFolder}/spam', - remoteRoot: '${workspaceFolder}/spam' - } - ] + remoteRoot: '${workspaceFolder}/spam', + }, + ], }); const pathMappings = (debugConfig as LaunchRequestArguments).pathMappings; expect(pathMappings).to.be.deep.equal([ { localRoot: `${workspaceFolder.uri.fsPath}/spam`, - remoteRoot: '${workspaceFolder}/spam' - } + remoteRoot: '${workspaceFolder}/spam', + }, ]); }); @@ -411,7 +411,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, - localRoot: localRoot + localRoot: localRoot, }); const pathMappings = (debugConfig as LaunchRequestArguments).pathMappings; @@ -428,7 +428,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, localRoot: localRoot, - pathMappings: [] + pathMappings: [], }); const pathMappings = (debugConfig as LaunchRequestArguments).pathMappings; @@ -448,9 +448,9 @@ getInfoPerOS().forEach(([osName, osType, path]) => { pathMappings: [ { localRoot: '/spam', - remoteRoot: '.' - } - ] + remoteRoot: '.', + }, + ], }); expect(debugConfig).to.have.property('localRoot', localRoot); @@ -458,8 +458,8 @@ getInfoPerOS().forEach(([osName, osType, path]) => { expect(pathMappings).to.be.deep.equal([ { localRoot: '/spam', - remoteRoot: '.' - } + remoteRoot: '.', + }, ]); }); @@ -479,9 +479,9 @@ getInfoPerOS().forEach(([osName, osType, path]) => { pathMappings: [ { localRoot, - remoteRoot: '/app/' - } - ] + remoteRoot: '/app/', + }, + ], }); const pathMappings = (debugConfig as LaunchRequestArguments).pathMappings; @@ -489,8 +489,8 @@ getInfoPerOS().forEach(([osName, osType, path]) => { expect(pathMappings).to.deep.equal([ { localRoot: expected, - remoteRoot: '/app/' - } + remoteRoot: '/app/', + }, ]); }); @@ -510,17 +510,17 @@ getInfoPerOS().forEach(([osName, osType, path]) => { pathMappings: [ { localRoot, - remoteRoot: '/app/' - } - ] + remoteRoot: '/app/', + }, + ], }); const pathMappings = (debugConfig as LaunchRequestArguments).pathMappings; expect(pathMappings).to.deep.equal([ { localRoot, - remoteRoot: '/app/' - } + remoteRoot: '/app/', + }, ]); }); @@ -535,17 +535,17 @@ getInfoPerOS().forEach(([osName, osType, path]) => { pathMappings: [ { localRoot: '/spam', - remoteRoot: '.' - } - ] + remoteRoot: '.', + }, + ], }); const pathMappings = (debugConfig as LaunchRequestArguments).pathMappings; expect(pathMappings).to.deep.equal([ { localRoot: '/spam', - remoteRoot: '.' - } + remoteRoot: '.', + }, ]); }); @@ -560,7 +560,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, - pythonPath: '${command:python.interpreterPath}' + pythonPath: '${command:python.interpreterPath}', }); expect(debugConfig).to.not.have.property('pythonPath'); @@ -580,7 +580,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, - python: '${command:python.interpreterPath}' + python: '${command:python.interpreterPath}', }); expect(debugConfig).to.not.have.property('pythonPath'); @@ -601,7 +601,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugPythonPath = `Debug_PythonPath_${new Date().toString()}`; const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, - pythonPath: debugPythonPath + pythonPath: debugPythonPath, }); expect(debugConfig).to.not.have.property('pythonPath'); @@ -622,7 +622,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugPythonPath = `Debug_PythonPath_${new Date().toString()}`; const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, - python: debugPythonPath + python: debugPythonPath, }); expect(debugConfig).to.not.have.property('pythonPath'); @@ -643,7 +643,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugPythonPath = `Debug_PythonPath_${new Date().toString()}`; const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, - debugAdapterPython: debugPythonPath + debugAdapterPython: debugPythonPath, }); expect(debugConfig).to.not.have.property('pythonPath'); @@ -664,7 +664,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugPythonPath = `Debug_PythonPath_${new Date().toString()}`; const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, - debugLauncherPython: debugPythonPath + debugLauncherPython: debugPythonPath, }); expect(debugConfig).to.not.have.property('pythonPath'); @@ -681,7 +681,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { setupActiveEditor(pythonFile, PYTHON_LANGUAGE); const debugConfig = await resolveDebugConfiguration(workspaceFolder, { - ...launch + ...launch, }); expect(debugConfig).to.have.property('console', 'integratedTerminal'); @@ -706,7 +706,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { setupActiveEditor(pythonFile, PYTHON_LANGUAGE); const debugConfig = await resolveDebugConfiguration(workspaceFolder, { - ...launch + ...launch, }); expect(debugConfig).to.have.property('stopOnEntry', false); @@ -725,7 +725,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, redirectOutput: true, - justMyCode: false + justMyCode: false, }); expect(debugConfig).to.have.property('console', 'integratedTerminal'); @@ -737,7 +737,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const expectedOptions = [ DebugOptions.DebugStdLib, DebugOptions.ShowReturnValue, - DebugOptions.RedirectOutput + DebugOptions.RedirectOutput, ]; if (osType === OSType.Windows) { expectedOptions.push(DebugOptions.FixFilePathCase); @@ -749,48 +749,48 @@ getInfoPerOS().forEach(([osName, osType, path]) => { { justMyCode: false, debugStdLib: true, - expectedResult: false + expectedResult: false, }, { justMyCode: false, debugStdLib: false, - expectedResult: false + expectedResult: false, }, { justMyCode: false, debugStdLib: undefined, - expectedResult: false + expectedResult: false, }, { justMyCode: true, debugStdLib: false, - expectedResult: true + expectedResult: true, }, { justMyCode: true, debugStdLib: true, - expectedResult: true + expectedResult: true, }, { justMyCode: true, debugStdLib: undefined, - expectedResult: true + expectedResult: true, }, { justMyCode: undefined, debugStdLib: false, - expectedResult: true + expectedResult: true, }, { justMyCode: undefined, debugStdLib: true, - expectedResult: false + expectedResult: false, }, { justMyCode: undefined, debugStdLib: undefined, - expectedResult: true - } + expectedResult: true, + }, ]; test('Ensure justMyCode property is correctly derived from debugStdLib', async () => { const pythonPath = `PythonPath_${new Date().toString()}`; @@ -802,7 +802,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, debugStdLib: testParams.debugStdLib, - justMyCode: testParams.justMyCode + justMyCode: testParams.justMyCode, }); expect(debugConfig).to.have.property('justMyCode', testParams.expectedResult); }); @@ -812,48 +812,48 @@ getInfoPerOS().forEach(([osName, osType, path]) => { { console: 'internalConsole', redirectOutput: undefined, - expectedRedirectOutput: true + expectedRedirectOutput: true, }, { console: 'integratedTerminal', redirectOutput: undefined, - expectedRedirectOutput: undefined + expectedRedirectOutput: undefined, }, { console: 'externalTerminal', redirectOutput: undefined, - expectedRedirectOutput: undefined + expectedRedirectOutput: undefined, }, { console: 'internalConsole', redirectOutput: false, - expectedRedirectOutput: false + expectedRedirectOutput: false, }, { console: 'integratedTerminal', redirectOutput: false, - expectedRedirectOutput: false + expectedRedirectOutput: false, }, { console: 'externalTerminal', redirectOutput: false, - expectedRedirectOutput: false + expectedRedirectOutput: false, }, { console: 'internalConsole', redirectOutput: true, - expectedRedirectOutput: true + expectedRedirectOutput: true, }, { console: 'integratedTerminal', redirectOutput: true, - expectedRedirectOutput: true + expectedRedirectOutput: true, }, { console: 'externalTerminal', redirectOutput: true, - expectedRedirectOutput: true - } + expectedRedirectOutput: true, + }, ]; test('Ensure redirectOutput property is correctly derived from console type', async () => { const pythonPath = `PythonPath_${new Date().toString()}`; @@ -865,7 +865,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, console: testParams.console as any, - redirectOutput: testParams.redirectOutput + redirectOutput: testParams.redirectOutput, }); expect(debugConfig).to.have.property('redirectOutput', testParams.expectedRedirectOutput); if (testParams.expectedRedirectOutput) { @@ -883,7 +883,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { setupActiveEditor(pythonFile, PYTHON_LANGUAGE); const debugConfig = await resolveDebugConfiguration(workspaceFolder, { - ...launch + ...launch, }); if (osType === OSType.Windows) { expect(debugConfig).to.have.property('debugOptions').contains(DebugOptions.FixFilePathCase); @@ -904,7 +904,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, debugOptions: [DebugOptions.Pyramid], - pyramid: true + pyramid: true, }); expect(debugConfig).to.have.property('debugOptions'); @@ -920,7 +920,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, - module: 'flask' + module: 'flask', }); expect(debugConfig).to.have.property('debugOptions'); @@ -942,8 +942,8 @@ getInfoPerOS().forEach(([osName, osType, path]) => { h.validatePythonPath( TypeMoq.It.isValue(pythonPath), PythonPathSource.launchJson, - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) // Invalid .returns(() => Promise.resolve(false)); @@ -952,8 +952,8 @@ getInfoPerOS().forEach(([osName, osType, path]) => { h.validatePythonPath( TypeMoq.It.isValue(debugLauncherPython), PythonPathSource.launchJson, - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve(true)); diagnosticsService @@ -961,8 +961,8 @@ getInfoPerOS().forEach(([osName, osType, path]) => { h.validatePythonPath( TypeMoq.It.isValue(debugAdapterPython), PythonPathSource.launchJson, - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve(true)); @@ -971,7 +971,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { redirectOutput: false, python: pythonPath, debugLauncherPython, - debugAdapterPython + debugAdapterPython, }); diagnosticsService.verifyAll(); @@ -993,8 +993,8 @@ getInfoPerOS().forEach(([osName, osType, path]) => { h.validatePythonPath( TypeMoq.It.isValue(pythonPath), PythonPathSource.launchJson, - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve(true)); diagnosticsService @@ -1002,8 +1002,8 @@ getInfoPerOS().forEach(([osName, osType, path]) => { h.validatePythonPath( TypeMoq.It.isValue(debugLauncherPython), PythonPathSource.launchJson, - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) // Invalid .returns(() => Promise.resolve(false)); @@ -1012,8 +1012,8 @@ getInfoPerOS().forEach(([osName, osType, path]) => { h.validatePythonPath( TypeMoq.It.isValue(debugAdapterPython), PythonPathSource.launchJson, - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve(true)); @@ -1022,7 +1022,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { redirectOutput: false, python: pythonPath, debugLauncherPython, - debugAdapterPython + debugAdapterPython, }); diagnosticsService.verifyAll(); @@ -1044,8 +1044,8 @@ getInfoPerOS().forEach(([osName, osType, path]) => { h.validatePythonPath( TypeMoq.It.isValue(pythonPath), PythonPathSource.launchJson, - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve(true)); diagnosticsService @@ -1053,8 +1053,8 @@ getInfoPerOS().forEach(([osName, osType, path]) => { h.validatePythonPath( TypeMoq.It.isValue(debugLauncherPython), PythonPathSource.launchJson, - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve(true)); diagnosticsService @@ -1062,8 +1062,8 @@ getInfoPerOS().forEach(([osName, osType, path]) => { h.validatePythonPath( TypeMoq.It.isValue(debugAdapterPython), PythonPathSource.launchJson, - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) // Invalid .returns(() => Promise.resolve(false)); @@ -1073,7 +1073,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { redirectOutput: false, python: pythonPath, debugLauncherPython, - debugAdapterPython + debugAdapterPython, }); diagnosticsService.verifyAll(); @@ -1093,8 +1093,8 @@ getInfoPerOS().forEach(([osName, osType, path]) => { h.validatePythonPath( TypeMoq.It.isValue(pythonPath), PythonPathSource.launchJson, - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve(true)) .verifiable(TypeMoq.Times.atLeastOnce()); @@ -1102,7 +1102,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, { ...launch, redirectOutput: false, - python: pythonPath + python: pythonPath, }); diagnosticsService.verifyAll(); @@ -1121,7 +1121,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { diagnosticsService.reset(); diagnosticsService .setup((h) => - h.validatePythonPath(TypeMoq.It.isValue(pythonPath), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + h.validatePythonPath(TypeMoq.It.isValue(pythonPath), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns(() => Promise.resolve(true)); @@ -1129,7 +1129,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { ...launch, redirectOutput: false, pythonPath, - envFile: path.join('${workspaceFolder}', 'wow.envFile') + envFile: path.join('${workspaceFolder}', 'wow.envFile'), }); expect(debugConfig!.envFile).to.be.equal(expectedEnvFilePath); @@ -1139,21 +1139,21 @@ getInfoPerOS().forEach(([osName, osType, path]) => { requestType: 'launch' | 'attach', settings: Record, debugOptionName: DebugOptions, - mustHaveDebugOption: boolean + mustHaveDebugOption: boolean, ) { setupIoc('pythonPath'); let debugConfig: DebugConfiguration = { request: requestType, type: 'python', name: '', - ...settings + ...settings, }; const workspaceFolder = createMoqWorkspaceFolder(__dirname); debugConfig = (await debugProvider.resolveDebugConfiguration!(workspaceFolder, debugConfig))!; debugConfig = (await debugProvider.resolveDebugConfigurationWithSubstitutedVariables!( workspaceFolder, - debugConfig + debugConfig, ))!; if (mustHaveDebugOption) { diff --git a/src/test/debugger/extension/hooks/childProcessAttachHandler.unit.test.ts b/src/test/debugger/extension/hooks/childProcessAttachHandler.unit.test.ts index 69d353da035a..63a661137508 100644 --- a/src/test/debugger/extension/hooks/childProcessAttachHandler.unit.test.ts +++ b/src/test/debugger/extension/hooks/childProcessAttachHandler.unit.test.ts @@ -51,7 +51,7 @@ suite('Debug - Child Process', () => { type: 'python', request: 'attach', port: 1234, - subProcessId: 2 + subProcessId: 2, }; const session: any = {}; when(attachService.attach(body, session)).thenThrow(new Error('Kaboom')); diff --git a/src/test/debugger/extension/hooks/childProcessAttachService.unit.test.ts b/src/test/debugger/extension/hooks/childProcessAttachService.unit.test.ts index c92147569be6..cc07274de188 100644 --- a/src/test/debugger/extension/hooks/childProcessAttachService.unit.test.ts +++ b/src/test/debugger/extension/hooks/childProcessAttachService.unit.test.ts @@ -28,7 +28,7 @@ suite('Debug - Attach to Child Process', () => { attachService = new ChildProcessAttachService( instance(shell), instance(debugService), - instance(workspaceService) + instance(workspaceService), ); }); @@ -38,7 +38,7 @@ suite('Debug - Attach to Child Process', () => { type: 'python', request: 'attach', port: 1234, - subProcessId: 2 + subProcessId: 2, }; const session: any = {}; when(workspaceService.hasWorkspaceFolders).thenReturn(false); @@ -57,7 +57,7 @@ suite('Debug - Attach to Child Process', () => { type: 'python', request: 'attach', port: 1234, - subProcessId: 2 + subProcessId: 2, }; const session: any = {}; @@ -82,7 +82,7 @@ suite('Debug - Attach to Child Process', () => { request: 'attach', port: 1234, subProcessId: 2, - workspaceFolder: rightWorkspaceFolder.uri.fsPath + workspaceFolder: rightWorkspaceFolder.uri.fsPath, }; const session: any = {}; @@ -107,7 +107,7 @@ suite('Debug - Attach to Child Process', () => { request: 'attach', port: 1234, subProcessId: 2, - workspaceFolder: rightWorkspaceFolder.uri.fsPath + workspaceFolder: rightWorkspaceFolder.uri.fsPath, }; const session: any = {}; @@ -128,7 +128,7 @@ suite('Debug - Attach to Child Process', () => { name: 'Attach', port: 1234, subProcessId: 2, - host: 'localhost' + host: 'localhost', }; const debugConfig = JSON.parse(JSON.stringify(data)); @@ -151,7 +151,7 @@ suite('Debug - Attach to Child Process', () => { const data: AttachRequestArguments = { type: 'python', request: 'attach', - name: '' + name: '', }; const session: any = {}; const debugConfig = JSON.parse(JSON.stringify(data)); @@ -175,7 +175,7 @@ suite('Debug - Attach to Child Process', () => { name: 'Attach', host: '123.123.123.123', port: 1234, - subProcessId: 2 + subProcessId: 2, }; const debugConfig = JSON.parse(JSON.stringify(data)); diff --git a/src/test/debugger/extension/serviceRegistry.unit.test.ts b/src/test/debugger/extension/serviceRegistry.unit.test.ts index 62d34759578b..afd24e44c792 100644 --- a/src/test/debugger/extension/serviceRegistry.unit.test.ts +++ b/src/test/debugger/extension/serviceRegistry.unit.test.ts @@ -31,7 +31,7 @@ import { AttachConfigurationResolver } from '../../../client/debugger/extension/ import { LaunchConfigurationResolver } from '../../../client/debugger/extension/configuration/resolvers/launch'; import { IDebugConfigurationProviderFactory, - IDebugConfigurationResolver + IDebugConfigurationResolver, } from '../../../client/debugger/extension/configuration/types'; import { ChildProcessAttachEventHandler } from '../../../client/debugger/extension/hooks/childProcessAttachHandler'; import { ChildProcessAttachService } from '../../../client/debugger/extension/hooks/childProcessAttachService'; @@ -44,7 +44,7 @@ import { IDebugConfigurationService, IDebuggerBanner, IDebugSessionLoggingFactory, - IOutdatedDebuggerPromptFactory + IOutdatedDebuggerPromptFactory, } from '../../../client/debugger/extension/types'; import { AttachRequestArguments, LaunchRequestArguments } from '../../../client/debugger/types'; import { ServiceManager } from '../../../client/ioc/serviceManager'; @@ -62,158 +62,158 @@ suite('Debugging - Service Registry', () => { verify( serviceManager.addSingleton( IExtensionSingleActivationService, - InterpreterPathCommand - ) + InterpreterPathCommand, + ), ).once(); verify( serviceManager.addSingleton( IDebugConfigurationService, - PythonDebugConfigurationService - ) + PythonDebugConfigurationService, + ), ).once(); verify(serviceManager.addSingleton(IDebuggerBanner, DebuggerBanner)).once(); verify( serviceManager.addSingleton( IChildProcessAttachService, - ChildProcessAttachService - ) + ChildProcessAttachService, + ), ).once(); verify( serviceManager.addSingleton( IExtensionSingleActivationService, - LaunchJsonCompletionProvider - ) + LaunchJsonCompletionProvider, + ), ).once(); verify( serviceManager.addSingleton( IExtensionSingleActivationService, - LaunchJsonUpdaterService - ) + LaunchJsonUpdaterService, + ), ).once(); verify( serviceManager.addSingleton( IExtensionSingleActivationService, - DebugAdapterActivator - ) + DebugAdapterActivator, + ), ).once(); verify( serviceManager.addSingleton( IDebugAdapterDescriptorFactory, - DebugAdapterDescriptorFactory - ) + DebugAdapterDescriptorFactory, + ), ).once(); verify( serviceManager.addSingleton( IDebugSessionEventHandlers, - ChildProcessAttachEventHandler - ) + ChildProcessAttachEventHandler, + ), ).once(); verify( serviceManager.addSingleton>( IDebugConfigurationResolver, LaunchConfigurationResolver, - 'launch' - ) + 'launch', + ), ).once(); verify( serviceManager.addSingleton>( IDebugConfigurationResolver, AttachConfigurationResolver, - 'attach' - ) + 'attach', + ), ).once(); verify( serviceManager.addSingleton( IDebugConfigurationProviderFactory, - DebugConfigurationProviderFactory - ) + DebugConfigurationProviderFactory, + ), ).once(); verify( serviceManager.addSingleton( IDebugConfigurationProvider, FileLaunchDebugConfigurationProvider, - DebugConfigurationType.launchFile - ) + DebugConfigurationType.launchFile, + ), ).once(); verify( serviceManager.addSingleton( IDebugConfigurationProvider, DjangoLaunchDebugConfigurationProvider, - DebugConfigurationType.launchDjango - ) + DebugConfigurationType.launchDjango, + ), ).once(); verify( serviceManager.addSingleton( IDebugConfigurationProvider, FastAPILaunchDebugConfigurationProvider, - DebugConfigurationType.launchFastAPI - ) + DebugConfigurationType.launchFastAPI, + ), ).once(); verify( serviceManager.addSingleton( IDebugConfigurationProvider, FlaskLaunchDebugConfigurationProvider, - DebugConfigurationType.launchFlask - ) + DebugConfigurationType.launchFlask, + ), ).once(); verify( serviceManager.addSingleton( IDebugConfigurationProvider, RemoteAttachDebugConfigurationProvider, - DebugConfigurationType.remoteAttach - ) + DebugConfigurationType.remoteAttach, + ), ).once(); verify( serviceManager.addSingleton( IDebugConfigurationProvider, ModuleLaunchDebugConfigurationProvider, - DebugConfigurationType.launchModule - ) + DebugConfigurationType.launchModule, + ), ).once(); verify( serviceManager.addSingleton( IDebugConfigurationProvider, PyramidLaunchDebugConfigurationProvider, - DebugConfigurationType.launchPyramid - ) + DebugConfigurationType.launchPyramid, + ), ).once(); verify( serviceManager.addSingleton( IDebugConfigurationProvider, PidAttachDebugConfigurationProvider, - DebugConfigurationType.pidAttach - ) + DebugConfigurationType.pidAttach, + ), ).once(); verify( serviceManager.addSingleton( IExtensionSingleActivationService, - DebugAdapterActivator - ) + DebugAdapterActivator, + ), ).once(); verify( serviceManager.addSingleton( IDebugAdapterDescriptorFactory, - DebugAdapterDescriptorFactory - ) + DebugAdapterDescriptorFactory, + ), ).once(); verify( serviceManager.addSingleton( IDebugSessionLoggingFactory, - DebugSessionLoggingFactory - ) + DebugSessionLoggingFactory, + ), ).once(); verify( serviceManager.addSingleton( IOutdatedDebuggerPromptFactory, - OutdatedDebuggerPromptFactory - ) + OutdatedDebuggerPromptFactory, + ), ).once(); verify( serviceManager.addSingleton( IAttachProcessProviderFactory, - AttachProcessProviderFactory - ) + AttachProcessProviderFactory, + ), ).once(); }); }); diff --git a/src/test/debugger/utils.ts b/src/test/debugger/utils.ts index 61496a14671f..0c4ba1a30a4e 100644 --- a/src/test/debugger/utils.ts +++ b/src/test/debugger/utils.ts @@ -42,7 +42,7 @@ type TrackedDebugger = { class DebugAdapterTracker { constructor( // This contains all the state. - private readonly tracked: TrackedDebugger + private readonly tracked: TrackedDebugger, ) {} // debugpy -> VS Code @@ -153,7 +153,7 @@ class Debuggers { } const result = { exitCode: tracked.exitCode, - stdout: tracked.output.stdout + stdout: tracked.output.stdout, }; this.results[id] = result; return result; @@ -184,7 +184,7 @@ class DebuggerSession { public readonly id: number, public readonly config: vscode.DebugConfiguration, private readonly wsRoot?: vscode.WorkspaceFolder, - private readonly proc?: Proc + private readonly proc?: Proc, ) {} public async start() { @@ -215,7 +215,7 @@ class DebuggerSession { vscode.Uri.file(filename), // VS Code wants 0-indexed line and column numbers. // We default to the beginning of the line. - new vscode.Position(line - 1, ch ? ch - 1 : 0) + new vscode.Position(line - 1, ch ? ch - 1 : 0), ); const bp = new vscode.SourceBreakpoint(loc); vscode.debug.addBreakpoints([bp]); @@ -240,7 +240,7 @@ class DebuggerSession { const msg = (baseMsg as unknown) as DebugProtocol.StoppedEvent; this.stopped = { breakpoint: msg.body.reason === 'breakpoint', - threadId: (msg.body.threadId as unknown) as number + threadId: (msg.body.threadId as unknown) as number, }; } else { // For now there aren't any other events we care about. @@ -283,7 +283,7 @@ export class DebuggerFixture extends PythonFixture { configName: string, file: string, scriptArgs: string[], - wsRoot?: vscode.WorkspaceFolder + wsRoot?: vscode.WorkspaceFolder, ): DebuggerSession { const config = getConfig(configName); let proc: Proc | undefined; @@ -323,7 +323,7 @@ export class DebuggerFixture extends PythonFixture { request: 'launch', program: filename, args: args, - console: 'integratedTerminal' + console: 'integratedTerminal', }; } @@ -340,9 +340,9 @@ export class DebuggerFixture extends PythonFixture { { // tslint:disable-next-line:no-invalid-template-strings localRoot: '${workspaceFolder}', - remoteRoot: '.' - } - ] + remoteRoot: '.', + }, + ], }; } else { const proc = this.runScript(filename, ...args); @@ -350,7 +350,7 @@ export class DebuggerFixture extends PythonFixture { type: 'python', name: 'debug', request: 'attach', - processId: proc.pid + processId: proc.pid, }; } } @@ -360,7 +360,7 @@ export class DebuggerFixture extends PythonFixture { host: 'localhost', port: port, // This causes problems if we set it to true. - waitUntilDebuggerAttaches: false + waitUntilDebuggerAttaches: false, }); args.push(filename, ...scriptArgs); return this.runScript(args[0], ...args.slice(1)); diff --git a/src/test/debuggerTest.ts b/src/test/debuggerTest.ts index 3720b0e662ed..5f337d9482d7 100644 --- a/src/test/debuggerTest.ts +++ b/src/test/debuggerTest.ts @@ -20,7 +20,7 @@ function start() { extensionTestsPath: path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'out', 'test', 'index'), launchArgs: [workspacePath], version: channel, - extensionTestsEnv: { ...process.env, UITEST_DISABLE_INSIDERS: '1' } + extensionTestsEnv: { ...process.env, UITEST_DISABLE_INSIDERS: '1' }, }).catch((ex) => { console.error('End Debugger tests (with errors)', ex); process.exit(1); diff --git a/src/test/extension-version.functional.test.ts b/src/test/extension-version.functional.test.ts index f19310c6540b..0f4e49b24273 100644 --- a/src/test/extension-version.functional.test.ts +++ b/src/test/extension-version.functional.test.ts @@ -39,7 +39,7 @@ suite('Extension version tests', () => { return expect( version.endsWith('-dev'), - 'When running a pipeline in the main branch, the extension version in package.json should have the -dev suffix' + 'When running a pipeline in the main branch, the extension version in package.json should have the -dev suffix', ).to.be.true; }); @@ -51,7 +51,7 @@ suite('Extension version tests', () => { return expect( version.endsWith('-dev'), - 'When running a pipeline in the release branch, the extension version in package.json should not have the -dev suffix' + 'When running a pipeline in the release branch, the extension version in package.json should not have the -dev suffix', ).to.be.false; }); }); diff --git a/src/test/fixtures.ts b/src/test/fixtures.ts index 0df2aaddffb8..7b44cd90e493 100644 --- a/src/test/fixtures.ts +++ b/src/test/fixtures.ts @@ -44,7 +44,7 @@ export class CleanupFixture { // tslint:disable-next-line:no-console console.error('moving on...'); } - }) + }), ); } } @@ -53,7 +53,7 @@ export class PythonFixture extends CleanupFixture { public readonly python: string; constructor( // If not provided, we will use the global default. - python?: string + python?: string, ) { super(); if (python) { diff --git a/src/test/format/extension.dispatch.test.ts b/src/test/format/extension.dispatch.test.ts index 19d937a4cfc6..0500d9987a6c 100644 --- a/src/test/format/extension.dispatch.test.ts +++ b/src/test/format/extension.dispatch.test.ts @@ -12,7 +12,7 @@ import { Position, ProviderResult, TextDocument, - TextEdit + TextEdit, } from 'vscode'; import { OnTypeFormattingDispatcher } from '../../client/typeFormatters/dispatcher'; @@ -34,7 +34,7 @@ suite('Formatting - Dispatcher', () => { pos.object, '\n', opt.object, - token.object + token.object, ); assert.deepStrictEqual(result, [], 'Did not return an empty list of edits'); }); @@ -43,7 +43,7 @@ suite('Formatting - Dispatcher', () => { const provider = setupProvider(doc.object, pos.object, ':', opt.object, token.object, edits.object); const dispatcher = new OnTypeFormattingDispatcher({ - ':': provider.object + ':': provider.object, }); const triggers = dispatcher.getTriggerCharacters(); @@ -70,12 +70,12 @@ suite('Formatting - Dispatcher', () => { '\n', opt2.object, token2.object, - edits2.object + edits2.object, ); const dispatcher = new OnTypeFormattingDispatcher({ ':': colonProvider.object, - '\n': newlineProvider.object + '\n': newlineProvider.object, }); const triggers = dispatcher.getTriggerCharacters(); @@ -89,7 +89,7 @@ suite('Formatting - Dispatcher', () => { pos2.object, '\n', opt2.object, - token2.object + token2.object, ); assert.equal(result2, edits2.object, 'Did not return correct edits for newline provider'); @@ -103,7 +103,7 @@ suite('Formatting - Dispatcher', () => { ch: string, options: FormattingOptions, cancellationToken: CancellationToken, - result: ProviderResult + result: ProviderResult, ): TypeMoq.IMock { const provider = TypeMoq.Mock.ofType(); provider diff --git a/src/test/format/extension.format.test.ts b/src/test/format/extension.format.test.ts index f4030765e6c0..9e47570e44aa 100644 --- a/src/test/format/extension.format.test.ts +++ b/src/test/format/extension.format.test.ts @@ -98,7 +98,7 @@ suite('Formatting - General', () => { if (args.indexOf('--diff') >= 0) { callback({ out: fs.readFileSync(path.join(formatFilesPath, outputFileName), 'utf8'), - source: 'stdout' + source: 'stdout', }); } }); @@ -108,13 +108,13 @@ suite('Formatting - General', () => { formatter: AutoPep8Formatter | BlackFormatter | YapfFormatter, formattedContents: string, fileToFormat: string, - outputFileName: string + outputFileName: string, ) { const textDocument = await workspace.openTextDocument(fileToFormat); const textEditor = await window.showTextDocument(textDocument); const options = { insertSpaces: textEditor.options.insertSpaces! as boolean, - tabSize: textEditor.options.tabSize! as number + tabSize: textEditor.options.tabSize! as number, }; await injectFormatOutput(outputFileName); @@ -134,7 +134,7 @@ suite('Formatting - General', () => { new AutoPep8Formatter(ioc.serviceContainer), formattedAutoPep8, autoPep8FileToFormat, - 'autopep8.output' + 'autopep8.output', ); }); // tslint:disable-next-line:no-function-expression @@ -151,7 +151,7 @@ suite('Formatting - General', () => { new BlackFormatter(ioc.serviceContainer), formattedBlack, blackFileToFormat, - 'black.output' + 'black.output', ); }); test('Yapf', async () => diff --git a/src/test/format/extension.lineFormatter.test.ts b/src/test/format/extension.lineFormatter.test.ts index 37c6b33edc93..8e9a5921269c 100644 --- a/src/test/format/extension.lineFormatter.test.ts +++ b/src/test/format/extension.lineFormatter.test.ts @@ -35,7 +35,7 @@ suite('Formatting - line formatter', () => { test('Colon slices with double colon', () => { testFormatLine( 'ham [1:9 ], ham[ 1: 9: 3], ham[: 9 :3], ham[1: :3], ham [ 1: 9:]', - 'ham[1:9], ham[1:9:3], ham[:9:3], ham[1::3], ham[1:9:]' + 'ham[1:9], ham[1:9:3], ham[:9:3], ham[1::3], ham[1:9:]', ); }); test('Colon slices with operators', () => { @@ -44,7 +44,7 @@ suite('Formatting - line formatter', () => { test('Colon slices with functions', () => { testFormatLine( 'ham[ : upper_fn ( x) : step_fn(x )], ham[ :: step_fn(x)]', - 'ham[:upper_fn(x):step_fn(x)], ham[::step_fn(x)]' + 'ham[:upper_fn(x):step_fn(x)], ham[::step_fn(x)]', ); }); test('Colon in for loop', () => { @@ -136,7 +136,7 @@ suite('Formatting - line formatter', () => { testFormatMultiline( 'l4= lambda x =lambda y =lambda z= 1: z: y(): x()', 0, - 'l4 = lambda x=lambda y=lambda z=1: z: y(): x()' + 'l4 = lambda x=lambda y=lambda z=1: z: y(): x()', ); }); test('star in multiline arguments', () => { @@ -162,13 +162,13 @@ suite('Formatting - line formatter', () => { async with session.ws_connect( "http://127.0.0.1:8000/", headers = cookie) as ws: # add unwanted spaces`, 3, - ' "http://127.0.0.1:8000/", headers=cookie) as ws: # add unwanted spaces' + ' "http://127.0.0.1:8000/", headers=cookie) as ws: # add unwanted spaces', ); testFormatMultiline('def pos0key1(*, key): return key\npos0key1(key= 100)', 1, 'pos0key1(key=100)'); testFormatMultiline( 'def test_string_literals(self):\n x= 1; y =2; self.assertTrue(len(x) == 0 and x == y)', 1, - ' x = 1; y = 2; self.assertTrue(len(x) == 0 and x == y)' + ' x = 1; y = 2; self.assertTrue(len(x) == 0 and x == y)', ); }); test('Grammar file', () => { @@ -201,7 +201,7 @@ suite('Formatting - line formatter', () => { const line = TypeMoq.Mock.ofType(); line.setup((x) => x.text).returns(() => lines[n]); line.setup((x) => x.range).returns( - () => new Range(new Position(n, 0), new Position(n, lines[n].length)) + () => new Range(new Position(n, 0), new Position(n, lines[n].length)), ); return line.object; }); diff --git a/src/test/format/extension.onEnterFormat.test.ts b/src/test/format/extension.onEnterFormat.test.ts index 69bf32e47366..2582fb9d1663 100644 --- a/src/test/format/extension.onEnterFormat.test.ts +++ b/src/test/format/extension.onEnterFormat.test.ts @@ -57,7 +57,7 @@ suite('Formatting - OnEnter provider', () => { new Position(line, character), '\n', { insertSpaces: true, tabSize: 2 }, - token + token, ); expect(edits).to.be.lengthOf(1); expect(edits[0].newText).to.be.equal(expectedFormattedString); @@ -69,7 +69,7 @@ suite('Formatting - OnEnter provider', () => { new Position(line, character), '\n', { insertSpaces: true, tabSize: 2 }, - token + token, ); expect(edits).to.be.lengthOf(0); } diff --git a/src/test/format/extension.onTypeFormat.test.ts b/src/test/format/extension.onTypeFormat.test.ts index 767d378db80d..408ec51292d5 100644 --- a/src/test/format/extension.onTypeFormat.test.ts +++ b/src/test/format/extension.onTypeFormat.test.ts @@ -31,7 +31,7 @@ function testFormatting( fileToFormat: string, position: vscode.Position, expectedEdits: vscode.TextEdit[], - formatOptions: vscode.FormattingOptions + formatOptions: vscode.FormattingOptions, ): PromiseLike { let textDocument: vscode.TextDocument; return vscode.workspace @@ -46,7 +46,7 @@ function testFormatting( position, ':', formatOptions, - new vscode.CancellationTokenSource().token + new vscode.CancellationTokenSource().token, ); }) .then( @@ -57,19 +57,19 @@ function testFormatting( assert.equal( edit.newText, expectedEdit.newText, - `newText for edit is not the same for index = ${index}` + `newText for edit is not the same for index = ${index}`, ); const providedRange = `${edit.range.start.line},${edit.range.start.character},${edit.range.end.line},${edit.range.end.character}`; const expectedRange = `${expectedEdit.range.start.line},${expectedEdit.range.start.character},${expectedEdit.range.end.line},${expectedEdit.range.end.character}`; assert.ok( edit.range.isEqual(expectedEdit.range), - `range for edit is not the same for index = ${index}, provided ${providedRange}, expected ${expectedRange}` + `range for edit is not the same for index = ${index}, provided ${providedRange}, expected ${expectedRange}`, ); }); }, (reason) => { assert.fail(reason, undefined, 'Type Formatting failed', ''); - } + }, ); } @@ -104,7 +104,7 @@ suite('Else block with if in first line of file', () => { column: 7, expectedEdits: [vscode.TextEdit.delete(new vscode.Range(3, 0, 3, 2))], formatOptions: { insertSpaces: true, tabSize: 2 }, - filePath: elseBlockFirstLine2OutFilePath + filePath: elseBlockFirstLine2OutFilePath, }, { title: 'else block with 4 spaces', @@ -112,7 +112,7 @@ suite('Else block with if in first line of file', () => { column: 9, expectedEdits: [vscode.TextEdit.delete(new vscode.Range(3, 0, 3, 4))], formatOptions: { insertSpaces: true, tabSize: 4 }, - filePath: elseBlockFirstLine4OutFilePath + filePath: elseBlockFirstLine4OutFilePath, }, { title: 'else block with Tab', @@ -120,11 +120,11 @@ suite('Else block with if in first line of file', () => { column: 6, expectedEdits: [ vscode.TextEdit.delete(new vscode.Range(3, 0, 3, 1)), - vscode.TextEdit.insert(new vscode.Position(3, 0), '') + vscode.TextEdit.insert(new vscode.Position(3, 0), ''), ], formatOptions: { insertSpaces: false, tabSize: 4 }, - filePath: elseBlockFirstLineTabOutFilePath - } + filePath: elseBlockFirstLineTabOutFilePath, + }, ]; testCases.forEach((testCase, index) => { @@ -162,67 +162,67 @@ suite('Try blocks with indentation of 2 spaces', () => { title: 'except off by tab', line: 6, column: 22, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(6, 0, 6, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(6, 0, 6, 2))], }, { title: 'except off by one should not be formatted', line: 15, column: 21, - expectedEdits: [] + expectedEdits: [], }, { title: 'except off by tab inside a for loop', line: 35, column: 13, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(35, 0, 35, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(35, 0, 35, 2))], }, { title: 'except off by one inside a for loop should not be formatted', line: 47, column: 12, - expectedEdits: [] + expectedEdits: [], }, { title: 'except IOError: off by tab inside a for loop', line: 54, column: 19, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(54, 0, 54, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(54, 0, 54, 2))], }, { title: 'else: off by tab inside a for loop', line: 76, column: 9, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(76, 0, 76, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(76, 0, 76, 2))], }, { title: 'except ValueError:: off by tab inside a function', line: 143, column: 22, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(143, 0, 143, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(143, 0, 143, 2))], }, { title: 'except ValueError as err: off by one inside a function should not be formatted', line: 157, column: 25, - expectedEdits: [] + expectedEdits: [], }, { title: 'else: off by tab inside function', line: 172, column: 11, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(172, 0, 172, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(172, 0, 172, 2))], }, { title: 'finally: off by tab inside function', line: 195, column: 12, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(195, 0, 195, 2))] - } + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(195, 0, 195, 2))], + }, ]; const formatOptions: vscode.FormattingOptions = { insertSpaces: true, - tabSize: 2 + tabSize: 2, }; testCases.forEach((testCase, index) => { @@ -260,67 +260,67 @@ suite('Try blocks with indentation of 4 spaces', () => { title: 'except off by tab', line: 6, column: 22, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(6, 0, 6, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(6, 0, 6, 4))], }, { title: 'except off by one should not be formatted', line: 15, column: 21, - expectedEdits: [] + expectedEdits: [], }, { title: 'except off by tab inside a for loop', line: 35, column: 13, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(35, 0, 35, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(35, 0, 35, 4))], }, { title: 'except off by one inside a for loop should not be formatted', line: 47, column: 12, - expectedEdits: [] + expectedEdits: [], }, { title: 'except IOError: off by tab inside a for loop', line: 54, column: 19, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(54, 0, 54, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(54, 0, 54, 4))], }, { title: 'else: off by tab inside a for loop', line: 76, column: 9, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(76, 0, 76, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(76, 0, 76, 4))], }, { title: 'except ValueError:: off by tab inside a function', line: 143, column: 22, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(143, 0, 143, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(143, 0, 143, 4))], }, { title: 'except ValueError as err: off by one inside a function should not be formatted', line: 157, column: 25, - expectedEdits: [] + expectedEdits: [], }, { title: 'else: off by tab inside function', line: 172, column: 11, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(172, 0, 172, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(172, 0, 172, 4))], }, { title: 'finally: off by tab inside function', line: 195, column: 12, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(195, 0, 195, 4))] - } + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(195, 0, 195, 4))], + }, ]; const formatOptions: vscode.FormattingOptions = { insertSpaces: true, - tabSize: 4 + tabSize: 4, }; testCases.forEach((testCase, index) => { @@ -361,8 +361,8 @@ suite('Try blocks with indentation of Tab', () => { column: 22, expectedEdits: [ vscode.TextEdit.delete(new vscode.Range(6, 0, 6, 2)), - vscode.TextEdit.insert(new vscode.Position(6, 0), TAB) - ] + vscode.TextEdit.insert(new vscode.Position(6, 0), TAB), + ], }, { title: 'except off by tab inside a for loop', @@ -370,8 +370,8 @@ suite('Try blocks with indentation of Tab', () => { column: 13, expectedEdits: [ vscode.TextEdit.delete(new vscode.Range(35, 0, 35, 2)), - vscode.TextEdit.insert(new vscode.Position(35, 0), TAB) - ] + vscode.TextEdit.insert(new vscode.Position(35, 0), TAB), + ], }, { title: 'except IOError: off by tab inside a for loop', @@ -379,8 +379,8 @@ suite('Try blocks with indentation of Tab', () => { column: 19, expectedEdits: [ vscode.TextEdit.delete(new vscode.Range(54, 0, 54, 2)), - vscode.TextEdit.insert(new vscode.Position(54, 0), TAB) - ] + vscode.TextEdit.insert(new vscode.Position(54, 0), TAB), + ], }, { title: 'else: off by tab inside a for loop', @@ -388,8 +388,8 @@ suite('Try blocks with indentation of Tab', () => { column: 9, expectedEdits: [ vscode.TextEdit.delete(new vscode.Range(76, 0, 76, 2)), - vscode.TextEdit.insert(new vscode.Position(76, 0), TAB) - ] + vscode.TextEdit.insert(new vscode.Position(76, 0), TAB), + ], }, { title: 'except ValueError:: off by tab inside a function', @@ -397,8 +397,8 @@ suite('Try blocks with indentation of Tab', () => { column: 22, expectedEdits: [ vscode.TextEdit.delete(new vscode.Range(143, 0, 143, 2)), - vscode.TextEdit.insert(new vscode.Position(143, 0), TAB) - ] + vscode.TextEdit.insert(new vscode.Position(143, 0), TAB), + ], }, { title: 'else: off by tab inside function', @@ -406,8 +406,8 @@ suite('Try blocks with indentation of Tab', () => { column: 11, expectedEdits: [ vscode.TextEdit.delete(new vscode.Range(172, 0, 172, 3)), - vscode.TextEdit.insert(new vscode.Position(172, 0), TAB + TAB) - ] + vscode.TextEdit.insert(new vscode.Position(172, 0), TAB + TAB), + ], }, { title: 'finally: off by tab inside function', @@ -415,14 +415,14 @@ suite('Try blocks with indentation of Tab', () => { column: 12, expectedEdits: [ vscode.TextEdit.delete(new vscode.Range(195, 0, 195, 2)), - vscode.TextEdit.insert(new vscode.Position(195, 0), TAB) - ] - } + vscode.TextEdit.insert(new vscode.Position(195, 0), TAB), + ], + }, ]; const formatOptions: vscode.FormattingOptions = { insertSpaces: false, - tabSize: 4 + tabSize: 4, }; testCases.forEach((testCase, index) => { @@ -461,91 +461,91 @@ suite('Else blocks with indentation of 2 spaces', () => { title: 'elif off by tab', line: 4, column: 18, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(4, 0, 4, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(4, 0, 4, 2))], }, { title: 'elif off by tab', line: 7, column: 18, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(7, 0, 7, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(7, 0, 7, 2))], }, { title: 'elif off by tab again', line: 21, column: 18, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(21, 0, 21, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(21, 0, 21, 2))], }, { title: 'else off by tab', line: 38, column: 7, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(38, 0, 38, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(38, 0, 38, 2))], }, { title: 'else: off by tab inside a for loop', line: 47, column: 13, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(47, 0, 47, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(47, 0, 47, 2))], }, { title: 'else: off by tab inside a try', line: 57, column: 9, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(57, 0, 57, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(57, 0, 57, 2))], }, { title: 'elif off by a tab inside a function', line: 66, column: 20, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(66, 0, 66, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(66, 0, 66, 2))], }, { title: 'elif off by a tab inside a function should not format', line: 69, column: 20, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(69, 0, 69, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(69, 0, 69, 2))], }, { title: 'elif off by a tab inside a function', line: 83, column: 20, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(83, 0, 83, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(83, 0, 83, 2))], }, { title: 'else: off by tab inside if of a for and for in a function', line: 109, column: 15, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(109, 0, 109, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(109, 0, 109, 2))], }, { title: 'else: off by tab inside try in a function', line: 119, column: 11, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(119, 0, 119, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(119, 0, 119, 2))], }, { title: 'else: off by tab inside while in a function', line: 134, column: 9, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(134, 0, 134, 2))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(134, 0, 134, 2))], }, { title: 'elif: off by tab inside if but inline with elif', line: 345, column: 18, - expectedEdits: [] + expectedEdits: [], }, { title: 'elif: off by tab inside if but inline with if', line: 359, column: 18, - expectedEdits: [] - } + expectedEdits: [], + }, ]; const formatOptions: vscode.FormattingOptions = { insertSpaces: true, - tabSize: 2 + tabSize: 2, }; testCases.forEach((testCase, index) => { @@ -583,85 +583,85 @@ suite('Else blocks with indentation of 4 spaces', () => { title: 'elif off by tab', line: 4, column: 18, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(4, 0, 4, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(4, 0, 4, 4))], }, { title: 'elif off by tab', line: 7, column: 18, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(7, 0, 7, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(7, 0, 7, 4))], }, { title: 'elif off by tab again', line: 21, column: 18, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(21, 0, 21, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(21, 0, 21, 4))], }, { title: 'else off by tab', line: 38, column: 7, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(38, 0, 38, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(38, 0, 38, 4))], }, { title: 'else: off by tab inside a for loop', line: 47, column: 13, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(47, 0, 47, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(47, 0, 47, 4))], }, { title: 'else: off by tab inside a try', line: 57, column: 9, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(57, 0, 57, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(57, 0, 57, 4))], }, { title: 'elif off by a tab inside a function', line: 66, column: 20, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(66, 0, 66, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(66, 0, 66, 4))], }, { title: 'elif off by a tab inside a function should not format', line: 69, column: 20, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(69, 0, 69, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(69, 0, 69, 4))], }, { title: 'elif off by a tab inside a function', line: 83, column: 20, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(83, 0, 83, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(83, 0, 83, 4))], }, { title: 'else: off by tab inside if of a for and for in a function', line: 109, column: 15, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(109, 0, 109, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(109, 0, 109, 4))], }, { title: 'else: off by tab inside try in a function', line: 119, column: 11, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(119, 0, 119, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(119, 0, 119, 4))], }, { title: 'else: off by tab inside while in a function', line: 134, column: 9, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(134, 0, 134, 4))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(134, 0, 134, 4))], }, { title: 'elif: off by tab inside if but inline with elif', line: 345, column: 18, - expectedEdits: [] - } + expectedEdits: [], + }, ]; const formatOptions: vscode.FormattingOptions = { insertSpaces: true, - tabSize: 2 + tabSize: 2, }; testCases.forEach((testCase, index) => { @@ -700,85 +700,85 @@ suite('Else blocks with indentation of Tab', () => { title: 'elif off by tab', line: 4, column: 18, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(4, 0, 4, 1))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(4, 0, 4, 1))], }, { title: 'elif off by tab', line: 7, column: 18, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(7, 0, 7, 1))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(7, 0, 7, 1))], }, { title: 'elif off by tab again', line: 21, column: 18, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(21, 0, 21, 1))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(21, 0, 21, 1))], }, { title: 'else off by tab', line: 38, column: 7, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(38, 0, 38, 1))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(38, 0, 38, 1))], }, { title: 'else: off by tab inside a for loop', line: 47, column: 13, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(47, 0, 47, 1))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(47, 0, 47, 1))], }, { title: 'else: off by tab inside a try', line: 57, column: 9, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(57, 0, 57, 1))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(57, 0, 57, 1))], }, { title: 'elif off by a tab inside a function', line: 66, column: 20, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(66, 0, 66, 1))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(66, 0, 66, 1))], }, { title: 'elif off by a tab inside a function should not format', line: 69, column: 20, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(69, 0, 69, 1))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(69, 0, 69, 1))], }, { title: 'elif off by a tab inside a function', line: 83, column: 20, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(83, 0, 83, 1))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(83, 0, 83, 1))], }, { title: 'else: off by tab inside if of a for and for in a function', line: 109, column: 15, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(109, 0, 109, 1))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(109, 0, 109, 1))], }, { title: 'else: off by tab inside try in a function', line: 119, column: 11, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(119, 0, 119, 1))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(119, 0, 119, 1))], }, { title: 'else: off by tab inside while in a function', line: 134, column: 9, - expectedEdits: [vscode.TextEdit.delete(new vscode.Range(134, 0, 134, 1))] + expectedEdits: [vscode.TextEdit.delete(new vscode.Range(134, 0, 134, 1))], }, { title: 'elif: off by tab inside if but inline with elif', line: 345, column: 18, - expectedEdits: [] - } + expectedEdits: [], + }, ]; const formatOptions: vscode.FormattingOptions = { insertSpaces: true, - tabSize: 2 + tabSize: 2, }; testCases.forEach((testCase, index) => { diff --git a/src/test/format/extension.sort.test.ts b/src/test/format/extension.sort.test.ts index e05b4e7a4365..54648516c426 100644 --- a/src/test/format/extension.sort.test.ts +++ b/src/test/format/extension.sort.test.ts @@ -83,26 +83,26 @@ suite('Sorting', () => { assert.equal( edits.filter((value) => value.newText === EOL && value.range.isEqual(new Range(2, 0, 2, 0))).length, 1, - 'EOL not found' + 'EOL not found', ); assert.equal( edits.filter((value) => value.newText === '' && value.range.isEqual(new Range(3, 0, 4, 0))).length, 1, - '"" not found' + '"" not found', ); assert.equal( edits.filter( (value) => value.newText === `from rope.refactor.extract import ExtractMethod, ExtractVariable${EOL}` && - value.range.isEqual(new Range(15, 0, 15, 0)) + value.range.isEqual(new Range(15, 0, 15, 0)), ).length, 1, - 'Text not found' + 'Text not found', ); assert.equal( edits.filter((value) => value.newText === '' && value.range.isEqual(new Range(16, 0, 18, 0))).length, 1, - '"" not found' + '"" not found', ); }); @@ -125,7 +125,7 @@ suite('Sorting', () => { assert.equal( edits.filter((value) => value.newText === newValue && value.range.isEqual(new Range(0, 0, 3, 0))).length, 1, - 'New Text not found' + 'New Text not found', ); }); @@ -142,7 +142,7 @@ suite('Sorting', () => { 'sortImports.args', ['--sp', path.join(sortingPath, 'withconfig')], Uri.file(sortingPath), - ConfigurationTarget.Workspace + ConfigurationTarget.Workspace, ); const textDocument = await workspace.openTextDocument(fileToFormatWithConfig); const editor = await window.showTextDocument(textDocument); @@ -159,7 +159,7 @@ suite('Sorting', () => { 'sortImports.args', ['--sp', path.join(sortingPath, 'withconfig')], Uri.file(sortingPath), - configTarget + configTarget, ); const textDocument = await workspace.openTextDocument(fileToFormatWithConfig); const editor = await window.showTextDocument(textDocument); diff --git a/src/test/format/format.helper.test.ts b/src/test/format/format.helper.test.ts index 9ec60c994cb8..e0728746a9d8 100644 --- a/src/test/format/format.helper.test.ts +++ b/src/test/format/format.helper.test.ts @@ -42,7 +42,7 @@ suite('Formatting - Helper', () => { assert.equal( info.execPath, execPath, - `Incorrect executable paths for product ${formatHelper.translateToId(formatter)}` + `Incorrect executable paths for product ${formatHelper.translateToId(formatter)}`, ); }); }); @@ -61,7 +61,7 @@ suite('Formatting - Helper', () => { assert.equal( expectedArgs.endsWith(customArgs.join(',')), true, - `Incorrect custom arguments for product ${formatHelper.translateToId(formatter)}` + `Incorrect custom arguments for product ${formatHelper.translateToId(formatter)}`, ); }); }); @@ -71,13 +71,13 @@ suite('Formatting - Helper', () => { const translatedId = formatHelper.translateToId(formatter)!; const settings = { argsName: `${translatedId}Args` as keyof IFormattingSettings, - pathName: `${translatedId}Path` as keyof IFormattingSettings + pathName: `${translatedId}Path` as keyof IFormattingSettings, }; assert.deepEqual( formatHelper.getSettingsPropertyNames(formatter), settings, - `Incorrect settings for product ${formatHelper.translateToId(formatter)}` + `Incorrect settings for product ${formatHelper.translateToId(formatter)}`, ); }); }); @@ -93,7 +93,7 @@ suite('Formatting - Helper', () => { assert.equal( translatedId, formatterMapping.get(formatter)!, - `Incorrect translation for product ${formatHelper.translateToId(formatter)}` + `Incorrect translation for product ${formatHelper.translateToId(formatter)}`, ); }); }); diff --git a/src/test/format/formatter.unit.test.ts b/src/test/format/formatter.unit.test.ts index 679b0d06f093..f0d9afc9b43d 100644 --- a/src/test/format/formatter.unit.test.ts +++ b/src/test/format/formatter.unit.test.ts @@ -22,7 +22,7 @@ import { IDisposableRegistry, IFormattingSettings, IOutputChannel, - IPythonSettings + IPythonSettings, } from '../../client/common/types'; import { AutoPep8Formatter } from '../../client/formatters/autoPep8Formatter'; import { BaseFormatter } from '../../client/formatters/baseFormatter'; @@ -53,7 +53,7 @@ suite('Formatting - Test Arguments', () => { blackPath: path.join('a', 'exe'), provider: '', yapfArgs: ['1', '2'], - yapfPath: path.join('a', 'exe') + yapfPath: path.join('a', 'exe'), }; const formattingSettingsWithModuleName: IFormattingSettings = { @@ -63,7 +63,7 @@ suite('Formatting - Test Arguments', () => { blackPath: 'module_name', provider: '', yapfArgs: ['1', '2'], - yapfPath: 'module_name' + yapfPath: 'module_name', }; setup(() => { @@ -87,21 +87,21 @@ suite('Formatting - Test Arguments', () => { when(configService.getSettings(anything())).thenReturn(instance(settings)); when(workspace.getWorkspaceFolder(anything())).thenReturn({ name: '', index: 0, uri: workspaceUri }); when(container.get(IOutputChannel, STANDARD_OUTPUT_CHANNEL)).thenReturn( - instance(outputChannel) + instance(outputChannel), ); when(container.get(IApplicationShell)).thenReturn(instance(appShell)); when(container.get(IFormatterHelper)).thenReturn(formatterHelper); when(container.get(IWorkspaceService)).thenReturn(instance(workspace)); when(container.get(IConfigurationService)).thenReturn(instance(configService)); when(container.get(IPythonToolExecutionService)).thenReturn( - instance(pythonToolExecutionService) + instance(pythonToolExecutionService), ); when(container.get(IDisposableRegistry)).thenReturn([]); }); async function setupFormatter( formatter: BaseFormatter, - formattingSettings: IFormattingSettings + formattingSettings: IFormattingSettings, ): Promise { const token = new CancellationTokenSource().token; when(settings.formatting).thenReturn(formattingSettings); @@ -121,7 +121,7 @@ suite('Formatting - Test Arguments', () => { assert.equal(execInfo.moduleName, undefined); assert.deepEqual( execInfo.args, - formattingSettingsWithPath.blackArgs.concat(['--diff', '--quiet', docUri.fsPath]) + formattingSettingsWithPath.blackArgs.concat(['--diff', '--quiet', docUri.fsPath]), ); }); test('Ensure black modulename and args used to launch the formatter', async () => { @@ -133,7 +133,7 @@ suite('Formatting - Test Arguments', () => { assert.equal(execInfo.moduleName, formattingSettingsWithModuleName.blackPath); assert.deepEqual( execInfo.args, - formattingSettingsWithPath.blackArgs.concat(['--diff', '--quiet', docUri.fsPath]) + formattingSettingsWithPath.blackArgs.concat(['--diff', '--quiet', docUri.fsPath]), ); }); test('Ensure autopep8path and args used to launch the formatter', async () => { diff --git a/src/test/index.ts b/src/test/index.ts index 3d15fe1d92be..e910f6ddb258 100644 --- a/src/test/index.ts +++ b/src/test/index.ts @@ -73,7 +73,7 @@ function configure(): SetupOptions { testFilesSuffix, // Force Mocha to exit after tests. // It has been observed that this isn't sufficient, hence the reason for src/test/common/exitCIAfterTestReporter.ts - exit: true + exit: true, }; // If the `MOCHA_REPORTER_JUNIT` env var is true, set up the CI reporter for @@ -84,7 +84,7 @@ function configure(): SetupOptions { options.reporter = 'mocha-multi-reporters'; const reporterPath = path.join(__dirname, 'common', 'exitCIAfterTestReporter.js'); options.reporterOptions = { - reporterEnabled: `spec,mocha-junit-reporter,${reporterPath}` + reporterEnabled: `spec,mocha-junit-reporter,${reporterPath}`, }; } @@ -146,7 +146,7 @@ export async function run(): Promise { return reject(error); } resolve(files); - } + }, ); }); diff --git a/src/test/initialize.ts b/src/test/initialize.ts index 6f19dbc4a8d1..7c0afecb63e1 100644 --- a/src/test/initialize.ts +++ b/src/test/initialize.ts @@ -8,7 +8,7 @@ import { IExtensionTestApi, PYTHON_PATH, resetGlobalPythonPathSetting, - setPythonPathInWorkspaceRoot + setPythonPathInWorkspaceRoot, } from './common'; import { IS_SMOKE_TEST, PVSC_EXTENSION_ID_FOR_TESTS } from './constants'; import { sleep } from './core'; @@ -98,7 +98,7 @@ async function closeWindowsInteral() { (ex) => { clearTimeout(timer); reject(ex); - } + }, ); }); } diff --git a/src/test/insiders/languageServer.insiders.test.ts b/src/test/insiders/languageServer.insiders.test.ts index 9fefe15c90dd..24d7c8c40b3a 100644 --- a/src/test/insiders/languageServer.insiders.test.ts +++ b/src/test/insiders/languageServer.insiders.test.ts @@ -20,7 +20,7 @@ const fileDefinitions = path.join( 'src', 'testMultiRootWkspc', 'smokeTests', - 'definitions.py' + 'definitions.py', ); const notebookDefinitions = path.join( @@ -28,7 +28,7 @@ const notebookDefinitions = path.join( 'src', 'testMultiRootWkspc', 'smokeTests', - 'definitions.ipynb' + 'definitions.ipynb', ); suite('Insiders Test: Language Server', () => { @@ -39,7 +39,7 @@ suite('Insiders Test: Language Server', () => { 'linting.ignorePatterns', ['**/dir1/**'], vscode.workspace.workspaceFolders![0].uri, - vscode.ConfigurationTarget.WorkspaceFolder + vscode.ConfigurationTarget.WorkspaceFolder, ); await initialize(); } else { @@ -56,7 +56,7 @@ suite('Insiders Test: Language Server', () => { 'linting.ignorePatterns', undefined, vscode.workspace.workspaceFolders![0].uri, - vscode.ConfigurationTarget.WorkspaceFolder + vscode.ConfigurationTarget.WorkspaceFolder, ); }); teardown(closeActiveWindows); @@ -69,7 +69,7 @@ suite('Insiders Test: Language Server', () => { const locations = await vscode.commands.executeCommand( 'vscode.executeDefinitionProvider', textDocument.uri, - startPosition + startPosition, ); if (locations && locations.length > 0) { expect(locations![0].uri.fsPath).to.contain(path.basename(fileDefinitions)); @@ -92,7 +92,7 @@ suite('Insiders Test: Language Server', () => { const locations = await vscode.commands.executeCommand( 'vscode.executeDefinitionProvider', notebookDocument.cells[2].uri, // Second cell should have a function with the decorator on it - startPosition + startPosition, ); if (locations && locations.length > 0) { expect(locations![0].uri.fsPath).to.contain(path.basename(notebookDefinitions)); diff --git a/src/test/install/channelManager.channels.test.ts b/src/test/install/channelManager.channels.test.ts index 6686351c16cc..4a34ae2e6224 100644 --- a/src/test/install/channelManager.channels.test.ts +++ b/src/test/install/channelManager.channels.test.ts @@ -13,7 +13,7 @@ import { Product } from '../../client/common/types'; import { Architecture } from '../../client/common/utils/platform'; import { IInterpreterAutoSelectionService, - IInterpreterAutoSeletionProxyService + IInterpreterAutoSeletionProxyService, } from '../../client/interpreter/autoSelection/types'; import { IInterpreterLocatorService, PIPENV_SERVICE } from '../../client/interpreter/contracts'; import { ServiceContainer } from '../../client/ioc/container'; @@ -31,7 +31,7 @@ const info: PythonEnvironment = { envType: EnvironmentType.Unknown, version: new SemVer('0.0.0-alpha'), sysPrefix: '', - sysVersion: '' + sysVersion: '', }; // tslint:disable-next-line:max-func-body-length @@ -48,15 +48,15 @@ suite('Installation - installation channels', () => { serviceManager.addSingletonInstance( IInterpreterLocatorService, pipEnv.object, - PIPENV_SERVICE + PIPENV_SERVICE, ); serviceManager.addSingleton( IInterpreterAutoSelectionService, - MockAutoSelectionService + MockAutoSelectionService, ); serviceManager.addSingleton( IInterpreterAutoSeletionProxyService, - MockAutoSelectionService + MockAutoSelectionService, ); }); @@ -89,7 +89,7 @@ suite('Installation - installation channels', () => { const interpreter: PythonEnvironment = { ...info, path: 'pipenv', - envType: EnvironmentType.VirtualEnv + envType: EnvironmentType.VirtualEnv, }; pipEnv.setup((x) => x.getInterpreters(TypeMoq.It.isAny())).returns(() => Promise.resolve([interpreter])); @@ -114,7 +114,7 @@ suite('Installation - installation channels', () => { items = i; }) .returns( - () => new Promise((resolve, _reject) => resolve(undefined)) + () => new Promise((resolve, _reject) => resolve(undefined)), ); installer1.setup((x) => x.displayName).returns(() => 'Name 1'); @@ -134,7 +134,7 @@ suite('Installation - installation channels', () => { installer .setup((x) => x.isSupported(TypeMoq.It.isAny())) .returns( - () => new Promise((resolve) => resolve(supported)) + () => new Promise((resolve) => resolve(supported)), ); installer.setup((x) => x.priority).returns(() => (priority ? priority : 0)); serviceManager.addSingletonInstance(IModuleInstaller, installer.object, name); diff --git a/src/test/install/channelManager.messages.test.ts b/src/test/install/channelManager.messages.test.ts index 6baba6a7e13f..be829b9918ec 100644 --- a/src/test/install/channelManager.messages.test.ts +++ b/src/test/install/channelManager.messages.test.ts @@ -13,7 +13,7 @@ import { Product } from '../../client/common/types'; import { Architecture } from '../../client/common/utils/platform'; import { IInterpreterAutoSelectionService, - IInterpreterAutoSeletionProxyService + IInterpreterAutoSeletionProxyService, } from '../../client/interpreter/autoSelection/types'; import { IInterpreterService } from '../../client/interpreter/contracts'; import { ServiceContainer } from '../../client/ioc/container'; @@ -31,7 +31,7 @@ const info: PythonEnvironment = { envType: EnvironmentType.Unknown, version: new SemVer('0.0.0-alpha'), sysPrefix: '', - sysVersion: '' + sysVersion: '', }; // tslint:disable-next-line:max-func-body-length @@ -59,11 +59,11 @@ suite('Installation - channel messages', () => { serviceManager.addSingletonInstance(IModuleInstaller, moduleInstaller.object); serviceManager.addSingleton( IInterpreterAutoSelectionService, - MockAutoSelectionService + MockAutoSelectionService, ); serviceManager.addSingleton( IInterpreterAutoSeletionProxyService, - MockAutoSelectionService + MockAutoSelectionService, ); }); @@ -129,7 +129,7 @@ suite('Installation - channel messages', () => { verifyMessage(message, ['Pip'], ['Conda']); verifyUrl(url, ['Windows', 'Pip']); }, - 'getInstallationChannel' + 'getInstallationChannel', ); }); @@ -152,17 +152,17 @@ suite('Installation - channel messages', () => { async function testInstallerMissingMessage( interpreterType: EnvironmentType, verify: (m: string, u: string) => Promise, - methodType: 'showNoInstallersMessage' | 'getInstallationChannel' = 'showNoInstallersMessage' + methodType: 'showNoInstallersMessage' | 'getInstallationChannel' = 'showNoInstallersMessage', ): Promise { const activeInterpreter: PythonEnvironment = { ...info, envType: interpreterType, - path: '' + path: '', }; interpreters .setup((x) => x.getActiveInterpreter(TypeMoq.It.isAny())) .returns( - () => new Promise((resolve, _reject) => resolve(activeInterpreter)) + () => new Promise((resolve, _reject) => resolve(activeInterpreter)), ); const channels = new InstallationChannelManager(serviceContainer); @@ -176,7 +176,7 @@ suite('Installation - channel messages', () => { search = s; }) .returns( - () => new Promise((resolve, _reject) => resolve(search)) + () => new Promise((resolve, _reject) => resolve(search)), ); appShell .setup((x) => x.openUrl(TypeMoq.It.isAnyString())) diff --git a/src/test/interpreters/activation/preWarmVariables.unit.test.ts b/src/test/interpreters/activation/preWarmVariables.unit.test.ts index 0881b5216e1e..824977e0fe88 100644 --- a/src/test/interpreters/activation/preWarmVariables.unit.test.ts +++ b/src/test/interpreters/activation/preWarmVariables.unit.test.ts @@ -24,7 +24,7 @@ suite('Interpreters Activation - Env Variables', () => { when(interpreterService.onDidChangeInterpreter).thenReturn(onDidChangeInterpreter.event); activationService = new PreWarmActivatedEnvironmentVariables( instance(envActivationService), - instance(interpreterService) + instance(interpreterService), ); }); test('Should pre-warm env variables', async () => { diff --git a/src/test/interpreters/activation/service.unit.test.ts b/src/test/interpreters/activation/service.unit.test.ts index 4e2c22fb27d8..4271f4ea1570 100644 --- a/src/test/interpreters/activation/service.unit.test.ts +++ b/src/test/interpreters/activation/service.unit.test.ts @@ -34,7 +34,7 @@ const defaultShells = { [OSType.Windows]: 'cmd', [OSType.OSX]: 'bash', [OSType.Linux]: 'bash', - [OSType.Unknown]: undefined + [OSType.Unknown]: undefined, }; // tslint:disable:no-unnecessary-override no-any max-func-body-length @@ -56,7 +56,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { sysVersion: '1.0.0.0', sysPrefix: 'Python', envType: EnvironmentType.Unknown, - architecture: Architecture.x64 + architecture: Architecture.x64, }; function initSetup() { @@ -79,7 +79,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { instance(currentProcess), instance(workspace), instance(interpreterService), - instance(envVarsService) + instance(envVarsService), ); } @@ -107,7 +107,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { test('getEnvironmentActivationShellCommands will be invoked', async () => { when(platform.osType).thenReturn(osType.value); when( - helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter) + helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter), ).thenResolve(); const env = await service.getActivatedEnvironmentVariables(resource, interpreter); @@ -115,7 +115,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { verify(platform.osType).once(); expect(env).to.equal(undefined, 'Should not have any variables'); verify( - helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter) + helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter), ).once(); }); test('Validate command used to activation and printing env vars', async () => { @@ -123,7 +123,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { const envVars = { one: '1', two: '2' }; when(platform.osType).thenReturn(osType.value); when( - helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter) + helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter), ).thenResolve(cmd); when(processServiceFactory.create(resource)).thenResolve(instance(processService)); when(envVarsService.getEnvironmentVariables(resource)).thenResolve(envVars); @@ -133,7 +133,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { verify(platform.osType).once(); expect(env).to.equal(undefined, 'Should not have any variables'); verify( - helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter) + helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter), ).once(); verify(processServiceFactory.create(resource)).once(); verify(envVarsService.getEnvironmentVariables(resource)).once(); @@ -146,7 +146,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { const expectedCommand = [ ...cmd, `echo '${getEnvironmentPrefix}'`, - `python ${isolated.toCommandArgument()} ${printEnvPyFile.fileToCommandArgument()}` + `python ${isolated.toCommandArgument()} ${printEnvPyFile.fileToCommandArgument()}`, ].join(' && '); expect(shellCmd).to.equal(expectedCommand); @@ -156,7 +156,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { const envVars = { one: '1', two: '2' }; when(platform.osType).thenReturn(osType.value); when( - helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter) + helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter), ).thenResolve(cmd); when(processServiceFactory.create(resource)).thenResolve(instance(processService)); when(envVarsService.getEnvironmentVariables(resource)).thenResolve(envVars); @@ -166,7 +166,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { verify(platform.osType).once(); expect(env).to.equal(undefined, 'Should not have any variables'); verify( - helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter) + helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter), ).once(); verify(processServiceFactory.create(resource)).once(); verify(envVarsService.getEnvironmentVariables(resource)).once(); @@ -181,7 +181,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { env: envVars, timeout: 30000, maxBuffer: 1000 * 1000, - throwOnStdErr: false + throwOnStdErr: false, }); }); test('Use current process variables if there are no custom variables', async () => { @@ -189,7 +189,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { const envVars = { one: '1', two: '2', PYTHONWARNINGS: 'ignore' }; when(platform.osType).thenReturn(osType.value); when( - helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter) + helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter), ).thenResolve(cmd); when(processServiceFactory.create(resource)).thenResolve(instance(processService)); when(envVarsService.getEnvironmentVariables(resource)).thenResolve({}); @@ -200,7 +200,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { verify(platform.osType).once(); expect(env).to.equal(undefined, 'Should not have any variables'); verify( - helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter) + helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter), ).once(); verify(processServiceFactory.create(resource)).once(); verify(envVarsService.getEnvironmentVariables(resource)).once(); @@ -216,7 +216,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { shell: expectedShell, timeout: 30000, maxBuffer: 1000 * 1000, - throwOnStdErr: false + throwOnStdErr: false, }); }); test('Error must be swallowed when activation fails', async () => { @@ -224,7 +224,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { const envVars = { one: '1', two: '2' }; when(platform.osType).thenReturn(osType.value); when( - helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter) + helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter), ).thenResolve(cmd); when(processServiceFactory.create(resource)).thenResolve(instance(processService)); when(envVarsService.getEnvironmentVariables(resource)).thenResolve(envVars); @@ -235,7 +235,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { verify(platform.osType).once(); expect(env).to.equal(undefined, 'Should not have any variables'); verify( - helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter) + helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter), ).once(); verify(processServiceFactory.create(resource)).once(); verify(envVarsService.getEnvironmentVariables(resource)).once(); @@ -248,7 +248,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { const stdout = `${getEnvironmentPrefix}${EOL}${JSON.stringify(varsFromEnv)}`; when(platform.osType).thenReturn(osType.value); when( - helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter) + helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter), ).thenResolve(cmd); when(processServiceFactory.create(resource)).thenResolve(instance(processService)); when(envVarsService.getEnvironmentVariables(resource)).thenResolve(envVars); @@ -259,7 +259,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { verify(platform.osType).once(); expect(env).to.deep.equal(varsFromEnv); verify( - helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter) + helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter), ).once(); verify(processServiceFactory.create(resource)).once(); verify(envVarsService.getEnvironmentVariables(resource)).once(); @@ -271,7 +271,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { const stdout = `${getEnvironmentPrefix}${EOL}${JSON.stringify(varsFromEnv)}`; when(platform.osType).thenReturn(osType.value); when( - helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter) + helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter), ).thenResolve(cmd); when(processServiceFactory.create(resource)).thenResolve(instance(processService)); when(envVarsService.getEnvironmentVariables(resource)).thenResolve({}); @@ -287,7 +287,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { // All methods invoked only once. verify( - helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter) + helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter), ).once(); verify(processServiceFactory.create(resource)).once(); verify(envVarsService.getEnvironmentVariables(resource)).once(); @@ -299,7 +299,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { const stdout = `${getEnvironmentPrefix}${EOL}${JSON.stringify(varsFromEnv)}`; when(platform.osType).thenReturn(osType.value); when( - helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter) + helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter), ).thenResolve(cmd); when(processServiceFactory.create(resource)).thenResolve(instance(processService)); when(envVarsService.getEnvironmentVariables(resource)).thenResolve({}); @@ -317,7 +317,7 @@ suite('Interpreters Activation - Python Environment Variables', () => { // All methods invoked twice as cache was blown. verify( - helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter) + helper.getEnvironmentActivationShellCommands(resource, anything(), interpreter), ).twice(); verify(processServiceFactory.create(resource)).twice(); verify(envVarsService.getEnvironmentVariables(resource)).twice(); @@ -332,6 +332,6 @@ suite('Interpreters Activation - Python Environment Variables', () => { }); }); }); - }) + }), ); }); diff --git a/src/test/interpreters/activation/terminalEnvironmentActivationService.unit.test.ts b/src/test/interpreters/activation/terminalEnvironmentActivationService.unit.test.ts index 54776fde9cae..26d4fd2819e5 100644 --- a/src/test/interpreters/activation/terminalEnvironmentActivationService.unit.test.ts +++ b/src/test/interpreters/activation/terminalEnvironmentActivationService.unit.test.ts @@ -32,7 +32,7 @@ suite('Interpreters Activation - Python Environment Variables (using terminals)' path: '', sysPrefix: '', sysVersion: '', - envType: EnvironmentType.Conda + envType: EnvironmentType.Conda, }; setup(() => { terminalFactory = mock(TerminalServiceFactory); @@ -46,7 +46,7 @@ suite('Interpreters Activation - Python Environment Variables (using terminals)' envActivationService = new TerminalEnvironmentActivationService( instance(terminalFactory), instance(fs), - instance(envVarsProvider) + instance(envVarsProvider), ); }); @@ -106,8 +106,8 @@ suite('Interpreters Activation - Python Environment Variables (using terminals)' cmd, deepEqual([isolated, pyFile, jsonFile.fileToCommandArgument()]), anything(), - false - ) + false, + ), ).once(); }); test('Should return activated environment variables', async () => { diff --git a/src/test/interpreters/activation/wrapperEnvironmentActivationService.unit.test.ts b/src/test/interpreters/activation/wrapperEnvironmentActivationService.unit.test.ts index 5c9ccee929f5..6283c6192260 100644 --- a/src/test/interpreters/activation/wrapperEnvironmentActivationService.unit.test.ts +++ b/src/test/interpreters/activation/wrapperEnvironmentActivationService.unit.test.ts @@ -40,7 +40,7 @@ suite('Interpreters Activation - Python Environment Variables (wrap terminal and path: '', sysPrefix: '', sysVersion: '', - envType: EnvironmentType.Conda + envType: EnvironmentType.Conda, }; // tslint:disable-next-line: max-func-body-length @@ -64,21 +64,21 @@ suite('Interpreters Activation - Python Environment Variables (wrap terminal and const extContext: IExtensionContext = { get storagePath() { return storagePath; - } + }, // tslint:disable-next-line: no-any } as any; when(crypto.createHash(anything(), anything(), anything())).thenCall((value) => value); when(experiment.inExperiment(anything())).thenReturn(true); when(envVarsProvider.getCustomEnvironmentVariables(anything())).thenCall((value) => Promise.resolve({ - key: (value || {}).toString() - }) + key: (value || {}).toString(), + }), ); when(envVarsProvider.onDidEnvironmentVariablesChange).thenReturn(onDidChangeEnvVars.event); when(fs.readFile(anything())).thenReject(new Error('kaboom')); // Generate a unique key based on resource. when(workspace.getWorkspaceFolderIdentifier(anything())).thenCall( - (identifier: Resource) => identifier?.fsPath || '' + (identifier: Resource) => identifier?.fsPath || '', ); envActivationService = new WrapperEnvironmentActivationService( instance(procActivation), @@ -89,7 +89,7 @@ suite('Interpreters Activation - Python Environment Variables (wrap terminal and extContext, instance(fs), instance(crypto), - [] + [], ); }); @@ -98,169 +98,177 @@ suite('Interpreters Activation - Python Environment Variables (wrap terminal and test('Environment variables returned by process provider should be used if terminal provider crashes', async () => { const expectedVars = { WOW: '1' }; when( - termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thenReject(new Error('kaboom')); when( - procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thenResolve(expectedVars); const vars = await envActivationService.getActivatedEnvironmentVariables( resource, - interpreter + interpreter, ); assert.deepEqual(vars, expectedVars); verify( - termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).once(); verify( - procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).once(); }); test('Use cached variables returned by process provider should be used if terminal provider crashes', async () => { const expectedVars = { WOW: '1' }; when( - termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thenReject(new Error('kaboom')); when( - procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thenResolve(expectedVars); let vars = await envActivationService.getActivatedEnvironmentVariables( resource, - interpreter + interpreter, ); assert.deepEqual(vars, expectedVars); verify( - termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).once(); verify( - procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).once(); vars = await envActivationService.getActivatedEnvironmentVariables( resource, - interpreter + interpreter, ); assert.deepEqual(vars, expectedVars); verify( - termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).once(); verify( - procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).once(); }); test('Environment variables returned by terminal provider should be used if that returns any variables', async () => { const expectedVars = { WOW: '1' }; when( - termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thenResolve(expectedVars); when( - procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thenResolve({ somethingElse: '1' }); const vars = await envActivationService.getActivatedEnvironmentVariables( resource, - interpreter + interpreter, ); assert.deepEqual(vars, expectedVars); verify( - termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).once(); verify( - procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).once(); }); test('Environment variables returned by terminal provider should be used if that returns any variables', async () => { const expectedVars = { WOW: '1' }; when( - termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thenResolve(expectedVars); when( - procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thenResolve({ somethingElse: '1' }); let vars = await envActivationService.getActivatedEnvironmentVariables( resource, - interpreter + interpreter, ); assert.deepEqual(vars, expectedVars); verify( - termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).once(); verify( - procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).once(); vars = await envActivationService.getActivatedEnvironmentVariables( resource, - interpreter + interpreter, ); assert.deepEqual(vars, expectedVars); verify( - termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).once(); verify( - procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).once(); }); test('Will not use cached info, if passing different resource or interpreter', async () => { const expectedVars = { WOW: '1' }; when( - termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thenResolve(expectedVars); when( - procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thenResolve({ somethingElse: '1' }); let vars = await envActivationService.getActivatedEnvironmentVariables( resource, - interpreter + interpreter, ); assert.deepEqual(vars, expectedVars); verify( - termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).once(); verify( - procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).once(); // Same resource, hence return cached info. vars = await envActivationService.getActivatedEnvironmentVariables( resource, - interpreter + interpreter, ); assert.deepEqual(vars, expectedVars); verify( - termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).once(); verify( - procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).once(); // Invoke again with a different resource. const newResource = Uri.file('New Resource'); when( - termActivation.getActivatedEnvironmentVariables(newResource, anything(), anything()) + termActivation.getActivatedEnvironmentVariables( + newResource, + anything(), + anything(), + ), ).thenResolve(undefined); when( - procActivation.getActivatedEnvironmentVariables(newResource, anything(), anything()) + procActivation.getActivatedEnvironmentVariables( + newResource, + anything(), + anything(), + ), ).thenResolve({ NewVars: '1' }); vars = await envActivationService.getActivatedEnvironmentVariables( newResource, - undefined + undefined, ); assert.deepEqual(vars, { NewVars: '1' }); verify( - termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).twice(); verify( - procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).twice(); // Invoke again with a different python interpreter. @@ -269,33 +277,33 @@ suite('Interpreters Activation - Python Environment Variables (wrap terminal and path: 'New', sysPrefix: '', sysVersion: '', - envType: EnvironmentType.Pipenv + envType: EnvironmentType.Pipenv, }; when( termActivation.getActivatedEnvironmentVariables( anything(), newInterpreter, - anything() - ) + anything(), + ), ).thenResolve({ NewPythonVars: '1' }); when( procActivation.getActivatedEnvironmentVariables( anything(), newInterpreter, - anything() - ) + anything(), + ), ).thenResolve(undefined); vars = await envActivationService.getActivatedEnvironmentVariables( newResource, - newInterpreter + newInterpreter, ); assert.deepEqual(vars, { NewPythonVars: '1' }); verify( - termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thrice(); verify( - procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thrice(); }); test('Use variables from file cache', async function () { @@ -305,16 +313,16 @@ suite('Interpreters Activation - Python Environment Variables (wrap terminal and } const expectedVars = { WOW: '1' }; when( - termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + termActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thenResolve(undefined); when( - procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()) + procActivation.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thenResolve(undefined); when(fs.readFile(anything())).thenResolve(JSON.stringify({ env: expectedVars })); const vars = await envActivationService.getActivatedEnvironmentVariables( resource, - interpreter + interpreter, ); assert.deepEqual(vars, expectedVars); diff --git a/src/test/interpreters/autoSelection/index.unit.test.ts b/src/test/interpreters/autoSelection/index.unit.test.ts index 14b697b551fd..e3ef2f5817e6 100644 --- a/src/test/interpreters/autoSelection/index.unit.test.ts +++ b/src/test/interpreters/autoSelection/index.unit.test.ts @@ -28,7 +28,7 @@ import { WorkspaceVirtualEnvInterpretersAutoSelectionRule } from '../../../clien import { IInterpreterAutoSelectionRule, IInterpreterAutoSeletionProxyService, - IInterpreterSecurityService + IInterpreterSecurityService, } from '../../../client/interpreter/autoSelection/types'; import { IInterpreterHelper } from '../../../client/interpreter/contracts'; import { InterpreterHelper } from '../../../client/interpreter/helpers'; @@ -90,7 +90,7 @@ suite('Interpreters - Auto Selection', () => { instance(workspaceInterpreter), instance(proxy), instance(helper), - instance(interpreterSecurityService) + instance(interpreterSecurityService), ); }); @@ -119,7 +119,7 @@ suite('Interpreters - Auto Selection', () => { currentPathInterpreter, systemInterpreter, workspaceInterpreter, - cachedPaths + cachedPaths, ]; for (const service of allRules) { verify(service.autoSelectInterpreter(undefined)).once(); @@ -154,8 +154,8 @@ suite('Interpreters - Auto Selection', () => { when( stateFactory.createGlobalPersistentState( preferredGlobalInterpreter, - undefined - ) + undefined, + ), ).thenReturn(instance(state)); await autoSelectionService.initializeStore(undefined); @@ -170,8 +170,8 @@ suite('Interpreters - Auto Selection', () => { when( stateFactory.createGlobalPersistentState( preferredGlobalInterpreter, - undefined - ) + undefined, + ), ).thenReturn(instance(state)); when(state.value).thenReturn(interpreterInfo); when(fs.fileExists(pythonPath)).thenResolve(false); @@ -189,8 +189,8 @@ suite('Interpreters - Auto Selection', () => { when( stateFactory.createGlobalPersistentState( preferredGlobalInterpreter, - undefined - ) + undefined, + ), ).thenReturn(instance(state)); when(state.value).thenReturn(interpreterInfo); when(fs.fileExists(pythonPath)).thenResolve(true); @@ -210,8 +210,8 @@ suite('Interpreters - Auto Selection', () => { when( stateFactory.createGlobalPersistentState( preferredGlobalInterpreter, - undefined - ) + undefined, + ), ).thenReturn(instance(state)); autoSelectionService.onDidChangeAutoSelectedInterpreter(() => (eventFired = true)); @@ -240,8 +240,8 @@ suite('Interpreters - Auto Selection', () => { when( stateFactory.createGlobalPersistentState( preferredGlobalInterpreter, - undefined - ) + undefined, + ), ).thenReturn(instance(state)); autoSelectionService.onDidChangeAutoSelectedInterpreter(() => (eventFired = true)); when(state.value).thenReturn(interpreterInfoInState); @@ -264,8 +264,8 @@ suite('Interpreters - Auto Selection', () => { when( stateFactory.createGlobalPersistentState( preferredGlobalInterpreter, - undefined - ) + undefined, + ), ).thenReturn(instance(state)); autoSelectionService.onDidChangeAutoSelectedInterpreter(() => (eventFired = true)); when(state.value).thenReturn(interpreterInfoInState); @@ -285,8 +285,8 @@ suite('Interpreters - Auto Selection', () => { when( stateFactory.createGlobalPersistentState( preferredGlobalInterpreter, - undefined - ) + undefined, + ), ).thenReturn(instance(state)); when(workspaceService.getWorkspaceFolderIdentifier(undefined, anything())).thenReturn(''); @@ -305,8 +305,8 @@ suite('Interpreters - Auto Selection', () => { when( stateFactory.createGlobalPersistentState( preferredGlobalInterpreter, - undefined - ) + undefined, + ), ).thenReturn(instance(state)); when(workspaceService.getWorkspaceFolder(resource)).thenReturn({ name: '', index: 0, uri: resource }); autoSelectionService.onDidChangeAutoSelectedInterpreter(() => (eventFired = true)); @@ -327,8 +327,8 @@ suite('Interpreters - Auto Selection', () => { when( stateFactory.createGlobalPersistentState( preferredGlobalInterpreter, - undefined - ) + undefined, + ), ).thenReturn(instance(state)); when(workspaceService.getWorkspaceFolder(resource)).thenReturn({ name: '', index: 0, uri: resource }); when(workspaceService.getWorkspaceFolderIdentifier(anything(), anything())).thenReturn(''); @@ -350,8 +350,8 @@ suite('Interpreters - Auto Selection', () => { when( stateFactory.createGlobalPersistentState( preferredGlobalInterpreter, - undefined - ) + undefined, + ), ).thenReturn(instance(state)); when(workspaceService.getWorkspaceFolder(resource)).thenReturn({ name: '', index: 0, uri: resource }); when(workspaceService.getWorkspaceFolderIdentifier(undefined, anything())).thenReturn(''); @@ -370,8 +370,8 @@ suite('Interpreters - Auto Selection', () => { when( stateFactory.createGlobalPersistentState( preferredGlobalInterpreter, - undefined - ) + undefined, + ), ).thenReturn(instance(state)); const globalInterpreterInfo = { path: 'global Value' }; when(state.value).thenReturn(globalInterpreterInfo as any); @@ -385,7 +385,7 @@ suite('Interpreters - Auto Selection', () => { const anotherResourceOfAnotherWorkspace = Uri.parse('Some other workspace'); when(workspaceService.getWorkspaceFolderIdentifier(anotherResourceOfAnotherWorkspace, anything())).thenReturn( - '2' + '2', ); const selectedInterpreter = autoSelectionService.getAutoSelectedInterpreter(anotherResourceOfAnotherWorkspace); diff --git a/src/test/interpreters/autoSelection/interpreterSecurity/interpreterEvaluation.unit.test.ts b/src/test/interpreters/autoSelection/interpreterSecurity/interpreterEvaluation.unit.test.ts index 9db6976bdf3b..85d79253d7eb 100644 --- a/src/test/interpreters/autoSelection/interpreterSecurity/interpreterEvaluation.unit.test.ts +++ b/src/test/interpreters/autoSelection/interpreterSecurity/interpreterEvaluation.unit.test.ts @@ -43,7 +43,7 @@ suite('Interpreter Evaluation', () => { applicationShell.object, browserService.object, interpreterHelper.object, - interpreterSecurityStorage.object + interpreterSecurityStorage.object, ); }); @@ -64,9 +64,9 @@ suite('Interpreter Evaluation', () => { .returns( () => ({ - folderUri: resource + folderUri: resource, // tslint:disable-next-line: no-any - } as any) + } as any), ); // tslint:disable-next-line: no-any interpreterEvaluation.inferValueUsingCurrentState = () => 'storageValue' as any; @@ -82,9 +82,9 @@ suite('Interpreter Evaluation', () => { .returns( () => ({ - folderUri: resource + folderUri: resource, // tslint:disable-next-line: no-any - } as any) + } as any), ); interpreterEvaluation.inferValueUsingCurrentState = () => undefined; // tslint:disable-next-line: no-any @@ -111,9 +111,9 @@ suite('Interpreter Evaluation', () => { .returns( () => ({ - folderUri: resource + folderUri: resource, // tslint:disable-next-line: no-any - } as any) + } as any), ); const isSafe = interpreterEvaluation.inferValueUsingCurrentState(interpreter, resource); expect(isSafe).to.equal(true, 'Should be true'); @@ -127,9 +127,9 @@ suite('Interpreter Evaluation', () => { .returns( () => ({ - folderUri: resource + folderUri: resource, // tslint:disable-next-line: no-any - } as any) + } as any), ); areInterpretersInWorkspaceSafe .setup((i) => i.value) @@ -147,9 +147,9 @@ suite('Interpreter Evaluation', () => { .returns( () => ({ - folderUri: resource + folderUri: resource, // tslint:disable-next-line: no-any - } as any) + } as any), ); areInterpretersInWorkspaceSafe.setup((i) => i.value).returns(() => undefined); unsafeInterpreterPromptEnabled.setup((s) => s.value).returns(() => false); @@ -165,9 +165,9 @@ suite('Interpreter Evaluation', () => { .returns( () => ({ - folderUri: resource + folderUri: resource, // tslint:disable-next-line: no-any - } as any) + } as any), ); areInterpretersInWorkspaceSafe.setup((i) => i.value).returns(() => undefined); unsafeInterpreterPromptEnabled.setup((s) => s.value).returns(() => true); diff --git a/src/test/interpreters/autoSelection/interpreterSecurity/interpreterSecurityService.unit.test.ts b/src/test/interpreters/autoSelection/interpreterSecurity/interpreterSecurityService.unit.test.ts index aecb047c260e..a2bee2717bd9 100644 --- a/src/test/interpreters/autoSelection/interpreterSecurity/interpreterSecurityService.unit.test.ts +++ b/src/test/interpreters/autoSelection/interpreterSecurity/interpreterSecurityService.unit.test.ts @@ -11,7 +11,7 @@ import { createDeferred, sleep } from '../../../../client/common/utils/async'; import { InterpreterSecurityService } from '../../../../client/interpreter/autoSelection/interpreterSecurity/interpreterSecurityService'; import { IInterpreterEvaluation, - IInterpreterSecurityStorage + IInterpreterSecurityStorage, } from '../../../../client/interpreter/autoSelection/types'; suite('Interpreter Security service', () => { @@ -34,7 +34,7 @@ suite('Interpreter Security service', () => { interpreterSecurityStorage.setup((p) => p.safeInterpreters).returns(() => safeInterpreters.object); interpreterSecurityService = new InterpreterSecurityService( interpreterSecurityStorage.object, - interpreterEvaluation.object + interpreterEvaluation.object, ); }); diff --git a/src/test/interpreters/autoSelection/interpreterSecurity/interpreterSecurityStorage.unit.test.ts b/src/test/interpreters/autoSelection/interpreterSecurity/interpreterSecurityStorage.unit.test.ts index 7fd4a4779308..91525e66ca88 100644 --- a/src/test/interpreters/autoSelection/interpreterSecurity/interpreterSecurityStorage.unit.test.ts +++ b/src/test/interpreters/autoSelection/interpreterSecurity/interpreterSecurityStorage.unit.test.ts @@ -13,7 +13,7 @@ import { flaggedWorkspacesKeysStorageKey, safeInterpretersKey, unsafeInterpreterPromptKey, - unsafeInterpretersKey + unsafeInterpretersKey, } from '../../../../client/interpreter/autoSelection/constants'; import { InterpreterSecurityStorage } from '../../../../client/interpreter/autoSelection/interpreterSecurity/interpreterSecurityStorage'; @@ -53,7 +53,7 @@ suite('Interpreter Security Storage', () => { persistentStateFactory.object, workspaceService.object, commandManager.object, - [] + [], ); }); @@ -135,8 +135,8 @@ suite('Interpreter Security Storage', () => { .setup((p) => p.createGlobalPersistentState( `ARE_INTERPRETERS_SAFE_FOR_WS_${resource.fsPath}`, - undefined - ) + undefined, + ), ) .returns(() => areInterpretersInWorkspaceSafe.object); const result = interpreterSecurityStorage.hasUserApprovedWorkspaceInterpreters(resource); diff --git a/src/test/interpreters/autoSelection/proxy.unit.test.ts b/src/test/interpreters/autoSelection/proxy.unit.test.ts index e3292a8506e0..74f600229c54 100644 --- a/src/test/interpreters/autoSelection/proxy.unit.test.ts +++ b/src/test/interpreters/autoSelection/proxy.unit.test.ts @@ -23,7 +23,7 @@ suite('Interpreters - Auto Selection Proxy', () => { } public async setWorkspaceInterpreter( _resource: Uri, - _interpreter: PythonEnvironment | undefined + _interpreter: PythonEnvironment | undefined, ): Promise { return; } diff --git a/src/test/interpreters/autoSelection/rules/base.unit.test.ts b/src/test/interpreters/autoSelection/rules/base.unit.test.ts index 28166c4fce64..73747fa78f4a 100644 --- a/src/test/interpreters/autoSelection/rules/base.unit.test.ts +++ b/src/test/interpreters/autoSelection/rules/base.unit.test.ts @@ -19,7 +19,7 @@ import { BaseRuleService, NextAction } from '../../../../client/interpreter/auto import { CurrentPathInterpretersAutoSelectionRule } from '../../../../client/interpreter/autoSelection/rules/currentPath'; import { AutoSelectionRule, - IInterpreterAutoSelectionService + IInterpreterAutoSelectionService, } from '../../../../client/interpreter/autoSelection/types'; import { PythonEnvironment } from '../../../../client/pythonEnvironments/info'; @@ -37,13 +37,13 @@ suite('Interpreters - Auto Selection - Base Rule', () => { } public async setGlobalInterpreter( interpreter?: PythonEnvironment, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise { return super.setGlobalInterpreter(interpreter, manager); } protected async onAutoSelectInterpreter( _resource: Uri, - _manager?: IInterpreterAutoSelectionService + _manager?: IInterpreterAutoSelectionService, ): Promise { return NextAction.runNextRule; } @@ -53,7 +53,7 @@ suite('Interpreters - Auto Selection - Base Rule', () => { state = mock(PersistentState); fs = mock(FileSystem); when(stateFactory.createGlobalPersistentState(anything(), undefined)).thenReturn( - instance(state) + instance(state), ); rule = new BaseRuleServiceTest(AutoSelectionRule.cachedInterpreters, instance(fs), instance(stateFactory)); }); @@ -62,8 +62,8 @@ suite('Interpreters - Auto Selection - Base Rule', () => { verify( stateFactory.createGlobalPersistentState( `InterpreterAutoSeletionRule-${AutoSelectionRule.cachedInterpreters}`, - undefined - ) + undefined, + ), ).once(); }); test('Next rule should be invoked', async () => { @@ -77,8 +77,8 @@ suite('Interpreters - Auto Selection - Base Rule', () => { verify( stateFactory.createGlobalPersistentState( `InterpreterAutoSeletionRule-${AutoSelectionRule.cachedInterpreters}`, - undefined - ) + undefined, + ), ).once(); verify(nextRule.autoSelectInterpreter(resource, manager)).once(); }); @@ -92,8 +92,8 @@ suite('Interpreters - Auto Selection - Base Rule', () => { verify( stateFactory.createGlobalPersistentState( `InterpreterAutoSeletionRule-${AutoSelectionRule.cachedInterpreters}`, - undefined - ) + undefined, + ), ).once(); verify(nextRule.autoSelectInterpreter(anything(), anything())).never(); }); diff --git a/src/test/interpreters/autoSelection/rules/cached.unit.test.ts b/src/test/interpreters/autoSelection/rules/cached.unit.test.ts index 65468375f7ac..249a81db7c24 100644 --- a/src/test/interpreters/autoSelection/rules/cached.unit.test.ts +++ b/src/test/interpreters/autoSelection/rules/cached.unit.test.ts @@ -20,7 +20,7 @@ import { CachedInterpretersAutoSelectionRule } from '../../../../client/interpre import { SystemWideInterpretersAutoSelectionRule } from '../../../../client/interpreter/autoSelection/rules/system'; import { IInterpreterAutoSelectionRule, - IInterpreterAutoSelectionService + IInterpreterAutoSelectionService, } from '../../../../client/interpreter/autoSelection/types'; import { IInterpreterHelper } from '../../../../client/interpreter/contracts'; import { InterpreterHelper } from '../../../../client/interpreter/helpers'; @@ -39,13 +39,13 @@ suite('Interpreters - Auto Selection - Cached Rule', () => { public readonly rules!: IInterpreterAutoSelectionRule[]; public async setGlobalInterpreter( interpreter?: PythonEnvironment, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise { return super.setGlobalInterpreter(interpreter, manager); } public async onAutoSelectInterpreter( resource: Resource, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise { return super.onAutoSelectInterpreter(resource, manager); } @@ -60,7 +60,7 @@ suite('Interpreters - Auto Selection - Cached Rule', () => { winRegInterpreter = mock(SystemWideInterpretersAutoSelectionRule); when(stateFactory.createGlobalPersistentState(anything(), undefined)).thenReturn( - instance(state) + instance(state), ); rule = new CachedInterpretersAutoSelectionRuleTest( instance(fs), @@ -68,7 +68,7 @@ suite('Interpreters - Auto Selection - Cached Rule', () => { instance(stateFactory), instance(systemInterpreter), instance(currentPathInterpreter), - instance(winRegInterpreter) + instance(winRegInterpreter), ); }); diff --git a/src/test/interpreters/autoSelection/rules/currentPath.unit.test.ts b/src/test/interpreters/autoSelection/rules/currentPath.unit.test.ts index c5717aa90804..c935cde5abdb 100644 --- a/src/test/interpreters/autoSelection/rules/currentPath.unit.test.ts +++ b/src/test/interpreters/autoSelection/rules/currentPath.unit.test.ts @@ -33,13 +33,13 @@ suite('Interpreters - Auto Selection - Current Path Rule', () => { class CurrentPathInterpretersAutoSelectionRuleTest extends CurrentPathInterpretersAutoSelectionRule { public async setGlobalInterpreter( interpreter?: PythonEnvironment, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise { return super.setGlobalInterpreter(interpreter, manager); } public async onAutoSelectInterpreter( resource: Resource, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise { return super.onAutoSelectInterpreter(resource, manager); } @@ -52,13 +52,13 @@ suite('Interpreters - Auto Selection - Current Path Rule', () => { locator = mock(KnownPathsService); when(stateFactory.createGlobalPersistentState(anything(), undefined)).thenReturn( - instance(state) + instance(state), ); rule = new CurrentPathInterpretersAutoSelectionRuleTest( instance(fs), instance(helper), instance(stateFactory), - instance(locator) + instance(locator), ); }); diff --git a/src/test/interpreters/autoSelection/rules/settings.unit.test.ts b/src/test/interpreters/autoSelection/rules/settings.unit.test.ts index eb1d2b33af56..2c6a84b3d58a 100644 --- a/src/test/interpreters/autoSelection/rules/settings.unit.test.ts +++ b/src/test/interpreters/autoSelection/rules/settings.unit.test.ts @@ -19,7 +19,7 @@ import { IExperimentsManager, IInterpreterPathService, IPersistentStateFactory, - Resource + Resource, } from '../../../../client/common/types'; import { InterpreterAutoSelectionService } from '../../../../client/interpreter/autoSelection'; import { NextAction } from '../../../../client/interpreter/autoSelection/rules/baseRule'; @@ -38,7 +38,7 @@ suite('Interpreters - Auto Selection - Settings Rule', () => { class SettingsInterpretersAutoSelectionRuleTest extends SettingsInterpretersAutoSelectionRule { public async onAutoSelectInterpreter( resource: Resource, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise { return super.onAutoSelectInterpreter(resource, manager); } @@ -53,14 +53,14 @@ suite('Interpreters - Auto Selection - Settings Rule', () => { when(experimentsManager.sendTelemetryIfInExperiment(DeprecatePythonPath.control)).thenReturn(undefined); when(stateFactory.createGlobalPersistentState(anything(), undefined)).thenReturn( - instance(state) + instance(state), ); rule = new SettingsInterpretersAutoSelectionRuleTest( instance(fs), instance(stateFactory), instance(workspaceService), instance(experimentsManager), - instance(interpreterPathService) + instance(interpreterPathService), ); }); diff --git a/src/test/interpreters/autoSelection/rules/system.unit.test.ts b/src/test/interpreters/autoSelection/rules/system.unit.test.ts index f3777f19cdb3..036b0bf8a212 100644 --- a/src/test/interpreters/autoSelection/rules/system.unit.test.ts +++ b/src/test/interpreters/autoSelection/rules/system.unit.test.ts @@ -33,13 +33,13 @@ suite('Interpreters - Auto Selection - System Interpreters Rule', () => { class SystemWideInterpretersAutoSelectionRuleTest extends SystemWideInterpretersAutoSelectionRule { public async setGlobalInterpreter( interpreter?: PythonEnvironment, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise { return super.setGlobalInterpreter(interpreter, manager); } public async onAutoSelectInterpreter( resource: Resource, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise { return super.onAutoSelectInterpreter(resource, manager); } @@ -52,13 +52,13 @@ suite('Interpreters - Auto Selection - System Interpreters Rule', () => { interpreterService = mock(InterpreterService); when(stateFactory.createGlobalPersistentState(anything(), undefined)).thenReturn( - instance(state) + instance(state), ); rule = new SystemWideInterpretersAutoSelectionRuleTest( instance(fs), instance(helper), instance(stateFactory), - instance(interpreterService) + instance(interpreterService), ); }); diff --git a/src/test/interpreters/autoSelection/rules/winRegistry.unit.test.ts b/src/test/interpreters/autoSelection/rules/winRegistry.unit.test.ts index 9fa20cc74233..04e0e0e46fb6 100644 --- a/src/test/interpreters/autoSelection/rules/winRegistry.unit.test.ts +++ b/src/test/interpreters/autoSelection/rules/winRegistry.unit.test.ts @@ -37,13 +37,13 @@ suite('Interpreters - Auto Selection - Windows Registry Rule', () => { class WindowsRegistryInterpretersAutoSelectionRuleTest extends WindowsRegistryInterpretersAutoSelectionRule { public async setGlobalInterpreter( interpreter?: PythonEnvironment, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise { return super.setGlobalInterpreter(interpreter, manager); } public async onAutoSelectInterpreter( resource: Resource, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise { return super.onAutoSelectInterpreter(resource, manager); } @@ -57,14 +57,14 @@ suite('Interpreters - Auto Selection - Windows Registry Rule', () => { platform = mock(PlatformService); when(stateFactory.createGlobalPersistentState(anything(), undefined)).thenReturn( - instance(state) + instance(state), ); rule = new WindowsRegistryInterpretersAutoSelectionRuleTest( instance(fs), instance(helper), instance(stateFactory), instance(platform), - instance(locator) + instance(locator), ); }); diff --git a/src/test/interpreters/autoSelection/rules/workspaceEnv.unit.test.ts b/src/test/interpreters/autoSelection/rules/workspaceEnv.unit.test.ts index 62015371b020..8ebb99d746f8 100644 --- a/src/test/interpreters/autoSelection/rules/workspaceEnv.unit.test.ts +++ b/src/test/interpreters/autoSelection/rules/workspaceEnv.unit.test.ts @@ -24,7 +24,7 @@ import { IExperimentsManager, IInterpreterPathService, IPersistentStateFactory, - Resource + Resource, } from '../../../../client/common/types'; import { createDeferred } from '../../../../client/common/utils/async'; import { OSType } from '../../../../client/common/utils/platform'; @@ -52,7 +52,7 @@ suite('Interpreters - Auto Selection - Workspace Virtual Envs Rule', () => { class WorkspaceVirtualEnvInterpretersAutoSelectionRuleTest extends WorkspaceVirtualEnvInterpretersAutoSelectionRule { public async setGlobalInterpreter( interpreter?: PythonEnvironment, - manager?: IInterpreterAutoSelectionService + manager?: IInterpreterAutoSelectionService, ): Promise { return super.setGlobalInterpreter(interpreter, manager); } @@ -78,7 +78,7 @@ suite('Interpreters - Auto Selection - Workspace Virtual Envs Rule', () => { interpreterPathService = mock(InterpreterPathService); when(stateFactory.createGlobalPersistentState(anything(), undefined)).thenReturn( - instance(state) + instance(state), ); rule = new WorkspaceVirtualEnvInterpretersAutoSelectionRuleTest( instance(fs), @@ -88,7 +88,7 @@ suite('Interpreters - Auto Selection - Workspace Virtual Envs Rule', () => { instance(workspaceService), instance(virtualEnvLocator), instance(experimentsManager), - instance(interpreterPathService) + instance(interpreterPathService), ); }); test('Invoke next rule if there is no workspace', async () => { @@ -217,7 +217,7 @@ suite('Interpreters - Auto Selection - Workspace Virtual Envs Rule', () => { when(virtualEnvLocator.getInterpreters(resource, deepEqual(options))).thenResolve([ interpreter1, interpreter2, - interpreter3 + interpreter3, ] as any); when(workspaceService.getWorkspaceFolder(resource)).thenReturn(workspaceFolder); when(platform.osType).thenReturn(OSType.Windows); @@ -254,7 +254,7 @@ suite('Interpreters - Auto Selection - Workspace Virtual Envs Rule', () => { when(virtualEnvLocator.getInterpreters(resource, deepEqual(options))).thenResolve([ interpreter1, interpreter2, - interpreter3 + interpreter3, ] as any); when(workspaceService.getWorkspaceFolder(resource)).thenReturn(workspaceFolder); when(platform.osType).thenReturn(osType); diff --git a/src/test/interpreters/currentPathService.unit.test.ts b/src/test/interpreters/currentPathService.unit.test.ts index 491f5b062ae3..bf6c763ef947 100644 --- a/src/test/interpreters/currentPathService.unit.test.ts +++ b/src/test/interpreters/currentPathService.unit.test.ts @@ -15,7 +15,7 @@ import { IConfigurationService, IPersistentState, IPersistentStateFactory, - IPythonSettings + IPythonSettings, } from '../../client/common/types'; import { OSType } from '../../client/common/utils/platform'; import { IInterpreterVersionService } from '../../client/interpreter/contracts'; @@ -25,7 +25,7 @@ import { IVirtualEnvironmentManager } from '../../client/interpreter/virtualEnvs import { IServiceContainer } from '../../client/ioc/types'; import { CurrentPathService, - PythonInPathCommandProvider + PythonInPathCommandProvider, } from '../../client/pythonEnvironments/discovery/locators/services/currentPathService'; import { EnvironmentType, PythonEnvironment } from '../../client/pythonEnvironments/info'; import { EXTENSION_ROOT_DIR_FOR_TESTS } from '../constants'; @@ -86,7 +86,7 @@ suite('Interpreters CurrentPath Service', () => { interpreterHelper.object, procServiceFactory.object, pythonInPathCommandProvider, - serviceContainer.object + serviceContainer.object, ); }); @@ -106,7 +106,7 @@ suite('Interpreters CurrentPath Service', () => { pythonSettings.setup((p) => p.pythonPath).returns(() => 'root:Python'); processService .setup((p) => - p.exec(TypeMoq.It.isValue('root:Python'), TypeMoq.It.isValue(execArgs), TypeMoq.It.isAny()) + p.exec(TypeMoq.It.isValue('root:Python'), TypeMoq.It.isValue(execArgs), TypeMoq.It.isAny()), ) .returns(() => Promise.resolve({ stdout: 'c:/root:python' })) .verifiable(TypeMoq.Times.once()); diff --git a/src/test/interpreters/display.unit.test.ts b/src/test/interpreters/display.unit.test.ts index 4697b7300b12..c9eb602b8197 100644 --- a/src/test/interpreters/display.unit.test.ts +++ b/src/test/interpreters/display.unit.test.ts @@ -10,7 +10,7 @@ import { StatusBarAlignment, StatusBarItem, Uri, - WorkspaceFolder + WorkspaceFolder, } from 'vscode'; import { IApplicationShell, IWorkspaceService } from '../../client/common/application/types'; import { STANDARD_OUTPUT_CHANNEL } from '../../client/common/constants'; @@ -21,7 +21,7 @@ import { IOutputChannel, IPathUtils, IPythonSettings, - ReadWrite + ReadWrite, } from '../../client/common/types'; import { Interpreters } from '../../client/common/utils/localize'; import { Architecture } from '../../client/common/utils/platform'; @@ -31,7 +31,7 @@ import { IInterpreterDisplay, IInterpreterHelper, IInterpreterService, - IInterpreterStatusbarVisibilityFilter + IInterpreterStatusbarVisibilityFilter, } from '../../client/interpreter/contracts'; import { InterpreterDisplay } from '../../client/interpreter/display'; import { IVirtualEnvironmentManager } from '../../client/interpreter/virtualEnvs/types'; @@ -49,7 +49,7 @@ const info: PythonEnvironment = { envType: EnvironmentType.Unknown, version: new SemVer('0.0.0-alpha'), sysPrefix: '', - sysVersion: '' + sysVersion: '', }; suite('Interpreters Display', () => { @@ -144,7 +144,7 @@ suite('Interpreters Display', () => { ...info, displayName: 'Dummy_Display_Name', envType: EnvironmentType.Unknown, - path: path.join('user', 'development', 'env', 'bin', 'python') + path: path.join('user', 'development', 'env', 'bin', 'python'), }; setupWorkspaceFolder(resource, workspaceFolder); when(autoSelection.autoSelectInterpreter(anything())).thenResolve(); @@ -168,7 +168,7 @@ suite('Interpreters Display', () => { ...info, displayName: 'Dummy_Display_Name', envType: EnvironmentType.Unknown, - path: path.join('user', 'development', 'env', 'bin', 'python') + path: path.join('user', 'development', 'env', 'bin', 'python'), }; pathUtils .setup((p) => p.getDisplayName(TypeMoq.It.isAny(), TypeMoq.It.isAny())) @@ -199,7 +199,7 @@ suite('Interpreters Display', () => { setupWorkspaceFolder(resource, workspaceFolder); const pythonInterpreter: PythonEnvironment = ({ displayName, - path: pythonPath + path: pythonPath, } as any) as PythonEnvironment; interpreterService .setup((i) => i.getActiveInterpreter(TypeMoq.It.isValue(workspaceFolder))) @@ -237,7 +237,7 @@ suite('Interpreters Display', () => { statusBar.verify((s) => (s.color = TypeMoq.It.isValue('')), TypeMoq.Times.once()); statusBar.verify( (s) => (s.text = TypeMoq.It.isValue('$(alert) Select Python Interpreter')), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); }); test('Ensure we try to identify the active workspace when a resource is not provided ', async () => { @@ -249,7 +249,7 @@ suite('Interpreters Display', () => { displayName: 'Dummy_Display_Name', envType: EnvironmentType.Unknown, companyDisplayName: 'Company Name', - path: pythonPath + path: pythonPath, }; fileSystem.setup((fs) => fs.fileExists(TypeMoq.It.isAny())).returns(() => Promise.resolve(true)); virtualEnvMgr @@ -281,7 +281,7 @@ suite('Interpreters Display', () => { ...info, displayName: 'Dummy_Display_Name', envType: EnvironmentType.Unknown, - path: path.join('user', 'development', 'env', 'bin', 'python') + path: path.join('user', 'development', 'env', 'bin', 'python'), }; setupWorkspaceFolder(resource, workspaceFolder); when(autoSelection.autoSelectInterpreter(anything())).thenResolve(); diff --git a/src/test/interpreters/display/interpreterSelectionTip.unit.test.ts b/src/test/interpreters/display/interpreterSelectionTip.unit.test.ts index 6eb8b046f00a..0b2898569ca4 100644 --- a/src/test/interpreters/display/interpreterSelectionTip.unit.test.ts +++ b/src/test/interpreters/display/interpreterSelectionTip.unit.test.ts @@ -33,7 +33,7 @@ suite('Interpreters - Interpreter Selection Tip', () => { instance(appShell), instance(factory), instance(experimentService), - instance(browserService) + instance(browserService), ); }); test('Do not show notification if already shown', async () => { @@ -76,7 +76,7 @@ suite('Interpreters - Interpreter Selection Tip', () => { when(experimentService.inExperiment(SurveyAndInterpreterTipNotification.surveyExperiment)).thenResolve(true); when(appShell.showInformationMessage(anything(), Common.bannerLabelYes(), Common.bannerLabelNo())).thenResolve( // tslint:disable-next-line: no-any - Common.bannerLabelYes() as any + Common.bannerLabelYes() as any, ); await selectionTip.activate(); diff --git a/src/test/interpreters/display/progressDisplay.unit.test.ts b/src/test/interpreters/display/progressDisplay.unit.test.ts index daeaf664e01f..455193fd5524 100644 --- a/src/test/interpreters/display/progressDisplay.unit.test.ts +++ b/src/test/interpreters/display/progressDisplay.unit.test.ts @@ -16,7 +16,7 @@ import { InterpreterLocatorProgressStatubarHandler } from '../../../client/inter type ProgressTask = ( progress: Progress<{ message?: string; increment?: number }>, - token: CancellationToken + token: CancellationToken, ) => Thenable; suite('Interpreters - Display Progress', () => { @@ -33,7 +33,7 @@ suite('Interpreters - Display Progress', () => { }, register(): void { noop(); - } + }, }; test('Display loading message when refreshing interpreters for the first time', async () => { @@ -42,7 +42,7 @@ suite('Interpreters - Display Progress', () => { instance(shell), progressService, [], - instance(mock(IComponentAdapter)) + instance(mock(IComponentAdapter)), ); when(shell.withProgress(anything(), anything())).thenResolve(); @@ -59,7 +59,7 @@ suite('Interpreters - Display Progress', () => { instance(shell), progressService, [], - instance(mock(IComponentAdapter)) + instance(mock(IComponentAdapter)), ); when(shell.withProgress(anything(), anything())).thenResolve(); @@ -81,7 +81,7 @@ suite('Interpreters - Display Progress', () => { instance(shell), progressService, [], - instance(mock(IComponentAdapter)) + instance(mock(IComponentAdapter)), ); when(shell.withProgress(anything(), anything())).thenResolve(); diff --git a/src/test/interpreters/interpreterService.unit.test.ts b/src/test/interpreters/interpreterService.unit.test.ts index 17d48f456414..009db30422b7 100644 --- a/src/test/interpreters/interpreterService.unit.test.ts +++ b/src/test/interpreters/interpreterService.unit.test.ts @@ -27,14 +27,14 @@ import { InterpreterConfigurationScope, IPersistentState, IPersistentStateFactory, - IPythonSettings + IPythonSettings, } from '../../client/common/types'; import * as EnumEx from '../../client/common/utils/enum'; import { noop } from '../../client/common/utils/misc'; import { Architecture } from '../../client/common/utils/platform'; import { IInterpreterAutoSelectionService, - IInterpreterAutoSeletionProxyService + IInterpreterAutoSeletionProxyService, } from '../../client/interpreter/autoSelection/types'; import { IPythonPathUpdaterServiceManager } from '../../client/interpreter/configuration/types'; import { @@ -42,7 +42,7 @@ import { IInterpreterDisplay, IInterpreterHelper, IInterpreterLocatorService, - INTERPRETER_LOCATOR_SERVICE + INTERPRETER_LOCATOR_SERVICE, } from '../../client/interpreter/contracts'; import { InterpreterService } from '../../client/interpreter/interpreterService'; import { IInterpreterHashProvider, IInterpreterHashProviderFactory } from '../../client/interpreter/locators/types'; @@ -114,7 +114,7 @@ suite('Interpreters service', () => { .setup((p) => p.createGlobalPersistentState(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())) .returns(() => { const state = { - updateValue: () => Promise.resolve() + updateValue: () => Promise.resolve(), }; return state as any; }); @@ -123,45 +123,45 @@ suite('Interpreters service', () => { serviceManager.addSingletonInstance(IInterpreterHelper, helper.object); serviceManager.addSingletonInstance( IPythonPathUpdaterServiceManager, - updater.object + updater.object, ); serviceManager.addSingletonInstance(IWorkspaceService, workspace.object); serviceManager.addSingletonInstance( IInterpreterLocatorService, locator.object, - INTERPRETER_LOCATOR_SERVICE + INTERPRETER_LOCATOR_SERVICE, ); serviceManager.addSingletonInstance(IFileSystem, fileSystem.object); serviceManager.addSingletonInstance(IExperimentsManager, experimentsManager.object); serviceManager.addSingletonInstance(IExperimentService, experimentService.object); serviceManager.addSingletonInstance( IInterpreterPathService, - interpreterPathService.object + interpreterPathService.object, ); serviceManager.addSingletonInstance(IInterpreterDisplay, interpreterDisplay.object); serviceManager.addSingletonInstance( IVirtualEnvironmentManager, - virtualEnvMgr.object + virtualEnvMgr.object, ); serviceManager.addSingletonInstance( IPersistentStateFactory, - persistentStateFactory.object + persistentStateFactory.object, ); serviceManager.addSingletonInstance( IPythonExecutionFactory, - pythonExecutionFactory.object + pythonExecutionFactory.object, ); serviceManager.addSingletonInstance( IPythonExecutionService, - pythonExecutionService.object + pythonExecutionService.object, ); serviceManager.addSingleton( IInterpreterAutoSelectionService, - MockAutoSelectionService + MockAutoSelectionService, ); serviceManager.addSingleton( IInterpreterAutoSeletionProxyService, - MockAutoSelectionService + MockAutoSelectionService, ); serviceManager.addSingletonInstance(IConfigurationService, configService.object); } @@ -270,7 +270,7 @@ suite('Interpreters service', () => { }); const i: InterpreterConfigurationScope = { uri: Uri.parse('a'), - configTarget: ConfigurationTarget.Workspace + configTarget: ConfigurationTarget.Workspace, }; configService.reset(); configService @@ -395,7 +395,7 @@ suite('Interpreters service', () => { .returns(() => { const state = { updateValue: () => Promise.resolve(), - value: { hash, displayName: expectedDisplayName } + value: { hash, displayName: expectedDisplayName }, }; return state as any; }) @@ -427,7 +427,7 @@ suite('Interpreters service', () => { .returns(() => { const state = { updateValue: () => Promise.resolve(), - value: { fileHash: 'something else', displayName: expectedDisplayName } + value: { fileHash: 'something else', displayName: expectedDisplayName }, }; return state as any; }) @@ -477,7 +477,7 @@ suite('Interpreters service', () => { : 'without interpreter type' }`, `${envName ? 'with' : 'without'} environment name`, - `${pipEnvName ? 'with' : 'without'} pip environment` + `${pipEnvName ? 'with' : 'without'} pip environment`, ].join(', '); test(testName, async () => { @@ -486,7 +486,7 @@ suite('Interpreters service', () => { architecture: arch ? arch.value : undefined, envName, envType: interpreterType ? interpreterType.value : undefined, - path: pythonPath + path: pythonPath, }; if ( @@ -498,8 +498,8 @@ suite('Interpreters service', () => { .setup((v) => v.getEnvironmentName( TypeMoq.It.isValue(interpreterInfo.path!), - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve(pipEnvName)); } @@ -507,8 +507,8 @@ suite('Interpreters service', () => { helper .setup((h) => h.getInterpreterTypeDisplayName( - TypeMoq.It.isValue(interpreterType.value) - ) + TypeMoq.It.isValue(interpreterType.value), + ), ) .returns(() => `${interpreterType!.name}_display`); } @@ -516,13 +516,13 @@ suite('Interpreters service', () => { const service = new InterpreterService( serviceContainer, hashProviderFactory.object, - pyenvs.object + pyenvs.object, ); const expectedDisplayName = buildDisplayName(interpreterInfo); const displayName = await service.getDisplayName( interpreterInfo, - resource + resource, ); expect(displayName).to.equal(expectedDisplayName); }); @@ -533,12 +533,12 @@ suite('Interpreters service', () => { if (interpreterInfo.version) { displayNameParts.push( - `${interpreterInfo.version.major}.${interpreterInfo.version.minor}.${interpreterInfo.version.patch}` + `${interpreterInfo.version.major}.${interpreterInfo.version.minor}.${interpreterInfo.version.patch}`, ); } if (interpreterInfo.architecture) { displayNameParts.push( - getArchitectureDisplayName(interpreterInfo.architecture) + getArchitectureDisplayName(interpreterInfo.architecture), ); } if ( @@ -600,7 +600,7 @@ suite('Interpreters service', () => { .returns(() => { return { fileHash, - info: info as any + info: info as any, }; }) .verifiable(TypeMoq.Times.atLeastOnce()); @@ -645,7 +645,7 @@ suite('Interpreters service', () => { .returns(() => { return { fileHash, - info: info as any + info: info as any, }; }) .verifiable(TypeMoq.Times.atLeastOnce()); diff --git a/src/test/interpreters/interpreterVersion.unit.test.ts b/src/test/interpreters/interpreterVersion.unit.test.ts index 5c9acf952dc8..f007b2136309 100644 --- a/src/test/interpreters/interpreterVersion.unit.test.ts +++ b/src/test/interpreters/interpreterVersion.unit.test.ts @@ -35,8 +35,8 @@ suite('InterpreterVersionService', () => { p.exec( typeMoq.It.isValue(pythonPath), typeMoq.It.isValue([isolated, 'pip', '--version']), - typeMoq.It.isAny() - ) + typeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve({ stdout: pipVersion })) .verifiable(typeMoq.Times.once()); @@ -52,8 +52,8 @@ suite('InterpreterVersionService', () => { p.exec( typeMoq.It.isValue(pythonPath), typeMoq.It.isValue([isolated, 'pip', '--version']), - typeMoq.It.isAny() - ) + typeMoq.It.isAny(), + ), ) .returns(() => Promise.reject('error')) .verifiable(typeMoq.Times.once()); diff --git a/src/test/interpreters/mocks.ts b/src/test/interpreters/mocks.ts index e32e5028c039..478da14f96e2 100644 --- a/src/test/interpreters/mocks.ts +++ b/src/test/interpreters/mocks.ts @@ -8,7 +8,7 @@ import { IInterpreterVersionService } from '../../client/interpreter/contracts'; export class MockRegistry implements IRegistry { constructor( private keys: { key: string; hive: RegistryHive; arch?: Architecture; values: string[] }[], - private values: { key: string; hive: RegistryHive; arch?: Architecture; value: string; name?: string }[] + private values: { key: string; hive: RegistryHive; arch?: Architecture; value: string; name?: string }[], ) {} public async getKeys(key: string, hive: RegistryHive, arch?: Architecture): Promise { const items = this.keys.find((item) => { @@ -24,7 +24,7 @@ export class MockRegistry implements IRegistry { key: string, hive: RegistryHive, arch?: Architecture, - name?: string + name?: string, ): Promise { const items = this.values.find((item) => { if (item.key !== key || item.hive !== hive) { @@ -49,7 +49,7 @@ export class MockInterpreterVersionProvider implements IInterpreterVersionServic constructor( private displayName: string, private useDefaultDisplayName: boolean = false, - private pipVersionPromise?: Promise + private pipVersionPromise?: Promise, ) {} public async getVersion(_pythonPath: string, defaultDisplayName: string): Promise { return this.useDefaultDisplayName ? Promise.resolve(defaultDisplayName) : Promise.resolve(this.displayName); diff --git a/src/test/interpreters/pythonPathUpdaterFactory.unit.test.ts b/src/test/interpreters/pythonPathUpdaterFactory.unit.test.ts index 5ba72dc2c1bf..4c74eeefbe09 100644 --- a/src/test/interpreters/pythonPathUpdaterFactory.unit.test.ts +++ b/src/test/interpreters/pythonPathUpdaterFactory.unit.test.ts @@ -61,7 +61,7 @@ suite('Python Path Settings Updater', () => { await updater.updatePythonPath(pythonPath); workspaceConfig.verify( (w) => w.update(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), - TypeMoq.Times.never() + TypeMoq.Times.never(), ); }); test('Python Path should be updated when current pythonPath is different', async () => { @@ -76,9 +76,9 @@ suite('Python Path Settings Updater', () => { w.update( TypeMoq.It.isValue('pythonPath'), TypeMoq.It.isValue(pythonPath), - TypeMoq.It.isValue(true) + TypeMoq.It.isValue(true), ), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); }); }); @@ -101,7 +101,7 @@ suite('Python Path Settings Updater', () => { await updater.updatePythonPath(pythonPath); workspaceConfig.verify( (w) => w.update(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), - TypeMoq.Times.never() + TypeMoq.Times.never(), ); }); test('Python Path should be updated when current pythonPath is different', async () => { @@ -118,9 +118,9 @@ suite('Python Path Settings Updater', () => { w.update( TypeMoq.It.isValue('pythonPath'), TypeMoq.It.isValue(pythonPath), - TypeMoq.It.isValue(ConfigurationTarget.WorkspaceFolder) + TypeMoq.It.isValue(ConfigurationTarget.WorkspaceFolder), ), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); }); test('Python Path should be truncated for worspace-relative paths', async () => { @@ -138,9 +138,9 @@ suite('Python Path Settings Updater', () => { w.update( TypeMoq.It.isValue('pythonPath'), TypeMoq.It.isValue(expectedPythonPath), - TypeMoq.It.isValue(ConfigurationTarget.WorkspaceFolder) + TypeMoq.It.isValue(ConfigurationTarget.WorkspaceFolder), ), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); }); }); @@ -162,7 +162,7 @@ suite('Python Path Settings Updater', () => { await updater.updatePythonPath(pythonPath); workspaceConfig.verify( (w) => w.update(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), - TypeMoq.Times.never() + TypeMoq.Times.never(), ); }); test('Python Path should be updated when current pythonPath is different', async () => { @@ -179,9 +179,9 @@ suite('Python Path Settings Updater', () => { w.update( TypeMoq.It.isValue('pythonPath'), TypeMoq.It.isValue(pythonPath), - TypeMoq.It.isValue(false) + TypeMoq.It.isValue(false), ), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); }); test('Python Path should be truncated for workspace-relative paths', async () => { @@ -199,9 +199,9 @@ suite('Python Path Settings Updater', () => { w.update( TypeMoq.It.isValue('pythonPath'), TypeMoq.It.isValue(expectedPythonPath), - TypeMoq.It.isValue(false) + TypeMoq.It.isValue(false), ), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); }); }); @@ -249,7 +249,7 @@ suite('Python Path Settings Updater', () => { interpreterPathService .setup((i) => i.inspect(workspaceFolder)) .returns(() => ({ - workspaceFolderValue: pythonPath + workspaceFolderValue: pythonPath, })); interpreterPathService .setup((i) => i.update(workspaceFolder, ConfigurationTarget.WorkspaceFolder, pythonPath)) diff --git a/src/test/interpreters/serviceRegistry.unit.test.ts b/src/test/interpreters/serviceRegistry.unit.test.ts index 5e166318533a..3bd12108e7ed 100644 --- a/src/test/interpreters/serviceRegistry.unit.test.ts +++ b/src/test/interpreters/serviceRegistry.unit.test.ts @@ -28,7 +28,7 @@ import { IInterpreterAutoSeletionProxyService, IInterpreterEvaluation, IInterpreterSecurityService, - IInterpreterSecurityStorage + IInterpreterSecurityStorage, } from '../../client/interpreter/autoSelection/types'; import { InterpreterComparer } from '../../client/interpreter/configuration/interpreterComparer'; import { ResetInterpreterCommand } from '../../client/interpreter/configuration/interpreterSelector/commands/resetInterpreter'; @@ -41,7 +41,7 @@ import { IInterpreterComparer, IInterpreterSelector, IPythonPathUpdaterServiceFactory, - IPythonPathUpdaterServiceManager + IPythonPathUpdaterServiceManager, } from '../../client/interpreter/configuration/types'; import { IInterpreterDisplay, @@ -49,7 +49,7 @@ import { IInterpreterLocatorProgressHandler, IInterpreterService, IInterpreterVersionService, - IShebangCodeLensProvider + IShebangCodeLensProvider, } from '../../client/interpreter/contracts'; import { InterpreterDisplay } from '../../client/interpreter/display'; import { InterpreterSelectionTip } from '../../client/interpreter/display/interpreterSelectionTip'; @@ -103,12 +103,12 @@ suite('Interpreters - Service Registry', () => { [ IInterpreterAutoSelectionRule, WindowsRegistryInterpretersAutoSelectionRule, - AutoSelectionRule.windowsRegistry + AutoSelectionRule.windowsRegistry, ], [ IInterpreterAutoSelectionRule, WorkspaceVirtualEnvInterpretersAutoSelectionRule, - AutoSelectionRule.workspaceVirtualEnvs + AutoSelectionRule.workspaceVirtualEnvs, ], [IInterpreterAutoSelectionRule, CachedInterpretersAutoSelectionRule, AutoSelectionRule.cachedInterpreters], [IInterpreterAutoSelectionRule, SettingsInterpretersAutoSelectionRule, AutoSelectionRule.settings], @@ -118,7 +118,7 @@ suite('Interpreters - Service Registry', () => { [EnvironmentActivationService, EnvironmentActivationService], [TerminalEnvironmentActivationService, TerminalEnvironmentActivationService], [IEnvironmentActivationService, EnvironmentActivationService], - [IExtensionActivationService, CondaInheritEnvPrompt] + [IExtensionActivationService, CondaInheritEnvPrompt], ].forEach((mapping) => { verify(serviceManager.addSingleton.apply(serviceManager, mapping as any)).once(); }); diff --git a/src/test/interpreters/virtualEnvs/condaInheritEnvPrompt.unit.test.ts b/src/test/interpreters/virtualEnvs/condaInheritEnvPrompt.unit.test.ts index 190b8723fd1d..a7e6435f689d 100644 --- a/src/test/interpreters/virtualEnvs/condaInheritEnvPrompt.unit.test.ts +++ b/src/test/interpreters/virtualEnvs/condaInheritEnvPrompt.unit.test.ts @@ -17,7 +17,7 @@ import { Common, Interpreters } from '../../../client/common/utils/localize'; import { IInterpreterService } from '../../../client/interpreter/contracts'; import { CondaInheritEnvPrompt, - condaInheritEnvPromptKey + condaInheritEnvPromptKey, } from '../../../client/interpreter/virtualEnvs/condaInheritEnvPrompt'; import { EnvironmentType } from '../../../client/pythonEnvironments/info'; @@ -54,7 +54,7 @@ suite('Conda Inherit Env Prompt', async () => { browserService.object, appShell.object, instance(persistentStateFactory), - platformService.object + platformService.object, ); }); test('Returns false if prompt has already been shown in the current session', async () => { @@ -65,7 +65,7 @@ suite('Conda Inherit Env Prompt', async () => { appShell.object, instance(persistentStateFactory), platformService.object, - true + true, ); const workspaceConfig = TypeMoq.Mock.ofType(); interpreterService @@ -93,7 +93,7 @@ suite('Conda Inherit Env Prompt', async () => { }); test('Returns false if active interpreter is not of type Conda', async () => { const interpreter = { - envType: EnvironmentType.Pipenv + envType: EnvironmentType.Pipenv, }; const workspaceConfig = TypeMoq.Mock.ofType(); platformService @@ -134,7 +134,7 @@ suite('Conda Inherit Env Prompt', async () => { }); test('Returns false if settings returned is `undefined`', async () => { const interpreter = { - envType: EnvironmentType.Conda + envType: EnvironmentType.Conda, }; const workspaceConfig = TypeMoq.Mock.ofType(); platformService @@ -164,29 +164,29 @@ suite('Conda Inherit Env Prompt', async () => { settings: { globalValue: true, workspaceValue: undefined, - workspaceFolderValue: undefined - } + workspaceFolderValue: undefined, + }, }, { name: 'Returns false if workspaceValue of `terminal.integrated.inheritEnv` setting is set', settings: { globalValue: undefined, workspaceValue: true, - workspaceFolderValue: undefined - } + workspaceFolderValue: undefined, + }, }, { name: 'Returns false if workspaceFolderValue of `terminal.integrated.inheritEnv` setting is set', settings: { globalValue: undefined, workspaceValue: undefined, - workspaceFolderValue: false - } - } + workspaceFolderValue: false, + }, + }, ].forEach((testParams) => { test(testParams.name, async () => { const interpreter = { - envType: EnvironmentType.Conda + envType: EnvironmentType.Conda, }; const workspaceConfig = TypeMoq.Mock.ofType(); platformService @@ -212,12 +212,12 @@ suite('Conda Inherit Env Prompt', async () => { }); test('Returns true otherwise', async () => { const interpreter = { - envType: EnvironmentType.Conda + envType: EnvironmentType.Conda, }; const settings = { globalValue: undefined, workspaceValue: undefined, - workspaceFolderValue: undefined + workspaceFolderValue: undefined, }; const workspaceConfig = TypeMoq.Mock.ofType(); platformService @@ -264,7 +264,7 @@ suite('Conda Inherit Env Prompt', async () => { browserService.object, appShell.object, instance(persistentStateFactory), - platformService.object + platformService.object, ); const promise = condaInheritEnvPrompt.activate(resource); @@ -288,7 +288,7 @@ suite('Conda Inherit Env Prompt', async () => { browserService.object, appShell.object, instance(persistentStateFactory), - platformService.object + platformService.object, ); await condaInheritEnvPrompt.activate(resource); assert.ok(initializeInBackground.calledOnce); @@ -322,7 +322,7 @@ suite('Conda Inherit Env Prompt', async () => { browserService.object, appShell.object, instance(persistentStateFactory), - platformService.object + platformService.object, ); await condaInheritEnvPrompt.initializeInBackground(resource); assert.ok(shouldShowPrompt.calledOnce); @@ -340,7 +340,7 @@ suite('Conda Inherit Env Prompt', async () => { browserService.object, appShell.object, instance(persistentStateFactory), - platformService.object + platformService.object, ); await condaInheritEnvPrompt.initializeInBackground(resource); assert.ok(shouldShowPrompt.calledOnce); @@ -359,7 +359,7 @@ suite('Conda Inherit Env Prompt', async () => { notificationPromptEnabled = TypeMoq.Mock.ofType>(); platformService = TypeMoq.Mock.ofType(); when(persistentStateFactory.createGlobalPersistentState(condaInheritEnvPromptKey, true)).thenReturn( - notificationPromptEnabled.object + notificationPromptEnabled.object, ); condaInheritEnvPrompt = new CondaInheritEnvPrompt( interpreterService.object, @@ -367,7 +367,7 @@ suite('Conda Inherit Env Prompt', async () => { browserService.object, appShell.object, instance(persistentStateFactory), - platformService.object + platformService.object, ); }); diff --git a/src/test/interpreters/virtualEnvs/virtualEnvPrompt.unit.test.ts b/src/test/interpreters/virtualEnvs/virtualEnvPrompt.unit.test.ts index a86b6a45e6bf..0bbf12fbff17 100644 --- a/src/test/interpreters/virtualEnvs/virtualEnvPrompt.unit.test.ts +++ b/src/test/interpreters/virtualEnvs/virtualEnvPrompt.unit.test.ts @@ -16,7 +16,7 @@ import { IPythonPathUpdaterServiceManager } from '../../../client/interpreter/co import { IInterpreterHelper, IInterpreterLocatorService, - IInterpreterWatcherBuilder + IInterpreterWatcherBuilder, } from '../../../client/interpreter/contracts'; import { InterpreterHelper } from '../../../client/interpreter/helpers'; import { VirtualEnvironmentPrompt } from '../../../client/interpreter/virtualEnvs/virtualEnvPrompt'; @@ -59,7 +59,7 @@ suite('Virtual Environment Prompt', () => { instance(pythonPathUpdaterService), instance(locator), [instance(disposable)], - instance(appShell) + instance(appShell), ); }); @@ -73,7 +73,7 @@ suite('Virtual Environment Prompt', () => { when(locator.getInterpreters(resource)).thenResolve([interpreter1, interpreter2] as any); when(helper.getBestInterpreter(anything())).thenReturn(interpreter2 as any); when(persistentStateFactory.createWorkspacePersistentState(anything(), true)).thenReturn( - notificationPromptEnabled.object + notificationPromptEnabled.object, ); notificationPromptEnabled.setup((n) => n.value).returns(() => true); when(appShell.showInformationMessage(anything(), ...prompts)).thenResolve(); @@ -92,7 +92,7 @@ suite('Virtual Environment Prompt', () => { const prompts = [Common.bannerLabelYes(), Common.bannerLabelNo(), Common.doNotShowAgain()]; const notificationPromptEnabled = TypeMoq.Mock.ofType>(); when(persistentStateFactory.createWorkspacePersistentState(anything(), true)).thenReturn( - notificationPromptEnabled.object + notificationPromptEnabled.object, ); notificationPromptEnabled.setup((n) => n.value).returns(() => true); when(appShell.showInformationMessage(anything(), ...prompts)).thenResolve(prompts[0] as any); @@ -101,8 +101,8 @@ suite('Virtual Environment Prompt', () => { interpreter1.path, ConfigurationTarget.WorkspaceFolder, 'ui', - resource - ) + resource, + ), ).thenResolve(); await environmentPrompt.notifyUser(interpreter1 as any, resource); @@ -114,8 +114,8 @@ suite('Virtual Environment Prompt', () => { interpreter1.path, ConfigurationTarget.WorkspaceFolder, 'ui', - resource - ) + resource, + ), ).once(); }); @@ -125,7 +125,7 @@ suite('Virtual Environment Prompt', () => { const prompts = [Common.bannerLabelYes(), Common.bannerLabelNo(), Common.doNotShowAgain()]; const notificationPromptEnabled = TypeMoq.Mock.ofType>(); when(persistentStateFactory.createWorkspacePersistentState(anything(), true)).thenReturn( - notificationPromptEnabled.object + notificationPromptEnabled.object, ); notificationPromptEnabled.setup((n) => n.value).returns(() => true); when(appShell.showInformationMessage(anything(), ...prompts)).thenResolve(prompts[1] as any); @@ -134,8 +134,8 @@ suite('Virtual Environment Prompt', () => { interpreter1.path, ConfigurationTarget.WorkspaceFolder, 'ui', - resource - ) + resource, + ), ).thenResolve(); notificationPromptEnabled .setup((n) => n.updateValue(false)) @@ -151,8 +151,8 @@ suite('Virtual Environment Prompt', () => { interpreter1.path, ConfigurationTarget.WorkspaceFolder, 'ui', - resource - ) + resource, + ), ).never(); notificationPromptEnabled.verifyAll(); }); @@ -163,7 +163,7 @@ suite('Virtual Environment Prompt', () => { const prompts = [Common.bannerLabelYes(), Common.bannerLabelNo(), Common.doNotShowAgain()]; const notificationPromptEnabled = TypeMoq.Mock.ofType>(); when(persistentStateFactory.createWorkspacePersistentState(anything(), true)).thenReturn( - notificationPromptEnabled.object + notificationPromptEnabled.object, ); notificationPromptEnabled.setup((n) => n.value).returns(() => true); when(appShell.showInformationMessage(anything(), ...prompts)).thenResolve(prompts[2] as any); @@ -185,7 +185,7 @@ suite('Virtual Environment Prompt', () => { const prompts = [Common.bannerLabelYes(), Common.bannerLabelNo(), Common.doNotShowAgain()]; const notificationPromptEnabled = TypeMoq.Mock.ofType>(); when(persistentStateFactory.createWorkspacePersistentState(anything(), true)).thenReturn( - notificationPromptEnabled.object + notificationPromptEnabled.object, ); notificationPromptEnabled.setup((n) => n.value).returns(() => false); when(appShell.showInformationMessage(anything(), ...prompts)).thenResolve(prompts[0] as any); diff --git a/src/test/language/languageConfiguration.unit.test.ts b/src/test/language/languageConfiguration.unit.test.ts index 194d90638207..09d462a7d75b 100644 --- a/src/test/language/languageConfiguration.unit.test.ts +++ b/src/test/language/languageConfiguration.unit.test.ts @@ -13,7 +13,7 @@ const NEEDS_INDENT = [ /^break$/, /^continue$/, /^raise$/, // only re-raise - /^return\b/ + /^return\b/, ]; const INDENT_ON_ENTER = [ // block-beginning statements @@ -30,7 +30,7 @@ const INDENT_ON_ENTER = [ /^for\b/, /^if\b/, /^elif\b/, - /^else\b/ + /^else\b/, ]; const DEDENT_ON_ENTER = [ // block-ending statements @@ -40,7 +40,7 @@ const DEDENT_ON_ENTER = [ /^break$/, /^continue$/, /^raise\b/, - /^pass\b/ + /^pass\b/, ]; function isMember(line: string, regexes: RegExp[]): boolean { @@ -57,7 +57,7 @@ function resolveExample( leading: string, postKeyword: string, preColon: string, - trailing: string + trailing: string, ): [string | undefined, string | undefined, boolean] { let invalid: string | undefined; if (base.trim() === '') { @@ -129,7 +129,7 @@ suite('Language Configuration', () => { const result = MULTILINE_SEPARATOR_INDENT_REGEX.test('a = "test"'); expect(result).to.be.equal( false, - 'Multiline separator indent regex for regular strings should not have matches' + 'Multiline separator indent regex for regular strings should not have matches', ); }); @@ -137,7 +137,7 @@ suite('Language Configuration', () => { const result = MULTILINE_SEPARATOR_INDENT_REGEX.test("a = 'hello \\n'"); expect(result).to.be.equal( false, - 'Multiline separator indent regex for strings with escaped characters should not have matches' + 'Multiline separator indent regex for strings with escaped characters should not have matches', ); }); @@ -145,7 +145,7 @@ suite('Language Configuration', () => { const result = MULTILINE_SEPARATOR_INDENT_REGEX.test("a = 'multiline \\"); expect(result).to.be.equal( true, - 'Multiline separator indent regex for strings with newline separator should have matches' + 'Multiline separator indent regex for strings with newline separator should have matches', ); }); @@ -198,7 +198,7 @@ suite('Language Configuration', () => { // bogus '', ' ', - ' ' + ' ', ].forEach((base) => { [ ['', '', '', ''], @@ -215,7 +215,7 @@ suite('Language Configuration', () => { // trailing ['', '', '', ' '], ['', '', '', '# a comment'], - ['', '', '', ' # ...'] + ['', '', '', ' # ...'], ].forEach((whitespace) => { const [leading, postKeyword, preColon, trailing] = whitespace; const [_example, invalid, ignored] = resolveExample(base, leading, postKeyword, preColon, trailing); diff --git a/src/test/language/tokenizer.unit.test.ts b/src/test/language/tokenizer.unit.test.ts index e0ad13dc6afd..647f435dc0e8 100644 --- a/src/test/language/tokenizer.unit.test.ts +++ b/src/test/language/tokenizer.unit.test.ts @@ -400,7 +400,7 @@ suite('Language.Tokenizer', () => { 2, 1, 2, - 2 + 2, ]; assert.equal(tokens.count, lengths.length); for (let i = 0; i < tokens.count; i += 1) { @@ -409,7 +409,7 @@ suite('Language.Tokenizer', () => { assert.equal( t.length, lengths[i], - `Length ${t.length} at ${i} (text ${text.substr(t.start, t.length)}), expected ${lengths[i]}` + `Length ${t.length} at ${i} (text ${text.substr(t.start, t.length)}), expected ${lengths[i]}`, ); } }); @@ -438,7 +438,7 @@ suite('Language.Tokenizer', () => { [',', TokenType.Comma], [':', TokenType.Colon], [';', TokenType.Semicolon], - ['.', TokenType.Operator] + ['.', TokenType.Operator], ].forEach((pair) => { const text: string = pair[0] as string; const expected = pair[1]; @@ -461,7 +461,7 @@ suite('Language.Tokenizer', () => { ['-0b1', TokenType.Number], ['-0B1', TokenType.Number], ['-0o1', TokenType.Number], - ['-0O1', TokenType.Number] + ['-0O1', TokenType.Number], ].forEach((pair) => { const text: string = pair[0] as string; const expected = pair[1]; @@ -477,7 +477,7 @@ suite('Language.Tokenizer', () => { [',-1', TokenType.Number], [':+1', TokenType.Number], [';+1', TokenType.Number], - ['=+1', TokenType.Number] + ['=+1', TokenType.Number], ].forEach((pair) => { const text: string = pair[0] as string; const expected = pair[1]; diff --git a/src/test/languageServers/jedi/autocomplete/base.test.ts b/src/test/languageServers/jedi/autocomplete/base.test.ts index cd02e303b50a..8cf4e7bc8fc9 100644 --- a/src/test/languageServers/jedi/autocomplete/base.test.ts +++ b/src/test/languageServers/jedi/autocomplete/base.test.ts @@ -65,14 +65,14 @@ suite('Language Server: Autocomplete Base Tests', function () { return vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); }) .then((list) => { assert.equal( list!.items.filter((item) => item.label === 'api_version').length, 1, - 'api_version not found' + 'api_version not found', ); }) .then(done, done); @@ -88,14 +88,14 @@ suite('Language Server: Autocomplete Base Tests', function () { const list = await vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); const indexOfFstat = list!.items.findIndex((val: vscode.CompletionItem) => val.label === 'fstat'); assert( indexOfFstat !== -1, - `fstat was not found as a completion in ${fileImport} at line ${lineNum}, col ${colNum}` + `fstat was not found as a completion in ${fileImport} at line ${lineNum}, col ${colNum}`, ); }); @@ -107,7 +107,7 @@ suite('Language Server: Autocomplete Base Tests', function () { await vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); // These are not known to work, jedi issue // assert.equal(list.items.filter(item => item.label === 'capitalize').length, 1, 'capitalize not found (known not to work, Jedi issue)'); @@ -127,7 +127,7 @@ suite('Language Server: Autocomplete Base Tests', function () { const list = await vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); assert.notEqual(list!.items.filter((item) => item.label === 'append').length, 0, 'append not found'); assert.notEqual(list!.items.filter((item) => item.label === 'clear').length, 0, 'clear not found'); @@ -142,39 +142,39 @@ suite('Language Server: Autocomplete Base Tests', function () { let list = await vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); assert.notEqual(list!.items.filter((item) => item.label === 'ABCMeta').length, 0, 'ABCMeta not found'); assert.notEqual( list!.items.filter((item) => item.label === 'abstractmethod').length, 0, - 'abstractmethod not found' + 'abstractmethod not found', ); position = new vscode.Position(4, 9); list = await vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); assert.notEqual(list!.items.filter((item) => item.label === 'ABCMeta').length, 0, 'ABCMeta not found'); assert.notEqual( list!.items.filter((item) => item.label === 'abstractmethod').length, 0, - 'abstractmethod not found' + 'abstractmethod not found', ); position = new vscode.Position(2, 30); list = await vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); assert.notEqual(list!.items.filter((item) => item.label === 'ABCMeta').length, 0, 'ABCMeta not found'); assert.notEqual( list!.items.filter((item) => item.label === 'abstractmethod').length, 0, - 'abstractmethod not found' + 'abstractmethod not found', ); }); @@ -188,7 +188,7 @@ suite('Language Server: Autocomplete Base Tests', function () { const list = await vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); const items = list!.items.filter((item) => item.label === 'sleep'); @@ -211,7 +211,7 @@ suite('Language Server: Autocomplete Base Tests', function () { return vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); }) .then((list) => { @@ -235,7 +235,7 @@ suite('Language Server: Autocomplete Base Tests', function () { return vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); }) .then((list) => { @@ -272,7 +272,7 @@ suite('Language Server: Autocomplete Base Tests', function () { return vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); }) .then((list) => { @@ -306,7 +306,7 @@ suite('Language Server: Autocomplete Base Tests', function () { new vscode.Position(4, 2), // false new vscode.Position(4, 8), // false new vscode.Position(5, 4), // false - new vscode.Position(5, 10) // false + new vscode.Position(5, 10), // false ]; const expected = [false, true, false, false, false, false, false, false, false, false, false]; const textDocument = await vscode.workspace.openTextDocument(fileSuppress); @@ -315,13 +315,13 @@ suite('Language Server: Autocomplete Base Tests', function () { const list = await vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - positions[i] + positions[i], ); const result = list!.items.filter((item) => item.label === 'abs').length; assert.equal( result > 0, expected[i], - `Expected ${expected[i]} at position ${positions[i].line}:${positions[i].character} but got ${result}` + `Expected ${expected[i]} at position ${positions[i].line}:${positions[i].character} but got ${result}`, ); } }); diff --git a/src/test/languageServers/jedi/autocomplete/pep484.test.ts b/src/test/languageServers/jedi/autocomplete/pep484.test.ts index 68e1afd48676..fdf6d3b2d068 100644 --- a/src/test/languageServers/jedi/autocomplete/pep484.test.ts +++ b/src/test/languageServers/jedi/autocomplete/pep484.test.ts @@ -48,7 +48,7 @@ suite('Language Server: Autocomplete PEP 484', () => { const list = await vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); assert.notEqual(list!.items.filter((item) => item.label === 'capitalize').length, 0, 'capitalize not found'); assert.notEqual(list!.items.filter((item) => item.label === 'upper').length, 0, 'upper not found'); @@ -63,7 +63,7 @@ suite('Language Server: Autocomplete PEP 484', () => { const list = await vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); assert.notEqual(list!.items.filter((item) => item.label === 'bit_length').length, 0, 'bit_length not found'); assert.notEqual(list!.items.filter((item) => item.label === 'from_bytes').length, 0, 'from_bytes not found'); diff --git a/src/test/languageServers/jedi/autocomplete/pep526.test.ts b/src/test/languageServers/jedi/autocomplete/pep526.test.ts index cdda64e3f628..3b845c31afcd 100644 --- a/src/test/languageServers/jedi/autocomplete/pep526.test.ts +++ b/src/test/languageServers/jedi/autocomplete/pep526.test.ts @@ -47,7 +47,7 @@ suite('Language Server: Autocomplete PEP 526', () => { const list = await vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); assert.notEqual(list!.items.filter((item) => item.label === 'capitalize').length, 0, 'capitalize not found'); assert.notEqual(list!.items.filter((item) => item.label === 'upper').length, 0, 'upper not found'); @@ -62,7 +62,7 @@ suite('Language Server: Autocomplete PEP 526', () => { const list = await vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); assert.notEqual(list!.items.filter((item) => item.label === 'capitalize').length, 0, 'capitalize not found'); assert.notEqual(list!.items.filter((item) => item.label === 'upper').length, 0, 'upper not found'); @@ -77,7 +77,7 @@ suite('Language Server: Autocomplete PEP 526', () => { const list = await vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); assert.notEqual(list!.items.filter((item) => item.label === 'capitalize').length, 0, 'capitalize not found'); assert.notEqual(list!.items.filter((item) => item.label === 'upper').length, 0, 'upper not found'); @@ -92,7 +92,7 @@ suite('Language Server: Autocomplete PEP 526', () => { let list = await vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); assert.notEqual(list!.items.filter((item) => item.label === 'a').length, 0, 'method a not found'); @@ -100,7 +100,7 @@ suite('Language Server: Autocomplete PEP 526', () => { list = await vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); assert.notEqual(list!.items.filter((item) => item.label === 'b').length, 0, 'method b not found'); }); @@ -113,7 +113,7 @@ suite('Language Server: Autocomplete PEP 526', () => { const list = await vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); assert.notEqual(list!.items.filter((item) => item.label === 'bit_length').length, 0, 'bit_length not found'); }); diff --git a/src/test/languageServers/jedi/completionSource.unit.test.ts b/src/test/languageServers/jedi/completionSource.unit.test.ts index 48b1610ba944..e7f462a9b75e 100644 --- a/src/test/languageServers/jedi/completionSource.unit.test.ts +++ b/src/test/languageServers/jedi/completionSource.unit.test.ts @@ -53,8 +53,8 @@ suite('Completion Provider', () => { rawType: CompletionItemKind.Function, rightLabel: 'right label', text: 'some text', - type: CompletionItemKind.Function - } + type: CompletionItemKind.Function, + }, ]; autoCompleteSettings.setup((a) => a.addBrackets).returns(() => addBrackets); @@ -80,8 +80,8 @@ suite('Completion Provider', () => { TypeMoq.It.isAny(), TypeMoq.It.isAny(), expectedSource, - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve(undefined)) .verifiable(TypeMoq.Times.once()); diff --git a/src/test/languageServers/jedi/definitions/hover.jedi.test.ts b/src/test/languageServers/jedi/definitions/hover.jedi.test.ts index 897ede6b89af..91dd09300976 100644 --- a/src/test/languageServers/jedi/definitions/hover.jedi.test.ts +++ b/src/test/languageServers/jedi/definitions/hover.jedi.test.ts @@ -46,7 +46,7 @@ suite('Language Server: Hover Definition (Jedi)', () => { return vscode.commands.executeCommand( 'vscode.executeHoverProvider', textDocument.uri, - position + position, ); }) .then((result) => { @@ -55,12 +55,12 @@ suite('Language Server: Hover Definition (Jedi)', () => { assert.equal( `${def[0].range!.start.line},${def[0].range!.start.character}`, '30,4', - 'Start position is incorrect' + 'Start position is incorrect', ); assert.equal( `${def[0].range!.end.line},${def[0].range!.end.character}`, '30,11', - 'End position is incorrect' + 'End position is incorrect', ); assert.equal(def[0].contents.length, 1, 'Invalid content items'); // tslint:disable-next-line:prefer-template @@ -68,7 +68,7 @@ suite('Language Server: Hover Definition (Jedi)', () => { assert.equal( normalizeMarkedString(def[0].contents[0]), expectedContent, - 'function signature incorrect' + 'function signature incorrect', ); }) .then(done, done); @@ -95,7 +95,7 @@ suite('Language Server: Hover Definition (Jedi)', () => { return vscode.commands.executeCommand( 'vscode.executeHoverProvider', textDocument.uri, - position + position, ); }) .then((result) => { @@ -104,18 +104,18 @@ suite('Language Server: Hover Definition (Jedi)', () => { assert.equal( `${def[0].range!.start.line},${def[0].range!.start.character}`, '1,9', - 'Start position is incorrect' + 'Start position is incorrect', ); assert.equal( `${def[0].range!.end.line},${def[0].range!.end.character}`, '1,12', - 'End position is incorrect' + 'End position is incorrect', ); assert.equal( normalizeMarkedString(def[0].contents[0]), // tslint:disable-next-line:prefer-template '```python' + EOL + 'def fun()' + EOL + '```' + EOL + 'This is fun', - 'Invalid contents' + 'Invalid contents', ); }) .then(done, done); @@ -135,7 +135,7 @@ suite('Language Server: Hover Definition (Jedi)', () => { return vscode.commands.executeCommand( 'vscode.executeHoverProvider', textDocument.uri, - position + position, ); }) .then((result) => { @@ -144,12 +144,12 @@ suite('Language Server: Hover Definition (Jedi)', () => { assert.equal( `${def[0].range!.start.line},${def[0].range!.start.character}`, '25,4', - 'Start position is incorrect' + 'Start position is incorrect', ); assert.equal( `${def[0].range!.end.line},${def[0].range!.end.character}`, '25,7', - 'End position is incorrect' + 'End position is incorrect', ); assert.equal( normalizeMarkedString(def[0].contents[0]), @@ -165,7 +165,7 @@ suite('Language Server: Hover Definition (Jedi)', () => { 'delete following line, it works' + EOL + '如果存在需要等待审批或正在执行的任务,将不刷新页面', - 'Invalid contents' + 'Invalid contents', ); }) .then(done, done); @@ -192,7 +192,7 @@ suite('Language Server: Hover Definition (Jedi)', () => { return vscode.commands.executeCommand( 'vscode.executeHoverProvider', textDocument.uri, - position + position, ); }) .then((result) => { @@ -201,12 +201,12 @@ suite('Language Server: Hover Definition (Jedi)', () => { assert.equal( `${def[0].range!.start.line},${def[0].range!.start.character}`, '1,5', - 'Start position is incorrect' + 'Start position is incorrect', ); assert.equal( `${def[0].range!.end.line},${def[0].range!.end.character}`, '1,16', - 'End position is incorrect' + 'End position is incorrect', ); assert.equal( normalizeMarkedString(def[0].contents[0]), @@ -220,7 +220,7 @@ suite('Language Server: Hover Definition (Jedi)', () => { 'Кюм ут жэмпэр пошжим льаборэж, коммюны янтэрэсщэт нам ед, декта игнота ныморэ жят эи. ' + EOL + 'Шэа декам экшырки эи, эи зыд эррэм докэндё, векж факэтэ пэрчыквюэрёж ку.', - 'Invalid contents' + 'Invalid contents', ); }) .then(done, done); @@ -240,7 +240,7 @@ suite('Language Server: Hover Definition (Jedi)', () => { return vscode.commands.executeCommand( 'vscode.executeHoverProvider', textDocument.uri, - position + position, ); }) .then((def) => { @@ -263,7 +263,7 @@ suite('Language Server: Hover Definition (Jedi)', () => { return vscode.commands.executeCommand( 'vscode.executeHoverProvider', textDocument.uri, - position + position, ); }) .then((def) => { @@ -293,7 +293,7 @@ suite('Language Server: Hover Definition (Jedi)', () => { return vscode.commands.executeCommand( 'vscode.executeHoverProvider', textDocument.uri, - position + position, ); }) .then((result) => { @@ -302,12 +302,12 @@ suite('Language Server: Hover Definition (Jedi)', () => { assert.equal( `${def[0].range!.start.line},${def[0].range!.start.character}`, '11,12', - 'Start position is incorrect' + 'Start position is incorrect', ); assert.equal( `${def[0].range!.end.line},${def[0].range!.end.character}`, '11,18', - 'End position is incorrect' + 'End position is incorrect', ); const documentation = // tslint:disable-next-line:prefer-template @@ -363,7 +363,7 @@ suite('Language Server: Hover Definition (Jedi)', () => { return vscode.commands.executeCommand( 'vscode.executeHoverProvider', textDocument.uri, - position + position, ); }) .then((result) => { @@ -372,12 +372,12 @@ suite('Language Server: Hover Definition (Jedi)', () => { assert.equal( `${def[0].range!.start.line},${def[0].range!.start.character}`, '12,5', - 'Start position is incorrect' + 'Start position is incorrect', ); assert.equal( `${def[0].range!.end.line},${def[0].range!.end.character}`, '12,12', - 'End position is incorrect' + 'End position is incorrect', ); assert.equal( normalizeMarkedString(def[0].contents[0]), @@ -389,7 +389,7 @@ suite('Language Server: Hover Definition (Jedi)', () => { '```' + EOL + 'Return random integer in range [a, b], including both end points.', - 'Invalid contents' + 'Invalid contents', ); }) .then(done, done); @@ -409,7 +409,7 @@ suite('Language Server: Hover Definition (Jedi)', () => { return vscode.commands.executeCommand( 'vscode.executeHoverProvider', textDocument.uri, - position + position, ); }) .then((result) => { @@ -418,12 +418,12 @@ suite('Language Server: Hover Definition (Jedi)', () => { assert.equal( `${def[0].range!.start.line},${def[0].range!.start.character}`, '8,11', - 'Start position is incorrect' + 'Start position is incorrect', ); assert.equal( `${def[0].range!.end.line},${def[0].range!.end.character}`, '8,15', - 'End position is incorrect' + 'End position is incorrect', ); const minExpectedContent = @@ -461,7 +461,7 @@ suite('Language Server: Hover Definition (Jedi)', () => { return vscode.commands.executeCommand( 'vscode.executeHoverProvider', textDocument.uri, - position + position, ); }) .then((result) => { @@ -470,12 +470,12 @@ suite('Language Server: Hover Definition (Jedi)', () => { assert.equal( `${def[0].range!.start.line},${def[0].range!.start.character}`, '14,9', - 'Start position is incorrect' + 'Start position is incorrect', ); assert.equal( `${def[0].range!.end.line},${def[0].range!.end.character}`, '14,15', - 'End position is incorrect' + 'End position is incorrect', ); assert.equal( normalizeMarkedString(def[0].contents[0]), @@ -491,7 +491,7 @@ suite('Language Server: Hover Definition (Jedi)', () => { '' + EOL + 'This class can be safely subclassed in a limited fashion.', - 'Invalid content items' + 'Invalid content items', ); }) .then(done, done); @@ -511,7 +511,7 @@ suite('Language Server: Hover Definition (Jedi)', () => { return vscode.commands.executeCommand( 'vscode.executeHoverProvider', textDocument.uri, - position + position, ); }) .then((result) => { @@ -536,7 +536,7 @@ suite('Language Server: Hover Definition (Jedi)', () => { const def = (await vscode.commands.executeCommand( 'vscode.executeHoverProvider', textDocument.uri, - position + position, ))!; assert.equal(def.length, 1, 'Definition length is incorrect'); assert.equal(def[0].contents.length, 1, 'Only expected one result'); diff --git a/src/test/languageServers/jedi/definitions/navigation.test.ts b/src/test/languageServers/jedi/definitions/navigation.test.ts index 787412d0f0f8..fc0ae461056f 100644 --- a/src/test/languageServers/jedi/definitions/navigation.test.ts +++ b/src/test/languageServers/jedi/definitions/navigation.test.ts @@ -58,7 +58,7 @@ suite('Language Server: Definition Navigation', () => { startFile: string, startPosition: vscode.Position, expectedFiles: string[], - expectedRanges: vscode.Range[] + expectedRanges: vscode.Range[], ) => { return async () => { const textDocument = await vscode.workspace.openTextDocument(startFile); @@ -68,7 +68,7 @@ suite('Language Server: Definition Navigation', () => { const locations = await vscode.commands.executeCommand( 'vscode.executeDefinitionProvider', textDocument.uri, - startPosition + startPosition, ); assert.equal(locations!.length, expectedFiles.length, 'Wrong number of results'); @@ -81,61 +81,61 @@ suite('Language Server: Definition Navigation', () => { test( 'From own definition', - buildTest(fileDefinitions, new vscode.Position(2, 6), [fileDefinitions], [new vscode.Range(2, 0, 11, 17)]) + buildTest(fileDefinitions, new vscode.Position(2, 6), [fileDefinitions], [new vscode.Range(2, 0, 11, 17)]), ); test( 'Nested function', - buildTest(fileDefinitions, new vscode.Position(11, 16), [fileDefinitions], [new vscode.Range(6, 4, 10, 16)]) + buildTest(fileDefinitions, new vscode.Position(11, 16), [fileDefinitions], [new vscode.Range(6, 4, 10, 16)]), ); test( 'Decorator usage', - buildTest(fileDefinitions, new vscode.Position(13, 1), [fileDefinitions], [new vscode.Range(2, 0, 11, 17)]) + buildTest(fileDefinitions, new vscode.Position(13, 1), [fileDefinitions], [new vscode.Range(2, 0, 11, 17)]), ); test( 'Function decorated by stdlib', - buildTest(fileDefinitions, new vscode.Position(29, 6), [fileDefinitions], [new vscode.Range(21, 0, 27, 17)]) + buildTest(fileDefinitions, new vscode.Position(29, 6), [fileDefinitions], [new vscode.Range(21, 0, 27, 17)]), ); test( 'Function decorated by local decorator', - buildTest(fileDefinitions, new vscode.Position(30, 6), [fileDefinitions], [new vscode.Range(14, 0, 18, 7)]) + buildTest(fileDefinitions, new vscode.Position(30, 6), [fileDefinitions], [new vscode.Range(14, 0, 18, 7)]), ); test( 'Module imported decorator usage', - buildTest(fileUsages, new vscode.Position(3, 15), [fileDefinitions], [new vscode.Range(2, 0, 11, 17)]) + buildTest(fileUsages, new vscode.Position(3, 15), [fileDefinitions], [new vscode.Range(2, 0, 11, 17)]), ); test( 'Module imported function decorated by stdlib', - buildTest(fileUsages, new vscode.Position(11, 19), [fileDefinitions], [new vscode.Range(21, 0, 27, 17)]) + buildTest(fileUsages, new vscode.Position(11, 19), [fileDefinitions], [new vscode.Range(21, 0, 27, 17)]), ); test( 'Module imported function decorated by local decorator', - buildTest(fileUsages, new vscode.Position(12, 19), [fileDefinitions], [new vscode.Range(14, 0, 18, 7)]) + buildTest(fileUsages, new vscode.Position(12, 19), [fileDefinitions], [new vscode.Range(14, 0, 18, 7)]), ); test('Specifically imported decorator usage', async () => { const navigationTest = buildTest(fileUsages, new vscode.Position(7, 1), isPython2 ? [] : [fileDefinitions], [ - new vscode.Range(2, 0, 11, 17) + new vscode.Range(2, 0, 11, 17), ]); await navigationTest(); }); test('Specifically imported function decorated by stdlib', async () => { const navigationTest = buildTest(fileUsages, new vscode.Position(14, 6), isPython2 ? [] : [fileDefinitions], [ - new vscode.Range(21, 0, 27, 17) + new vscode.Range(21, 0, 27, 17), ]); await navigationTest(); }); test('Specifically imported function decorated by local decorator', async () => { const navigationTest = buildTest(fileUsages, new vscode.Position(15, 6), isPython2 ? [] : [fileDefinitions], [ - new vscode.Range(14, 0, 18, 7) + new vscode.Range(14, 0, 18, 7), ]); await navigationTest(); }); diff --git a/src/test/languageServers/jedi/definitions/parallel.jedi.test.ts b/src/test/languageServers/jedi/definitions/parallel.jedi.test.ts index 84dc7921f55b..0e93bd6d9c34 100644 --- a/src/test/languageServers/jedi/definitions/parallel.jedi.test.ts +++ b/src/test/languageServers/jedi/definitions/parallel.jedi.test.ts @@ -27,18 +27,18 @@ suite('Language Server: Code, Hover Definition and Intellisense (Jedi)', () => { const hoverDef = await vscode.commands.executeCommand( 'vscode.executeHoverProvider', textDocument.uri, - position + position, ); const codeDef = await vscode.commands.executeCommand( 'vscode.executeDefinitionProvider', textDocument.uri, - position + position, ); position = new vscode.Position(3, 10); const list = await vscode.commands.executeCommand( 'vscode.executeCompletionItemProvider', textDocument.uri, - position + position, ); assert.equal(list!.items.filter((item) => item.label === 'api_version').length, 1, 'api_version not found'); @@ -50,24 +50,24 @@ suite('Language Server: Code, Hover Definition and Intellisense (Jedi)', () => { assert.equal( `${codeDef![0].range!.start.line},${codeDef![0].range!.start.character}`, '17,4', - 'Start position is incorrect' + 'Start position is incorrect', ); assert.equal( `${codeDef![0].range!.end.line},${codeDef![0].range!.end.character}`, '21,11', - 'End position is incorrect' + 'End position is incorrect', ); assert.equal(hoverDef!.length, 1, 'Definition length is incorrect'); assert.equal( `${hoverDef![0].range!.start.line},${hoverDef![0].range!.start.character}`, '30,4', - 'Start position is incorrect' + 'Start position is incorrect', ); assert.equal( `${hoverDef![0].range!.end.line},${hoverDef![0].range!.end.character}`, '30,11', - 'End position is incorrect' + 'End position is incorrect', ); assert.equal(hoverDef![0].contents.length, 1, 'Invalid content items'); // tslint:disable-next-line:prefer-template diff --git a/src/test/languageServers/jedi/lspTeardown.ts b/src/test/languageServers/jedi/lspTeardown.ts index caee90daaa75..3b2e27ab308d 100644 --- a/src/test/languageServers/jedi/lspTeardown.ts +++ b/src/test/languageServers/jedi/lspTeardown.ts @@ -15,5 +15,5 @@ const settingsJsonPath = path.join(__dirname, '..', '..', '..', '..', 'src', 'te const settingsJsonPromise = import('../../.vscode/settings.json'); // tslint:disable-next-line: no-floating-promises settingsJsonPromise.then((settingsJson) => - fs.writeFile(settingsJsonPath, JSON.stringify(settingsJson, undefined, ' ')) + fs.writeFile(settingsJsonPath, JSON.stringify(settingsJson, undefined, ' ')), ); diff --git a/src/test/languageServers/jedi/pythonSignatureProvider.unit.test.ts b/src/test/languageServers/jedi/pythonSignatureProvider.unit.test.ts index 3d4b87ad9dda..c5aa190f8a6e 100644 --- a/src/test/languageServers/jedi/pythonSignatureProvider.unit.test.ts +++ b/src/test/languageServers/jedi/pythonSignatureProvider.unit.test.ts @@ -37,12 +37,12 @@ suite('Signature Provider unit tests', () => { description: 'Some parameter', docstring: 'gimme docs', name: 'param', - value: 'blah' - } - ] - } + value: 'blah', + }, + ], + }, ], - requestId: 1 + requestId: 1, }; }); @@ -93,7 +93,7 @@ suite('Signature Provider unit tests', () => { const sigHelp: SignatureHelp = await testSignatureReturns(source, 27); expect(sigHelp).to.not.be.equal( undefined, - 'Expected to get a blank signature item back - did the pattern change here?' + 'Expected to get a blank signature item back - did the pattern change here?', ); expect(sigHelp.signatures.length).to.equal(0, 'Signature provided for symbols within a string?'); }); @@ -102,7 +102,7 @@ suite('Signature Provider unit tests', () => { const sigHelp: SignatureHelp = await testSignatureReturns(source, 28); expect(sigHelp).to.not.be.equal( undefined, - 'Expected to get a blank signature item back - did the pattern change here?' + 'Expected to get a blank signature item back - did the pattern change here?', ); expect(sigHelp.signatures.length).to.equal(0, 'Signature provided for symbols within a full-line comment?'); }); @@ -111,7 +111,7 @@ suite('Signature Provider unit tests', () => { const sigHelp: SignatureHelp = await testSignatureReturns(source, 38); expect(sigHelp).to.not.be.equal( undefined, - 'Expected to get a blank signature item back - did the pattern change here?' + 'Expected to get a blank signature item back - did the pattern change here?', ); expect(sigHelp.signatures.length).to.equal(0, 'Signature provided for symbols within a trailing comment?'); }); @@ -122,25 +122,25 @@ suite('Signature Provider unit tests', () => { sigHelp = await testSignatureReturns(source, 18); expect(sigHelp).to.not.equal( undefined, - 'Expected to get a blank signature item back - did the pattern change here?' + 'Expected to get a blank signature item back - did the pattern change here?', ); expect(sigHelp.signatures.length).to.not.equal( 0, - 'Expected dummy argresult back from testing our print signature.' + 'Expected dummy argresult back from testing our print signature.', ); expect(sigHelp.activeParameter).to.be.equal( 0, - "Parameter for print should be the first member of the test argresult's params object." + "Parameter for print should be the first member of the test argresult's params object.", ); expect(sigHelp.activeSignature).to.be.equal( 0, - 'The signature for print should be the first member of the test argresult.' + 'The signature for print should be the first member of the test argresult.', ); expect(sigHelp.signatures[sigHelp.activeSignature].label).to.be.equal( 'print(param)', `Expected arg result calls for specific returned signature of \'print(param)\' but we got ${ sigHelp.signatures[sigHelp.activeSignature].label - }` + }`, ); } catch (error) { assert(false, `Caught exception ${error}`); @@ -154,8 +154,8 @@ suite('Signature Provider unit tests', () => { expect(isInsideStrComment).to.not.be.equal( true, [`Position set to the end of ${sourceLine} but `, 'is reported as being within a string or comment.'].join( - '' - ) + '', + ), ); }); test('Ensure isPositionInsideStringOrComment is behaving as expected at end of source.', () => { @@ -166,8 +166,8 @@ suite('Signature Provider unit tests', () => { expect(isInsideStrComment).to.not.be.equal( true, [`Position set to the end of ${sourceLine} but `, 'is reported as being within a string or comment.'].join( - '' - ) + '', + ), ); }); test('Ensure isPositionInsideStringOrComment is behaving as expected at beginning of source.', () => { @@ -179,8 +179,8 @@ suite('Signature Provider unit tests', () => { true, [ `Position set to the beginning of ${sourceLine} but `, - 'is reported as being within a string or comment.' - ].join('') + 'is reported as being within a string or comment.', + ].join(''), ); }); test('Ensure isPositionInsideStringOrComment is behaving as expected within a string.', () => { @@ -192,8 +192,8 @@ suite('Signature Provider unit tests', () => { true, [ `Position set within the string in ${sourceLine} (position ${sourcePos}) but `, - 'is reported as NOT being within a string or comment.' - ].join('') + 'is reported as NOT being within a string or comment.', + ].join(''), ); }); test('Ensure isPositionInsideStringOrComment is behaving as expected immediately before a string.', () => { @@ -205,8 +205,8 @@ suite('Signature Provider unit tests', () => { false, [ `Position set to just before the string in ${sourceLine} (position ${sourcePos}) but `, - 'is reported as being within a string or comment.' - ].join('') + 'is reported as being within a string or comment.', + ].join(''), ); }); test('Ensure isPositionInsideStringOrComment is behaving as expected immediately in a string.', () => { @@ -218,8 +218,8 @@ suite('Signature Provider unit tests', () => { true, [ `Position set to the start of the string in ${sourceLine} (position ${sourcePos}) but `, - 'is reported as being within a string or comment.' - ].join('') + 'is reported as being within a string or comment.', + ].join(''), ); }); test('Ensure isPositionInsideStringOrComment is behaving as expected within a comment.', () => { @@ -231,8 +231,8 @@ suite('Signature Provider unit tests', () => { true, [ `Position set within a full line comment ${sourceLine} (position ${sourcePos}) but `, - 'is reported as NOT being within a string or comment.' - ].join('') + 'is reported as NOT being within a string or comment.', + ].join(''), ); }); test('Ensure isPositionInsideStringOrComment is behaving as expected within a trailing comment.', () => { @@ -244,8 +244,8 @@ suite('Signature Provider unit tests', () => { true, [ `Position set within a trailing line comment ${sourceLine} (position ${sourcePos}) but `, - 'is reported as NOT being within a string or comment.' - ].join('') + 'is reported as NOT being within a string or comment.', + ].join(''), ); }); test('Ensure isPositionInsideStringOrComment is behaving as expected at the very end of a trailing comment.', () => { @@ -257,8 +257,8 @@ suite('Signature Provider unit tests', () => { true, [ `Position set within a trailing line comment ${sourceLine} (position ${sourcePos}) but `, - 'is reported as NOT being within a string or comment.' - ].join('') + 'is reported as NOT being within a string or comment.', + ].join(''), ); }); test('Ensure isPositionInsideStringOrComment is behaving as expected within a multiline string.', () => { @@ -271,8 +271,8 @@ suite('Signature Provider unit tests', () => { true, [ `Position set within a multi-line string ${sourceLine} (position ${sourcePos}) but `, - 'is reported as NOT being within a string or comment.' - ].join('') + 'is reported as NOT being within a string or comment.', + ].join(''), ); }); test('Ensure isPositionInsideStringOrComment is behaving as expected at the very last quote on a multiline string.', () => { @@ -285,8 +285,8 @@ suite('Signature Provider unit tests', () => { true, [ `Position set within a multi-line string ${sourceLine} (position ${sourcePos}) but `, - 'is reported as NOT being within a string or comment.' - ].join('') + 'is reported as NOT being within a string or comment.', + ].join(''), ); }); test('Ensure isPositionInsideStringOrComment is behaving as expected within a multiline string (double-quoted).', () => { @@ -299,8 +299,8 @@ suite('Signature Provider unit tests', () => { true, [ `Position set within a multi-line string ${sourceLine} (position ${sourcePos}) but `, - 'is reported as NOT being within a string or comment.' - ].join('') + 'is reported as NOT being within a string or comment.', + ].join(''), ); }); test('Ensure isPositionInsideStringOrComment is behaving as expected at the very last quote on a multiline string (double-quoted).', () => { @@ -313,8 +313,8 @@ suite('Signature Provider unit tests', () => { true, [ `Position set within a multi-line string ${sourceLine} (position ${sourcePos}) but `, - 'is reported as NOT being within a string or comment.' - ].join('') + 'is reported as NOT being within a string or comment.', + ].join(''), ); }); test('Ensure isPositionInsideStringOrComment is behaving as expected during construction of a multiline string (double-quoted).', () => { @@ -326,8 +326,8 @@ suite('Signature Provider unit tests', () => { true, [ `Position set within a multi-line string ${sourceLine} (position ${sourcePos}) but `, - 'is reported as NOT being within a string or comment.' - ].join('') + 'is reported as NOT being within a string or comment.', + ].join(''), ); }); }); diff --git a/src/test/languageServers/jedi/signature/signature.jedi.test.ts b/src/test/languageServers/jedi/signature/signature.jedi.test.ts index ca22d202431f..80967e387e66 100644 --- a/src/test/languageServers/jedi/signature/signature.jedi.test.ts +++ b/src/test/languageServers/jedi/signature/signature.jedi.test.ts @@ -19,7 +19,7 @@ class SignatureHelpResult { public index: number, public signaturesCount: number, public activeParameter: number, - public parameterName: string | null + public parameterName: string | null, ) {} } @@ -56,7 +56,7 @@ suite('Language Server: Signatures (Jedi)', () => { new SignatureHelpResult(5, 17, 0, 0, null), new SignatureHelpResult(5, 18, 1, 1, 'age'), new SignatureHelpResult(5, 19, 1, 1, 'age'), - new SignatureHelpResult(5, 20, 0, 0, null) + new SignatureHelpResult(5, 20, 0, 0, null), ]; const document = await openDocument(path.join(autoCompPath, 'classCtor.py')); @@ -76,7 +76,7 @@ suite('Language Server: Signatures (Jedi)', () => { new SignatureHelpResult(0, 4, 0, 0, null), new SignatureHelpResult(0, 5, 0, 0, null), new SignatureHelpResult(0, 6, 1, 0, 'x'), - new SignatureHelpResult(0, 7, 1, 0, 'x') + new SignatureHelpResult(0, 7, 1, 0, 'x'), ]; } else { expected = [ @@ -87,7 +87,7 @@ suite('Language Server: Signatures (Jedi)', () => { new SignatureHelpResult(0, 4, 0, 0, null), new SignatureHelpResult(0, 5, 0, 0, null), new SignatureHelpResult(0, 6, 2, 0, 'stop'), - new SignatureHelpResult(0, 7, 2, 0, 'stop') + new SignatureHelpResult(0, 7, 2, 0, 'stop'), // new SignatureHelpResult(0, 6, 1, 0, 'start'), // new SignatureHelpResult(0, 7, 1, 0, 'start'), // new SignatureHelpResult(0, 8, 1, 1, 'stop'), @@ -117,7 +117,7 @@ suite('Language Server: Signatures (Jedi)', () => { new SignatureHelpResult(0, 9, 1, 0, 'values'), new SignatureHelpResult(0, 10, 1, 0, 'values'), new SignatureHelpResult(0, 11, 1, 0, 'values'), - new SignatureHelpResult(0, 12, 1, 0, 'values') + new SignatureHelpResult(0, 12, 1, 0, 'values'), ]; const document = await openDocument(path.join(autoCompPath, 'ellipsis.py')); @@ -150,18 +150,18 @@ async function checkSignature(expected: SignatureHelpResult, uri: vscode.Uri, ca const actual = await vscode.commands.executeCommand( 'vscode.executeSignatureHelpProvider', uri, - position + position, ); assert.equal( actual!.signatures.length, expected.signaturesCount, - `Signature count does not match, case ${caseIndex}` + `Signature count does not match, case ${caseIndex}`, ); if (expected.signaturesCount > 0) { assert.equal( actual!.activeParameter, expected.activeParameter, - `Parameter index does not match, case ${caseIndex}` + `Parameter index does not match, case ${caseIndex}`, ); if (expected.parameterName) { const parameter = actual!.signatures[0].parameters[expected.activeParameter]; diff --git a/src/test/languageServers/jedi/symbolProvider.unit.test.ts b/src/test/languageServers/jedi/symbolProvider.unit.test.ts index 72235e0f4e3c..10c253fa9c0e 100644 --- a/src/test/languageServers/jedi/symbolProvider.unit.test.ts +++ b/src/test/languageServers/jedi/symbolProvider.unit.test.ts @@ -17,7 +17,7 @@ import { SymbolInformation, SymbolKind, TextDocument, - Uri + Uri, } from 'vscode'; import { LanguageClient } from 'vscode-languageclient/node'; import { IFileSystem } from '../../../client/common/platform/types'; @@ -55,7 +55,7 @@ suite('Jedi Symbol Provider', () => { fileName: string, expectedSize: number, token?: CancellationToken, - isUntitled = false + isUntitled = false, ) { fileSystem.setup((fs) => fs.arePathsSame(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => true); token = token ? token : new CancellationTokenSource().token; @@ -69,8 +69,8 @@ suite('Jedi Symbol Provider', () => { range: { endColumn: 0, endLine: 0, startColumn: 0, startLine: 0 }, rawType: '', text: '', - type: CompletionItemKind.Class - } + type: CompletionItemKind.Class, + }, ]; uri = Uri.file(fileName); @@ -123,7 +123,7 @@ suite('Jedi Symbol Provider', () => { await Promise.all([ testDocumentation(1, __filename, 0), testDocumentation(2, __filename, 0), - testDocumentation(3, __filename, 1) + testDocumentation(3, __filename, 1), ]); }); test('Ensure symbols are returned for all the requests when the doc is untitled', async () => { @@ -131,7 +131,7 @@ suite('Jedi Symbol Provider', () => { await Promise.all([ testDocumentation(1, __filename, 1, undefined, true), testDocumentation(2, __filename, 1, undefined, true), - testDocumentation(3, __filename, 1, undefined, true) + testDocumentation(3, __filename, 1, undefined, true), ]); }); test('Ensure symbols are returned for multiple documents', async () => { @@ -142,7 +142,7 @@ suite('Jedi Symbol Provider', () => { provider = new JediSymbolProvider(serviceContainer.object, jediFactory.object, 0); await Promise.all([ testDocumentation(1, 'file1', 1, undefined, true), - testDocumentation(2, 'file2', 1, undefined, true) + testDocumentation(2, 'file2', 1, undefined, true), ]); }); test('Ensure symbols are returned for multiple documents with a debounce of 100ms', async () => { @@ -153,7 +153,7 @@ suite('Jedi Symbol Provider', () => { provider = new JediSymbolProvider(serviceContainer.object, jediFactory.object, 100); await Promise.all([ testDocumentation(1, 'file1', 1, undefined, true), - testDocumentation(2, 'file2', 1, undefined, true) + testDocumentation(2, 'file2', 1, undefined, true), ]); }); test('Ensure IFileSystem.arePathsSame is used', async () => { @@ -207,8 +207,8 @@ suite('Language Server Symbol Provider', () => { l.sendRequest( TypeMoq.It.isValue('textDocument/documentSymbol'), TypeMoq.It.isValue(doc), - TypeMoq.It.isValue(token) - ) + TypeMoq.It.isValue(token), + ), ) .returns(() => Promise.resolve(symbols)) .verifiable(TypeMoq.Times.once()); @@ -219,8 +219,8 @@ suite('Language Server Symbol Provider', () => { function getRawDoc(uri: Uri) { return { textDocument: { - uri: uri.toString() - } + uri: uri.toString(), + }, }; } @@ -231,10 +231,10 @@ suite('Language Server Symbol Provider', () => { kind: SymbolKind.Array + 1, range: { start: { line: 0, character: 0 }, - end: { line: 0, character: 0 } + end: { line: 0, character: 0 }, }, - children: [] - } + children: [], + }, ]; const uri = Uri.file(__filename); const expected = createSymbols(uri, [['spam', SymbolKind.Array, 0]]); @@ -259,7 +259,7 @@ suite('Language Server Symbol Provider', () => { kind: 5, range: { start: { line: 2, character: 6 }, - end: { line: 2, character: 15 } + end: { line: 2, character: 15 }, }, children: [ { @@ -267,7 +267,7 @@ suite('Language Server Symbol Provider', () => { kind: 12, range: { start: { line: 3, character: 8 }, - end: { line: 3, character: 16 } + end: { line: 3, character: 16 }, }, children: [ { @@ -275,23 +275,23 @@ suite('Language Server Symbol Provider', () => { kind: 13, range: { start: { line: 3, character: 17 }, - end: { line: 3, character: 21 } + end: { line: 3, character: 21 }, }, - children: [] - } - ] + children: [], + }, + ], }, { name: 'assertTrue', kind: 13, range: { start: { line: 0, character: 0 }, - end: { line: 0, character: 0 } + end: { line: 0, character: 0 }, }, - children: [] - } - ] - } + children: [], + }, + ], + }, ]; const expected = [ new SymbolInformation('SpamTests', SymbolKind.Class, '', new Location(uri, new Range(2, 6, 2, 15))), @@ -299,15 +299,15 @@ suite('Language Server Symbol Provider', () => { 'test_all', SymbolKind.Function, 'SpamTests', - new Location(uri, new Range(3, 8, 3, 16)) + new Location(uri, new Range(3, 8, 3, 16)), ), new SymbolInformation('self', SymbolKind.Variable, 'test_all', new Location(uri, new Range(3, 17, 3, 21))), new SymbolInformation( 'assertTrue', SymbolKind.Variable, 'SpamTests', - new Location(uri, new Range(0, 0, 0, 0)) - ) + new Location(uri, new Range(0, 0, 0, 0)), + ), ]; const doc = createDoc(uri); @@ -338,7 +338,7 @@ suite('Language Server Symbol Provider', () => { // * https://github.com/Microsoft/python-language-server/issues/1 // * https://github.com/Microsoft/python-language-server/issues/2 const raw = JSON.parse( - '[{"name":"SpamTests","detail":"SpamTests","kind":5,"deprecated":false,"range":{"start":{"line":2,"character":6},"end":{"line":2,"character":15}},"selectionRange":{"start":{"line":2,"character":6},"end":{"line":2,"character":15}},"children":[{"name":"test_all","detail":"test_all","kind":12,"deprecated":false,"range":{"start":{"line":3,"character":4},"end":{"line":4,"character":30}},"selectionRange":{"start":{"line":3,"character":4},"end":{"line":4,"character":30}},"children":[{"name":"self","detail":"self","kind":13,"deprecated":false,"range":{"start":{"line":3,"character":17},"end":{"line":3,"character":21}},"selectionRange":{"start":{"line":3,"character":17},"end":{"line":3,"character":21}},"children":[],"_functionKind":""}],"_functionKind":"function"},{"name":"assertTrue","detail":"assertTrue","kind":13,"deprecated":false,"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"selectionRange":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"children":[],"_functionKind":""}],"_functionKind":"class"}]' + '[{"name":"SpamTests","detail":"SpamTests","kind":5,"deprecated":false,"range":{"start":{"line":2,"character":6},"end":{"line":2,"character":15}},"selectionRange":{"start":{"line":2,"character":6},"end":{"line":2,"character":15}},"children":[{"name":"test_all","detail":"test_all","kind":12,"deprecated":false,"range":{"start":{"line":3,"character":4},"end":{"line":4,"character":30}},"selectionRange":{"start":{"line":3,"character":4},"end":{"line":4,"character":30}},"children":[{"name":"self","detail":"self","kind":13,"deprecated":false,"range":{"start":{"line":3,"character":17},"end":{"line":3,"character":21}},"selectionRange":{"start":{"line":3,"character":17},"end":{"line":3,"character":21}},"children":[],"_functionKind":""}],"_functionKind":"function"},{"name":"assertTrue","detail":"assertTrue","kind":13,"deprecated":false,"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"selectionRange":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"children":[],"_functionKind":""}],"_functionKind":"class"}]', ); raw[0].children[0].range.start.character = 8; raw[0].children[0].range.end.line = 3; @@ -348,7 +348,7 @@ suite('Language Server Symbol Provider', () => { // for which the raw data above was generated. // See: JediSymbolProvider.provideDocumentSymbols() const expectedRaw = JSON.parse( - '[{"name":"unittest","kind":1,"location":{"uri":{"$mid":1,"path":"","scheme":"file"},"range":[{"line":0,"character":7},{"line":0,"character":15}]},"containerName":""},{"name":"SpamTests","kind":4,"location":{"uri":{"$mid":1,"path":"","scheme":"file"},"range":[{"line":2,"character":0},{"line":4,"character":29}]},"containerName":""},{"name":"test_all","kind":11,"location":{"uri":{"$mid":1,"path":"","scheme":"file"},"range":[{"line":3,"character":4},{"line":4,"character":29}]},"containerName":"SpamTests"},{"name":"self","kind":12,"location":{"uri":{"$mid":1,"path":"","scheme":"file"},"range":[{"line":3,"character":17},{"line":3,"character":21}]},"containerName":"test_all"}]' + '[{"name":"unittest","kind":1,"location":{"uri":{"$mid":1,"path":"","scheme":"file"},"range":[{"line":0,"character":7},{"line":0,"character":15}]},"containerName":""},{"name":"SpamTests","kind":4,"location":{"uri":{"$mid":1,"path":"","scheme":"file"},"range":[{"line":2,"character":0},{"line":4,"character":29}]},"containerName":""},{"name":"test_all","kind":11,"location":{"uri":{"$mid":1,"path":"","scheme":"file"},"range":[{"line":3,"character":4},{"line":4,"character":29}]},"containerName":"SpamTests"},{"name":"self","kind":12,"location":{"uri":{"$mid":1,"path":"","scheme":"file"},"range":[{"line":3,"character":17},{"line":3,"character":21}]},"containerName":"test_all"}]', ); expectedRaw[1].location.range[0].character = 6; expectedRaw[1].location.range[1].line = 2; @@ -363,8 +363,8 @@ suite('Language Server Symbol Provider', () => { 'assertTrue', SymbolKind.Variable, 'SpamTests', - new Location(uri, new Range(0, 0, 0, 0)) - ) + new Location(uri, new Range(0, 0, 0, 0)), + ), ); const doc = createDoc(uri); @@ -429,9 +429,9 @@ function normalizeSymbols(uri: Uri, raw: any[]): SymbolInformation[] { item.location.range[0].line, item.location.range[0].character, item.location.range[1].line, - item.location.range[1].character - ) - ) + item.location.range[1].character, + ), + ), ); symbols.push(symbol); } diff --git a/src/test/linters/common.ts b/src/test/linters/common.ts index 4c5d03f066ef..2bf4e173ab99 100644 --- a/src/test/linters/common.ts +++ b/src/test/linters/common.ts @@ -19,7 +19,7 @@ import { IOutputChannel, IPycodestyleCategorySeverity, IPylintCategorySeverity, - IPythonSettings + IPythonSettings, } from '../../client/common/types'; import { IServiceContainer } from '../../client/ioc/types'; import { LINTERID_BY_PRODUCT } from '../../client/linters/constants'; @@ -117,7 +117,7 @@ export class LintingSettings { this.flake8CategorySeverity = { E: DiagnosticSeverity.Error, W: DiagnosticSeverity.Warning, - F: DiagnosticSeverity.Warning + F: DiagnosticSeverity.Warning, }; this.mypyEnabled = false; @@ -125,7 +125,7 @@ export class LintingSettings { this.mypyArgs = []; this.mypyCategorySeverity = { error: DiagnosticSeverity.Error, - note: DiagnosticSeverity.Hint + note: DiagnosticSeverity.Hint, }; this.banditEnabled = false; @@ -137,7 +137,7 @@ export class LintingSettings { this.pycodestyleArgs = []; this.pycodestyleCategorySeverity = { E: DiagnosticSeverity.Error, - W: DiagnosticSeverity.Warning + W: DiagnosticSeverity.Warning, }; this.pylamaEnabled = false; @@ -160,7 +160,7 @@ export class LintingSettings { error: DiagnosticSeverity.Error, fatal: DiagnosticSeverity.Error, refactor: DiagnosticSeverity.Hint, - warning: DiagnosticSeverity.Warning + warning: DiagnosticSeverity.Warning, }; this.pylintUseMinimalCheckers = false; } @@ -196,7 +196,7 @@ export class BaseTestFixture { serviceContainer?: TypeMoq.IMock, ignoreConfigUpdates = false, public readonly workspaceDir = '.', - protected readonly printLogs = false + protected readonly printLogs = false, ) { this.serviceContainer = serviceContainer ? serviceContainer @@ -305,7 +305,7 @@ export class BaseTestFixture { private initConfig(ignoreUpdates = false): void { this.configService .setup((c) => - c.updateSetting(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + c.updateSetting(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .callback((setting, value) => { if (ignoreUpdates) { diff --git a/src/test/linters/lint.args.test.ts b/src/test/linters/lint.args.test.ts index 0cac56804c11..0656581e07d8 100644 --- a/src/test/linters/lint.args.test.ts +++ b/src/test/linters/lint.args.test.ts @@ -18,11 +18,11 @@ import { IInstaller, ILintingSettings, IOutputChannel, - IPythonSettings + IPythonSettings, } from '../../client/common/types'; import { IInterpreterAutoSelectionService, - IInterpreterAutoSeletionProxyService + IInterpreterAutoSeletionProxyService, } from '../../client/interpreter/autoSelection/types'; import { IInterpreterService } from '../../client/interpreter/contracts'; import { ServiceContainer } from '../../client/ioc/container'; @@ -45,7 +45,7 @@ suite('Linting - Arguments', () => { [undefined, path.join('users', 'dev_user')].forEach((workspaceUri) => { [ Uri.file(path.join('users', 'dev_user', 'development path to', 'one.py')), - Uri.file(path.join('users', 'dev_user', 'development', 'one.py')) + Uri.file(path.join('users', 'dev_user', 'development', 'one.py')), ].forEach((fileUri) => { suite( `File path ${fileUri.fsPath.indexOf(' ') > 0 ? 'with' : 'without'} spaces and ${ @@ -73,10 +73,10 @@ suite('Linting - Arguments', () => { const fs = TypeMoq.Mock.ofType(); fs.setup((x) => x.fileExists(TypeMoq.It.isAny())).returns( - () => new Promise((resolve, _reject) => resolve(true)) + () => new Promise((resolve, _reject) => resolve(true)), ); fs.setup((x) => x.arePathsSame(TypeMoq.It.isAnyString(), TypeMoq.It.isAnyString())).returns( - () => true + () => true, ); serviceManager.addSingletonInstance(IFileSystem, fs.object); @@ -85,15 +85,15 @@ suite('Linting - Arguments', () => { interpreterService = TypeMoq.Mock.ofType(); serviceManager.addSingletonInstance( IInterpreterService, - interpreterService.object + interpreterService.object, ); serviceManager.addSingleton( IInterpreterAutoSelectionService, - MockAutoSelectionService + MockAutoSelectionService, ); serviceManager.addSingleton( IInterpreterAutoSeletionProxyService, - MockAutoSelectionService + MockAutoSelectionService, ); engine = TypeMoq.Mock.ofType(); serviceManager.addSingletonInstance(ILintingEngine, engine.object); @@ -112,7 +112,7 @@ suite('Linting - Arguments', () => { configService.setup((x) => x.getSettings(TypeMoq.It.isAny())).returns(() => settings.object); serviceManager.addSingletonInstance( IConfigurationService, - configService.object + configService.object, ); const workspaceFolder: WorkspaceFolder | undefined = workspaceUri @@ -124,7 +124,7 @@ suite('Linting - Arguments', () => { .returns(() => workspaceFolder); serviceManager.addSingletonInstance( IWorkspaceService, - workspaceService.object + workspaceService.object, ); const installer = TypeMoq.Mock.ofType(); @@ -205,11 +205,11 @@ suite('Linting - Arguments', () => { '{line},0,{severity},{test_id}:{msg}', '-n', '-1', - fileUri.fsPath + fileUri.fsPath, ]; await testLinter(linter, expectedArgs); }); - } + }, ); }); }); diff --git a/src/test/linters/lint.functional.test.ts b/src/test/linters/lint.functional.test.ts index 36e762c701c9..dbb6d0b3b111 100644 --- a/src/test/linters/lint.functional.test.ts +++ b/src/test/linters/lint.functional.test.ts @@ -22,7 +22,7 @@ import { IBufferDecoder, IProcessLogger, IPythonExecutionFactory, - IPythonToolExecutionService + IPythonToolExecutionService, } from '../../client/common/process/types'; import { IConfigurationService, IDisposableRegistry } from '../../client/common/types'; import { IEnvironmentVariablesProvider } from '../../client/common/variables/types'; @@ -44,11 +44,11 @@ const linterConfigDirs = new Map([ [LinterId.Flake8, path.join(pythonFilesDir, 'flake8config')], [LinterId.PyCodeStyle, path.join(pythonFilesDir, 'pycodestyleconfig')], [LinterId.PyDocStyle, path.join(pythonFilesDir, 'pydocstyleconfig27')], - [LinterId.PyLint, path.join(pythonFilesDir, 'pylintconfig')] + [LinterId.PyLint, path.join(pythonFilesDir, 'pylintconfig')], ]); const linterConfigRCFiles = new Map([ [LinterId.PyLint, '.pylintrc'], - [LinterId.PyDocStyle, '.pydocstyle'] + [LinterId.PyDocStyle, '.pydocstyle'], ]); const pylintMessagesToBeReturned: ILintMessage[] = [ @@ -59,7 +59,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0011', message: 'Locally disabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 30, @@ -68,7 +68,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0011', message: 'Locally disabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 34, @@ -77,7 +77,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0012', message: 'Locally enabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 40, @@ -86,7 +86,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0011', message: 'Locally disabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 44, @@ -95,7 +95,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0012', message: 'Locally enabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 55, @@ -104,7 +104,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0011', message: 'Locally disabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 59, @@ -113,7 +113,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0012', message: 'Locally enabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 62, @@ -122,7 +122,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0011', message: 'Locally disabling undefined-variable (E0602)', provider: '', - type: 'warning' + type: 'warning', }, { line: 70, @@ -131,7 +131,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0011', message: 'Locally disabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 84, @@ -140,7 +140,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0011', message: 'Locally disabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 87, @@ -149,7 +149,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'C0304', message: 'Final newline missing', provider: '', - type: 'warning' + type: 'warning', }, { line: 11, @@ -158,7 +158,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'W0613', message: "Unused argument 'arg'", provider: '', - type: 'warning' + type: 'warning', }, { line: 26, @@ -167,7 +167,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'E1101', message: "Instance of 'Foo' has no 'blop' member", provider: '', - type: 'warning' + type: 'warning', }, { line: 36, @@ -176,7 +176,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'E1101', message: "Instance of 'Foo' has no 'blip' member", provider: '', - type: 'warning' + type: 'warning', }, { line: 46, @@ -185,7 +185,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'E1101', message: "Instance of 'Foo' has no 'blip' member", provider: '', - type: 'warning' + type: 'warning', }, { line: 61, @@ -194,7 +194,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'E1101', message: "Instance of 'Foo' has no 'blip' member", provider: '', - type: 'warning' + type: 'warning', }, { line: 72, @@ -203,7 +203,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'E1101', message: "Instance of 'Foo' has no 'blip' member", provider: '', - type: 'warning' + type: 'warning', }, { line: 75, @@ -212,7 +212,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'E1101', message: "Instance of 'Foo' has no 'blip' member", provider: '', - type: 'warning' + type: 'warning', }, { line: 77, @@ -221,7 +221,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'E1101', message: "Instance of 'Foo' has no 'blip' member", provider: '', - type: 'warning' + type: 'warning', }, { line: 83, @@ -230,8 +230,8 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'E1101', message: "Instance of 'Foo' has no 'blip' member", provider: '', - type: 'warning' - } + type: 'warning', + }, ]; const flake8MessagesToBeReturned: ILintMessage[] = [ { @@ -241,7 +241,7 @@ const flake8MessagesToBeReturned: ILintMessage[] = [ code: 'E302', message: 'expected 2 blank lines, found 1', provider: '', - type: 'E' + type: 'E', }, { line: 19, @@ -250,7 +250,7 @@ const flake8MessagesToBeReturned: ILintMessage[] = [ code: 'E127', message: 'continuation line over-indented for visual indent', provider: '', - type: 'E' + type: 'E', }, { line: 24, @@ -259,7 +259,7 @@ const flake8MessagesToBeReturned: ILintMessage[] = [ code: 'E261', message: 'at least two spaces before inline comment', provider: '', - type: 'E' + type: 'E', }, { line: 62, @@ -268,7 +268,7 @@ const flake8MessagesToBeReturned: ILintMessage[] = [ code: 'E261', message: 'at least two spaces before inline comment', provider: '', - type: 'E' + type: 'E', }, { line: 70, @@ -277,7 +277,7 @@ const flake8MessagesToBeReturned: ILintMessage[] = [ code: 'E261', message: 'at least two spaces before inline comment', provider: '', - type: 'E' + type: 'E', }, { line: 80, @@ -286,7 +286,7 @@ const flake8MessagesToBeReturned: ILintMessage[] = [ code: 'E303', message: 'too many blank lines (2)', provider: '', - type: 'E' + type: 'E', }, { line: 87, @@ -295,8 +295,8 @@ const flake8MessagesToBeReturned: ILintMessage[] = [ code: 'W292', message: 'no newline at end of file', provider: '', - type: 'E' - } + type: 'E', + }, ]; const pycodestyleMessagesToBeReturned: ILintMessage[] = [ { @@ -306,7 +306,7 @@ const pycodestyleMessagesToBeReturned: ILintMessage[] = [ code: 'E302', message: 'expected 2 blank lines, found 1', provider: '', - type: 'E' + type: 'E', }, { line: 19, @@ -315,7 +315,7 @@ const pycodestyleMessagesToBeReturned: ILintMessage[] = [ code: 'E127', message: 'continuation line over-indented for visual indent', provider: '', - type: 'E' + type: 'E', }, { line: 24, @@ -324,7 +324,7 @@ const pycodestyleMessagesToBeReturned: ILintMessage[] = [ code: 'E261', message: 'at least two spaces before inline comment', provider: '', - type: 'E' + type: 'E', }, { line: 62, @@ -333,7 +333,7 @@ const pycodestyleMessagesToBeReturned: ILintMessage[] = [ code: 'E261', message: 'at least two spaces before inline comment', provider: '', - type: 'E' + type: 'E', }, { line: 70, @@ -342,7 +342,7 @@ const pycodestyleMessagesToBeReturned: ILintMessage[] = [ code: 'E261', message: 'at least two spaces before inline comment', provider: '', - type: 'E' + type: 'E', }, { line: 80, @@ -351,7 +351,7 @@ const pycodestyleMessagesToBeReturned: ILintMessage[] = [ code: 'E303', message: 'too many blank lines (2)', provider: '', - type: 'E' + type: 'E', }, { line: 87, @@ -360,8 +360,8 @@ const pycodestyleMessagesToBeReturned: ILintMessage[] = [ code: 'W292', message: 'no newline at end of file', provider: '', - type: 'E' - } + type: 'E', + }, ]; const pydocstyleMessagesToBeReturned: ILintMessage[] = [ { @@ -371,7 +371,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 0, line: 1, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -380,7 +380,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 0, line: 5, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D102', @@ -389,7 +389,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 8, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D401', @@ -398,7 +398,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 11, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D403', @@ -407,7 +407,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 11, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -416,7 +416,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 11, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D403', @@ -425,7 +425,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 15, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -434,7 +434,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 15, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D403', @@ -443,7 +443,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 21, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -452,7 +452,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 21, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D403', @@ -461,7 +461,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 28, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -470,7 +470,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 28, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D403', @@ -479,7 +479,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 38, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -488,7 +488,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 38, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D403', @@ -497,7 +497,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 53, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -506,7 +506,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 53, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D403', @@ -515,7 +515,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 68, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -524,7 +524,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 68, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D403', @@ -533,7 +533,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 80, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -542,8 +542,8 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 80, type: '', - provider: 'pydocstyle' - } + provider: 'pydocstyle', + }, ]; const filteredFlake8MessagesToBeReturned: ILintMessage[] = [ @@ -554,8 +554,8 @@ const filteredFlake8MessagesToBeReturned: ILintMessage[] = [ code: 'W292', message: 'no newline at end of file', provider: '', - type: '' - } + type: '', + }, ]; const filteredPycodestyleMessagesToBeReturned: ILintMessage[] = [ { @@ -565,8 +565,8 @@ const filteredPycodestyleMessagesToBeReturned: ILintMessage[] = [ code: 'W292', message: 'no newline at end of file', provider: '', - type: '' - } + type: '', + }, ]; function getMessages(product: Product): ILintMessage[] { @@ -614,7 +614,7 @@ async function getInfoForConfig(product: Product) { return { filename, messagesToBeReceived, - origRCFile: basename ? path.join(dirname!, basename) : '' + origRCFile: basename ? path.join(dirname!, basename) : '', }; } @@ -647,7 +647,7 @@ class TestFixture extends BaseTestFixture { serviceContainer, false, workspaceDir, - printLogs + printLogs, ); this.pythonSettings.setup((s) => s.pythonPath).returns(() => PYTHON_PATH); @@ -661,11 +661,11 @@ class TestFixture extends BaseTestFixture { private static newPythonExecFactory( serviceContainer: TypeMoq.IMock, - configService: IConfigurationService + configService: IConfigurationService, ): IPythonExecutionFactory { const envVarsService = TypeMoq.Mock.ofType( undefined, - TypeMoq.MockBehavior.Strict + TypeMoq.MockBehavior.Strict, ); envVarsService .setup((e) => e.getEnvironmentVariables(TypeMoq.It.isAny())) @@ -680,7 +680,7 @@ class TestFixture extends BaseTestFixture { const envActivationService = TypeMoq.Mock.ofType( undefined, - TypeMoq.MockBehavior.Strict + TypeMoq.MockBehavior.Strict, ); const decoder = new BufferDecoder(); @@ -711,7 +711,7 @@ class TestFixture extends BaseTestFixture { envVarsService.object, processLogger.object, decoder, - disposableRegistry + disposableRegistry, ); const windowsStoreInterpreter = mock(WindowsStoreInterpreter); return new PythonExecutionFactory( @@ -721,7 +721,7 @@ class TestFixture extends BaseTestFixture { configService, condaService.object, decoder, - instance(windowsStoreInterpreter) + instance(windowsStoreInterpreter), ); } @@ -750,14 +750,14 @@ suite('Linting Functional Tests', () => { fixture: TestFixture, product: Product, pythonFile: string, - messagesToBeReceived: ILintMessage[] + messagesToBeReceived: ILintMessage[], ) { const doc = fixture.makeDocument(pythonFile); await fixture.linterManager.setActiveLintersAsync([product], doc.uri); const linter = await fixture.linterManager.createLinter( product, fixture.outputChannel.object, - fixture.serviceContainer.object + fixture.serviceContainer.object, ); const messages = await linter.lint(doc, new CancellationTokenSource().token); @@ -821,14 +821,14 @@ suite('Linting Functional Tests', () => { fixture: TestFixture, product: Product, pythonFile: string, - messageCountToBeReceived: number + messageCountToBeReceived: number, ) { const doc = fixture.makeDocument(pythonFile); await fixture.linterManager.setActiveLintersAsync([product], doc.uri); const linter = await fixture.linterManager.createLinter( product, fixture.outputChannel.object, - fixture.serviceContainer.object + fixture.serviceContainer.object, ); const messages = await linter.lint(doc, new CancellationTokenSource().token); @@ -836,7 +836,7 @@ suite('Linting Functional Tests', () => { assert.equal( messages.length, messageCountToBeReceived, - 'Expected number of lint errors does not match lint error count' + 'Expected number of lint errors does not match lint error count', ); } test('Three line output counted as one message', async () => { @@ -847,7 +847,7 @@ suite('Linting Functional Tests', () => { fixture, Product.pylint, path.join(pythonFilesDir, 'threeLineLints.py'), - maxErrors + maxErrors, ); }); }); diff --git a/src/test/linters/lint.manager.unit.test.ts b/src/test/linters/lint.manager.unit.test.ts index be23cef27d9b..67303eb441bb 100644 --- a/src/test/linters/lint.manager.unit.test.ts +++ b/src/test/linters/lint.manager.unit.test.ts @@ -33,7 +33,7 @@ function getServiceContainerMockForLinterManagerTests(): TypeMoq.IMock {} + inspect: () => {}, }; workspaceService .setup((x) => x.getConfiguration('python', TypeMoq.It.isAny())) diff --git a/src/test/linters/lint.multilinter.test.ts b/src/test/linters/lint.multilinter.test.ts index ebc804b2e9c5..0b4b3034b29b 100644 --- a/src/test/linters/lint.multilinter.test.ts +++ b/src/test/linters/lint.multilinter.test.ts @@ -32,7 +32,7 @@ class MockPythonToolExecService extends PythonToolExecutionService { public async exec( executionInfo: ExecutionInfo, _options: SpawnOptions, - _resource: Uri + _resource: Uri, ): Promise> { let msg = this.flake8Msg; if (executionInfo.moduleName === 'pylint') { @@ -98,7 +98,7 @@ suite('Linting - Multiple Linters Enabled Test', () => { 'languageServer', LanguageServerType.Jedi, undefined, - ConfigurationTarget.Workspace + ConfigurationTarget.Workspace, ); await configService.updateSetting('linting.enabled', true, workspaceUri); await configService.updateSetting('linting.pylintUseMinimalCheckers', false, workspaceUri); diff --git a/src/test/linters/lint.multiroot.test.ts b/src/test/linters/lint.multiroot.test.ts index 9f309aee53fe..2b03c9e686b3 100644 --- a/src/test/linters/lint.multiroot.test.ts +++ b/src/test/linters/lint.multiroot.test.ts @@ -8,7 +8,7 @@ import { FormatterProductPathService, LinterProductPathService, RefactoringLibraryProductPathService, - TestFrameworkProductPathService + TestFrameworkProductPathService, } from '../../client/common/installer/productPath'; import { ProductService } from '../../client/common/installer/productService'; import { IProductPathService, IProductService } from '../../client/common/installer/types'; @@ -58,27 +58,27 @@ suite('Multiroot Linting', () => { ioc.serviceManager.addSingleton( IProductPathService, CTagsProductPathService, - ProductType.WorkspaceSymbols + ProductType.WorkspaceSymbols, ); ioc.serviceManager.addSingleton( IProductPathService, FormatterProductPathService, - ProductType.Formatter + ProductType.Formatter, ); ioc.serviceManager.addSingleton( IProductPathService, LinterProductPathService, - ProductType.Linter + ProductType.Linter, ); ioc.serviceManager.addSingleton( IProductPathService, TestFrameworkProductPathService, - ProductType.TestFramework + ProductType.TestFramework, ); ioc.serviceManager.addSingleton( IProductPathService, RefactoringLibraryProductPathService, - ProductType.RefactoringLibrary + ProductType.RefactoringLibrary, ); } @@ -90,7 +90,7 @@ suite('Multiroot Linting', () => { async function testLinterInWorkspaceFolder( product: Product, workspaceFolderRelativePath: string, - mustHaveErrors: boolean + mustHaveErrors: boolean, ): Promise { const fileToLint = path.join(multirootPath, workspaceFolderRelativePath, 'file.py'); const cancelToken = new CancellationTokenSource(); @@ -129,17 +129,17 @@ suite('Multiroot Linting', () => { 'languageServer', LanguageServerType.Jedi, Uri.file(multirootPath), - ConfigurationTarget.Global + ConfigurationTarget.Global, ); await Promise.all([ config.updateSetting(setting, global, Uri.file(multirootPath), ConfigurationTarget.Global), - config.updateSetting(setting, wks, Uri.file(multirootPath), ConfigurationTarget.Workspace) + config.updateSetting(setting, wks, Uri.file(multirootPath), ConfigurationTarget.Workspace), ]); await testLinterInWorkspaceFolder(product, 'workspace1', wks); await Promise.all( [ConfigurationTarget.Global, ConfigurationTarget.Workspace].map((configTarget) => - config.updateSetting(setting, undefined, Uri.file(multirootPath), configTarget) - ) + config.updateSetting(setting, undefined, Uri.file(multirootPath), configTarget), + ), ); } }); diff --git a/src/test/linters/lint.provider.test.ts b/src/test/linters/lint.provider.test.ts index d5f9d3f3220a..dc4a18f13df3 100644 --- a/src/test/linters/lint.provider.test.ts +++ b/src/test/linters/lint.provider.test.ts @@ -18,12 +18,12 @@ import { IPersistentStateFactory, IPythonSettings, Product, - WORKSPACE_MEMENTO + WORKSPACE_MEMENTO, } from '../../client/common/types'; import { createDeferred } from '../../client/common/utils/async'; import { IInterpreterAutoSelectionService, - IInterpreterAutoSeletionProxyService + IInterpreterAutoSeletionProxyService, } from '../../client/interpreter/autoSelection/types'; import { IInterpreterService } from '../../client/interpreter/contracts'; import { ServiceContainer } from '../../client/ioc/container'; @@ -62,7 +62,7 @@ suite('Linting - Provider', () => { fs = TypeMoq.Mock.ofType(); fs.setup((x) => x.fileExists(TypeMoq.It.isAny())).returns( - () => new Promise((resolve, _reject) => resolve(true)) + () => new Promise((resolve, _reject) => resolve(true)), ); fs.setup((x) => x.arePathsSame(TypeMoq.It.isAnyString(), TypeMoq.It.isAnyString())).returns(() => true); serviceManager.addSingletonInstance(IFileSystem, fs.object); @@ -104,11 +104,11 @@ suite('Linting - Provider', () => { serviceManager.add(IAvailableLinterActivator, AvailableLinterActivator); serviceManager.addSingleton( IInterpreterAutoSelectionService, - MockAutoSelectionService + MockAutoSelectionService, ); serviceManager.addSingleton( IInterpreterAutoSeletionProxyService, - MockAutoSelectionService + MockAutoSelectionService, ); serviceManager.addSingleton(IPersistentStateFactory, PersistentStateFactory); serviceManager.addSingleton(IMemento, MockMemento, GLOBAL_MEMENTO); diff --git a/src/test/linters/lint.test.ts b/src/test/linters/lint.test.ts index 3d7f1216688e..e0470b2c07ce 100644 --- a/src/test/linters/lint.test.ts +++ b/src/test/linters/lint.test.ts @@ -12,7 +12,7 @@ import { FormatterProductPathService, LinterProductPathService, RefactoringLibraryProductPathService, - TestFrameworkProductPathService + TestFrameworkProductPathService, } from '../../client/common/installer/productPath'; import { ProductService } from '../../client/common/installer/productService'; import { IProductPathService, IProductService } from '../../client/common/installer/types'; @@ -65,27 +65,27 @@ suite('Linting Settings', () => { ioc.serviceManager.addSingleton( IProductPathService, CTagsProductPathService, - ProductType.WorkspaceSymbols + ProductType.WorkspaceSymbols, ); ioc.serviceManager.addSingleton( IProductPathService, FormatterProductPathService, - ProductType.Formatter + ProductType.Formatter, ); ioc.serviceManager.addSingleton( IProductPathService, LinterProductPathService, - ProductType.Linter + ProductType.Linter, ); ioc.serviceManager.addSingleton( IProductPathService, TestFrameworkProductPathService, - ProductType.TestFramework + ProductType.TestFramework, ); ioc.serviceManager.addSingleton( IProductPathService, RefactoringLibraryProductPathService, - ProductType.RefactoringLibrary + ProductType.RefactoringLibrary, ); } diff --git a/src/test/linters/lint.unit.test.ts b/src/test/linters/lint.unit.test.ts index 7c92fac4c0cc..914fe87ca30c 100644 --- a/src/test/linters/lint.unit.test.ts +++ b/src/test/linters/lint.unit.test.ts @@ -13,7 +13,7 @@ import { IFileSystem, IPlatformService } from '../../client/common/platform/type import { IPythonExecutionFactory, IPythonExecutionService, - IPythonToolExecutionService + IPythonToolExecutionService, } from '../../client/common/process/types'; import { ProductType } from '../../client/common/types'; import { LINTERID_BY_PRODUCT } from '../../client/linters/constants'; @@ -28,7 +28,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0011', message: 'Locally disabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 30, @@ -37,7 +37,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0011', message: 'Locally disabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 34, @@ -46,7 +46,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0012', message: 'Locally enabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 40, @@ -55,7 +55,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0011', message: 'Locally disabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 44, @@ -64,7 +64,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0012', message: 'Locally enabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 55, @@ -73,7 +73,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0011', message: 'Locally disabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 59, @@ -82,7 +82,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0012', message: 'Locally enabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 62, @@ -91,7 +91,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0011', message: 'Locally disabling undefined-variable (E0602)', provider: '', - type: 'warning' + type: 'warning', }, { line: 70, @@ -100,7 +100,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0011', message: 'Locally disabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 84, @@ -109,7 +109,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'I0011', message: 'Locally disabling no-member (E1101)', provider: '', - type: 'warning' + type: 'warning', }, { line: 87, @@ -118,7 +118,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'C0304', message: 'Final newline missing', provider: '', - type: 'warning' + type: 'warning', }, { line: 11, @@ -127,7 +127,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'W0613', message: "Unused argument 'arg'", provider: '', - type: 'warning' + type: 'warning', }, { line: 26, @@ -136,7 +136,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'E1101', message: "Instance of 'Foo' has no 'blop' member", provider: '', - type: 'warning' + type: 'warning', }, { line: 36, @@ -145,7 +145,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'E1101', message: "Instance of 'Foo' has no 'blip' member", provider: '', - type: 'warning' + type: 'warning', }, { line: 46, @@ -154,7 +154,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'E1101', message: "Instance of 'Foo' has no 'blip' member", provider: '', - type: 'warning' + type: 'warning', }, { line: 61, @@ -163,7 +163,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'E1101', message: "Instance of 'Foo' has no 'blip' member", provider: '', - type: 'warning' + type: 'warning', }, { line: 72, @@ -172,7 +172,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'E1101', message: "Instance of 'Foo' has no 'blip' member", provider: '', - type: 'warning' + type: 'warning', }, { line: 75, @@ -181,7 +181,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'E1101', message: "Instance of 'Foo' has no 'blip' member", provider: '', - type: 'warning' + type: 'warning', }, { line: 77, @@ -190,7 +190,7 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'E1101', message: "Instance of 'Foo' has no 'blip' member", provider: '', - type: 'warning' + type: 'warning', }, { line: 83, @@ -199,8 +199,8 @@ const pylintMessagesToBeReturned: ILintMessage[] = [ code: 'E1101', message: "Instance of 'Foo' has no 'blip' member", provider: '', - type: 'warning' - } + type: 'warning', + }, ]; const flake8MessagesToBeReturned: ILintMessage[] = [ { @@ -210,7 +210,7 @@ const flake8MessagesToBeReturned: ILintMessage[] = [ code: 'E302', message: 'expected 2 blank lines, found 1', provider: '', - type: 'E' + type: 'E', }, { line: 19, @@ -219,7 +219,7 @@ const flake8MessagesToBeReturned: ILintMessage[] = [ code: 'E127', message: 'continuation line over-indented for visual indent', provider: '', - type: 'E' + type: 'E', }, { line: 24, @@ -228,7 +228,7 @@ const flake8MessagesToBeReturned: ILintMessage[] = [ code: 'E261', message: 'at least two spaces before inline comment', provider: '', - type: 'E' + type: 'E', }, { line: 62, @@ -237,7 +237,7 @@ const flake8MessagesToBeReturned: ILintMessage[] = [ code: 'E261', message: 'at least two spaces before inline comment', provider: '', - type: 'E' + type: 'E', }, { line: 70, @@ -246,7 +246,7 @@ const flake8MessagesToBeReturned: ILintMessage[] = [ code: 'E261', message: 'at least two spaces before inline comment', provider: '', - type: 'E' + type: 'E', }, { line: 80, @@ -255,7 +255,7 @@ const flake8MessagesToBeReturned: ILintMessage[] = [ code: 'E303', message: 'too many blank lines (2)', provider: '', - type: 'E' + type: 'E', }, { line: 87, @@ -264,8 +264,8 @@ const flake8MessagesToBeReturned: ILintMessage[] = [ code: 'W292', message: 'no newline at end of file', provider: '', - type: 'E' - } + type: 'E', + }, ]; const pycodestyleMessagesToBeReturned: ILintMessage[] = [ { @@ -275,7 +275,7 @@ const pycodestyleMessagesToBeReturned: ILintMessage[] = [ code: 'E302', message: 'expected 2 blank lines, found 1', provider: '', - type: 'E' + type: 'E', }, { line: 19, @@ -284,7 +284,7 @@ const pycodestyleMessagesToBeReturned: ILintMessage[] = [ code: 'E127', message: 'continuation line over-indented for visual indent', provider: '', - type: 'E' + type: 'E', }, { line: 24, @@ -293,7 +293,7 @@ const pycodestyleMessagesToBeReturned: ILintMessage[] = [ code: 'E261', message: 'at least two spaces before inline comment', provider: '', - type: 'E' + type: 'E', }, { line: 62, @@ -302,7 +302,7 @@ const pycodestyleMessagesToBeReturned: ILintMessage[] = [ code: 'E261', message: 'at least two spaces before inline comment', provider: '', - type: 'E' + type: 'E', }, { line: 70, @@ -311,7 +311,7 @@ const pycodestyleMessagesToBeReturned: ILintMessage[] = [ code: 'E261', message: 'at least two spaces before inline comment', provider: '', - type: 'E' + type: 'E', }, { line: 80, @@ -320,7 +320,7 @@ const pycodestyleMessagesToBeReturned: ILintMessage[] = [ code: 'E303', message: 'too many blank lines (2)', provider: '', - type: 'E' + type: 'E', }, { line: 87, @@ -329,8 +329,8 @@ const pycodestyleMessagesToBeReturned: ILintMessage[] = [ code: 'W292', message: 'no newline at end of file', provider: '', - type: 'E' - } + type: 'E', + }, ]; const pydocstyleMessagesToBeReturned: ILintMessage[] = [ { @@ -340,7 +340,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 0, line: 1, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -349,7 +349,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 0, line: 5, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D102', @@ -358,7 +358,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 8, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D401', @@ -367,7 +367,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 11, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D403', @@ -376,7 +376,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 11, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -385,7 +385,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 11, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D403', @@ -394,7 +394,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 15, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -403,7 +403,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 15, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D403', @@ -412,7 +412,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 21, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -421,7 +421,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 21, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D403', @@ -430,7 +430,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 28, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -439,7 +439,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 28, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D403', @@ -448,7 +448,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 38, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -457,7 +457,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 38, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D403', @@ -466,7 +466,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 53, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -475,7 +475,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 53, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D403', @@ -484,7 +484,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 68, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -493,7 +493,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 68, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D403', @@ -502,7 +502,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 80, type: '', - provider: 'pydocstyle' + provider: 'pydocstyle', }, { code: 'D400', @@ -511,8 +511,8 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ column: 4, line: 80, type: '', - provider: 'pydocstyle' - } + provider: 'pydocstyle', + }, ]; class TestFixture extends BaseTestFixture { @@ -527,7 +527,7 @@ class TestFixture extends BaseTestFixture { const filesystem = TypeMoq.Mock.ofType(undefined, TypeMoq.MockBehavior.Strict); const pythonToolExecService = TypeMoq.Mock.ofType( undefined, - TypeMoq.MockBehavior.Strict + TypeMoq.MockBehavior.Strict, ); const pythonExecFactory = TypeMoq.Mock.ofType(undefined, TypeMoq.MockBehavior.Strict); super( @@ -539,7 +539,7 @@ class TestFixture extends BaseTestFixture { undefined, true, workspaceDir, - printLogs + printLogs, ); this.platformService = platformService; @@ -637,13 +637,13 @@ suite('Linting Scenarios', () => { const messages = await linter.lint( fixture.makeDocument(product, 'spam.py'), - new CancellationTokenSource().token + new CancellationTokenSource().token, ); assert.equal( messages.length, 0, - `Unexpected linter errors when linting is disabled, Output - ${fixture.output}` + `Unexpected linter errors when linting is disabled, Output - ${fixture.output}`, ); }); @@ -657,13 +657,13 @@ suite('Linting Scenarios', () => { const messages = await linter.lint( fixture.makeDocument(product, 'spam.py'), - new CancellationTokenSource().token + new CancellationTokenSource().token, ); assert.equal( messages.length, 0, - `Unexpected linter errors when linting is disabled, Output - ${fixture.output}` + `Unexpected linter errors when linting is disabled, Output - ${fixture.output}`, ); }); @@ -677,20 +677,20 @@ suite('Linting Scenarios', () => { const messages = await linter.lint( fixture.makeDocument(product, 'spam.py'), - new CancellationTokenSource().token + new CancellationTokenSource().token, ); if (enabled) { assert.notEqual( messages.length, 0, - `Expected linter errors when linter is enabled, Output - ${fixture.output}` + `Expected linter errors when linter is enabled, Output - ${fixture.output}`, ); } else { assert.equal( messages.length, 0, - `Unexpected linter errors when linter is disabled, Output - ${fixture.output}` + `Unexpected linter errors when linter is disabled, Output - ${fixture.output}`, ); } } @@ -727,7 +727,7 @@ suite('Linting Scenarios', () => { const messages = await linter.lint( fixture.makeDocument(product, 'spam.py'), - new CancellationTokenSource().token + new CancellationTokenSource().token, ); if (messagesToBeReceived.length === 0) { @@ -760,13 +760,13 @@ suite('Linting Scenarios', () => { const messages = await linter.lint( fixture.makeDocument(product, 'spam.py'), - new CancellationTokenSource().token + new CancellationTokenSource().token, ); assert.equal( messages.length, messageCountToBeReceived, - `Expected number of lint errors does not match lint error count, Output - ${fixture.output}` + `Expected number of lint errors does not match lint error count, Output - ${fixture.output}`, ); } test('Three line output counted as one message (Pylint)', async () => { diff --git a/src/test/linters/lintengine.test.ts b/src/test/linters/lintengine.test.ts index e2db5059dfab..fdbd8a67b589 100644 --- a/src/test/linters/lintengine.test.ts +++ b/src/test/linters/lintengine.test.ts @@ -76,7 +76,7 @@ suite('Linting - LintingEngine', () => { } catch { lintManager.verify( (l) => l.isLintingEnabled(TypeMoq.It.isAny(), TypeMoq.It.isValue(doc.uri)), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); } }); @@ -91,9 +91,9 @@ suite('Linting - LintingEngine', () => { TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), - TypeMoq.It.isValue(doc.uri) + TypeMoq.It.isValue(doc.uri), ), - TypeMoq.Times.atLeastOnce() + TypeMoq.Times.atLeastOnce(), ); } }); @@ -103,7 +103,7 @@ suite('Linting - LintingEngine', () => { await lintingEngine.lintDocument(doc, 'auto'); lintManager.verify( (l) => l.createLinter(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), - TypeMoq.Times.never() + TypeMoq.Times.never(), ); }); @@ -112,7 +112,7 @@ suite('Linting - LintingEngine', () => { await lintingEngine.lintDocument(doc, 'auto'); lintManager.verify( (l) => l.createLinter(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), - TypeMoq.Times.never() + TypeMoq.Times.never(), ); }); @@ -121,7 +121,7 @@ suite('Linting - LintingEngine', () => { await lintingEngine.lintDocument(doc, 'auto'); lintManager.verify( (l) => l.createLinter(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), - TypeMoq.Times.never() + TypeMoq.Times.never(), ); }); test('Ensure files with showModifications scheme are not linted', async () => { @@ -129,7 +129,7 @@ suite('Linting - LintingEngine', () => { await lintingEngine.lintDocument(doc, 'auto'); lintManager.verify( (l) => l.createLinter(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), - TypeMoq.Times.never() + TypeMoq.Times.never(), ); }); test('Ensure files with svn scheme are not linted', async () => { @@ -137,7 +137,7 @@ suite('Linting - LintingEngine', () => { await lintingEngine.lintDocument(doc, 'auto'); lintManager.verify( (l) => l.createLinter(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), - TypeMoq.Times.never() + TypeMoq.Times.never(), ); }); @@ -146,7 +146,7 @@ suite('Linting - LintingEngine', () => { await lintingEngine.lintDocument(doc, 'auto'); lintManager.verify( (l) => l.createLinter(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), - TypeMoq.Times.never() + TypeMoq.Times.never(), ); }); @@ -155,7 +155,7 @@ suite('Linting - LintingEngine', () => { language: string, exists: boolean, ignorePattern: string[] = [], - scheme?: string + scheme?: string, ): TextDocument { fileSystem.setup((x) => x.fileExists(TypeMoq.It.isAnyString())).returns(() => Promise.resolve(exists)); diff --git a/src/test/linters/linter.availability.unit.test.ts b/src/test/linters/linter.availability.unit.test.ts index 23e11ec8e9cc..d2fda21cbbee 100644 --- a/src/test/linters/linter.availability.unit.test.ts +++ b/src/test/linters/linter.availability.unit.test.ts @@ -21,7 +21,7 @@ import { IPersistentState, IPersistentStateFactory, IPythonSettings, - Product + Product, } from '../../client/common/types'; import { Common, Linters } from '../../client/common/utils/localize'; import { AvailableLinterActivator } from '../../client/linters/linterAvailability'; @@ -41,7 +41,7 @@ suite('Linter Availability Provider tests', () => { fsMock, workspaceServiceMock, configServiceMock, - factoryMock + factoryMock, ] = getDependenciesForAvailabilityTests(); setupConfigurationServiceForJediSettingsTest(languageServerValue, configServiceMock); @@ -51,13 +51,13 @@ suite('Linter Availability Provider tests', () => { fsMock.object, workspaceServiceMock.object, configServiceMock.object, - factoryMock.object + factoryMock.object, ); // check expectaions expect(availabilityProvider.isFeatureEnabled).is.equal( expectedResult, - 'Avaialability feature should be disabled when python.languageServer is Jedi' + 'Avaialability feature should be disabled when python.languageServer is Jedi', ); workspaceServiceMock.verifyAll(); }); @@ -73,7 +73,7 @@ suite('Linter Availability Provider tests', () => { fsMock, workspaceServiceMock, configServiceMock, - factoryMock + factoryMock, ] = getDependenciesForAvailabilityTests(); setupConfigurationServiceForJediSettingsTest(languageServerValue, configServiceMock); @@ -82,12 +82,12 @@ suite('Linter Availability Provider tests', () => { fsMock.object, workspaceServiceMock.object, configServiceMock.object, - factoryMock.object + factoryMock.object, ); expect(availabilityProvider.isFeatureEnabled).is.equal( expectedResult, - 'Avaialability feature should be enabled when python.languageServer defaults to non-Jedi' + 'Avaialability feature should be enabled when python.languageServer defaults to non-Jedi', ); workspaceServiceMock.verifyAll(); }); @@ -105,13 +105,13 @@ suite('Linter Availability Provider tests', () => { workspaceServiceMock, configServiceMock, factoryMock, - linterInfo + linterInfo, ] = getDependenciesForAvailabilityTests(); setupWorkspaceMockForLinterConfiguredTests( pylintUserValue, pylintWorkspaceValue, pylintWorkspaceFolderValue, - workspaceServiceMock + workspaceServiceMock, ); const availabilityProvider = new AvailableLinterActivator( @@ -119,7 +119,7 @@ suite('Linter Availability Provider tests', () => { fsMock.object, workspaceServiceMock.object, configServiceMock.object, - factoryMock.object + factoryMock.object, ); const result = availabilityProvider.isLinterUsingDefaultConfiguration(linterInfo); @@ -141,13 +141,13 @@ suite('Linter Availability Provider tests', () => { workspaceServiceMock, configServiceMock, factoryMock, - linterInfo + linterInfo, ] = getDependenciesForAvailabilityTests(); setupWorkspaceMockForLinterConfiguredTests( pylintUserValue, pylintWorkspaceValue, pylintWorkspaceFolderValue, - workspaceServiceMock + workspaceServiceMock, ); const availabilityProvider = new AvailableLinterActivator( @@ -155,13 +155,13 @@ suite('Linter Availability Provider tests', () => { fsMock.object, workspaceServiceMock.object, configServiceMock.object, - factoryMock.object + factoryMock.object, ); const result = availabilityProvider.isLinterUsingDefaultConfiguration(linterInfo); expect(result).to.equal( expectedResult, - 'Available linter prompt should not be shown when linter is configured for workspace.' + 'Available linter prompt should not be shown when linter is configured for workspace.', ); workspaceServiceMock.verifyAll(); }); @@ -180,26 +180,26 @@ suite('Linter Availability Provider tests', () => { workspaceServiceMock, configServiceMock, factoryMock, - linterInfo + linterInfo, ] = getDependenciesForAvailabilityTests(); setupWorkspaceMockForLinterConfiguredTests( pylintUserValue, pylintWorkspaceValue, pylintWorkspaceFolderValue, - workspaceServiceMock + workspaceServiceMock, ); const availabilityProvider = new AvailableLinterActivator( appShellMock.object, fsMock.object, workspaceServiceMock.object, configServiceMock.object, - factoryMock.object + factoryMock.object, ); const result = availabilityProvider.isLinterUsingDefaultConfiguration(linterInfo); expect(result).to.equal( expectedResult, - 'Available linter prompt should not be shown when linter is configured for user.' + 'Available linter prompt should not be shown when linter is configured for user.', ); workspaceServiceMock.verifyAll(); }); @@ -218,33 +218,33 @@ suite('Linter Availability Provider tests', () => { workspaceServiceMock, configServiceMock, factoryMock, - linterInfo + linterInfo, ] = getDependenciesForAvailabilityTests(); setupWorkspaceMockForLinterConfiguredTests( pylintUserValue, pylintWorkspaceValue, pylintWorkspaceFolderValue, - workspaceServiceMock + workspaceServiceMock, ); const availabilityProvider = new AvailableLinterActivator( appShellMock.object, fsMock.object, workspaceServiceMock.object, configServiceMock.object, - factoryMock.object + factoryMock.object, ); const result = availabilityProvider.isLinterUsingDefaultConfiguration(linterInfo); expect(result).to.equal( expectedResult, - 'Available linter prompt should not be shown when linter is configured for workspace-folder.' + 'Available linter prompt should not be shown when linter is configured for workspace-folder.', ); workspaceServiceMock.verifyAll(); }); async function testForLinterPromptResponse( promptAction: 'enable' | 'ignore' | 'disablePrompt' | undefined, - promptEnabled = true + promptEnabled = true, ): Promise { // arrange const [appShellMock, fsMock, workspaceServiceMock, , factoryMock] = getDependenciesForAvailabilityTests(); @@ -273,8 +273,8 @@ suite('Linter Availability Provider tests', () => { TypeMoq.It.isValue(Linters.enablePylint().format(linterInfo.id)), TypeMoq.It.isValue(Linters.enableLinter().format(linterInfo.id)), TypeMoq.It.isAny(), - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve(promptAction ? optButtons[selections.indexOf(promptAction)] : undefined)) .verifiable(TypeMoq.Times.once()); @@ -291,8 +291,8 @@ suite('Linter Availability Provider tests', () => { TypeMoq.It.isValue(Linters.enablePylint().format(linterInfo.id)), TypeMoq.It.isValue(Linters.enableLinter().format(linterInfo.id)), TypeMoq.It.isAny(), - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve(promptAction ? optButtons[selections.indexOf(promptAction)] : undefined)) .verifiable(TypeMoq.Times.never()); @@ -304,13 +304,13 @@ suite('Linter Availability Provider tests', () => { fsMock.object, workspaceServiceMock.object, configServiceMock.object, - factoryMock.object + factoryMock.object, ); const result = await availabilityProvider.promptToConfigureAvailableLinter(linterInfo); if (promptEnabled && promptAction === 'enable') { expect(linterInfo.testIsEnabled).to.equal( true, - 'LinterInfo test class was not updated as a result of the test.' + 'LinterInfo test class was not updated as a result of the test.', ); } @@ -331,7 +331,7 @@ suite('Linter Availability Provider tests', () => { // test results expect(result).to.equal( expectedResult, - 'Expected promptToConfigureAvailableLinter to return true because the configuration was updated.' + 'Expected promptToConfigureAvailableLinter to return true because the configuration was updated.', ); }); @@ -402,7 +402,7 @@ suite('Linter Availability Provider tests', () => { workspaceServiceMock, configServiceMock, factoryMock, - linterInfo + linterInfo, ] = getDependenciesForAvailabilityTests(); const selections: ['enable', 'ignore', 'disablePrompt'] = ['enable', 'ignore', 'disablePrompt']; const optButtons = [Linters.enableLinter().format(linterInfo.id), Common.notNow(), Common.doNotShowAgain()]; @@ -412,11 +412,13 @@ suite('Linter Availability Provider tests', () => { TypeMoq.It.isValue(Linters.enablePylint().format(linterInfo.id)), TypeMoq.It.isValue(Linters.enableLinter().format(linterInfo.id)), TypeMoq.It.isAny(), - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => - Promise.resolve(options.promptAction ? optButtons[selections.indexOf(options.promptAction)] : undefined) + Promise.resolve( + options.promptAction ? optButtons[selections.indexOf(options.promptAction)] : undefined, + ), ) .verifiable(TypeMoq.Times.once()); @@ -439,7 +441,7 @@ suite('Linter Availability Provider tests', () => { options.pylintUserEnabled, options.pylintWorkspaceEnabled, options.pylintWorkspaceFolderEnabled, - workspaceServiceMock + workspaceServiceMock, ); const notificationPromptEnabled = TypeMoq.Mock.ofType>(); @@ -453,7 +455,7 @@ suite('Linter Availability Provider tests', () => { fsMock.object, workspaceServiceMock.object, configServiceMock.object, - factoryMock.object + factoryMock.object, ); return availabilityProvider.promptIfLinterAvailable(linterInfo); } @@ -470,7 +472,7 @@ suite('Linter Availability Provider tests', () => { // perform test expect(expectedResult).to.equal( result, - 'promptIfLinterAvailable should not change any configuration when python.languageServer is Jedi.' + 'promptIfLinterAvailable should not change any configuration when python.languageServer is Jedi.', ); }); @@ -486,7 +488,7 @@ suite('Linter Availability Provider tests', () => { // perform test expect(expectedResult).to.equal( result, - 'Configuration should not change if the linter is configured in any way.' + 'Configuration should not change if the linter is configured in any way.', ); }); @@ -501,7 +503,7 @@ suite('Linter Availability Provider tests', () => { expect(expectedResult).to.equal( result, - 'Configuration should not change if the linter is disabled in any way.' + 'Configuration should not change if the linter is disabled in any way.', ); }); @@ -516,7 +518,7 @@ suite('Linter Availability Provider tests', () => { expect(expectedResult).to.equal( result, - 'Configuration should not change if the linter is unavailable in the current workspace environment.' + 'Configuration should not change if the linter is unavailable in the current workspace environment.', ); }); @@ -531,7 +533,7 @@ suite('Linter Availability Provider tests', () => { expect(expectedResult).to.equal( result, - 'Configuration should not change if the user is prompted and they dismiss the prompt.' + 'Configuration should not change if the user is prompted and they dismiss the prompt.', ); }); @@ -546,7 +548,7 @@ suite('Linter Availability Provider tests', () => { expect(expectedResult).to.equal( result, - 'Configuration should change if the user is prompted and they choose to update the linter config.' + 'Configuration should change if the user is prompted and they choose to update the linter config.', ); }); @@ -561,7 +563,7 @@ suite('Linter Availability Provider tests', () => { expect(expectedResult).to.equal( result, - 'Configuration should change if the user is prompted and they choose to update the linter config.' + 'Configuration should change if the user is prompted and they choose to update the linter config.', ); }); @@ -576,7 +578,7 @@ suite('Linter Availability Provider tests', () => { expect(expectedResult).to.equal( result, - 'Configuration should change if the user is prompted and they choose to update the linter config.' + 'Configuration should change if the user is prompted and they choose to update the linter config.', ); }); @@ -592,7 +594,7 @@ suite('Linter Availability Provider tests', () => { workspaceServiceMock, configServiceMock, factoryMock, - linterInfo + linterInfo, ] = getDependenciesForAvailabilityTests(); setupInstallerForAvailabilityTest(linterInfo, linterIsInstalled, fsMock, workspaceServiceMock); @@ -602,13 +604,13 @@ suite('Linter Availability Provider tests', () => { fsMock.object, workspaceServiceMock.object, configServiceMock.object, - factoryMock.object + factoryMock.object, ); const result = await availabilityProvider.isLinterAvailable(linterInfo, undefined); expect(result).to.equal( expectedResult, - 'Expected promptToConfigureAvailableLinter to return true because the configuration was updated.' + 'Expected promptToConfigureAvailableLinter to return true because the configuration was updated.', ); fsMock.verifyAll(); workspaceServiceMock.verifyAll(); @@ -626,7 +628,7 @@ suite('Linter Availability Provider tests', () => { workspaceServiceMock, configServiceMock, factoryMock, - linterInfo + linterInfo, ] = getDependenciesForAvailabilityTests(); setupInstallerForAvailabilityTest(linterInfo, linterIsInstalled, fsMock, workspaceServiceMock); @@ -636,13 +638,13 @@ suite('Linter Availability Provider tests', () => { fsMock.object, workspaceServiceMock.object, configServiceMock.object, - factoryMock.object + factoryMock.object, ); const result = await availabilityProvider.isLinterAvailable(linterInfo, undefined); expect(result).to.equal( expectedResult, - 'Expected promptToConfigureAvailableLinter to return true because the configuration was updated.' + 'Expected promptToConfigureAvailableLinter to return true because the configuration was updated.', ); fsMock.verifyAll(); workspaceServiceMock.verifyAll(); @@ -655,7 +657,7 @@ suite('Linter Availability Provider tests', () => { const defaultWorkspace: WorkspaceFolder = { uri: Uri.file(path.join('a', 'b', 'default')), name: 'default', - index: 0 + index: 0, }; const resource = Uri.file(__dirname); setup(() => { @@ -667,7 +669,7 @@ suite('Linter Availability Provider tests', () => { instance(fs), instance(workspaceService), instance(mock(ConfigurationService)), - instance(mock(PersistentStateFactory)) + instance(mock(PersistentStateFactory)), ); }); test('No linters when there are no workspaces', async () => { @@ -767,7 +769,7 @@ suite('Linter Availability Provider tests', () => { verify(workspaceService.workspaceFolders).once(); } }); - } + }, ); }); }); @@ -776,7 +778,7 @@ function setupWorkspaceMockForLinterConfiguredTests( enabledForUser: boolean | undefined, enabeldForWorkspace: boolean | undefined, enabledForWorkspaceFolder: boolean | undefined, - workspaceServiceMock?: TypeMoq.IMock + workspaceServiceMock?: TypeMoq.IMock, ): TypeMoq.IMock { if (!workspaceServiceMock) { workspaceServiceMock = TypeMoq.Mock.ofType(); @@ -790,7 +792,7 @@ function setupWorkspaceMockForLinterConfiguredTests( globalValue: enabledForUser, defaultValue: false, workspaceFolderValue: enabeldForWorkspace, - workspaceValue: enabledForWorkspaceFolder + workspaceValue: enabledForWorkspaceFolder, }; }) .verifiable(TypeMoq.Times.once()); @@ -805,7 +807,7 @@ function setupWorkspaceMockForLinterConfiguredTests( function setupConfigurationServiceForJediSettingsTest( languageServerValue: LanguageServerType, - configServiceMock: TypeMoq.IMock + configServiceMock: TypeMoq.IMock, ): [TypeMoq.IMock, TypeMoq.IMock] { if (!configServiceMock) { configServiceMock = TypeMoq.Mock.ofType(); @@ -821,7 +823,7 @@ function setupInstallerForAvailabilityTest( _linterInfo: LinterInfo, linterIsInstalled: boolean, fsMock: TypeMoq.IMock, - workspaceServiceMock: TypeMoq.IMock + workspaceServiceMock: TypeMoq.IMock, ): TypeMoq.IMock { if (!fsMock) { fsMock = TypeMoq.Mock.ofType(); @@ -847,7 +849,7 @@ function getDependenciesForAvailabilityTests(): [ TypeMoq.IMock, TypeMoq.IMock, TypeMoq.IMock, - LinterInfo + LinterInfo, ] { const configServiceMock = TypeMoq.Mock.ofType(); return [ @@ -856,6 +858,6 @@ function getDependenciesForAvailabilityTests(): [ TypeMoq.Mock.ofType(), TypeMoq.Mock.ofType(), TypeMoq.Mock.ofType(), - new LinterInfo(Product.pylint, LinterId.PyLint, configServiceMock.object, ['.pylintrc', 'pylintrc']) + new LinterInfo(Product.pylint, LinterId.PyLint, configServiceMock.object, ['.pylintrc', 'pylintrc']), ]; } diff --git a/src/test/linters/linterCommands.unit.test.ts b/src/test/linters/linterCommands.unit.test.ts index 4f7259fd41d7..32111c0bb5c9 100644 --- a/src/test/linters/linterCommands.unit.test.ts +++ b/src/test/linters/linterCommands.unit.test.ts @@ -60,7 +60,7 @@ suite('Linting - Linter Commands', () => { const expectedQuickPickOptions = { matchOnDetail: true, matchOnDescription: true, - placeHolder: `current: ${currentState ? 'on' : 'off'}` + placeHolder: `current: ${currentState ? 'on' : 'off'}`, }; when(shell.showQuickPick(anything(), anything())).thenResolve(selectedState as any); @@ -101,7 +101,7 @@ suite('Linting - Linter Commands', () => { const expectedQuickPickOptions = { matchOnDetail: true, matchOnDescription: true, - placeHolder: 'current: none' + placeHolder: 'current: none', }; await linterCommands.setLinterAsync(); @@ -119,7 +119,7 @@ suite('Linting - Linter Commands', () => { const expectedQuickPickOptions = { matchOnDetail: true, matchOnDescription: true, - placeHolder: `current: ${linterId}` + placeHolder: `current: ${linterId}`, }; await linterCommands.setLinterAsync(); @@ -136,7 +136,7 @@ suite('Linting - Linter Commands', () => { const expectedQuickPickOptions = { matchOnDetail: true, matchOnDescription: true, - placeHolder: 'current: multiple selected' + placeHolder: 'current: multiple selected', }; await linterCommands.setLinterAsync(); @@ -155,7 +155,7 @@ suite('Linting - Linter Commands', () => { const expectedQuickPickOptions = { matchOnDetail: true, matchOnDescription: true, - placeHolder: 'current: multiple selected' + placeHolder: 'current: multiple selected', }; await linterCommands.setLinterAsync(); diff --git a/src/test/linters/linterManager.unit.test.ts b/src/test/linters/linterManager.unit.test.ts index efdc927eaa9d..6145a090c7da 100644 --- a/src/test/linters/linterManager.unit.test.ts +++ b/src/test/linters/linterManager.unit.test.ts @@ -16,7 +16,7 @@ import { IApplicationShell, ICommandManager, IDocumentManager, - IWorkspaceService + IWorkspaceService, } from '../../client/common/application/types'; import { WorkspaceService } from '../../client/common/application/workspace'; import { ConfigurationService } from '../../client/common/configuration/service'; @@ -171,7 +171,7 @@ suite('Linting - Linter Manager', () => { linterInstances.set(product, instanceOfLinterInfo); when(linterInfo.product).thenReturn(product); when(linterInfo.enableAsync(anything(), resource)).thenResolve(); - } + }, ); linterManager.getActiveLinters = () => Promise.resolve(Array.from(linterInstances.values())); diff --git a/src/test/linters/linterinfo.unit.test.ts b/src/test/linters/linterinfo.unit.test.ts index a648c1949d46..822a376ebc02 100644 --- a/src/test/linters/linterinfo.unit.test.ts +++ b/src/test/linters/linterinfo.unit.test.ts @@ -22,7 +22,7 @@ suite('Linter Info - Pylint', () => { when(config.getSettings(anything())).thenReturn({ linting: { pylintEnabled: false }, - languageServer: LanguageServerType.Jedi + languageServer: LanguageServerType.Jedi, } as any); expect(linterInfo.isEnabled()).to.be.false; @@ -32,7 +32,7 @@ suite('Linter Info - Pylint', () => { when(config.getSettings(anything())).thenReturn({ linting: { pylintEnabled: false }, - languageServer: LanguageServerType.Jedi + languageServer: LanguageServerType.Jedi, } as any); expect(linterInfo.isEnabled()).to.be.false; @@ -42,7 +42,7 @@ suite('Linter Info - Pylint', () => { when(config.getSettings(anything())).thenReturn({ linting: { pylintEnabled: true }, - languageServer: LanguageServerType.Jedi + languageServer: LanguageServerType.Jedi, } as any); expect(linterInfo.isEnabled()).to.be.true; @@ -52,12 +52,12 @@ suite('Linter Info - Pylint', () => { when(config.getSettings(anything())).thenReturn({ linting: { pylintEnabled: true }, - languageServer: LanguageServerType.Microsoft + languageServer: LanguageServerType.Microsoft, } as any); const pythonConfig = { // tslint:disable-next-line:no-empty - inspect: () => {} + inspect: () => {}, }; when(workspace.getConfiguration('python', anything())).thenReturn(pythonConfig as any); @@ -67,12 +67,12 @@ suite('Linter Info - Pylint', () => { const linterInfo = new PylintLinterInfo(instance(config), instance(workspace), []); const inspectStub = sinon.stub(); const pythonConfig = { - inspect: inspectStub + inspect: inspectStub, }; when(config.getSettings(anything())).thenReturn({ linting: { pylintEnabled: true }, - languageServer: LanguageServerType.Microsoft + languageServer: LanguageServerType.Microsoft, } as any); when(workspace.getConfiguration('python', anything())).thenReturn(pythonConfig as any); @@ -82,16 +82,16 @@ suite('Linter Info - Pylint', () => { const testsForisEnabled = [ { testName: 'When workspaceFolder setting is provided', - inspection: { workspaceFolderValue: true } + inspection: { workspaceFolderValue: true }, }, { testName: 'When workspace setting is provided', - inspection: { workspaceValue: true } + inspection: { workspaceValue: true }, }, { testName: 'When global setting is provided', - inspection: { globalValue: true } - } + inspection: { globalValue: true }, + }, ]; suite('Test is enabled when using Language Server and Pylint is configured', () => { @@ -103,11 +103,11 @@ suite('Linter Info - Pylint', () => { const linterInfo = new PylintLinterInfo(instance(config), instance(workspaceService), []); const pythonConfig = { - inspect: () => testParams.inspection + inspect: () => testParams.inspection, }; when(config.getSettings(anything())).thenReturn({ linting: { pylintEnabled: true }, - languageServer: LanguageServerType.Microsoft + languageServer: LanguageServerType.Microsoft, } as any); when(workspaceService.getConfiguration('python', anything())).thenReturn(pythonConfig as any); diff --git a/src/test/linters/mypy.unit.test.ts b/src/test/linters/mypy.unit.test.ts index b0d0843a9173..ed5a87eb2253 100644 --- a/src/test/linters/mypy.unit.test.ts +++ b/src/test/linters/mypy.unit.test.ts @@ -30,8 +30,8 @@ suite('Linting - MyPy', () => { column: 0, line: 10, type: 'error', - provider: 'mypy' - } as ILintMessage + provider: 'mypy', + } as ILintMessage, ], [ lines[2], @@ -41,8 +41,8 @@ suite('Linting - MyPy', () => { column: 0, line: 11, type: 'error', - provider: 'mypy' - } as ILintMessage + provider: 'mypy', + } as ILintMessage, ], [ lines[3], @@ -52,9 +52,9 @@ suite('Linting - MyPy', () => { column: 21, line: 12, type: 'error', - provider: 'mypy' - } as ILintMessage - ] + provider: 'mypy', + } as ILintMessage, + ], ]; for (const [line, expected] of tests) { const msg = parseLine(line, REGEX, LinterId.MyPy); diff --git a/src/test/linters/pylint.test.ts b/src/test/linters/pylint.test.ts index 02b19a7ef9bd..03d32f701bd9 100644 --- a/src/test/linters/pylint.test.ts +++ b/src/test/linters/pylint.test.ts @@ -13,7 +13,7 @@ import { TextDocument, Uri, WorkspaceConfiguration, - WorkspaceFolder + WorkspaceFolder, } from 'vscode'; import { LanguageServerType } from '../../client/activation/types'; import { IWorkspaceService } from '../../client/common/application/types'; @@ -22,7 +22,7 @@ import { IPythonToolExecutionService } from '../../client/common/process/types'; import { ExecutionInfo, IConfigurationService, IInstaller, IPythonSettings } from '../../client/common/types'; import { IInterpreterAutoSelectionService, - IInterpreterAutoSeletionProxyService + IInterpreterAutoSeletionProxyService, } from '../../client/interpreter/autoSelection/types'; import { ServiceContainer } from '../../client/ioc/container'; import { ServiceManager } from '../../client/ioc/serviceManager'; @@ -67,16 +67,16 @@ suite('Linting - Pylint', () => { serviceManager.addSingletonInstance(IWorkspaceService, workspace.object); serviceManager.addSingletonInstance( IPythonToolExecutionService, - execService.object + execService.object, ); serviceManager.addSingletonInstance(IPlatformService, platformService.object); serviceManager.addSingleton( IInterpreterAutoSelectionService, - MockAutoSelectionService + MockAutoSelectionService, ); serviceManager.addSingleton( IInterpreterAutoSeletionProxyService, - MockAutoSelectionService + MockAutoSelectionService, ); pythonSettings = TypeMoq.Mock.ofType(); @@ -224,7 +224,7 @@ suite('Linting - Pylint', () => { await pylinter.lint(document.object, new CancellationTokenSource().token); expect( execInfo!.args.findIndex((x) => x.indexOf('--disable=all') >= 0), - 'Minimal args passed to pylint while pylintrc exists.' + 'Minimal args passed to pylint while pylintrc exists.', ).to.be.eq(expectedMinArgs ? 0 : -1); } test('Negative column numbers should be treated 0', async () => { @@ -244,7 +244,7 @@ suite('Linting - Pylint', () => { 'No config file found, using default configuration', '************* Module test', '1,1,convention,C0111:Missing module docstring', - '3,-1,error,E1305:Too many arguments for format string' + '3,-1,error,E1305:Too many arguments for format string', ].join(os.EOL); execService .setup((x) => x.exec(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())) @@ -260,7 +260,7 @@ suite('Linting - Pylint', () => { error: DiagnosticSeverity.Error, fatal: DiagnosticSeverity.Error, refactor: DiagnosticSeverity.Hint, - warning: DiagnosticSeverity.Warning + warning: DiagnosticSeverity.Warning, }; const settings = TypeMoq.Mock.ofType(); diff --git a/src/test/linters/pylint.unit.test.ts b/src/test/linters/pylint.unit.test.ts index b09bc1feecb3..75e06623acd7 100644 --- a/src/test/linters/pylint.unit.test.ts +++ b/src/test/linters/pylint.unit.test.ts @@ -325,16 +325,16 @@ suite('Pylint - Function runLinter()', () => { ',E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127' + ',E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137' + ',E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303' + - ',E1304,E1305,E1306,E1310,E1700,E1701' + ',E1304,E1305,E1306,E1310,E1700,E1701', ]; const doc = { - uri: vscode.Uri.file('path/to/doc') + uri: vscode.Uri.file('path/to/doc'), }; const args = [ "--msg-template='{line},{column},{category},{symbol}:{msg}'", '--reports=n', '--output-format=text', - doc.uri.fsPath + doc.uri.fsPath, ]; const original_hasConfigurationFileInWorkspace = Pylint.hasConfigurationFileInWorkspace; const original_hasConfigurationFile = Pylint.hasConfigurationFile; @@ -344,7 +344,7 @@ suite('Pylint - Function runLinter()', () => { _args: string[], _document: vscode.TextDocument, _cancellation: vscode.CancellationToken, - _regEx: string + _regEx: string, ): Promise { return []; } @@ -357,7 +357,7 @@ suite('Pylint - Function runLinter()', () => { // tslint:disable-next-line: no-unnecessary-override public async runLinter( document: vscode.TextDocument, - cancellation: vscode.CancellationToken + cancellation: vscode.CancellationToken, ): Promise { return super.runLinter(document, cancellation); } @@ -401,8 +401,8 @@ suite('Pylint - Function runLinter()', () => { test('Use minimal checkers if a) setting to use minimal checkers is true, b) there are no custom arguments and c) there is no pylintrc file next to the file or at the workspace root and above', async () => { const settings = { linting: { - pylintUseMinimalCheckers: true - } + pylintUseMinimalCheckers: true, + }, }; configService.setup((c) => c.getSettings(doc.uri)).returns(() => settings as any); _info.setup((info) => info.linterArgs(doc.uri)).returns(() => []); @@ -422,8 +422,8 @@ suite('Pylint - Function runLinter()', () => { test('Do not use minimal checkers if setting to use minimal checkers is false', async () => { const settings = { linting: { - pylintUseMinimalCheckers: false - } + pylintUseMinimalCheckers: false, + }, }; configService.setup((c) => c.getSettings(doc.uri)).returns(() => settings as any); _info.setup((info) => info.linterArgs(doc.uri)).returns(() => []); @@ -443,8 +443,8 @@ suite('Pylint - Function runLinter()', () => { test('Do not use minimal checkers if there are custom arguments', async () => { const settings = { linting: { - pylintUseMinimalCheckers: true - } + pylintUseMinimalCheckers: true, + }, }; configService.setup((c) => c.getSettings(doc.uri)).returns(() => settings as any); _info.setup((info) => info.linterArgs(doc.uri)).returns(() => ['customArg1', 'customArg2']); @@ -464,8 +464,8 @@ suite('Pylint - Function runLinter()', () => { test('Do not use minimal checkers if there is a pylintrc file in the current working directory or when traversing the workspace up to its root (hasConfigurationFileInWorkspace() returns true)', async () => { const settings = { linting: { - pylintUseMinimalCheckers: true - } + pylintUseMinimalCheckers: true, + }, }; configService.setup((c) => c.getSettings(doc.uri)).returns(() => settings as any); _info.setup((info) => info.linterArgs(doc.uri)).returns(() => []); @@ -485,8 +485,8 @@ suite('Pylint - Function runLinter()', () => { test('Do not use minimal checkers if a pylintrc file exists in the process, in the current working directory or up in the hierarchy tree (hasConfigurationFile() returns true)', async () => { const settings = { linting: { - pylintUseMinimalCheckers: true - } + pylintUseMinimalCheckers: true, + }, }; configService.setup((c) => c.getSettings(doc.uri)).returns(() => settings as any); _info.setup((info) => info.linterArgs(doc.uri)).returns(() => []); @@ -506,19 +506,19 @@ suite('Pylint - Function runLinter()', () => { test('Message returned by runLinter() is as expected', async () => { const message = [ { - type: 'messageType' - } + type: 'messageType', + }, ]; const expectedResult = [ { type: 'messageType', - severity: 'LintMessageSeverity' - } + severity: 'LintMessageSeverity', + }, ]; const settings = { linting: { - pylintUseMinimalCheckers: true - } + pylintUseMinimalCheckers: true, + }, }; configService.setup((c) => c.getSettings(doc.uri)).returns(() => settings as any); _info.setup((info) => info.linterArgs(doc.uri)).returns(() => []); diff --git a/src/test/linters/serviceRegistry.unit.test.ts b/src/test/linters/serviceRegistry.unit.test.ts index 4f63e9fae940..1bedcdeccd85 100644 --- a/src/test/linters/serviceRegistry.unit.test.ts +++ b/src/test/linters/serviceRegistry.unit.test.ts @@ -26,10 +26,10 @@ suite('Linters Service Registry', () => { verify(serviceManager.addSingleton(ILintingEngine, LintingEngine)).once(); verify(serviceManager.addSingleton(ILinterManager, LinterManager)).once(); verify( - serviceManager.add(IAvailableLinterActivator, AvailableLinterActivator) + serviceManager.add(IAvailableLinterActivator, AvailableLinterActivator), ).once(); verify( - serviceManager.addSingleton(IExtensionActivationService, LinterProvider) + serviceManager.addSingleton(IExtensionActivationService, LinterProvider), ).once(); }); }); diff --git a/src/test/mockClasses.ts b/src/test/mockClasses.ts index cca3df5787bc..8d61d9a8ef93 100644 --- a/src/test/mockClasses.ts +++ b/src/test/mockClasses.ts @@ -4,7 +4,7 @@ import { ILintingSettings, IMypyCategorySeverity, IPycodestyleCategorySeverity, - IPylintCategorySeverity + IPylintCategorySeverity, } from '../client/common/types'; export class MockOutputChannel implements vscode.OutputChannel { diff --git a/src/test/mocks/autoSelector.ts b/src/test/mocks/autoSelector.ts index e8a4b0fc76a4..d5c08fb4e2e0 100644 --- a/src/test/mocks/autoSelector.ts +++ b/src/test/mocks/autoSelector.ts @@ -8,7 +8,7 @@ import { Event, EventEmitter } from 'vscode'; import { Resource } from '../../client/common/types'; import { IInterpreterAutoSelectionService, - IInterpreterAutoSeletionProxyService + IInterpreterAutoSeletionProxyService, } from '../../client/interpreter/autoSelection/types'; import { PythonEnvironment } from '../../client/pythonEnvironments/info'; diff --git a/src/test/mocks/proc.ts b/src/test/mocks/proc.ts index 59f069cd4d33..30c9670617ca 100644 --- a/src/test/mocks/proc.ts +++ b/src/test/mocks/proc.ts @@ -9,7 +9,7 @@ import { ObservableExecutionResult, Output, ShellOptions, - SpawnOptions + SpawnOptions, } from '../../client/common/process/types'; import { noop } from '../core'; @@ -23,7 +23,7 @@ export class MockProcessService extends EventEmitter implements IProcessService super(); } public onExecObservable( - handler: (file: string, args: string[], options: SpawnOptions, callback: ExecObservableCallback) => void + handler: (file: string, args: string[], options: SpawnOptions, callback: ExecObservableCallback) => void, ) { this.on('execObservable', handler); } @@ -44,7 +44,7 @@ export class MockProcessService extends EventEmitter implements IProcessService out: Observable.of(output), dispose: () => { noop(); - } + }, }; } else { return { @@ -53,7 +53,7 @@ export class MockProcessService extends EventEmitter implements IProcessService out: value as Observable>, dispose: () => { noop(); - } + }, }; } } else { diff --git a/src/test/mocks/vsc/arrays.ts b/src/test/mocks/vsc/arrays.ts index 9291745a066f..c27c3ed4ec9e 100644 --- a/src/test/mocks/vsc/arrays.ts +++ b/src/test/mocks/vsc/arrays.ts @@ -323,7 +323,7 @@ export namespace vscMockArrays { export function commonPrefixLength( one: T[], other: T[], - equals: (a: T, b: T) => boolean = (a, b) => a === b + equals: (a: T, b: T) => boolean = (a, b) => a === b, ): number { let result = 0; @@ -379,7 +379,7 @@ export namespace vscMockArrays { export function index( array: T[], indexer: (t: T) => string, - merger: (t: T, r: R) => R = (t) => t as any + merger: (t: T, r: R) => R = (t) => t as any, ): Record { return array.reduce((r, t) => { const key = indexer(t); diff --git a/src/test/mocks/vsc/charCode.ts b/src/test/mocks/vsc/charCode.ts index b13bc31658d1..b17d40342266 100644 --- a/src/test/mocks/vsc/charCode.ts +++ b/src/test/mocks/vsc/charCode.ts @@ -422,5 +422,5 @@ export const enum CharCode { * Unicode Character 'ZERO WIDTH NO-BREAK SPACE' (U+FEFF) * http://www.fileformat.info/info/unicode/char/feff/index.htm */ - UTF8_BOM = 65279 + UTF8_BOM = 65279, } diff --git a/src/test/mocks/vsc/extHostedTypes.ts b/src/test/mocks/vsc/extHostedTypes.ts index 9ecb76f73563..cbb116f0ff2c 100644 --- a/src/test/mocks/vsc/extHostedTypes.ts +++ b/src/test/mocks/vsc/extHostedTypes.ts @@ -18,19 +18,19 @@ import { generateUuid } from './uuid'; export namespace vscMockExtHostedTypes { export enum CellKind { Markdown = 1, - Code = 2 + Code = 2, } export enum CellOutputKind { Text = 1, Error = 2, - Rich = 3 + Rich = 3, } export enum NotebookCellRunState { Running = 1, Idle = 2, Success = 3, - Error = 4 + Error = 4, } export interface IRelativePattern { @@ -188,7 +188,7 @@ export namespace vscMockExtHostedTypes { translate(lineDelta?: number, characterDelta?: number): Position; translate( lineDeltaOrChange: number | { lineDelta?: number; characterDelta?: number }, - characterDelta: number = 0 + characterDelta: number = 0, ): Position { if (lineDeltaOrChange === null || characterDelta === null) { throw illegalArgument(); @@ -216,7 +216,7 @@ export namespace vscMockExtHostedTypes { with(line?: number, character?: number): Position; with( lineOrChange: number | { line?: number; character?: number }, - character: number = this.character + character: number = this.character, ): Position { if (lineOrChange === null || character === null) { throw illegalArgument(); @@ -271,7 +271,7 @@ export namespace vscMockExtHostedTypes { startLineOrStart: number | Position, startColumnOrEnd: number | Position, endLine?: number, - endColumn?: number + endColumn?: number, ) { let start: Position; let end: Position; @@ -416,7 +416,7 @@ export namespace vscMockExtHostedTypes { anchorLineOrAnchor: number | Position, anchorColumnOrActive: number | Position, activeLine?: number, - activeColumn?: number + activeColumn?: number, ) { let anchor: Position; let active: Position; @@ -453,14 +453,14 @@ export namespace vscMockExtHostedTypes { start: this.start, end: this.end, active: this.active, - anchor: this.anchor + anchor: this.anchor, }; } } export enum EndOfLine { LF = 1, - CRLF = 2 + CRLF = 2, } export class TextEdit { @@ -541,7 +541,7 @@ export namespace vscMockExtHostedTypes { return { range: this.range, newText: this.newText, - newEol: this._newEol + newEol: this._newEol, }; } } @@ -555,7 +555,7 @@ export namespace vscMockExtHostedTypes { _start: number, _end: number, _cells: vscode.NotebookCellData[], - _metadata?: vscode.WorkspaceEditEntryMetadata + _metadata?: vscode.WorkspaceEditEntryMetadata, ): void { // Noop. } @@ -564,7 +564,7 @@ export namespace vscMockExtHostedTypes { _uri: vscode.Uri, _index: number, _outputs: vscode.CellOutput[], - _metadata?: vscode.WorkspaceEditEntryMetadata + _metadata?: vscode.WorkspaceEditEntryMetadata, ): void { // Noop. } @@ -573,7 +573,7 @@ export namespace vscMockExtHostedTypes { _uri: vscode.Uri, _index: number, _cellMetadata: vscode.NotebookCellMetadata, - _metadata?: vscode.WorkspaceEditEntryMetadata + _metadata?: vscode.WorkspaceEditEntryMetadata, ): void { // Noop. } @@ -608,7 +608,7 @@ export namespace vscMockExtHostedTypes { renameFile( _oldUri: vscode.Uri, _newUri: vscode.Uri, - _options?: { overwrite?: boolean; ignoreIfExists?: boolean } + _options?: { overwrite?: boolean; ignoreIfExists?: boolean }, ): void { throw new Error('Method not implemented.'); } @@ -728,7 +728,7 @@ export namespace vscMockExtHostedTypes { appendPlaceholder( value: string | ((snippet: SnippetString) => any), - number: number = this._tabstop++ + number: number = this._tabstop++, ): SnippetString { if (typeof value === 'function') { const nested = new SnippetString(); @@ -785,14 +785,14 @@ export namespace vscMockExtHostedTypes { } export enum DiagnosticTag { - Unnecessary = 1 + Unnecessary = 1, } export enum DiagnosticSeverity { Hint = 3, Information = 2, Warning = 1, - Error = 0 + Error = 0, } export class Location { @@ -827,7 +827,7 @@ export namespace vscMockExtHostedTypes { toJSON(): any { return { uri: this.uri, - range: this.range + range: this.range, }; } } @@ -878,7 +878,7 @@ export namespace vscMockExtHostedTypes { message: this.message, range: this.range, source: this.source, - code: this.code + code: this.code, }; } } @@ -889,7 +889,7 @@ export namespace vscMockExtHostedTypes { constructor( contents: vscode.MarkdownString | vscode.MarkedString | vscode.MarkdownString[] | vscode.MarkedString[], - range?: Range + range?: Range, ) { if (!contents) { throw new Error('Illegal argument, contents must be defined'); @@ -909,7 +909,7 @@ export namespace vscMockExtHostedTypes { export enum DocumentHighlightKind { Text = 0, Read = 1, - Write = 2 + Write = 2, } export class DocumentHighlight { @@ -924,7 +924,7 @@ export namespace vscMockExtHostedTypes { toJSON(): any { return { range: this.range, - kind: DocumentHighlightKind[this.kind] + kind: DocumentHighlightKind[this.kind], }; } } @@ -955,7 +955,7 @@ export namespace vscMockExtHostedTypes { Struct = 22, Event = 23, Operator = 24, - TypeParameter = 25 + TypeParameter = 25, } export class SymbolInformation { @@ -972,7 +972,7 @@ export namespace vscMockExtHostedTypes { kind: SymbolKind, rangeOrContainer: string | Range, locationOrUri?: Location | vscUri.URI, - containerName?: string + containerName?: string, ) { this.name = name; this.kind = kind; @@ -996,7 +996,7 @@ export namespace vscMockExtHostedTypes { name: this.name, kind: SymbolKind[this.kind], location: this.location, - containerName: this.containerName + containerName: this.containerName, }; } } @@ -1014,7 +1014,7 @@ export namespace vscMockExtHostedTypes { export enum CodeActionTrigger { Automatic = 1, - Manual = 2 + Manual = 2, } export class CodeAction { @@ -1141,7 +1141,7 @@ export namespace vscMockExtHostedTypes { export enum CompletionTriggerKind { Invoke = 0, TriggerCharacter = 1, - TriggerForIncompleteCompletions = 2 + TriggerForIncompleteCompletions = 2, } export interface CompletionContext { @@ -1176,11 +1176,11 @@ export namespace vscMockExtHostedTypes { Operator = 23, TypeParameter = 24, User = 25, - Issue = 26 + Issue = 26, } export enum CompletionItemTag { - Deprecated = 1 + Deprecated = 1, } export interface CompletionItemLabel { @@ -1225,7 +1225,7 @@ export namespace vscMockExtHostedTypes { filterText: this.filterText, preselect: this.preselect, insertText: this.insertText, - textEdit: this.textEdit + textEdit: this.textEdit, }; } } @@ -1256,7 +1256,7 @@ export namespace vscMockExtHostedTypes { detail: string, uri: vscode.Uri, range: vscode.Range, - selectionRange: vscode.Range + selectionRange: vscode.Range, ) { this.kind = kind; this.name = name; @@ -1278,37 +1278,37 @@ export namespace vscMockExtHostedTypes { Six = 6, Seven = 7, Eight = 8, - Nine = 9 + Nine = 9, } export enum StatusBarAlignment { Left = 1, - Right = 2 + Right = 2, } export enum TextEditorLineNumbersStyle { Off = 0, On = 1, - Relative = 2 + Relative = 2, } export enum TextDocumentSaveReason { Manual = 1, AfterDelay = 2, - FocusOut = 3 + FocusOut = 3, } export enum TextEditorRevealType { Default = 0, InCenter = 1, InCenterIfOutsideViewport = 2, - AtTop = 3 + AtTop = 3, } export enum TextEditorSelectionChangeKind { Keyboard = 1, Mouse = 2, - Command = 3 + Command = 3, } /** @@ -1330,7 +1330,7 @@ export namespace vscMockExtHostedTypes { /** * TrackedRangeStickiness.GrowsOnlyWhenTypingAfter */ - ClosedOpen = 3 + ClosedOpen = 3, } export namespace TextEditorSelectionChangeKind { @@ -1413,13 +1413,13 @@ export namespace vscMockExtHostedTypes { export enum ColorFormat { RGB = 0, HEX = 1, - HSL = 2 + HSL = 2, } export enum SourceControlInputBoxValidationType { Error = 0, Warning = 1, - Information = 2 + Information = 2, } export enum TaskRevealKind { @@ -1427,7 +1427,7 @@ export namespace vscMockExtHostedTypes { Silent = 2, - Never = 3 + Never = 3, } export enum TaskPanelKind { @@ -1435,7 +1435,7 @@ export namespace vscMockExtHostedTypes { Dedicated = 2, - New = 3 + New = 3, } export class TaskGroup implements vscode.TaskGroup { @@ -1490,7 +1490,7 @@ export namespace vscMockExtHostedTypes { constructor( process: string, varg1?: string[] | vscode.ProcessExecutionOptions, - varg2?: vscode.ProcessExecutionOptions + varg2?: vscode.ProcessExecutionOptions, ) { if (typeof process !== 'string') { throw illegalArgument('process'); @@ -1571,12 +1571,12 @@ export namespace vscMockExtHostedTypes { constructor( command: string | vscode.ShellQuotedString, args: (string | vscode.ShellQuotedString)[], - options?: vscode.ShellExecutionOptions + options?: vscode.ShellExecutionOptions, ); constructor( arg0: string | vscode.ShellQuotedString, arg1?: vscode.ShellExecutionOptions | (string | vscode.ShellQuotedString)[], - arg2?: vscode.ShellExecutionOptions + arg2?: vscode.ShellExecutionOptions, ) { if (Array.isArray(arg1)) { if (!arg0) { @@ -1659,12 +1659,12 @@ export namespace vscMockExtHostedTypes { export enum ShellQuoting { Escape = 1, Strong = 2, - Weak = 3 + Weak = 3, } export enum TaskScope { Global = 1, - Workspace = 2 + Workspace = 2, } export class Task implements vscode.Task { @@ -1691,7 +1691,7 @@ export namespace vscMockExtHostedTypes { name: string, source: string, execution?: ProcessExecution | ShellExecution, - problemMatchers?: string | string[] + problemMatchers?: string | string[], ); constructor( definition: vscode.TaskDefinition, @@ -1699,7 +1699,7 @@ export namespace vscMockExtHostedTypes { name: string, source: string, execution?: ProcessExecution | ShellExecution, - problemMatchers?: string | string[] + problemMatchers?: string | string[], ); constructor( definition: vscode.TaskDefinition, @@ -1707,7 +1707,7 @@ export namespace vscMockExtHostedTypes { arg3: any, arg4?: any, arg5?: any, - arg6?: any + arg6?: any, ) { this.definition = definition; let problemMatchers: string | string[]; @@ -1765,17 +1765,17 @@ export namespace vscMockExtHostedTypes { if (this._execution instanceof ProcessExecution) { this._definition = { type: Task.ProcessType, - id: this._execution.computeId() + id: this._execution.computeId(), }; } else if (this._execution instanceof ShellExecution) { this._definition = { type: Task.ShellType, - id: this._execution.computeId() + id: this._execution.computeId(), }; } else { this._definition = { type: Task.EmptyType, - id: generateUuid() + id: generateUuid(), }; } } @@ -1914,7 +1914,7 @@ export namespace vscMockExtHostedTypes { export enum ProgressLocation { SourceControl = 1, Window = 10, - Notification = 15 + Notification = 15, } export class TreeItem { @@ -1929,7 +1929,7 @@ export namespace vscMockExtHostedTypes { constructor(resourceUri: vscUri.URI, collapsibleState?: vscode.TreeItemCollapsibleState); constructor( arg1: string | vscUri.URI, - public collapsibleState: vscode.TreeItemCollapsibleState = TreeItemCollapsibleState.None + public collapsibleState: vscode.TreeItemCollapsibleState = TreeItemCollapsibleState.None, ) { if (arg1 instanceof vscUri.URI) { this.resourceUri = arg1; @@ -1942,7 +1942,7 @@ export namespace vscMockExtHostedTypes { export enum TreeItemCollapsibleState { None = 0, Collapsed = 1, - Expanded = 2 + Expanded = 2, } export class ThemeIcon { @@ -1969,7 +1969,7 @@ export namespace vscMockExtHostedTypes { Workspace = 2, - WorkspaceFolder = 3 + WorkspaceFolder = 3, } export class RelativePattern implements IRelativePattern { @@ -2024,7 +2024,7 @@ export namespace vscMockExtHostedTypes { enabled?: boolean, condition?: string, hitCondition?: string, - logMessage?: string + logMessage?: string, ) { super(enabled, condition, hitCondition, logMessage); if (location === null) { @@ -2042,7 +2042,7 @@ export namespace vscMockExtHostedTypes { enabled?: boolean, condition?: string, hitCondition?: string, - logMessage?: string + logMessage?: string, ) { super(enabled, condition, hitCondition, logMessage); if (!functionName) { @@ -2080,7 +2080,7 @@ export namespace vscMockExtHostedTypes { Warning = 4, Error = 5, Critical = 6, - Off = 7 + Off = 7, } //#region file api @@ -2088,7 +2088,7 @@ export namespace vscMockExtHostedTypes { export enum FileChangeType { Changed = 1, Created = 2, - Deleted = 3 + Deleted = 3, } export class FileSystemError extends Error { @@ -2152,7 +2152,7 @@ export namespace vscMockExtHostedTypes { export enum FoldingRangeKind { Comment = 1, Imports = 2, - Region = 3 + Region = 3, } //#endregion @@ -2165,7 +2165,7 @@ export namespace vscMockExtHostedTypes { /** * Determines an item is expanded */ - Expanded = 1 + Expanded = 1, } export class QuickInputButtons { diff --git a/src/test/mocks/vsc/htmlContent.ts b/src/test/mocks/vsc/htmlContent.ts index 61d3c7b7b995..d5a968ef972f 100644 --- a/src/test/mocks/vsc/htmlContent.ts +++ b/src/test/mocks/vsc/htmlContent.ts @@ -68,7 +68,7 @@ export namespace vscMockHtmlContent { export function markedStringsEquals( a: IMarkdownString | IMarkdownString[], - b: IMarkdownString | IMarkdownString[] + b: IMarkdownString | IMarkdownString[], ): boolean { if (!a && !b) { return true; diff --git a/src/test/mocks/vsc/index.ts b/src/test/mocks/vsc/index.ts index c561b9fcb54e..e2f2921959b8 100644 --- a/src/test/mocks/vsc/index.ts +++ b/src/test/mocks/vsc/index.ts @@ -28,7 +28,7 @@ export namespace vscMock { /** * Extension runs where the remote extension host runs. */ - Workspace = 2 + Workspace = 2, } export class Disposable { @@ -61,7 +61,7 @@ export namespace vscMock { return ({ dispose: () => { this.emitter.removeListener('evt', bound); - } + }, } as any) as Disposable; }; } @@ -133,7 +133,7 @@ export namespace vscMock { Operator = 23, TypeParameter = 24, User = 25, - Issue = 26 + Issue = 26, } export enum SymbolKind { File = 0, @@ -161,19 +161,19 @@ export namespace vscMock { Struct = 22, Event = 23, Operator = 24, - TypeParameter = 25 + TypeParameter = 25, } export enum IndentAction { None = 0, Indent = 1, IndentOutdent = 2, - Outdent = 3 + Outdent = 3, } export enum CompletionTriggerKind { Invoke = 0, TriggerCharacter = 1, - TriggerForIncompleteCompletions = 2 + TriggerForIncompleteCompletions = 2, } export class MarkdownString { @@ -226,7 +226,7 @@ export namespace vscMock { constructor( contents: vscode.MarkdownString | vscode.MarkedString | vscode.MarkdownString[] | vscode.MarkedString[], - range?: vscode.Range + range?: vscode.Range, ) { if (!contents) { throw new Error('Illegal argument, contents must be defined'); @@ -288,7 +288,7 @@ export namespace vscMock { constructor( public readonly command: string, public readonly args: string[] = [], - public readonly options?: DebugAdapterExecutableOptions + public readonly options?: DebugAdapterExecutableOptions, ) {} } @@ -296,6 +296,6 @@ export namespace vscMock { Unknown = 0, File = 1, Directory = 2, - SymbolicLink = 64 + SymbolicLink = 64, } } diff --git a/src/test/mocks/vsc/selection.ts b/src/test/mocks/vsc/selection.ts index 9e82b905f7cc..623a7fdecb7f 100644 --- a/src/test/mocks/vsc/selection.ts +++ b/src/test/mocks/vsc/selection.ts @@ -41,7 +41,7 @@ export namespace vscMockSelection { /** * The selection starts below where it ends. */ - RTL + RTL, } /** @@ -70,7 +70,7 @@ export namespace vscMockSelection { selectionStartLineNumber: number, selectionStartColumn: number, positionLineNumber: number, - positionColumn: number + positionColumn: number, ) { super(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn); this.selectionStartLineNumber = selectionStartLineNumber; @@ -87,7 +87,7 @@ export namespace vscMockSelection { this.selectionStartLineNumber, this.selectionStartColumn, this.positionLineNumber, - this.positionColumn + this.positionColumn, ); } @@ -174,7 +174,7 @@ export namespace vscMockSelection { */ public static fromPositions( start: vscMockPosition.IPosition, - end: vscMockPosition.IPosition = start + end: vscMockPosition.IPosition = start, ): Selection { return new Selection(start.lineNumber, start.column, end.lineNumber, end.column); } @@ -187,7 +187,7 @@ export namespace vscMockSelection { sel.selectionStartLineNumber, sel.selectionStartColumn, sel.positionLineNumber, - sel.positionColumn + sel.positionColumn, ); } @@ -233,7 +233,7 @@ export namespace vscMockSelection { startColumn: number, endLineNumber: number, endColumn: number, - direction: SelectionDirection + direction: SelectionDirection, ): Selection { if (direction === SelectionDirection.LTR) { return new Selection(startLineNumber, startColumn, endLineNumber, endColumn); diff --git a/src/test/mocks/vsc/uri.ts b/src/test/mocks/vsc/uri.ts index aa5f38a25555..3a542d4544ad 100644 --- a/src/test/mocks/vsc/uri.ts +++ b/src/test/mocks/vsc/uri.ts @@ -56,13 +56,13 @@ export namespace vscUri { if (ret.authority) { if (!_singleSlashStart.test(ret.path)) { throw new Error( - '[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character' + '[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character', ); } } else { if (_doubleSlashStart.test(ret.path)) { throw new Error( - '[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")' + '[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")', ); } } @@ -180,7 +180,7 @@ export namespace vscUri { path?: string, query?: string, fragment?: string, - _strict?: boolean + _strict?: boolean, ); /** @@ -197,7 +197,7 @@ export namespace vscUri { path?: string, query?: string, fragment?: string, - _strict: boolean = false + _strict: boolean = false, ) { if (typeof schemeOrData === 'object') { this.scheme = schemeOrData.scheme || _empty; @@ -325,7 +325,7 @@ export namespace vscUri { decodeURIComponent(match[5] || _empty), decodeURIComponent(match[7] || _empty), decodeURIComponent(match[9] || _empty), - _strict + _strict, ); } @@ -388,7 +388,7 @@ export namespace vscUri { components.authority, components.path, components.query, - components.fragment + components.fragment, ); } @@ -471,7 +471,7 @@ export namespace vscUri { path?: string, query?: string, fragment?: string, - _strict: boolean = false + _strict: boolean = false, ) { super(schemeOrData as any, authority, path, query, fragment, _strict); this._fsPath = this.fsPath; @@ -497,7 +497,7 @@ export namespace vscUri { toJSON(): UriComponents { const res = { - $mid: 1 + $mid: 1, }; // cached state if (this._fsPath) { @@ -551,7 +551,7 @@ export namespace vscUri { [CharCode.Semicolon]: '%3B', [CharCode.Equals]: '%3D', - [CharCode.Space]: '%20' + [CharCode.Space]: '%20', }; function encodeURIComponentFast(uriComponent: string, allowSlash: boolean): string { diff --git a/src/test/mocks/vsc/uuid.ts b/src/test/mocks/vsc/uuid.ts index 2ddb98481445..e76ff9e5cd57 100644 --- a/src/test/mocks/vsc/uuid.ts +++ b/src/test/mocks/vsc/uuid.ts @@ -76,8 +76,8 @@ class V4UUID extends ValueUUID { V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), - V4UUID._randomHex() - ].join('') + V4UUID._randomHex(), + ].join(''), ); } } diff --git a/src/test/multiRootTest.ts b/src/test/multiRootTest.ts index 04631bd1b2ca..f873bde69d32 100644 --- a/src/test/multiRootTest.ts +++ b/src/test/multiRootTest.ts @@ -21,7 +21,7 @@ function start() { extensionTestsPath: path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'out', 'test', 'index'), launchArgs: [workspacePath], version: channel, - extensionTestsEnv: { ...process.env, UITEST_DISABLE_INSIDERS: '1' } + extensionTestsEnv: { ...process.env, UITEST_DISABLE_INSIDERS: '1' }, }).catch((ex) => { console.error('End Multiroot tests (with errors)', ex); process.exit(1); diff --git a/src/test/performance/load.perf.test.ts b/src/test/performance/load.perf.test.ts index 05e3ff90627a..7d48b7411380 100644 --- a/src/test/performance/load.perf.test.ts +++ b/src/test/performance/load.perf.test.ts @@ -62,10 +62,10 @@ suite('Activation Times', () => { } const devActivationTimes = getActivationTimes(JSON.parse(process.env.ACTIVATION_TIMES_DEV_LOG_FILE_PATHS!)); const releaseActivationTimes = getActivationTimes( - JSON.parse(process.env.ACTIVATION_TIMES_RELEASE_LOG_FILE_PATHS!) + JSON.parse(process.env.ACTIVATION_TIMES_RELEASE_LOG_FILE_PATHS!), ); const languageServerActivationTimes = getActivationTimes( - JSON.parse(process.env.ACTIVATION_TIMES_DEV_LANGUAGE_SERVER_LOG_FILE_PATHS!) + JSON.parse(process.env.ACTIVATION_TIMES_DEV_LANGUAGE_SERVER_LOG_FILE_PATHS!), ); const devActivationAvgTime = devActivationTimes.reduce((sum, item) => sum + item, 0) / devActivationTimes.length; @@ -81,7 +81,7 @@ suite('Activation Times', () => { expect(devActivationAvgTime - releaseActivationAvgTime).to.be.lessThan( AllowedIncreaseInActivationDelayInMS, - 'Activation times have increased above allowed threshold.' + 'Activation times have increased above allowed threshold.', ); }); } diff --git a/src/test/performanceTest.ts b/src/test/performanceTest.ts index df2208e19481..c327737ea668 100644 --- a/src/test/performanceTest.ts +++ b/src/test/performanceTest.ts @@ -38,7 +38,7 @@ const logFilesPath = path.join(tmpFolder, 'test', 'logs'); enum Version { Dev, - Release + Release, } class TestRunner { @@ -89,7 +89,7 @@ class TestRunner { const env: Record = { ACTIVATION_TIMES_LOG_FILE_PATH: logFile, ACTIVATION_TIMES_EXT_VERSION: version === Version.Release ? releaseVersion : devVersion, - CODE_EXTENSIONS_PATH: version === Version.Release ? publishedExtensionPath : EXTENSION_ROOT_DIR + CODE_EXTENSIONS_PATH: version === Version.Release ? publishedExtensionPath : EXTENSION_ROOT_DIR, }; await this.launchTest(env); @@ -98,7 +98,7 @@ class TestRunner { const env: Record = { ACTIVATION_TIMES_DEV_LOG_FILE_PATHS: JSON.stringify(devLogFiles), ACTIVATION_TIMES_RELEASE_LOG_FILE_PATHS: JSON.stringify(releaseLogFiles), - ACTIVATION_TIMES_DEV_LANGUAGE_SERVER_LOG_FILE_PATHS: JSON.stringify(languageServerLogFiles) + ACTIVATION_TIMES_DEV_LANGUAGE_SERVER_LOG_FILE_PATHS: JSON.stringify(languageServerLogFiles), }; await this.launchTest(env); @@ -110,7 +110,7 @@ class TestRunner { TEST_FILES_SUFFIX: 'perf.test', CODE_TESTS_WORKSPACE: path.join(EXTENSION_ROOT_DIR, 'src', 'test', 'performance'), ...process.env, - ...customEnvVars + ...customEnvVars, }; const proc = spawn('node', [path.join(__dirname, 'standardTest.js')], { cwd: EXTENSION_ROOT_DIR, env }); diff --git a/src/test/proc.ts b/src/test/proc.ts index d674d29b8cc0..a25ae1aebfc0 100644 --- a/src/test/proc.ts +++ b/src/test/proc.ts @@ -69,7 +69,7 @@ export class Proc { } this.result = { exitCode: this.raw.exitCode, - stdout: this.output.stdout + stdout: this.output.stdout, }; return this.result; } diff --git a/src/test/providers/codeActionProvider/main.unit.test.ts b/src/test/providers/codeActionProvider/main.unit.test.ts index a29b78fcd4fb..44599b4cf93e 100644 --- a/src/test/providers/codeActionProvider/main.unit.test.ts +++ b/src/test/providers/codeActionProvider/main.unit.test.ts @@ -25,16 +25,16 @@ suite('Code Action Provider service', async () => { registerCodeActionsProvider: ( _selector: DocumentSelector, _provider: CodeActionProvider, - _metadata: CodeActionProviderMetadata + _metadata: CodeActionProviderMetadata, ) => { selector = _selector; provider = _provider; metadata = _metadata; - } + }, }, CodeActionKind: { - QuickFix: 'CodeAction' - } + QuickFix: 'CodeAction', + }, }; rewiremock.enable(); rewiremock('vscode').with(vscodeMock); @@ -46,11 +46,11 @@ suite('Code Action Provider service', async () => { assert.deepEqual(selector!, { scheme: 'file', language: 'jsonc', - pattern: '**/launch.json' + pattern: '**/launch.json', }); assert.deepEqual(metadata!, { // tslint:disable-next-line:no-any - providedCodeActionKinds: ['CodeAction' as any] + providedCodeActionKinds: ['CodeAction' as any], }); expect(provider!).instanceOf(LaunchJsonCodeActionProvider); }); diff --git a/src/test/providers/codeActionProvider/pythonCodeActionsProvider.unit.test.ts b/src/test/providers/codeActionProvider/pythonCodeActionsProvider.unit.test.ts index e6fad21c7750..1fdf37d209fe 100644 --- a/src/test/providers/codeActionProvider/pythonCodeActionsProvider.unit.test.ts +++ b/src/test/providers/codeActionProvider/pythonCodeActionsProvider.unit.test.ts @@ -29,13 +29,13 @@ suite('Python CodeAction Provider', () => { document.object, range.object, context.object, - token.object + token.object, ); assert.isArray(codeActions, 'codeActionsProvider.provideCodeActions did not return an array'); const organizeImportsCodeAction = (codeActions || []).filter( - (codeAction) => codeAction.kind === CodeActionKind.SourceOrganizeImports + (codeAction) => codeAction.kind === CodeActionKind.SourceOrganizeImports, ); expect(organizeImportsCodeAction).to.have.length(1); expect(organizeImportsCodeAction[0].kind).to.eq(CodeActionKind.SourceOrganizeImports); @@ -46,13 +46,13 @@ suite('Python CodeAction Provider', () => { document.object, range.object, context.object, - token.object + token.object, ); assert.isArray(codeActions, 'codeActionsProvider.provideCodeActions did not return an array'); const organizeImportsCodeAction = (codeActions || []).filter( - (codeAction) => codeAction.kind === CodeActionKind.SourceOrganizeImports + (codeAction) => codeAction.kind === CodeActionKind.SourceOrganizeImports, ); expect(organizeImportsCodeAction).to.have.length(0); }); diff --git a/src/test/providers/foldingProvider.test.ts b/src/test/providers/foldingProvider.test.ts index b4fec804ea39..bc59ce43e85b 100644 --- a/src/test/providers/foldingProvider.test.ts +++ b/src/test/providers/foldingProvider.test.ts @@ -20,8 +20,8 @@ suite('Provider - Folding Provider', () => { new FoldingRange(98, 146), new FoldingRange(152, 153, FoldingRangeKind.Comment), new FoldingRange(312, 320), - new FoldingRange(327, 329) - ] + new FoldingRange(327, 329), + ], }, { file: path.join(pythonFilesPath, 'visualstudio_ipython_repl.py'), @@ -34,8 +34,8 @@ suite('Provider - Folding Provider', () => { new FoldingRange(139, 140, FoldingRangeKind.Comment), new FoldingRange(169, 170, FoldingRangeKind.Comment), new FoldingRange(275, 277, FoldingRangeKind.Comment), - new FoldingRange(319, 320, FoldingRangeKind.Comment) - ] + new FoldingRange(319, 320, FoldingRangeKind.Comment), + ], }, { file: path.join(pythonFilesPath, 'visualstudio_py_debugger.py'), @@ -60,13 +60,13 @@ suite('Provider - Folding Provider', () => { new FoldingRange(602, 604, FoldingRangeKind.Comment), new FoldingRange(608, 609, FoldingRangeKind.Comment), new FoldingRange(612, 614, FoldingRangeKind.Comment), - new FoldingRange(637, 638, FoldingRangeKind.Comment) - ] + new FoldingRange(637, 638, FoldingRangeKind.Comment), + ], }, { file: path.join(pythonFilesPath, 'visualstudio_py_repl.py'), - ranges: [] - } + ranges: [], + }, ]; docStringFileAndExpectedFoldingRanges.forEach((item) => { @@ -77,7 +77,7 @@ suite('Provider - Folding Provider', () => { expect(ranges).to.be.lengthOf(item.ranges.length); ranges!.forEach((range) => { const index = item.ranges.findIndex( - (searchItem) => searchItem.start === range.start && searchItem.end === range.end + (searchItem) => searchItem.start === range.start && searchItem.end === range.end, ); expect(index).to.be.greaterThan(-1, `${range.start}, ${range.end} not found`); }); diff --git a/src/test/providers/importSortProvider.unit.test.ts b/src/test/providers/importSortProvider.unit.test.ts index 07ed714f082d..6455a45c8019 100644 --- a/src/test/providers/importSortProvider.unit.test.ts +++ b/src/test/providers/importSortProvider.unit.test.ts @@ -22,7 +22,7 @@ import { IProcessServiceFactory, IPythonExecutionFactory, IPythonExecutionService, - Output + Output, } from '../../client/common/process/types'; import { IConfigurationService, @@ -32,7 +32,7 @@ import { IPersistentState, IPersistentStateFactory, IPythonSettings, - ISortImportSettings + ISortImportSettings, } from '../../client/common/types'; import { createDeferred, createDeferredFromPromise } from '../../client/common/utils/async'; import { Common, Diagnostics } from '../../client/common/utils/localize'; @@ -92,8 +92,8 @@ suite('Import Sort Provider', () => { c.registerCommand( TypeMoq.It.isValue(Commands.Sort_Imports), TypeMoq.It.isAny(), - TypeMoq.It.isValue(sortProvider) - ) + TypeMoq.It.isValue(sortProvider), + ), ) .verifiable(TypeMoq.Times.once()); @@ -348,7 +348,7 @@ suite('Import Sort Provider', () => { const executionResult = { proc: childProcess.object, out: new Observable>((subscriber) => (actualSubscriber = subscriber)), - dispose: noop + dispose: noop, }; const expectedArgs = ['-', '--diff', '1', '2']; processService @@ -356,8 +356,8 @@ suite('Import Sort Provider', () => { p.execObservable( TypeMoq.It.isValue('CUSTOM_ISORT'), TypeMoq.It.isValue(expectedArgs), - TypeMoq.It.isValue({ token: undefined, cwd: path.sep }) - ) + TypeMoq.It.isValue({ token: undefined, cwd: path.sep }), + ), ) .returns(() => executionResult) .verifiable(TypeMoq.Times.once()); @@ -367,8 +367,8 @@ suite('Import Sort Provider', () => { e.getWorkspaceEditsFromPatch( TypeMoq.It.isValue('Hello'), TypeMoq.It.isValue('DIFF'), - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => expectedEdit) .verifiable(TypeMoq.Times.once()); @@ -435,7 +435,7 @@ suite('Import Sort Provider', () => { const executionResult = { proc: childProcess.object, out: new Observable>((subscriber) => (actualSubscriber = subscriber)), - dispose: noop + dispose: noop, }; const importScript = path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'sortImports.py'); const expectedArgs = [ISOLATED, importScript, '-', '--diff', '1', '2']; @@ -443,8 +443,8 @@ suite('Import Sort Provider', () => { .setup((p) => p.execObservable( TypeMoq.It.isValue(expectedArgs), - TypeMoq.It.isValue({ token: undefined, cwd: path.sep }) - ) + TypeMoq.It.isValue({ token: undefined, cwd: path.sep }), + ), ) .returns(() => executionResult) .verifiable(TypeMoq.Times.once()); @@ -454,8 +454,8 @@ suite('Import Sort Provider', () => { e.getWorkspaceEditsFromPatch( TypeMoq.It.isValue('Hello'), TypeMoq.It.isValue('DIFF'), - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => expectedEdit) .verifiable(TypeMoq.Times.once()); @@ -496,8 +496,8 @@ suite('Import Sort Provider', () => { e.getWorkspaceEditsFromPatch( TypeMoq.It.isValue('Hello'), TypeMoq.It.isValue('DIFF'), - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => result); @@ -520,7 +520,7 @@ suite('Import Sort Provider', () => { const firstExecutionResult = { proc: firstChildProcess.object, out: new Observable>((subscriber) => (firstSubscriber = subscriber)), - dispose: noop + dispose: noop, }; processService .setup((p) => p.execObservable(TypeMoq.It.isValue('CUSTOM_ISORT'), TypeMoq.It.isAny(), TypeMoq.It.isAny())) @@ -548,7 +548,7 @@ suite('Import Sort Provider', () => { const secondExecutionResult = { proc: secondChildProcess.object, out: new Observable>((subscriber) => (secondSubscriber = subscriber)), - dispose: noop + dispose: noop, }; processService.reset(); processService.setup((d: any) => d.then).returns(() => undefined); @@ -575,7 +575,7 @@ suite('Import Sort Provider', () => { test('If isort raises a warning message related to isort5 upgrade guide, show message', async () => { const _showWarningAndOptionallyShowOutput = sinon.stub( SortImportsEditingProvider.prototype, - '_showWarningAndOptionallyShowOutput' + '_showWarningAndOptionallyShowOutput', ); _showWarningAndOptionallyShowOutput.resolves(); const uri = Uri.file('something.py'); @@ -604,8 +604,8 @@ suite('Import Sort Provider', () => { e.getWorkspaceEditsFromPatch( TypeMoq.It.isValue('Hello'), TypeMoq.It.isValue('DIFF'), - TypeMoq.It.isAny() - ) + TypeMoq.It.isAny(), + ), ) .returns(() => result); @@ -626,7 +626,7 @@ suite('Import Sort Provider', () => { const executionResult = { proc: childProcess.object, out: new Observable>((s) => (subscriber = s)), - dispose: noop + dispose: noop, }; processService.reset(); processService.setup((d: any) => d.then).returns(() => undefined); @@ -653,8 +653,8 @@ suite('Import Sort Provider', () => { s.showWarningMessage( Diagnostics.checkIsort5UpgradeGuide(), Common.openOutputPanel(), - Common.doNotShowAgain() - ) + Common.doNotShowAgain(), + ), ) .returns(() => Promise.resolve(Common.openOutputPanel())); output.setup((o) => o.show(true)).verifiable(TypeMoq.Times.once()); @@ -680,8 +680,8 @@ suite('Import Sort Provider', () => { s.showWarningMessage( Diagnostics.checkIsort5UpgradeGuide(), Common.openOutputPanel(), - Common.doNotShowAgain() - ) + Common.doNotShowAgain(), + ), ) .returns(() => Promise.resolve(Common.doNotShowAgain())) .verifiable(TypeMoq.Times.once()); diff --git a/src/test/providers/repl.unit.test.ts b/src/test/providers/repl.unit.test.ts index 31a213f3ac33..5b7f81315bae 100644 --- a/src/test/providers/repl.unit.test.ts +++ b/src/test/providers/repl.unit.test.ts @@ -8,7 +8,7 @@ import { IActiveResourceService, ICommandManager, IDocumentManager, - IWorkspaceService + IWorkspaceService, } from '../../client/common/application/types'; import { Commands } from '../../client/common/constants'; import { IServiceContainer } from '../../client/ioc/types'; @@ -50,7 +50,7 @@ suite('REPL Provider', () => { replProvider = new ReplProvider(serviceContainer.object); commandManager.verify( (c) => c.registerCommand(TypeMoq.It.isValue(Commands.Start_REPL), TypeMoq.It.isAny(), TypeMoq.It.isAny()), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); }); @@ -58,7 +58,7 @@ suite('REPL Provider', () => { const disposable = TypeMoq.Mock.ofType(); commandManager .setup((c) => - c.registerCommand(TypeMoq.It.isValue(Commands.Start_REPL), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + c.registerCommand(TypeMoq.It.isValue(Commands.Start_REPL), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns(() => disposable.object); @@ -74,7 +74,7 @@ suite('REPL Provider', () => { let commandHandler: undefined | (() => void); commandManager .setup((c) => - c.registerCommand(TypeMoq.It.isValue(Commands.Start_REPL), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + c.registerCommand(TypeMoq.It.isValue(Commands.Start_REPL), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns((_cmd, callback) => { commandHandler = callback; @@ -91,7 +91,7 @@ suite('REPL Provider', () => { serviceContainer.verify( (c) => c.get(TypeMoq.It.isValue(ICodeExecutionService), TypeMoq.It.isValue('repl')), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); codeExecutionService.verify((c) => c.initializeRepl(TypeMoq.It.isValue(resource)), TypeMoq.Times.once()); }); diff --git a/src/test/providers/serviceRegistry.unit.test.ts b/src/test/providers/serviceRegistry.unit.test.ts index 7c55645bd473..2edc42c05860 100644 --- a/src/test/providers/serviceRegistry.unit.test.ts +++ b/src/test/providers/serviceRegistry.unit.test.ts @@ -24,14 +24,14 @@ suite('Common Providers Service Registry', () => { verify( serviceManager.addSingleton( ISortImportsEditingProvider, - SortImportsEditingProvider - ) + SortImportsEditingProvider, + ), ).once(); verify( serviceManager.addSingleton( IExtensionSingleActivationService, - CodeActionProviderService - ) + CodeActionProviderService, + ), ).once(); }); }); diff --git a/src/test/providers/shebangCodeLenseProvider.unit.test.ts b/src/test/providers/shebangCodeLenseProvider.unit.test.ts index c878cb34a9fa..5904dee81671 100644 --- a/src/test/providers/shebangCodeLenseProvider.unit.test.ts +++ b/src/test/providers/shebangCodeLenseProvider.unit.test.ts @@ -41,12 +41,12 @@ suite('Shebang detection', () => { instance(factory), instance(configurationService), platformService.object, - instance(workspaceService) + instance(workspaceService), ); }); function createDocument( firstLine: string, - uri = Uri.parse('xyz.py') + uri = Uri.parse('xyz.py'), ): [typemoq.IMock, typemoq.IMock] { const doc = typemoq.Mock.ofType(); const line = typemoq.Mock.ofType(); diff --git a/src/test/providers/terminal.unit.test.ts b/src/test/providers/terminal.unit.test.ts index aa1fc837cfd1..5db01c0d3666 100644 --- a/src/test/providers/terminal.unit.test.ts +++ b/src/test/providers/terminal.unit.test.ts @@ -42,7 +42,7 @@ suite('Terminal Provider', () => { commandManager.verify( (c) => c.registerCommand(TypeMoq.It.isValue(Commands.Create_Terminal), TypeMoq.It.isAny(), TypeMoq.It.isAny()), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); }); @@ -50,7 +50,7 @@ suite('Terminal Provider', () => { const disposable = TypeMoq.Mock.ofType(); commandManager .setup((c) => - c.registerCommand(TypeMoq.It.isValue(Commands.Create_Terminal), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + c.registerCommand(TypeMoq.It.isValue(Commands.Create_Terminal), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns(() => disposable.object); @@ -65,7 +65,7 @@ suite('Terminal Provider', () => { let commandHandler: undefined | (() => void); commandManager .setup((c) => - c.registerCommand(TypeMoq.It.isValue(Commands.Create_Terminal), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + c.registerCommand(TypeMoq.It.isValue(Commands.Create_Terminal), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns((_cmd, callback) => { commandHandler = callback; @@ -145,7 +145,7 @@ suite('Terminal Provider', () => { terminalActivator.verify( (a) => a.activateEnvironmentInTerminal(terminal.object, TypeMoq.It.isAny()), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); configService.verifyAll(); activeResourceService.verifyAll(); @@ -167,7 +167,7 @@ suite('Terminal Provider', () => { terminalActivator.verify( (a) => a.activateEnvironmentInTerminal(TypeMoq.It.isAny(), TypeMoq.It.isAny()), - TypeMoq.Times.never() + TypeMoq.Times.never(), ); activeResourceService.verifyAll(); configService.verifyAll(); @@ -195,7 +195,7 @@ suite('Terminal Provider', () => { terminalActivator.verify( (a) => a.activateEnvironmentInTerminal(TypeMoq.It.isAny(), TypeMoq.It.isAny()), - TypeMoq.Times.never() + TypeMoq.Times.never(), ); activeResourceService.verifyAll(); configService.verifyAll(); @@ -217,7 +217,7 @@ suite('Terminal Provider', () => { terminalActivator.verify( (a) => a.activateEnvironmentInTerminal(TypeMoq.It.isAny(), TypeMoq.It.isAny()), - TypeMoq.Times.never() + TypeMoq.Times.never(), ); activeResourceService.verifyAll(); configService.verifyAll(); diff --git a/src/test/pythonEnvironments/base/common.ts b/src/test/pythonEnvironments/base/common.ts index 0016c1d65e72..af4bf7f4774b 100644 --- a/src/test/pythonEnvironments/base/common.ts +++ b/src/test/pythonEnvironments/base/common.ts @@ -6,9 +6,7 @@ import { expect } from 'chai'; import * as path from 'path'; import { Event } from 'vscode'; -import { - createDeferred, flattenIterator, iterable, mapToIterator, -} from '../../../client/common/utils/async'; +import { createDeferred, flattenIterator, iterable, mapToIterator } from '../../../client/common/utils/async'; import { Architecture } from '../../../client/common/utils/platform'; import { getVersionString } from '../../../client/common/utils/version'; import { @@ -38,13 +36,17 @@ export function createLocatedEnv( let executable: string | undefined; if (typeof exec === 'string') { const normalizedExecutable = path.normalize(exec); - executable = location === '' || path.isAbsolute(normalizedExecutable) - ? normalizedExecutable - : path.join(location, 'bin', normalizedExecutable); + executable = + location === '' || path.isAbsolute(normalizedExecutable) + ? normalizedExecutable + : path.join(location, 'bin', normalizedExecutable); } const version = parseVersion(versionStr); const env = buildEnvInfo({ - kind, executable, location, version, + kind, + executable, + location, + version, }); env.arch = Architecture.x86; env.distro = distro; @@ -127,7 +129,7 @@ export class SimpleLocator extends Locator { await callbacks.after; } deferred.resolve(); - }()); + })(); iterator.onUpdated = this.callbacks?.onUpdated; return iterator; } @@ -136,7 +138,8 @@ export class SimpleLocator extends Locator { const envInfo: PythonEnvInfo = typeof env === 'string' ? createLocatedEnv('', '', undefined, env) : env; if (this.callbacks.resolve === undefined) { return envInfo; - } if (this.callbacks?.resolve === null) { + } + if (this.callbacks?.resolve === null) { return undefined; } return this.callbacks.resolve(envInfo); @@ -148,13 +151,11 @@ export async function getEnvs(iterator: IPythonEnvsIterator): Promise { - const env1str = `${env1.kind}-${env1.executable.filename}-${getVersionString(env1.version)}`; - const env2str = `${env2.kind}-${env2.executable.filename}-${getVersionString(env2.version)}`; - return env1str.localeCompare(env2str); - }, - ); + return envs.sort((env1, env2) => { + const env1str = `${env1.kind}-${env1.executable.filename}-${getVersionString(env1.version)}`; + const env2str = `${env2.kind}-${env2.executable.filename}-${getVersionString(env2.version)}`; + return env1str.localeCompare(env2str); + }); } export function assertSameEnvs(envs: PythonEnvInfo[], expected: PythonEnvInfo[]): void { diff --git a/src/test/pythonEnvironments/base/envsCache.unit.test.ts b/src/test/pythonEnvironments/base/envsCache.unit.test.ts index a6be122ec37c..f541ff21e344 100644 --- a/src/test/pythonEnvironments/base/envsCache.unit.test.ts +++ b/src/test/pythonEnvironments/base/envsCache.unit.test.ts @@ -9,13 +9,16 @@ const allEnvsComplete = () => true; const envInfoArray = [ { - kind: PythonEnvKind.Conda, executable: { filename: 'my-conda-env' }, + kind: PythonEnvKind.Conda, + executable: { filename: 'my-conda-env' }, }, { - kind: PythonEnvKind.Venv, executable: { filename: 'my-venv-env' }, + kind: PythonEnvKind.Venv, + executable: { filename: 'my-venv-env' }, }, { - kind: PythonEnvKind.Pyenv, executable: { filename: 'my-pyenv-env' }, + kind: PythonEnvKind.Pyenv, + executable: { filename: 'my-pyenv-env' }, }, ] as PythonEnvInfo[]; @@ -88,21 +91,25 @@ suite('Environment Info cache', () => { }); test('`filterEnvs` should return environments that match its argument using areSameEnvironmnet', async () => { - const env:PythonEnvInfo = { executable: { filename: 'my-venv-env' } } as unknown as PythonEnvInfo; + const env: PythonEnvInfo = ({ executable: { filename: 'my-venv-env' } } as unknown) as PythonEnvInfo; const envsCache = await getPersistentCache(getGlobalPersistentStore(), allEnvsComplete); const result = envsCache.filterEnvs(env); - assert.deepStrictEqual(result, [{ - kind: PythonEnvKind.Venv, executable: { filename: 'my-venv-env' }, - }]); + assert.deepStrictEqual(result, [ + { + kind: PythonEnvKind.Venv, + executable: { filename: 'my-venv-env' }, + }, + ]); }); test('`filterEnvs` should return a deep copy of the matched environments', () => { - const envToFind = { - kind: PythonEnvKind.System, executable: { filename: 'my-system-env' }, - } as unknown as PythonEnvInfo; - const env:PythonEnvInfo = { executable: { filename: 'my-system-env' } } as unknown as PythonEnvInfo; + const envToFind = ({ + kind: PythonEnvKind.System, + executable: { filename: 'my-system-env' }, + } as unknown) as PythonEnvInfo; + const env: PythonEnvInfo = ({ executable: { filename: 'my-system-env' } } as unknown) as PythonEnvInfo; const envsCache = new PythonEnvInfoCache(getGlobalPersistentStore(), allEnvsComplete); envsCache.setAllEnvs([...envInfoArray, envToFind]); @@ -114,7 +121,7 @@ suite('Environment Info cache', () => { }); test('`filterEnvs` should return an empty array if no environment matches the properties of its argument', async () => { - const env:PythonEnvInfo = { executable: { filename: 'my-nonexistent-env' } } as unknown as PythonEnvInfo; + const env: PythonEnvInfo = ({ executable: { filename: 'my-nonexistent-env' } } as unknown) as PythonEnvInfo; const envsCache = await getPersistentCache(getGlobalPersistentStore(), allEnvsComplete); const result = envsCache.filterEnvs(env); @@ -122,8 +129,8 @@ suite('Environment Info cache', () => { assert.deepStrictEqual(result, []); }); - test('`filterEnvs` should return undefined if the cache hasn\'t been activated', () => { - const env:PythonEnvInfo = { executable: { filename: 'my-nonexistent-env' } } as unknown as PythonEnvInfo; + test("`filterEnvs` should return undefined if the cache hasn't been activated", () => { + const env: PythonEnvInfo = ({ executable: { filename: 'my-nonexistent-env' } } as unknown) as PythonEnvInfo; const envsCache = new PythonEnvInfoCache(getGlobalPersistentStore(), allEnvsComplete); const result = envsCache.filterEnvs(env); @@ -138,11 +145,10 @@ suite('Environment Info cache', () => { defaultDisplayName: 'other-env', }; const updatedEnvInfoArray = [ - otherEnv, { kind: PythonEnvKind.System, executable: { filename: 'my-system-env' } }, - ] as PythonEnvInfo[]; - const expected = [ otherEnv, - ]; + { kind: PythonEnvKind.System, executable: { filename: 'my-system-env' } }, + ] as PythonEnvInfo[]; + const expected = [otherEnv]; const envsCache = await getPersistentCache( getGlobalPersistentStore(), (env) => env.defaultDisplayName !== undefined, diff --git a/src/test/pythonEnvironments/base/info/pythonVersion.unit.test.ts b/src/test/pythonEnvironments/base/info/pythonVersion.unit.test.ts index c65e821ba141..c38ac2c47a22 100644 --- a/src/test/pythonEnvironments/base/info/pythonVersion.unit.test.ts +++ b/src/test/pythonEnvironments/base/info/pythonVersion.unit.test.ts @@ -4,10 +4,7 @@ import * as assert from 'assert'; import { PythonReleaseLevel, PythonVersion } from '../../../../client/pythonEnvironments/base/info'; -import { - getEmptyVersion, - parseVersion, -} from '../../../../client/pythonEnvironments/base/info/pythonVersion'; +import { getEmptyVersion, parseVersion } from '../../../../client/pythonEnvironments/base/info/pythonVersion'; export function ver( major: number, diff --git a/src/test/pythonEnvironments/base/locatorUtils.unit.test.ts b/src/test/pythonEnvironments/base/locatorUtils.unit.test.ts index fe297360e7a8..8c5e4707a6d1 100644 --- a/src/test/pythonEnvironments/base/locatorUtils.unit.test.ts +++ b/src/test/pythonEnvironments/base/locatorUtils.unit.test.ts @@ -13,19 +13,14 @@ import { PythonLocatorQuery, } from '../../../client/pythonEnvironments/base/locator'; import { getEnvs, getQueryFilter } from '../../../client/pythonEnvironments/base/locatorUtils'; -import { - createLocatedEnv, - createNamedEnv, -} from './common'; +import { createLocatedEnv, createNamedEnv } from './common'; const homeDir = path.normalize('/home/me'); const workspaceRoot = Uri.file('workspace-root'); const doesNotExist = Uri.file(path.normalize('does-not-exist')); function setSearchLocation(env: PythonEnvInfo, location?: string): void { - const locationStr = location === undefined - ? path.dirname(env.location) - : path.normalize(location); + const locationStr = location === undefined ? path.dirname(env.location) : path.normalize(location); env.searchLocation = Uri.file(locationStr); } @@ -61,12 +56,7 @@ const envSL5 = createLocatedEnv(`${homeDir}/.venvs/envSL5`, '3.9.0', PythonEnvKi setSearchLocation(envSL5); const rootedLocatedEnvs = [envSL1, envSL2, envSL3, envSL4, envSL5]; -const envs = [ - ...plainEnvs, - ...locatedEnvs, - ...rootedEnvs, - ...rootedLocatedEnvs, -]; +const envs = [...plainEnvs, ...locatedEnvs, ...rootedEnvs, ...rootedLocatedEnvs]; suite('Python envs locator utils - getQueryFilter', () => { suite('empty query', () => { @@ -175,9 +165,7 @@ suite('Python envs locator utils - getQueryFilter', () => { test('match multiple (one location)', () => { const expected = [envS3, envSL2]; const searchLocations = { - roots: [ - workspaceRoot, - ], + roots: [workspaceRoot], }; const query: PythonLocatorQuery = { searchLocations }; @@ -335,7 +323,7 @@ suite('Python envs locator utils - getEnvs', () => { test('empty, no update emitter', async () => { const iterator = (async function* () { // Yield nothing. - }()) as IPythonEnvsIterator; + })() as IPythonEnvsIterator; const result = await getEnvs(iterator); @@ -348,7 +336,7 @@ suite('Python envs locator utils - getEnvs', () => { const iterator = (async function* () { // Yield nothing. emitter.fire(null); - }()) as IPythonEnvsIterator; + })() as IPythonEnvsIterator; iterator.onUpdated = emitter.event; const result = await getEnvs(iterator); @@ -359,7 +347,7 @@ suite('Python envs locator utils - getEnvs', () => { test('yield one, no update emitter', async () => { const iterator = (async function* () { yield env1; - }()) as IPythonEnvsIterator; + })() as IPythonEnvsIterator; const result = await getEnvs(iterator); @@ -371,7 +359,7 @@ suite('Python envs locator utils - getEnvs', () => { const iterator = (async function* () { yield env1; emitter.fire(null); - }()) as IPythonEnvsIterator; + })() as IPythonEnvsIterator; iterator.onUpdated = emitter.event; const result = await getEnvs(iterator); @@ -387,7 +375,7 @@ suite('Python envs locator utils - getEnvs', () => { yield old; emitter.fire({ index: 0, old, update: envSL2 }); emitter.fire(null); - }()) as IPythonEnvsIterator; + })() as IPythonEnvsIterator; iterator.onUpdated = emitter.event; const result = await getEnvs(iterator); @@ -399,7 +387,7 @@ suite('Python envs locator utils - getEnvs', () => { const expected = rootedLocatedEnvs; const iterator = (async function* () { yield* expected; - }()) as IPythonEnvsIterator; + })() as IPythonEnvsIterator; const result = await getEnvs(iterator); @@ -412,7 +400,7 @@ suite('Python envs locator utils - getEnvs', () => { const iterator = (async function* () { yield* expected; emitter.fire(null); - }()) as IPythonEnvsIterator; + })() as IPythonEnvsIterator; iterator.onUpdated = emitter.event; const result = await getEnvs(iterator); @@ -437,7 +425,7 @@ suite('Python envs locator utils - getEnvs', () => { emitter.fire({ index, old: original[index], update: expected[index] }); }); emitter.fire(null); - }()) as IPythonEnvsIterator; + })() as IPythonEnvsIterator; iterator.onUpdated = emitter.event; const result = await getEnvs(iterator); @@ -462,7 +450,7 @@ suite('Python envs locator utils - getEnvs', () => { } }); emitter.fire(null); - }()) as IPythonEnvsIterator; + })() as IPythonEnvsIterator; iterator.onUpdated = emitter.event; const result = await getEnvs(iterator); diff --git a/src/test/pythonEnvironments/base/locators.unit.test.ts b/src/test/pythonEnvironments/base/locators.unit.test.ts index 06018e5016ba..e71bcf9f04ef 100644 --- a/src/test/pythonEnvironments/base/locators.unit.test.ts +++ b/src/test/pythonEnvironments/base/locators.unit.test.ts @@ -8,9 +8,7 @@ import { PythonEnvInfo, PythonEnvKind } from '../../../client/pythonEnvironments import { PythonLocatorQuery } from '../../../client/pythonEnvironments/base/locator'; import { Locators } from '../../../client/pythonEnvironments/base/locators'; import { PythonEnvsChangedEvent } from '../../../client/pythonEnvironments/base/watcher'; -import { - createLocatedEnv, createNamedEnv, getEnvs, SimpleLocator, -} from './common'; +import { createLocatedEnv, createNamedEnv, getEnvs, SimpleLocator } from './common'; suite('Python envs locators - Locators', () => { suite('onChanged consolidates', () => { diff --git a/src/test/pythonEnvironments/base/locators/composite/cachingLocator.unit.test.ts b/src/test/pythonEnvironments/base/locators/composite/cachingLocator.unit.test.ts index dcf5308f75be..461f4b277d8a 100644 --- a/src/test/pythonEnvironments/base/locators/composite/cachingLocator.unit.test.ts +++ b/src/test/pythonEnvironments/base/locators/composite/cachingLocator.unit.test.ts @@ -11,11 +11,7 @@ import { PythonEnvInfo, PythonEnvKind } from '../../../../../client/pythonEnviro import { CachingLocator } from '../../../../../client/pythonEnvironments/base/locators/composite/cachingLocator'; import { getEnvs } from '../../../../../client/pythonEnvironments/base/locatorUtils'; import { PythonEnvsChangedEvent } from '../../../../../client/pythonEnvironments/base/watcher'; -import { - createLocatedEnv, - createNamedEnv, - SimpleLocator, -} from '../../common'; +import { createLocatedEnv, createNamedEnv, SimpleLocator } from '../../common'; const env1 = createNamedEnv('env1', '2.7.11', PythonEnvKind.System, '/usr/bin/python'); const env2 = createNamedEnv('env2', '3.8.1', PythonEnvKind.System, '/usr/bin/python3'); @@ -91,10 +87,7 @@ suite('Python envs locator - CachingLocator', () => { const expected = [env1, env2, env4, env5]; const [, locator] = await getInitializedLocator(envs); const query = { - kinds: [ - PythonEnvKind.Venv, - PythonEnvKind.System, - ], + kinds: [PythonEnvKind.Venv, PythonEnvKind.System], }; const iterator = locator.iterEnvs(query); diff --git a/src/test/pythonEnvironments/base/locators/lowLevel/workspaceVirtualEnvLocator.testvirtualenvs.ts b/src/test/pythonEnvironments/base/locators/lowLevel/workspaceVirtualEnvLocator.testvirtualenvs.ts index 56f6b27cafd4..b79a43636f47 100644 --- a/src/test/pythonEnvironments/base/locators/lowLevel/workspaceVirtualEnvLocator.testvirtualenvs.ts +++ b/src/test/pythonEnvironments/base/locators/lowLevel/workspaceVirtualEnvLocator.testvirtualenvs.ts @@ -8,9 +8,7 @@ import { testLocatorWatcher } from '../../../discovery/locators/watcherTestUtils suite('WorkspaceVirtualEnvironment Locator', async () => { const testWorkspaceFolder = path.join(TEST_LAYOUT_ROOT, 'workspace', 'folder1'); - testLocatorWatcher( - testWorkspaceFolder, - async (root?: string) => new WorkspaceVirtualEnvironmentLocator(root!), - { arg: testWorkspaceFolder }, - ); + testLocatorWatcher(testWorkspaceFolder, async (root?: string) => new WorkspaceVirtualEnvironmentLocator(root!), { + arg: testWorkspaceFolder, + }); }); diff --git a/src/test/pythonEnvironments/base/locators/lowLevel/workspaceVirtualEnvLocator.unit.test.ts b/src/test/pythonEnvironments/base/locators/lowLevel/workspaceVirtualEnvLocator.unit.test.ts index cf9e8c074268..8360f4debe5e 100644 --- a/src/test/pythonEnvironments/base/locators/lowLevel/workspaceVirtualEnvLocator.unit.test.ts +++ b/src/test/pythonEnvironments/base/locators/lowLevel/workspaceVirtualEnvLocator.unit.test.ts @@ -59,7 +59,11 @@ suite('WorkspaceVirtualEnvironment Locator', () => { getOSTypeStub = sinon.stub(platformUtils, 'getOSType'); getOSTypeStub.returns(platformUtils.OSType.Linux); watchLocationForPatternStub = sinon.stub(fsWatcher, 'watchLocationForPattern'); - watchLocationForPatternStub.returns({ dispose: () => { /* do nothing */ } }); + watchLocationForPatternStub.returns({ + dispose: () => { + /* do nothing */ + }, + }); locator = new WorkspaceVirtualEnvironmentLocator(testWorkspaceFolder); }); teardown(async () => { @@ -105,8 +109,8 @@ suite('WorkspaceVirtualEnvironment Locator', () => { ].sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)).sort( - (a, b) => a.executable.filename.localeCompare(b.executable.filename), + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), ); comparePaths(actualEnvs, expectedEnvs); @@ -137,8 +141,8 @@ suite('WorkspaceVirtualEnvironment Locator', () => { ].sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)).sort( - (a, b) => a.executable.filename.localeCompare(b.executable.filename), + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), ); comparePaths(actualEnvs, expectedEnvs); diff --git a/src/test/pythonEnvironments/base/watcher.unit.test.ts b/src/test/pythonEnvironments/base/watcher.unit.test.ts index cb2a1ab54549..30b9608346e8 100644 --- a/src/test/pythonEnvironments/base/watcher.unit.test.ts +++ b/src/test/pythonEnvironments/base/watcher.unit.test.ts @@ -7,7 +7,7 @@ import { PythonEnvKind } from '../../../client/pythonEnvironments/base/info'; import { BasicPythonEnvsChangedEvent, PythonEnvsChangedEvent, - PythonEnvsWatcher + PythonEnvsWatcher, } from '../../../client/pythonEnvironments/base/watcher'; const KINDS_TO_TEST = [ @@ -17,7 +17,7 @@ const KINDS_TO_TEST = [ PythonEnvKind.OtherGlobal, PythonEnvKind.Venv, PythonEnvKind.Conda, - PythonEnvKind.OtherVirtual + PythonEnvKind.OtherVirtual, ]; suite('Python envs watcher - PythonEnvsWatcher', () => { @@ -41,7 +41,7 @@ suite('Python envs watcher - PythonEnvsWatcher', () => { test(`non-empty event ("${kind}")`, () => { const expected: PythonEnvsChangedEvent = { kind, - searchLocation: location + searchLocation: location, }; const watcher = new PythonEnvsWatcher(); let event: PythonEnvsChangedEvent | undefined; @@ -99,7 +99,7 @@ suite('Python envs watcher - PythonEnvsWatcher', () => { KINDS_TO_TEST.forEach((kind) => { test(`non-empty event ("${kind}")`, () => { const expected: BasicPythonEnvsChangedEvent = { - kind + kind, }; const watcher = new PythonEnvsWatcher(); let event: BasicPythonEnvsChangedEvent | undefined; diff --git a/src/test/pythonEnvironments/common/environmentIdentifier.unit.test.ts b/src/test/pythonEnvironments/common/environmentIdentifier.unit.test.ts index a2f00aa4d3e9..3d9dfbb4517f 100644 --- a/src/test/pythonEnvironments/common/environmentIdentifier.unit.test.ts +++ b/src/test/pythonEnvironments/common/environmentIdentifier.unit.test.ts @@ -39,10 +39,23 @@ suite('Environment Identifier', () => { }); test('Path to a global pipenv environment', async () => { - const expectedDotProjectFile = path.join(TEST_LAYOUT_ROOT, 'pipenv', 'globalEnvironments', 'project2-vnNIWe9P', '.project'); + const expectedDotProjectFile = path.join( + TEST_LAYOUT_ROOT, + 'pipenv', + 'globalEnvironments', + 'project2-vnNIWe9P', + '.project', + ); const expectedProjectFile = path.join(TEST_LAYOUT_ROOT, 'pipenv', 'project2'); readFile.withArgs(expectedDotProjectFile).resolves(expectedProjectFile); - const interpreterPath: string = path.join(TEST_LAYOUT_ROOT, 'pipenv', 'globalEnvironments', 'project2-vnNIWe9P', 'bin', 'python'); + const interpreterPath: string = path.join( + TEST_LAYOUT_ROOT, + 'pipenv', + 'globalEnvironments', + 'project2-vnNIWe9P', + 'bin', + 'python', + ); const envType: EnvironmentType = await identifyEnvironment(interpreterPath); @@ -51,7 +64,14 @@ suite('Environment Identifier', () => { test('Path to a local pipenv environment with a custom Pipfile name', async () => { getEnvVar.withArgs('PIPENV_PIPFILE').returns('CustomPipfileName'); - const interpreterPath: string = path.join(TEST_LAYOUT_ROOT, 'pipenv', 'project1', '.venv', 'Scripts', 'python.exe'); + const interpreterPath: string = path.join( + TEST_LAYOUT_ROOT, + 'pipenv', + 'project1', + '.venv', + 'Scripts', + 'python.exe', + ); const envType: EnvironmentType = await identifyEnvironment(interpreterPath); @@ -156,7 +176,15 @@ suite('Environment Identifier', () => { return this.skip(); } - const interpreterPath = path.join(TEST_LAYOUT_ROOT, 'pyenv1', '.pyenv', 'versions', '3.6.9', 'bin', 'python'); + const interpreterPath = path.join( + TEST_LAYOUT_ROOT, + 'pyenv1', + '.pyenv', + 'versions', + '3.6.9', + 'bin', + 'python', + ); getUserHomeDirStub.returns(path.join(TEST_LAYOUT_ROOT, 'pyenv1')); getEnvVarStub.withArgs('PYENV_ROOT').returns(undefined); @@ -173,7 +201,16 @@ suite('Environment Identifier', () => { return this.skip(); } - const interpreterPath = path.join(TEST_LAYOUT_ROOT, 'pyenv2', '.pyenv', 'pyenv-win', 'versions', '3.6.9', 'bin', 'python.exe'); + const interpreterPath = path.join( + TEST_LAYOUT_ROOT, + 'pyenv2', + '.pyenv', + 'pyenv-win', + 'versions', + '3.6.9', + 'bin', + 'python.exe', + ); getUserHomeDirStub.returns(path.join(TEST_LAYOUT_ROOT, 'pyenv2')); getEnvVarStub.withArgs('PYENV').returns(undefined); @@ -257,7 +294,14 @@ suite('Environment Identifier', () => { return this.skip(); } - const interpreterPath = path.join(TEST_LAYOUT_ROOT, 'virtualenvwrapper1', '.virtualenvs', 'myenv', 'bin', 'python'); + const interpreterPath = path.join( + TEST_LAYOUT_ROOT, + 'virtualenvwrapper1', + '.virtualenvs', + 'myenv', + 'bin', + 'python', + ); getEnvVarStub.withArgs('WORKON_HOME').returns(undefined); @@ -273,7 +317,14 @@ suite('Environment Identifier', () => { return this.skip(); } - const interpreterPath = path.join(TEST_LAYOUT_ROOT, 'virtualenvwrapper1', 'Envs', 'myenv', 'Scripts', 'python'); + const interpreterPath = path.join( + TEST_LAYOUT_ROOT, + 'virtualenvwrapper1', + 'Envs', + 'myenv', + 'Scripts', + 'python', + ); getEnvVarStub.withArgs('WORKON_HOME').returns(undefined); getOsTypeStub.returns(platformApis.OSType.Windows); diff --git a/src/test/pythonEnvironments/common/windowsUtils.unit.test.ts b/src/test/pythonEnvironments/common/windowsUtils.unit.test.ts index d190fdf2386c..e1ce91ba8807 100644 --- a/src/test/pythonEnvironments/common/windowsUtils.unit.test.ts +++ b/src/test/pythonEnvironments/common/windowsUtils.unit.test.ts @@ -22,7 +22,9 @@ suite('Windows Utils tests', () => { ]; testParams.forEach((testParam) => { - test(`Python executable check ${testParam.expected ? 'should match' : 'should not match'} this path: ${testParam.path}`, () => { + test(`Python executable check ${testParam.expected ? 'should match' : 'should not match'} this path: ${ + testParam.path + }`, () => { assert.deepEqual(isWindowsPythonExe(testParam.path), testParam.expected); }); }); diff --git a/src/test/pythonEnvironments/discovery/locators/cacheableLocatorService.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/cacheableLocatorService.unit.test.ts index 15804abe451b..952a968e1d3b 100644 --- a/src/test/pythonEnvironments/discovery/locators/cacheableLocatorService.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/cacheableLocatorService.unit.test.ts @@ -8,9 +8,7 @@ import { expect } from 'chai'; import * as md5 from 'md5'; -import { - anything, instance, mock, verify, when, -} from 'ts-mockito'; +import { anything, instance, mock, verify, when } from 'ts-mockito'; import { Disposable, Uri, WorkspaceFolder } from 'vscode'; import { IWorkspaceService } from '../../../../client/common/application/types'; import { WorkspaceService } from '../../../../client/common/application/workspace'; diff --git a/src/test/pythonEnvironments/discovery/locators/condaEnvFileService.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/condaEnvFileService.unit.test.ts index b41d11374b28..0f6c86aabe6e 100644 --- a/src/test/pythonEnvironments/discovery/locators/condaEnvFileService.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/condaEnvFileService.unit.test.ts @@ -81,9 +81,9 @@ suite('Interpreters from Conda Environments Text File', () => { condaService.setup((c) => c.condaEnvironmentsFile).returns(() => environmentsFilePath); condaService .setup((c) => c.getInterpreterPath(TypeMoq.It.isAny())) - .returns((environmentPath) => (isWindows - ? path.join(environmentPath, 'python.exe') - : path.join(environmentPath, 'bin', 'python'))); + .returns((environmentPath) => + isWindows ? path.join(environmentPath, 'python.exe') : path.join(environmentPath, 'bin', 'python'), + ); condaService .setup((c) => c.getCondaEnvironments(TypeMoq.It.isAny())) .returns(() => { diff --git a/src/test/pythonEnvironments/discovery/locators/condaEnvService.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/condaEnvService.unit.test.ts index 3e2d1724abd3..e0e721bcd64e 100644 --- a/src/test/pythonEnvironments/discovery/locators/condaEnvService.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/condaEnvService.unit.test.ts @@ -61,7 +61,7 @@ suite('Interpreters from Conda Environments', () => { test('Must return an empty list for empty json', async () => { const interpreters = await _parseCondaInfo( // tslint:disable-next-line:no-any prefer-type-cast - {} as any, + {} as CondaInfo, condaService.object, fileSystem.object, interpreterHelper.object, @@ -81,9 +81,9 @@ suite('Interpreters from Conda Environments', () => { }; condaService .setup((c) => c.getInterpreterPath(TypeMoq.It.isAny())) - .returns((environmentPath) => (isWindows - ? path.join(environmentPath, 'python.exe') - : path.join(environmentPath, 'bin', 'python'))); + .returns((environmentPath) => + isWindows ? path.join(environmentPath, 'python.exe') : path.join(environmentPath, 'bin', 'python'), + ); info.envs.forEach((validPath) => { const pythonPath = isWindows ? path.join(validPath, 'python.exe') : path.join(validPath, 'bin', 'python'); fileSystem @@ -138,9 +138,9 @@ suite('Interpreters from Conda Environments', () => { }; condaService .setup((c) => c.getInterpreterPath(TypeMoq.It.isAny())) - .returns((environmentPath) => (isWindows - ? path.join(environmentPath, 'python.exe') - : path.join(environmentPath, 'bin', 'python'))); + .returns((environmentPath) => + isWindows ? path.join(environmentPath, 'python.exe') : path.join(environmentPath, 'bin', 'python'), + ); info.envs.forEach((validPath) => { const pythonPath = isWindows ? path.join(validPath, 'python.exe') : path.join(validPath, 'bin', 'python'); fileSystem @@ -154,11 +154,13 @@ suite('Interpreters from Conda Environments', () => { condaService.setup((c) => c.getCondaInfo()).returns(() => Promise.resolve(info)); condaService .setup((c) => c.getCondaEnvironments(TypeMoq.It.isAny())) - .returns(() => Promise.resolve([ - { name: 'base', path: environmentsPath }, - { name: 'numpy', path: path.join(environmentsPath, 'conda', 'envs', 'numpy') }, - { name: 'scipy', path: path.join(environmentsPath, 'conda', 'envs', 'scipy') }, - ])); + .returns(() => + Promise.resolve([ + { name: 'base', path: environmentsPath }, + { name: 'numpy', path: path.join(environmentsPath, 'conda', 'envs', 'numpy') }, + { name: 'scipy', path: path.join(environmentsPath, 'conda', 'envs', 'scipy') }, + ]), + ); fileSystem .setup((fs) => fs.arePathsSame(TypeMoq.It.isAny(), TypeMoq.It.isAny())) .returns((p1: string, p2: string) => (isWindows ? p1 === p2 : p1.toUpperCase() === p2.toUpperCase())); @@ -195,13 +197,14 @@ suite('Interpreters from Conda Environments', () => { const info = { envs: [path.join(environmentsPath, 'conda', 'envs', 'numpy')], default_prefix: '', - 'sys.version': '3.6.1 |Anaonda 4.4.0 (64-bit)| (default, May 11 2017, 13:25:24) [MSC v.1900 64 bit (AMD64)]', + 'sys.version': + '3.6.1 |Anaonda 4.4.0 (64-bit)| (default, May 11 2017, 13:25:24) [MSC v.1900 64 bit (AMD64)]', }; condaService .setup((c) => c.getInterpreterPath(TypeMoq.It.isAny())) - .returns((environmentPath) => (isWindows - ? path.join(environmentPath, 'python.exe') - : path.join(environmentPath, 'bin', 'python'))); + .returns((environmentPath) => + isWindows ? path.join(environmentPath, 'python.exe') : path.join(environmentPath, 'bin', 'python'), + ); info.envs.forEach((validPath) => { const pythonPath = isWindows ? path.join(validPath, 'python.exe') : path.join(validPath, 'bin', 'python'); fileSystem @@ -240,7 +243,8 @@ suite('Interpreters from Conda Environments', () => { const info = { envs: [path.join(environmentsPath, 'conda', 'envs', 'numpy')], default_prefix: '', - 'sys.version': '3.6.1 |Anaonda 4.4.0 (64-bit)| (default, May 11 2017, 13:25:24) [MSC v.1900 64 bit (AMD64)]', + 'sys.version': + '3.6.1 |Anaonda 4.4.0 (64-bit)| (default, May 11 2017, 13:25:24) [MSC v.1900 64 bit (AMD64)]', }; interpreterHelper .setup((i) => i.getInterpreterInformation(TypeMoq.It.isAny())) @@ -248,16 +252,18 @@ suite('Interpreters from Conda Environments', () => { condaService.setup((c) => c.getCondaInfo()).returns(() => Promise.resolve(info)); condaService .setup((c) => c.getCondaEnvironments(TypeMoq.It.isAny())) - .returns(() => Promise.resolve([ - { name: 'base', path: environmentsPath }, - { name: 'numpy', path: path.join(environmentsPath, 'conda', 'envs', 'numpy') }, - { name: 'scipy', path: path.join(environmentsPath, 'conda', 'envs', 'scipy') }, - ])); + .returns(() => + Promise.resolve([ + { name: 'base', path: environmentsPath }, + { name: 'numpy', path: path.join(environmentsPath, 'conda', 'envs', 'numpy') }, + { name: 'scipy', path: path.join(environmentsPath, 'conda', 'envs', 'scipy') }, + ]), + ); condaService .setup((c) => c.getInterpreterPath(TypeMoq.It.isAny())) - .returns((environmentPath) => (isWindows - ? path.join(environmentPath, 'python.exe') - : path.join(environmentPath, 'bin', 'python'))); + .returns((environmentPath) => + isWindows ? path.join(environmentPath, 'python.exe') : path.join(environmentPath, 'bin', 'python'), + ); info.envs.forEach((validPath) => { const pythonPath = isWindows ? path.join(validPath, 'python.exe') : path.join(validPath, 'bin', 'python'); fileSystem @@ -296,9 +302,9 @@ suite('Interpreters from Conda Environments', () => { }; condaService .setup((c) => c.getInterpreterPath(TypeMoq.It.isAny())) - .returns((environmentPath) => (isWindows - ? path.join(environmentPath, 'python.exe') - : path.join(environmentPath, 'bin', 'python'))); + .returns((environmentPath) => + isWindows ? path.join(environmentPath, 'python.exe') : path.join(environmentPath, 'bin', 'python'), + ); info.envs.forEach((validPath) => { const pythonPath = isWindows ? path.join(validPath, 'python.exe') : path.join(validPath, 'bin', 'python'); fileSystem @@ -340,9 +346,9 @@ suite('Interpreters from Conda Environments', () => { }; condaService .setup((c) => c.getInterpreterPath(TypeMoq.It.isAny())) - .returns((environmentPath) => (isWindows - ? path.join(environmentPath, 'python.exe') - : path.join(environmentPath, 'bin', 'python'))); + .returns((environmentPath) => + isWindows ? path.join(environmentPath, 'python.exe') : path.join(environmentPath, 'bin', 'python'), + ); info.envs.forEach((validPath) => { const pythonPath = isWindows ? path.join(validPath, 'python.exe') : path.join(validPath, 'bin', 'python'); fileSystem @@ -356,11 +362,13 @@ suite('Interpreters from Conda Environments', () => { condaService.setup((c) => c.getCondaInfo()).returns(() => Promise.resolve(info)); condaService .setup((c) => c.getCondaEnvironments(TypeMoq.It.isAny())) - .returns(() => Promise.resolve([ - { name: 'base', path: environmentsPath }, - { name: 'numpy', path: path.join(environmentsPath, 'conda', 'envs', 'numpy') }, - { name: 'scipy', path: path.join(environmentsPath, 'conda', 'envs', 'scipy') }, - ])); + .returns(() => + Promise.resolve([ + { name: 'base', path: environmentsPath }, + { name: 'numpy', path: path.join(environmentsPath, 'conda', 'envs', 'numpy') }, + { name: 'scipy', path: path.join(environmentsPath, 'conda', 'envs', 'scipy') }, + ]), + ); fileSystem .setup((fs) => fs.arePathsSame(TypeMoq.It.isAny(), TypeMoq.It.isAny())) .returns((p1: string, p2: string) => (isWindows ? p1 === p2 : p1.toUpperCase() === p2.toUpperCase())); @@ -390,9 +398,9 @@ suite('Interpreters from Conda Environments', () => { }; condaService .setup((c) => c.getInterpreterPath(TypeMoq.It.isAny())) - .returns((environmentPath) => (isWindows - ? path.join(environmentPath, 'python.exe') - : path.join(environmentPath, 'bin', 'python'))); + .returns((environmentPath) => + isWindows ? path.join(environmentPath, 'python.exe') : path.join(environmentPath, 'bin', 'python'), + ); const pythonPath = isWindows ? path.join(info.defaultPrefix, 'python.exe') : path.join(info.defaultPrefix, 'bin', 'python'); @@ -443,9 +451,9 @@ suite('Interpreters from Conda Environments', () => { validPaths.forEach((envPath) => { condaService .setup((c) => c.getInterpreterPath(TypeMoq.It.isValue(envPath))) - .returns((environmentPath) => (isWindows - ? path.join(environmentPath, 'python.exe') - : path.join(environmentPath, 'bin', 'python'))); + .returns((environmentPath) => + isWindows ? path.join(environmentPath, 'python.exe') : path.join(environmentPath, 'bin', 'python'), + ); const pythonPath = isWindows ? path.join(envPath, 'python.exe') : path.join(envPath, 'bin', 'python'); fileSystem .setup((fs) => fs.fileExists(TypeMoq.It.isValue(pythonPath))) diff --git a/src/test/pythonEnvironments/discovery/locators/condaHelper.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/condaHelper.unit.test.ts index 934e29e1751b..1b6c024103ca 100644 --- a/src/test/pythonEnvironments/discovery/locators/condaHelper.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/condaHelper.unit.test.ts @@ -185,46 +185,40 @@ suite('Conda binary is located correctly', () => { sinon.stub(platform, 'getUserHomeDir').callsFake(() => homeDir); - sinon.stub(fsapi, 'readdir').callsFake( - async (filePath: string | Buffer) => { - if (typeof filePath !== 'string') { - throw new Error(`expected filePath to be string, got ${typeof filePath}`); - } - return Object.keys(getFile(filePath)); + sinon.stub(fsapi, 'readdir').callsFake(async (filePath: string | Buffer) => { + if (typeof filePath !== 'string') { + throw new Error(`expected filePath to be string, got ${typeof filePath}`); } - ); + return Object.keys(getFile(filePath)); + }); // tslint:disable-next-line: no-any - sinon.stub(fsapi, 'readFile' as any).callsFake( - async (filePath: string | Buffer | number, encoding: string) => { - if (typeof filePath !== 'string') { - throw new Error(`expected filePath to be string, got ${typeof filePath}`); - } else if (encoding !== 'utf8') { - throw new Error(`Unsupported encoding ${encoding}`); - } - - const contents = getFile(filePath); - if (typeof contents !== 'string') { - throw new Error(`${filePath} is not a file`); - } + sinon.stub(fsapi, 'readFile' as any).callsFake(async (filePath: string | Buffer | number, encoding: string) => { + if (typeof filePath !== 'string') { + throw new Error(`expected filePath to be string, got ${typeof filePath}`); + } else if (encoding !== 'utf8') { + throw new Error(`Unsupported encoding ${encoding}`); + } - return contents; + const contents = getFile(filePath); + if (typeof contents !== 'string') { + throw new Error(`${filePath} is not a file`); } - ); - - sinon.stub(externalDependencies, 'exec').callsFake( - async (command: string, args: string[]) => { - for (const prefix of ['', ...execPath]) { - const contents = getFile(path.join(prefix, command)); - if (args[0] !== 'info' || args[1] !== '--json') { - throw new Error(`Invalid arguments: ${util.inspect(args)}`); - } else if (typeof contents === 'string' && contents !== '') { - return { stdout: contents }; - } + + return contents; + }); + + sinon.stub(externalDependencies, 'exec').callsFake(async (command: string, args: string[]) => { + for (const prefix of ['', ...execPath]) { + const contents = getFile(path.join(prefix, command)); + if (args[0] !== 'info' || args[1] !== '--json') { + throw new Error(`Invalid arguments: ${util.inspect(args)}`); + } else if (typeof contents === 'string' && contents !== '') { + return { stdout: contents }; } - throw new Error(`${command} is missing or is not executable`); - }, - ); + } + throw new Error(`${command} is missing or is not executable`); + }); }); teardown(() => { @@ -306,8 +300,10 @@ suite('Conda binary is located correctly', () => { osType = platform.OSType.Windows; homeDir = 'E:\\Users\\user'; - sinon.stub(platform, 'getEnvironmentVariable') - .withArgs('PROGRAMDATA').returns('D:\\ProgramData') + sinon + .stub(platform, 'getEnvironmentVariable') + .withArgs('PROGRAMDATA') + .returns('D:\\ProgramData') .withArgs('LOCALAPPDATA') .returns('F:\\Users\\user\\AppData\\Local'); @@ -336,20 +332,22 @@ suite('Conda binary is located correctly', () => { }); // Drive letters are intentionally unusual to ascertain that locator doesn't hardcode paths. - ['D:\\ProgramData', 'E:\\Users\\user', 'F:\\Users\\user\\AppData\\Local\\Continuum'].forEach((prefix) => { - const condaPath = `${prefix}\\${condaDirName}`; - - test(`Must find conda in ${condaPath}`, async () => { - const prefixDir = getFile(prefix) as Directory; - prefixDir[condaDirName] = { - Scripts: { - 'conda.exe': JSON.stringify(condaInfo('4.8.0')), - }, - }; + ['D:\\ProgramData', 'E:\\Users\\user', 'F:\\Users\\user\\AppData\\Local\\Continuum'].forEach( + (prefix) => { + const condaPath = `${prefix}\\${condaDirName}`; + + test(`Must find conda in ${condaPath}`, async () => { + const prefixDir = getFile(prefix) as Directory; + prefixDir[condaDirName] = { + Scripts: { + 'conda.exe': JSON.stringify(condaInfo('4.8.0')), + }, + }; - await expectConda(`${condaPath}\\Scripts\\conda.exe`); - }); - }); + await expectConda(`${condaPath}\\Scripts\\conda.exe`); + }); + }, + ); }); }); }); @@ -371,14 +369,14 @@ suite('Conda binary is located correctly', () => { '', ' /present ', // whitespace should be ignored '', - ].join('\n') + ].join('\n'), }, }, }, present: { bin: { conda: JSON.stringify(condaInfo('4.8.0')), - } + }, }, }; @@ -402,18 +400,18 @@ suite('Conda binary is located correctly', () => { '', ' E:\\Present ', // whitespace should be ignored '', - ].join('\r\n') + ].join('\r\n'), }, }, - } + }, }, 'E:': { Present: { Scripts: { - 'conda.exe': JSON.stringify(condaInfo('4.8.0')) - } - } - } + 'conda.exe': JSON.stringify(condaInfo('4.8.0')), + }, + }, + }, }; await expectConda('E:\\Present\\Scripts\\conda.exe'); @@ -447,19 +445,19 @@ suite('Conda binary is located correctly', () => { // Shouldn't be located because it's not a well-known conda path, // and it's listed under PythonCore in the registry. Scripts: { - 'conda.exe': JSON.stringify(condaInfo('4.8.0')) - } + 'conda.exe': JSON.stringify(condaInfo('4.8.0')), + }, }, Anaconda2: { // Shouldn't be located because it can't handle "conda info --json". Scripts: { - 'conda.exe': '' - } + 'conda.exe': '', + }, }, Anaconda3: { Scripts: { - 'conda.exe': JSON.stringify(condaInfo('4.8.1')) - } + 'conda.exe': JSON.stringify(condaInfo('4.8.1')), + }, }, }, }; @@ -476,10 +474,7 @@ suite('Conda env list is parsed correctly', () => { 'sys.prefix': '/some/env', rootPrefix: '/home/user/miniconda3', defaultPrefix: '/home/user/miniconda3/envs/env1', - envsDirs: [ - '/home/user/miniconda3/envs', - '/home/user/.conda/envs', - ], + envsDirs: ['/home/user/miniconda3/envs', '/home/user/.conda/envs'], envs: [ '/home/user/miniconda3', '/home/user/miniconda3/envs/env1', @@ -488,20 +483,18 @@ suite('Conda env list is parsed correctly', () => { '/home/user/.conda/envs/env4', '/home/user/.conda/envs/env5', '/env6', - ] + ], }; setup(() => { - sinon.stub(externalDependencies, 'exec').callsFake( - async (command: string, args: string[]) => { - if (command !== 'conda') { - throw new Error(`Unknown command: ${util.inspect(command)}`); - } else if (args[0] !== 'info' || args[1] !== '--json') { - throw new Error(`Invalid arguments: ${util.inspect(args)}`); - } - return { stdout: JSON.stringify(condaInfo) }; - }, - ); + sinon.stub(externalDependencies, 'exec').callsFake(async (command: string, args: string[]) => { + if (command !== 'conda') { + throw new Error(`Unknown command: ${util.inspect(command)}`); + } else if (args[0] !== 'info' || args[1] !== '--json') { + throw new Error(`Invalid arguments: ${util.inspect(args)}`); + } + return { stdout: JSON.stringify(condaInfo) }; + }); }); teardown(() => { @@ -514,31 +507,31 @@ suite('Conda env list is parsed correctly', () => { expect(envs).to.have.deep.members([ { prefix: '/home/user/miniconda3', - name: 'base' + name: 'base', }, { prefix: '/home/user/miniconda3/envs/env1', - name: 'env1' + name: 'env1', }, { prefix: '/home/user/miniconda3/envs/env2', - name: 'env2' + name: 'env2', }, { prefix: '/home/user/miniconda3/envs/dir/env3', - name: undefined // because it's not directly under envsDirs + name: undefined, // because it's not directly under envsDirs }, { prefix: '/home/user/.conda/envs/env4', - name: 'env4' + name: 'env4', }, { prefix: '/home/user/.conda/envs/env5', - name: 'env5' + name: 'env5', }, { prefix: '/env6', - name: undefined // because it's not directly under envsDirs + name: undefined, // because it's not directly under envsDirs }, ]); }); diff --git a/src/test/pythonEnvironments/discovery/locators/condaLocator.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/condaLocator.unit.test.ts index 90d7c91e85ce..78e89efd3deb 100644 --- a/src/test/pythonEnvironments/discovery/locators/condaLocator.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/condaLocator.unit.test.ts @@ -34,26 +34,38 @@ suite('Conda Python Version Parser Tests', () => { } function getTestData(): ICondaPythonVersionTestData[] { - const data:ICondaPythonVersionTestData[] = []; + const data: ICondaPythonVersionTestData[] = []; - const cases = (fsapi.readdirSync(testDataRoot)).map((c) => path.join(testDataRoot, c)); + const cases = fsapi.readdirSync(testDataRoot).map((c) => path.join(testDataRoot, c)); const casesToVersion = new Map(); casesToVersion.set('case1', { major: 3, minor: 8, micro: 5 }); casesToVersion.set('case2', { - major: 3, minor: 9, micro: 0, release: { level: PythonReleaseLevel.Alpha, serial: 1 }, + major: 3, + minor: 9, + micro: 0, + release: { level: PythonReleaseLevel.Alpha, serial: 1 }, }); casesToVersion.set('case3', { - major: 3, minor: 9, micro: 0, release: { level: PythonReleaseLevel.Beta, serial: 2 }, + major: 3, + minor: 9, + micro: 0, + release: { level: PythonReleaseLevel.Beta, serial: 2 }, }); casesToVersion.set('case4', { - major: 3, minor: 9, micro: 0, release: { level: PythonReleaseLevel.Candidate, serial: 1 }, + major: 3, + minor: 9, + micro: 0, + release: { level: PythonReleaseLevel.Candidate, serial: 1 }, }); casesToVersion.set('case5', { - major: 3, minor: 9, micro: 0, release: { level: PythonReleaseLevel.Candidate, serial: 2 }, + major: 3, + minor: 9, + micro: 0, + release: { level: PythonReleaseLevel.Candidate, serial: 2 }, }); for (const c of cases) { diff --git a/src/test/pythonEnvironments/discovery/locators/condaService.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/condaService.unit.test.ts index f86233bfb08e..1b19f29b56d0 100644 --- a/src/test/pythonEnvironments/discovery/locators/condaService.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/condaService.unit.test.ts @@ -14,7 +14,11 @@ import { IProcessService, IProcessServiceFactory } from '../../../../client/comm import { ITerminalActivationCommandProvider } from '../../../../client/common/terminal/types'; import { IConfigurationService, IPersistentStateFactory, IPythonSettings } from '../../../../client/common/types'; import { Architecture } from '../../../../client/common/utils/platform'; -import { IComponentAdapter, IInterpreterLocatorService, IInterpreterService } from '../../../../client/interpreter/contracts'; +import { + IComponentAdapter, + IInterpreterLocatorService, + IInterpreterService, +} from '../../../../client/interpreter/contracts'; import { IServiceContainer } from '../../../../client/ioc/types'; import { CondaService } from '../../../../client/pythonEnvironments/discovery/locators/services/condaService'; import { EnvironmentType, PythonEnvironment } from '../../../../client/pythonEnvironments/info'; @@ -159,7 +163,9 @@ suite('Interpreters Conda Service', () => { test('Correctly identifies a python path as a conda environment (linux)', async () => { const pythonPath = path.join('users', 'xyz', '.conda', 'envs', 'enva', 'bin', 'python'); fileSystem - .setup((f) => f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta')))) + .setup((f) => + f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta'))), + ) .returns(() => Promise.resolve(true)); await identifyPythonPathAsCondaEnvironment(false, false, true, pythonPath); }); @@ -167,7 +173,9 @@ suite('Interpreters Conda Service', () => { test('Correctly identifies a python path as a conda environment (osx)', async () => { const pythonPath = path.join('users', 'xyz', '.conda', 'envs', 'enva', 'bin', 'python'); fileSystem - .setup((f) => f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta')))) + .setup((f) => + f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta'))), + ) .returns(() => Promise.resolve(true)); await identifyPythonPathAsCondaEnvironment(false, true, false, pythonPath); }); @@ -186,7 +194,9 @@ suite('Interpreters Conda Service', () => { .setup((f) => f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), 'conda-meta')))) .returns(() => Promise.resolve(false)); fileSystem - .setup((f) => f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta')))) + .setup((f) => + f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta'))), + ) .returns(() => Promise.resolve(false)); const isCondaEnv = await condaService.isCondaEnvironment(pythonPath); @@ -265,7 +275,9 @@ suite('Interpreters Conda Service', () => { const condaEnvDir = path.join('c', 'users', 'xyz', '.conda', 'envs'); fileSystem - .setup((f) => f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta')))) + .setup((f) => + f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta'))), + ) .returns(() => Promise.resolve(true)); await checkCondaNameAndPathForCondaEnvironments(false, true, false, pythonPath, condaEnvDir, { name: 'One', @@ -278,7 +290,9 @@ suite('Interpreters Conda Service', () => { const condaEnvDir = path.join('c', 'users', 'xyz', '.conda', 'envs'); fileSystem - .setup((f) => f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta')))) + .setup((f) => + f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta'))), + ) .returns(() => Promise.resolve(true)); await checkCondaNameAndPathForCondaEnvironments(false, true, false, pythonPath, condaEnvDir, { name: 'Eight', @@ -291,7 +305,9 @@ suite('Interpreters Conda Service', () => { const condaEnvDir = path.join('c', 'users', 'xyz', '.conda', 'envs'); fileSystem - .setup((f) => f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta')))) + .setup((f) => + f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta'))), + ) .returns(() => Promise.resolve(true)); await checkCondaNameAndPathForCondaEnvironments(false, false, true, pythonPath, condaEnvDir, { name: 'One', @@ -304,7 +320,9 @@ suite('Interpreters Conda Service', () => { const condaEnvDir = path.join('c', 'users', 'xyz', '.conda', 'envs'); fileSystem - .setup((f) => f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta')))) + .setup((f) => + f.directoryExists(TypeMoq.It.isValue(path.join(path.dirname(pythonPath), '..', 'conda-meta'))), + ) .returns(() => Promise.resolve(true)); await checkCondaNameAndPathForCondaEnvironments(false, false, true, pythonPath, condaEnvDir, { name: 'Eight', @@ -679,7 +697,9 @@ suite('Interpreters Conda Service', () => { const expectedCondaLocation = untildify(knownLocation); platformService.setup((p) => p.isWindows).returns(() => false); processService - .setup((p) => p.exec(TypeMoq.It.isValue('conda'), TypeMoq.It.isValue(['--version']), TypeMoq.It.isAny())) + .setup((p) => + p.exec(TypeMoq.It.isValue('conda'), TypeMoq.It.isValue(['--version']), TypeMoq.It.isAny()), + ) .returns(() => Promise.reject(new Error('Not Found'))); fileSystem .setup((fs) => fs.search(TypeMoq.It.isAny())) @@ -733,7 +753,9 @@ suite('Interpreters Conda Service', () => { .setup((p) => p.exec(TypeMoq.It.isValue('conda'), TypeMoq.It.isValue(['--version']), TypeMoq.It.isAny())) .returns(() => Promise.resolve({ stdout: 'xyz' })); processService - .setup((p) => p.exec(TypeMoq.It.isValue('conda'), TypeMoq.It.isValue(['info', '--json']), TypeMoq.It.isAny())) + .setup((p) => + p.exec(TypeMoq.It.isValue('conda'), TypeMoq.It.isValue(['info', '--json']), TypeMoq.It.isAny()), + ) .returns(() => Promise.resolve({ stdout: JSON.stringify(expectedInfo) })); const condaInfo = await condaService.getCondaInfo(); @@ -745,7 +767,9 @@ suite('Interpreters Conda Service', () => { .setup((p) => p.exec(TypeMoq.It.isValue('conda'), TypeMoq.It.isValue(['--version']), TypeMoq.It.isAny())) .returns(() => Promise.resolve({ stdout: 'xyz' })); processService - .setup((p) => p.exec(TypeMoq.It.isValue('conda'), TypeMoq.It.isValue(['info', '--json']), TypeMoq.It.isAny())) + .setup((p) => + p.exec(TypeMoq.It.isValue('conda'), TypeMoq.It.isValue(['info', '--json']), TypeMoq.It.isAny()), + ) .returns(() => Promise.reject(new Error('unknown'))); const condaInfo = await condaService.getCondaInfo(); @@ -819,7 +843,9 @@ suite('Interpreters Conda Service', () => { .setup((p) => p.exec(TypeMoq.It.isValue('conda'), TypeMoq.It.isValue(['--version']), TypeMoq.It.isAny())) .returns(() => Promise.resolve({ stdout: 'xyz' })); processService - .setup((p) => p.exec(TypeMoq.It.isValue('conda'), TypeMoq.It.isValue(['info', '--json']), TypeMoq.It.isAny())) + .setup((p) => + p.exec(TypeMoq.It.isValue('conda'), TypeMoq.It.isValue(['info', '--json']), TypeMoq.It.isAny()), + ) .returns(() => Promise.reject(new Error('unknown'))); const condaInfo = await condaService.getCondaInfo(); @@ -1021,14 +1047,16 @@ suite('Interpreters Conda Service', () => { platformService.setup((p) => p.isWindows).returns(() => !t.isLinux); platformService.setup((p) => p.isMac).returns(() => false); fileSystem - .setup((f) => f.fileExists( - TypeMoq.It.is((p) => { - if (p === t.expectedCondaPath) { - return true; - } - return false; - }), - )) + .setup((f) => + f.fileExists( + TypeMoq.It.is((p) => { + if (p === t.expectedCondaPath) { + return true; + } + return false; + }), + ), + ) .returns(() => Promise.resolve(true)); const condaFile = await condaService.getCondaFileFromInterpreter(t.pythonPath, t.environmentName); @@ -1039,14 +1067,16 @@ suite('Interpreters Conda Service', () => { platformService.setup((p) => p.isWindows).returns(() => !t.isLinux); platformService.setup((p) => p.isMac).returns(() => false); fileSystem - .setup((f) => f.fileExists( - TypeMoq.It.is((p) => { - if (p === t.expectedCondaPath) { - return true; - } - return false; - }), - )) + .setup((f) => + f.fileExists( + TypeMoq.It.is((p) => { + if (p === t.expectedCondaPath) { + return true; + } + return false; + }), + ), + ) .returns(() => Promise.resolve(true)); const condaFile = await condaService.getCondaFileFromInterpreter(t.pythonPath, undefined); diff --git a/src/test/pythonEnvironments/discovery/locators/customVirtualEnvLocator.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/customVirtualEnvLocator.unit.test.ts index 8b5c052c16a9..63cb378c1d0e 100644 --- a/src/test/pythonEnvironments/discovery/locators/customVirtualEnvLocator.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/customVirtualEnvLocator.unit.test.ts @@ -7,12 +7,20 @@ import * as sinon from 'sinon'; import * as fsWatcher from '../../../../client/common/platform/fileSystemWatcher'; import * as platformUtils from '../../../../client/common/utils/platform'; import { - PythonEnvInfo, PythonEnvKind, PythonReleaseLevel, PythonVersion, UNKNOWN_PYTHON_VERSION, + PythonEnvInfo, + PythonEnvKind, + PythonReleaseLevel, + PythonVersion, + UNKNOWN_PYTHON_VERSION, } from '../../../../client/pythonEnvironments/base/info'; import { getEnvs } from '../../../../client/pythonEnvironments/base/locatorUtils'; import { PythonEnvsChangedEvent } from '../../../../client/pythonEnvironments/base/watcher'; import * as externalDependencies from '../../../../client/pythonEnvironments/common/externalDependencies'; -import { CustomVirtualEnvironmentLocator, VENVFOLDERS_SETTING_KEY, VENVPATH_SETTING_KEY } from '../../../../client/pythonEnvironments/discovery/locators/services/customVirtualEnvLocator'; +import { + CustomVirtualEnvironmentLocator, + VENVFOLDERS_SETTING_KEY, + VENVPATH_SETTING_KEY, +} from '../../../../client/pythonEnvironments/discovery/locators/services/customVirtualEnvLocator'; import { TEST_LAYOUT_ROOT } from '../../common/commonTestConstants'; import { assertEnvEqual, assertEnvsEqual } from './envTestUtils'; @@ -67,12 +75,27 @@ suite('CustomVirtualEnvironment Locator', () => { getOSTypeStub.returns(platformUtils.OSType.Linux); watchLocationForPatternStub = sinon.stub(fsWatcher, 'watchLocationForPattern'); - watchLocationForPatternStub.returns({ dispose: () => { /* do nothing */ } }); + watchLocationForPatternStub.returns({ + dispose: () => { + /* do nothing */ + }, + }); onDidChangePythonSettingStub = sinon.stub(externalDependencies, 'onDidChangePythonSetting'); - onDidChangePythonSettingStub.returns({ dispose: () => { /* do nothing */ } }); - - const expectedDotProjectFile = path.join(testVirtualHomeDir, '.local', 'share', 'virtualenvs', 'project2-vnNIWe9P', '.project'); + onDidChangePythonSettingStub.returns({ + dispose: () => { + /* do nothing */ + }, + }); + + const expectedDotProjectFile = path.join( + testVirtualHomeDir, + '.local', + 'share', + 'virtualenvs', + 'project2-vnNIWe9P', + '.project', + ); readFileStub = sinon.stub(externalDependencies, 'readFile'); readFileStub.withArgs(expectedDotProjectFile).returns(path.join(TEST_LAYOUT_ROOT, 'pipenv', 'project2')); readFileStub.callThrough(); @@ -91,11 +114,7 @@ suite('CustomVirtualEnvironment Locator', () => { test('iterEnvs(): Windows with both settings set', async () => { getPythonSettingStub.withArgs('venvPath').returns(testVenvPath); - getPythonSettingStub.withArgs('venvFolders').returns([ - '.venvs', - '.virtualenvs', - 'Envs', - ]); + getPythonSettingStub.withArgs('venvFolders').returns(['.venvs', '.virtualenvs', 'Envs']); getOSTypeStub.returns(platformUtils.OSType.Windows); const expectedEnvs = [ createExpectedEnvInfo( @@ -163,8 +182,9 @@ suite('CustomVirtualEnvironment Locator', () => { ].sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)) - .sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), + ); comparePaths(actualEnvs, expectedEnvs); assertEnvsEqual(actualEnvs, expectedEnvs); @@ -174,12 +194,9 @@ suite('CustomVirtualEnvironment Locator', () => { const testWorkspaceFolder = path.join(TEST_LAYOUT_ROOT, 'workspace', 'folder1'); getPythonSettingStub.withArgs('venvPath').returns(path.join(testWorkspaceFolder, 'posix2conda')); - getPythonSettingStub.withArgs('venvFolders').returns([ - '.venvs', - '.virtualenvs', - 'envs', - path.join('.local', 'share', 'virtualenvs'), - ]); + getPythonSettingStub + .withArgs('venvFolders') + .returns(['.venvs', '.virtualenvs', 'envs', path.join('.local', 'share', 'virtualenvs')]); const expectedEnvs = [ createExpectedEnvInfo( path.join(testWorkspaceFolder, 'posix2conda', 'python'), @@ -232,8 +249,9 @@ suite('CustomVirtualEnvironment Locator', () => { ].sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)) - .sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), + ); comparePaths(actualEnvs, expectedEnvs); assertEnvsEqual(actualEnvs, expectedEnvs); @@ -243,11 +261,7 @@ suite('CustomVirtualEnvironment Locator', () => { getUserHomeDirStub.returns(undefined); getPythonSettingStub.withArgs('venvPath').returns(testVenvPath); - getPythonSettingStub.withArgs('venvFolders').returns([ - '.venvs', - '.virtualenvs', - 'Envs', - ]); + getPythonSettingStub.withArgs('venvFolders').returns(['.venvs', '.virtualenvs', 'Envs']); getOSTypeStub.returns(platformUtils.OSType.Windows); const expectedEnvs = [ createExpectedEnvInfo( @@ -267,19 +281,16 @@ suite('CustomVirtualEnvironment Locator', () => { ].sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)) - .sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), + ); comparePaths(actualEnvs, expectedEnvs); assertEnvsEqual(actualEnvs, expectedEnvs); }); test('iterEnvs(): with only venvFolders set', async () => { - getPythonSettingStub.withArgs('venvFolders').returns([ - '.venvs', - '.virtualenvs', - 'Envs', - ]); + getPythonSettingStub.withArgs('venvFolders').returns(['.venvs', '.virtualenvs', 'Envs']); getOSTypeStub.returns(platformUtils.OSType.Windows); const expectedEnvs = [ createExpectedEnvInfo( @@ -333,8 +344,9 @@ suite('CustomVirtualEnvironment Locator', () => { ].sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)) - .sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), + ); comparePaths(actualEnvs, expectedEnvs); assertEnvsEqual(actualEnvs, expectedEnvs); @@ -355,8 +367,9 @@ suite('CustomVirtualEnvironment Locator', () => { ].sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)) - .sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), + ); comparePaths(actualEnvs, expectedEnvs); assertEnvsEqual(actualEnvs, expectedEnvs); diff --git a/src/test/pythonEnvironments/discovery/locators/envTestUtils.ts b/src/test/pythonEnvironments/discovery/locators/envTestUtils.ts index dd55f9a8d02d..c959e68c2207 100644 --- a/src/test/pythonEnvironments/discovery/locators/envTestUtils.ts +++ b/src/test/pythonEnvironments/discovery/locators/envTestUtils.ts @@ -5,11 +5,7 @@ import * as assert from 'assert'; import { exec } from 'child_process'; import { zip } from 'lodash'; import { promisify } from 'util'; -import { - PythonEnvInfo, - PythonVersion, - UNKNOWN_PYTHON_VERSION, -} from '../../../../client/pythonEnvironments/base/info'; +import { PythonEnvInfo, PythonVersion, UNKNOWN_PYTHON_VERSION } from '../../../../client/pythonEnvironments/base/info'; import { getEmptyVersion } from '../../../../client/pythonEnvironments/base/info/pythonVersion'; const execAsync = promisify(exec); diff --git a/src/test/pythonEnvironments/discovery/locators/globalVirtualEnvironmentLocator.testvirtualenvs.ts b/src/test/pythonEnvironments/discovery/locators/globalVirtualEnvironmentLocator.testvirtualenvs.ts index 09ce425ad93e..c3484788cec6 100644 --- a/src/test/pythonEnvironments/discovery/locators/globalVirtualEnvironmentLocator.testvirtualenvs.ts +++ b/src/test/pythonEnvironments/discovery/locators/globalVirtualEnvironmentLocator.testvirtualenvs.ts @@ -14,10 +14,7 @@ suite('GlobalVirtualEnvironment Locator', async () => { workonHomeOldValue = process.env.WORKON_HOME; process.env.WORKON_HOME = testWorkOnHomePath; }); - testLocatorWatcher( - testWorkOnHomePath, - async () => new GlobalVirtualEnvironmentLocator(), - ); + testLocatorWatcher(testWorkOnHomePath, async () => new GlobalVirtualEnvironmentLocator()); suiteTeardown(() => { process.env.WORKON_HOME = workonHomeOldValue; }); diff --git a/src/test/pythonEnvironments/discovery/locators/globalVirtualEnvironmentLocator.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/globalVirtualEnvironmentLocator.unit.test.ts index 4590daf8eff1..1465ba07c550 100644 --- a/src/test/pythonEnvironments/discovery/locators/globalVirtualEnvironmentLocator.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/globalVirtualEnvironmentLocator.unit.test.ts @@ -7,7 +7,11 @@ import * as sinon from 'sinon'; import * as fsWatcher from '../../../../client/common/platform/fileSystemWatcher'; import * as platformUtils from '../../../../client/common/utils/platform'; import { - PythonEnvInfo, PythonEnvKind, PythonReleaseLevel, PythonVersion, UNKNOWN_PYTHON_VERSION + PythonEnvInfo, + PythonEnvKind, + PythonReleaseLevel, + PythonVersion, + UNKNOWN_PYTHON_VERSION, } from '../../../../client/pythonEnvironments/base/info'; import { getEnvs } from '../../../../client/pythonEnvironments/base/locatorUtils'; import * as externalDependencies from '../../../../client/pythonEnvironments/common/externalDependencies'; @@ -67,9 +71,20 @@ suite('GlobalVirtualEnvironment Locator', () => { getOSTypeStub.returns(platformUtils.OSType.Linux); watchLocationForPatternStub = sinon.stub(fsWatcher, 'watchLocationForPattern'); - watchLocationForPatternStub.returns({ dispose: () => { /* do nothing */ } }); - - const expectedDotProjectFile = path.join(testVirtualHomeDir, '.local', 'share', 'virtualenvs', 'project2-vnNIWe9P', '.project'); + watchLocationForPatternStub.returns({ + dispose: () => { + /* do nothing */ + }, + }); + + const expectedDotProjectFile = path.join( + testVirtualHomeDir, + '.local', + 'share', + 'virtualenvs', + 'project2-vnNIWe9P', + '.project', + ); readFileStub = sinon.stub(externalDependencies, 'readFile'); readFileStub.withArgs(expectedDotProjectFile).returns(path.join(TEST_LAYOUT_ROOT, 'pipenv', 'project2')); readFileStub.callThrough(); @@ -152,8 +167,9 @@ suite('GlobalVirtualEnvironment Locator', () => { locator = new GlobalVirtualEnvironmentLocator(); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)) - .sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), + ); comparePaths(actualEnvs, expectedEnvs); assertEnvsEqual(actualEnvs, expectedEnvs); @@ -215,8 +231,9 @@ suite('GlobalVirtualEnvironment Locator', () => { locator = new GlobalVirtualEnvironmentLocator(); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)) - .sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), + ); comparePaths(actualEnvs, expectedEnvs); assertEnvsEqual(actualEnvs, expectedEnvs); @@ -283,8 +300,9 @@ suite('GlobalVirtualEnvironment Locator', () => { locator = new GlobalVirtualEnvironmentLocator(); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)) - .sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), + ); comparePaths(actualEnvs, expectedEnvs); assertEnvsEqual(actualEnvs, expectedEnvs); @@ -317,8 +335,9 @@ suite('GlobalVirtualEnvironment Locator', () => { locator = new GlobalVirtualEnvironmentLocator(1); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)) - .sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), + ); comparePaths(actualEnvs, expectedEnvs); assertEnvsEqual(actualEnvs, expectedEnvs); @@ -372,8 +391,9 @@ suite('GlobalVirtualEnvironment Locator', () => { locator = new GlobalVirtualEnvironmentLocator(); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)) - .sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), + ); comparePaths(actualEnvs, expectedEnvs); assertEnvsEqual(actualEnvs, expectedEnvs); @@ -400,8 +420,9 @@ suite('GlobalVirtualEnvironment Locator', () => { locator = new GlobalVirtualEnvironmentLocator(); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)) - .sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), + ); comparePaths(actualEnvs, expectedEnvs); assertEnvsEqual(actualEnvs, expectedEnvs); @@ -429,8 +450,9 @@ suite('GlobalVirtualEnvironment Locator', () => { locator = new GlobalVirtualEnvironmentLocator(2); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)) - .sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), + ); comparePaths(actualEnvs, expectedEnvs); assertEnvsEqual(actualEnvs, expectedEnvs); diff --git a/src/test/pythonEnvironments/discovery/locators/hasProviderFactory.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/hasProviderFactory.unit.test.ts index 9a0923a05ffb..73bafdd1ce4d 100644 --- a/src/test/pythonEnvironments/discovery/locators/hasProviderFactory.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/hasProviderFactory.unit.test.ts @@ -7,9 +7,7 @@ import { expect, use } from 'chai'; import * as chaiAsPromised from 'chai-as-promised'; -import { - instance, mock, verify, when, -} from 'ts-mockito'; +import { instance, mock, verify, when } from 'ts-mockito'; import { Uri } from 'vscode'; import { ConfigurationService } from '../../../../client/common/configuration/service'; import { IConfigurationService } from '../../../../client/common/types'; diff --git a/src/test/pythonEnvironments/discovery/locators/hashProvider.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/hashProvider.unit.test.ts index aeebbc08b678..51b6ea5ba463 100644 --- a/src/test/pythonEnvironments/discovery/locators/hashProvider.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/hashProvider.unit.test.ts @@ -7,9 +7,7 @@ import { expect, use } from 'chai'; import * as chaiAsPromised from 'chai-as-promised'; -import { - instance, mock, verify, when, -} from 'ts-mockito'; +import { instance, mock, verify, when } from 'ts-mockito'; import { FileSystem } from '../../../../client/common/platform/fileSystem'; import { IFileSystem } from '../../../../client/common/platform/types'; import { InterpreterHashProvider } from '../../../../client/pythonEnvironments/discovery/locators/services/hashProvider'; diff --git a/src/test/pythonEnvironments/discovery/locators/helpers.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/helpers.unit.test.ts index 248962b43ccb..a8bd9f01c3b2 100644 --- a/src/test/pythonEnvironments/discovery/locators/helpers.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/helpers.unit.test.ts @@ -8,9 +8,7 @@ import { expect } from 'chai'; import * as path from 'path'; import { SemVer } from 'semver'; -import { - anything, instance, mock, when, -} from 'ts-mockito'; +import { anything, instance, mock, when } from 'ts-mockito'; import * as TypeMoq from 'typemoq'; import { IFileSystem, IPlatformService } from '../../../../client/common/platform/types'; import { getNamesAndValues } from '../../../../client/common/utils/enum'; @@ -25,7 +23,7 @@ import { EnvironmentType, PythonEnvironment } from '../../../../client/pythonEnv enum OS { Windows = 'Windows', Linux = 'Linux', - Mac = 'Mac' + Mac = 'Mac', } suite('Interpreters - Locators Helper', () => { diff --git a/src/test/pythonEnvironments/discovery/locators/index.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/index.unit.test.ts index c6d06f8c0710..2c09194da0ee 100644 --- a/src/test/pythonEnvironments/discovery/locators/index.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/index.unit.test.ts @@ -37,13 +37,7 @@ import { WorkspaceLocators, } from '../../../../client/pythonEnvironments/discovery/locators'; import { EnvironmentType, PythonEnvironment } from '../../../../client/pythonEnvironments/info'; -import { - assertSameEnvs, - createLocatedEnv, - createNamedEnv, - getEnvs, - SimpleLocator, -} from '../../base/common'; +import { assertSameEnvs, createLocatedEnv, createNamedEnv, getEnvs, SimpleLocator } from '../../base/common'; class WorkspaceFolders { public added = new EventEmitter(); @@ -92,12 +86,7 @@ suite('WorkspaceLocators', () => { const env1 = createNamedEnv('foo', '3.8.1', PythonEnvKind.Venv); const loc1 = new SimpleLocator([env1]); const folders = new WorkspaceFolders([]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - () => [loc1], - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [() => [loc1]]); await ensureActivated(locators); const events: PythonEnvsChangedEvent[] = []; locators.onChanged((e) => events.push(e)); @@ -149,14 +138,11 @@ suite('WorkspaceLocators', () => { const loc5 = new SimpleLocator([]); const loc6 = new SimpleLocator([]); const folders = new WorkspaceFolders([root1, root2]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - (r) => (r === root1 ? [loc1] : [loc2]), - (r) => (r === root1 ? [loc3] : [loc4, loc5]), - (r) => (r === root1 ? [loc6] : []), - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [ + (r) => (r === root1 ? [loc1] : [loc2]), + (r) => (r === root1 ? [loc3] : [loc4, loc5]), + (r) => (r === root1 ? [loc6] : []), + ]); await ensureActivated(locators); const events: PythonEnvsChangedEvent[] = []; locators.onChanged((e) => events.push(e)); @@ -188,9 +174,7 @@ suite('WorkspaceLocators', () => { test('identifies added roots', async () => { const added = Uri.file('baz'); - const expected: PythonEnvsChangedEvent[] = [ - { searchLocation: added }, - ]; + const expected: PythonEnvsChangedEvent[] = [{ searchLocation: added }]; const folders = new WorkspaceFolders(['foo', 'bar']); const locators = new WorkspaceLocators(folders.getRootsWatcher(), []); await ensureActivated(locators); @@ -207,9 +191,7 @@ suite('WorkspaceLocators', () => { const root2 = Uri.file('bar'); // Force r._formatted to be set. [root1, root2].forEach((r) => r.toString()); - const expected: PythonEnvsChangedEvent[] = [ - { searchLocation: root2 }, - ]; + const expected: PythonEnvsChangedEvent[] = [{ searchLocation: root2 }]; const folders = new WorkspaceFolders([root1, root2]); const locators = new WorkspaceLocators(folders.getRootsWatcher(), []); await ensureActivated(locators); @@ -237,12 +219,7 @@ suite('WorkspaceLocators', () => { const loc1 = new SimpleLocator([]); const loc2 = new SimpleLocator([]); const folders = new WorkspaceFolders([root1, root2]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - (r) => (r === root1 ? [loc1] : [loc2]), - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [(r) => (r === root1 ? [loc1] : [loc2])]); await ensureActivated(locators); const events: PythonEnvsChangedEvent[] = []; locators.onChanged((e) => events.push(e)); @@ -263,12 +240,7 @@ suite('WorkspaceLocators', () => { const env1 = createNamedEnv('foo', '3.8.1', PythonEnvKind.Venv); const loc1 = new SimpleLocator([env1]); const folders = new WorkspaceFolders([]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - () => [loc1], - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [() => [loc1]]); await ensureActivated(locators); const iterators = locators.iterEnvs(); @@ -294,12 +266,7 @@ suite('WorkspaceLocators', () => { const expected: PythonEnvInfo[] = []; const loc1 = new SimpleLocator([]); const folders = new WorkspaceFolders([root1]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - () => [loc1], - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [() => [loc1]]); await ensureActivated(locators); const iterators = locators.iterEnvs(); @@ -314,12 +281,7 @@ suite('WorkspaceLocators', () => { const expected: PythonEnvInfo[] = [env1]; const loc1 = new SimpleLocator([env1]); const folders = new WorkspaceFolders([root1]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - () => [loc1], - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [() => [loc1]]); await ensureActivated(locators); const iterators = locators.iterEnvs(); @@ -337,12 +299,7 @@ suite('WorkspaceLocators', () => { const loc2 = new SimpleLocator([], { before: loc1.done }); const loc3 = new SimpleLocator([env2], { before: loc2.done }); const folders = new WorkspaceFolders([root1]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - () => [loc1, loc2, loc3], - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [() => [loc1, loc2, loc3]]); await ensureActivated(locators); const iterators = locators.iterEnvs(); @@ -368,13 +325,10 @@ suite('WorkspaceLocators', () => { const loc3 = new SimpleLocator([env5, env6], { before: loc2.done }); const loc4 = new SimpleLocator([env7, env8], { before: loc3.done }); const folders = new WorkspaceFolders([root1, root2]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - (r) => (r === root1 ? [loc1] : [loc3]), - (r) => (r === root1 ? [loc2] : [loc4]), - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [ + (r) => (r === root1 ? [loc1] : [loc3]), + (r) => (r === root1 ? [loc2] : [loc4]), + ]); await ensureActivated(locators); const iterators = locators.iterEnvs(); @@ -396,13 +350,10 @@ suite('WorkspaceLocators', () => { const loc3 = new SimpleLocator([env3], { before: loc2.done }); const loc4 = new SimpleLocator([env4], { before: loc3.done }); const folders = new WorkspaceFolders([root1, root2]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - (r) => (r === root1 ? [loc1] : [loc3]), - (r) => (r === root1 ? [loc2] : [loc4]), - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [ + (r) => (r === root1 ? [loc1] : [loc3]), + (r) => (r === root1 ? [loc2] : [loc4]), + ]); await ensureActivated(locators); const query = { searchLocations: { roots: [root1] } }; @@ -425,13 +376,10 @@ suite('WorkspaceLocators', () => { const loc3 = new SimpleLocator([env3], { before: loc2.done }); const loc4 = new SimpleLocator([env4], { before: loc3.done }); const folders = new WorkspaceFolders([root1, root2]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - (r) => (r === root1 ? [loc1] : [loc3]), - (r) => (r === root1 ? [loc2] : [loc4]), - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [ + (r) => (r === root1 ? [loc1] : [loc3]), + (r) => (r === root1 ? [loc2] : [loc4]), + ]); await ensureActivated(locators); const query = { searchLocations: { roots: [root1, root2] } }; @@ -453,13 +401,10 @@ suite('WorkspaceLocators', () => { const loc3 = new SimpleLocator([env3], { before: loc2.done }); const loc4 = new SimpleLocator([env4], { before: loc3.done }); const folders = new WorkspaceFolders([root1, root2]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - (r) => (r === root1 ? [loc1] : [loc3]), - (r) => (r === root1 ? [loc2] : [loc4]), - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [ + (r) => (r === root1 ? [loc1] : [loc3]), + (r) => (r === root1 ? [loc2] : [loc4]), + ]); await ensureActivated(locators); const query = { searchLocations: { roots: [Uri.file('baz')] } }; @@ -482,13 +427,10 @@ suite('WorkspaceLocators', () => { const loc3 = new SimpleLocator([env3], { before: loc2.done }); const loc4 = new SimpleLocator([env4], { before: loc3.done }); const folders = new WorkspaceFolders([root1, root2]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - (r) => (r === root1 ? [loc1] : [loc3]), - (r) => (r === root1 ? [loc2] : [loc4]), - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [ + (r) => (r === root1 ? [loc1] : [loc3]), + (r) => (r === root1 ? [loc2] : [loc4]), + ]); await ensureActivated(locators); const iterators = locators.iterEnvs({ kinds: [PythonEnvKind.Unknown] }); @@ -514,13 +456,10 @@ suite('WorkspaceLocators', () => { const loc2 = new SimpleLocator([env3, env4], { before: loc1.done }); const loc4 = new SimpleLocator([env7, env8], { before: loc2.done }); const folders = new WorkspaceFolders([root1, root2]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - (r) => (r === root1 ? [loc1] : [loc3]), - (r) => (r === root1 ? [loc2] : [loc4]), - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [ + (r) => (r === root1 ? [loc1] : [loc3]), + (r) => (r === root1 ? [loc2] : [loc4]), + ]); await ensureActivated(locators); const iterators = locators.iterEnvs(); @@ -569,13 +508,10 @@ suite('WorkspaceLocators', () => { const loc3 = new SimpleLocator([env5, env6], { beforeEach, afterEach }); const loc4 = new SimpleLocator([env7, env8], { beforeEach, afterEach }); const folders = new WorkspaceFolders([root1, root2]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - (r) => (r === root1 ? [loc1] : [loc3]), - (r) => (r === root1 ? [loc2] : [loc4]), - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [ + (r) => (r === root1 ? [loc1] : [loc3]), + (r) => (r === root1 ? [loc2] : [loc4]), + ]); await ensureActivated(locators); const iterator = locators.iterEnvs(); @@ -601,13 +537,10 @@ suite('WorkspaceLocators', () => { const loc3 = new SimpleLocator([env5, env6], { before: loc2.done }); const loc4 = new SimpleLocator([env7, env8], { before: loc3.done }); const folders = new WorkspaceFolders([root1, root2]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - (r) => (r === root1 ? [loc1] : [loc3]), - (r) => (r === root1 ? [loc2] : [loc4]), - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [ + (r) => (r === root1 ? [loc1] : [loc3]), + (r) => (r === root1 ? [loc2] : [loc4]), + ]); const iterator = locators.iterEnvs(); const envs = await getEnvs(iterator); @@ -632,13 +565,10 @@ suite('WorkspaceLocators', () => { const loc3 = new SimpleLocator([env5, env6], { before: loc2.done }); const loc4 = new SimpleLocator([env7, env8], { before: loc3.done }); const folders = new WorkspaceFolders([]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - (r) => (r === root1 ? [loc1] : [loc3]), - (r) => (r === root1 ? [loc2] : [loc4]), - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [ + (r) => (r === root1 ? [loc1] : [loc3]), + (r) => (r === root1 ? [loc2] : [loc4]), + ]); await ensureActivated(locators); const iteratorBefore = locators.iterEnvs(); @@ -670,13 +600,10 @@ suite('WorkspaceLocators', () => { const loc3 = new SimpleLocator([env5, env6], { before: loc2.done }); const loc4 = new SimpleLocator([env7, env8], { before: loc3.done }); const folders = new WorkspaceFolders([root1, root2]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - (r) => (r === root1 ? [loc1] : [loc3]), - (r) => (r === root1 ? [loc2] : [loc4]), - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [ + (r) => (r === root1 ? [loc1] : [loc3]), + (r) => (r === root1 ? [loc2] : [loc4]), + ]); await ensureActivated(locators); const iteratorBefore = locators.iterEnvs(); @@ -702,12 +629,7 @@ suite('WorkspaceLocators', () => { const env1 = createNamedEnv('foo', '3.8.1', PythonEnvKind.Venv); const loc1 = new SimpleLocator([env1]); const folders = new WorkspaceFolders([]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - () => [loc1], - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [() => [loc1]]); await ensureActivated(locators); const resolved = await locators.resolveEnv(env1); @@ -731,12 +653,7 @@ suite('WorkspaceLocators', () => { const env1 = createNamedEnv('foo', '3.8.1', PythonEnvKind.Venv); const loc1 = new SimpleLocator([env1], { resolve: null }); const folders = new WorkspaceFolders([root1]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - () => [loc1], - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [() => [loc1]]); await ensureActivated(locators); const resolved = await locators.resolveEnv(env1); @@ -750,12 +667,7 @@ suite('WorkspaceLocators', () => { const expected = env1; const loc1 = new SimpleLocator([env1]); const folders = new WorkspaceFolders([root1]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - () => [loc1], - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [() => [loc1]]); await ensureActivated(locators); const resolved = await locators.resolveEnv(env1); @@ -771,12 +683,7 @@ suite('WorkspaceLocators', () => { const loc1 = new SimpleLocator([env1], { resolve: getResolver(seen, 1) }); const loc2 = new SimpleLocator([], { resolve: getResolver(seen, 2) }); const folders = new WorkspaceFolders([root1]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - () => [loc1, loc2], - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [() => [loc1, loc2]]); await ensureActivated(locators); const resolved = await locators.resolveEnv(env1); @@ -793,12 +700,7 @@ suite('WorkspaceLocators', () => { const loc1 = new SimpleLocator([env1], { resolve: getResolver(seen, 1, false) }); const loc2 = new SimpleLocator([], { resolve: getResolver(seen, 2) }); const folders = new WorkspaceFolders([root1]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - () => [loc1, loc2], - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [() => [loc1, loc2]]); await ensureActivated(locators); const resolved = await locators.resolveEnv(env1); @@ -814,12 +716,7 @@ suite('WorkspaceLocators', () => { const loc1 = new SimpleLocator([env1], { resolve: getResolver(seen, 1, false) }); const loc2 = new SimpleLocator([], { resolve: getResolver(seen, 2, false) }); const folders = new WorkspaceFolders([root1]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - () => [loc1, loc2], - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [() => [loc1, loc2]]); await ensureActivated(locators); const resolved = await locators.resolveEnv(env1); @@ -837,12 +734,7 @@ suite('WorkspaceLocators', () => { const loc1 = new SimpleLocator([env1], { resolve: getResolver(seen, 1, false) }); const loc2 = new SimpleLocator([], { resolve: getResolver(seen, 2) }); const folders = new WorkspaceFolders([root1, root2]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - (r) => (r === root1 ? [loc1] : [loc2]), - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [(r) => (r === root1 ? [loc1] : [loc2])]); await ensureActivated(locators); const resolved = await locators.resolveEnv(env1); @@ -861,12 +753,7 @@ suite('WorkspaceLocators', () => { const loc1 = new SimpleLocator([], { resolve: getResolver(seen, 1) }); const loc2 = new SimpleLocator([], { resolve: getResolver(seen, 2) }); const folders = new WorkspaceFolders([root1, root2]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - (r) => (r === root1 ? [loc1] : [loc2]), - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [(r) => (r === root1 ? [loc1] : [loc2])]); await ensureActivated(locators); const resolved = await locators.resolveEnv(env1); @@ -885,12 +772,7 @@ suite('WorkspaceLocators', () => { const loc1 = new SimpleLocator([env1], { resolve: getResolver(seen, 1) }); const loc2 = new SimpleLocator([], { resolve: getResolver(seen, 2) }); const folders = new WorkspaceFolders([root1, root2]); - const locators = new WorkspaceLocators( - folders.getRootsWatcher(), - [ - (r) => (r === root1 ? [loc1] : [loc2]), - ], - ); + const locators = new WorkspaceLocators(folders.getRootsWatcher(), [(r) => (r === root1 ? [loc1] : [loc2])]); await ensureActivated(locators); const resolved = await locators.resolveEnv(env1); @@ -968,8 +850,8 @@ suite('Interpreters - Locators Index', () => { .verifiable(TypeMoq.Times.once()); serviceContainer - .setup( - (c) => c.get(TypeMoq.It.isValue(IInterpreterLocatorService), TypeMoq.It.isValue(typeName)), + .setup((c) => + c.get(TypeMoq.It.isValue(IInterpreterLocatorService), TypeMoq.It.isValue(typeName)), ) .returns(() => typeLocator.object); @@ -1031,8 +913,8 @@ suite('Interpreters - Locators Index', () => { .verifiable(TypeMoq.Times.once()); serviceContainer - .setup( - (c) => c.get(TypeMoq.It.isValue(IInterpreterLocatorService), TypeMoq.It.isValue(typeName)), + .setup((c) => + c.get(TypeMoq.It.isValue(IInterpreterLocatorService), TypeMoq.It.isValue(typeName)), ) .returns(() => typeLocator.object); @@ -1097,8 +979,8 @@ suite('Interpreters - Locators Index', () => { .verifiable(TypeMoq.Times.once()); serviceContainer - .setup( - (c) => c.get(TypeMoq.It.isValue(IInterpreterLocatorService), TypeMoq.It.isValue(typeName)), + .setup((c) => + c.get(TypeMoq.It.isValue(IInterpreterLocatorService), TypeMoq.It.isValue(typeName)), ) .returns(() => typeLocator.object); @@ -1115,9 +997,11 @@ suite('Interpreters - Locators Index', () => { await locator.getInterpreters(resource, { onSuggestion: true }); - locatorsWithInterpreters.forEach((item) => item.locator.verify( - (l) => { l.didTriggerInterpreterSuggestions = true; }, TypeMoq.Times.once(), - )); + locatorsWithInterpreters.forEach((item) => + item.locator.verify((l) => { + l.didTriggerInterpreterSuggestions = true; + }, TypeMoq.Times.once()), + ); expect(locator.didTriggerInterpreterSuggestions).to.equal( true, 'didTriggerInterpreterSuggestions should be set to true.', diff --git a/src/test/pythonEnvironments/discovery/locators/interpreterFilter.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/interpreterFilter.unit.test.ts index f32e4e7d4138..3cdc6d3de800 100644 --- a/src/test/pythonEnvironments/discovery/locators/interpreterFilter.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/interpreterFilter.unit.test.ts @@ -47,7 +47,9 @@ suite('Interpreters - Filter', () => { test(`Interpreter path should NOT be hidden - ${interpreterPath}`, () => { const interpreter: PythonEnvironment = getInterpreterFromPath(interpreterPath); // tslint:disable-next-line: chai-vague-errors - expect(isHiddenInterpreter(interpreter), `${interpreterPath} should NOT be treated as hidden.`).to.equal(false); + expect(isHiddenInterpreter(interpreter), `${interpreterPath} should NOT be treated as hidden.`).to.equal( + false, + ); }); }); hideThesePaths.forEach((interpreterPath) => { diff --git a/src/test/pythonEnvironments/discovery/locators/interpreterWatcherBuilder.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/interpreterWatcherBuilder.unit.test.ts index 3d21f5d228cb..74cef5c13c13 100644 --- a/src/test/pythonEnvironments/discovery/locators/interpreterWatcherBuilder.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/interpreterWatcherBuilder.unit.test.ts @@ -6,9 +6,7 @@ // tslint:disable:no-any max-classes-per-file max-func-body-length import { expect } from 'chai'; -import { - anything, instance, mock, when, -} from 'ts-mockito'; +import { anything, instance, mock, when } from 'ts-mockito'; import { WorkspaceService } from '../../../../client/common/application/workspace'; import { IInterpreterWatcher, WORKSPACE_VIRTUAL_ENV_SERVICE } from '../../../../client/interpreter/contracts'; import { ServiceContainer } from '../../../../client/ioc/container'; diff --git a/src/test/pythonEnvironments/discovery/locators/knownPathService.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/knownPathService.unit.test.ts index 0903efaa4a3c..b779ab7a9bb7 100644 --- a/src/test/pythonEnvironments/discovery/locators/knownPathService.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/knownPathService.unit.test.ts @@ -45,9 +45,7 @@ suite('Interpreters Known Paths', () => { pathUtils.setup((p) => p.delimiter).returns(() => pathDelimiter); platformService.setup((p) => p.isWindows).returns(() => true); platformService.setup((p) => p.pathVariableName).returns(() => 'PATH'); - currentProcess - .setup((p) => p.env) - .returns(() => ({ PATH: pathsInPATHVar.join(pathDelimiter) })); + currentProcess.setup((p) => p.env).returns(() => ({ PATH: pathsInPATHVar.join(pathDelimiter) })); const expectedPaths = [...pathsInPATHVar].filter((item) => item.length > 0); @@ -63,9 +61,7 @@ suite('Interpreters Known Paths', () => { pathUtils.setup((p) => p.home).returns(() => homeDir); platformService.setup((p) => p.isWindows).returns(() => false); platformService.setup((p) => p.pathVariableName).returns(() => 'PATH'); - currentProcess - .setup((p) => p.env) - .returns(() => ({ PATH: '' })); + currentProcess.setup((p) => p.env).returns(() => ({ PATH: '' })); const expectedPaths: string[] = []; ['/usr/local/bin', '/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/sbin'].forEach((p) => { @@ -89,9 +85,7 @@ suite('Interpreters Known Paths', () => { pathUtils.setup((p) => p.home).returns(() => homeDir); platformService.setup((p) => p.isWindows).returns(() => false); platformService.setup((p) => p.pathVariableName).returns(() => 'PATH'); - currentProcess - .setup((p) => p.env) - .returns(() => ({ PATH: pathsInPATHVar.join(pathDelimiter) })); + currentProcess.setup((p) => p.env).returns(() => ({ PATH: pathsInPATHVar.join(pathDelimiter) })); const expectedPaths = [...pathsInPATHVar].filter((item) => item.length > 0); ['/usr/local/bin', '/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/sbin'].forEach((p) => { diff --git a/src/test/pythonEnvironments/discovery/locators/pipEnvHelper.functional.test.ts b/src/test/pythonEnvironments/discovery/locators/pipEnvHelper.functional.test.ts index 1d2855ad5f56..ed5e8e657977 100644 --- a/src/test/pythonEnvironments/discovery/locators/pipEnvHelper.functional.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/pipEnvHelper.functional.test.ts @@ -21,10 +21,23 @@ suite('Pipenv utils', () => { test('Global pipenv environment is associated with a project whose Pipfile lies at 3 levels above the project', async () => { getEnvVar.withArgs('PIPENV_MAX_DEPTH').returns('5'); - const expectedDotProjectFile = path.join(TEST_LAYOUT_ROOT, 'pipenv', 'globalEnvironments', 'project3-2s1eXEJ2', '.project'); + const expectedDotProjectFile = path.join( + TEST_LAYOUT_ROOT, + 'pipenv', + 'globalEnvironments', + 'project3-2s1eXEJ2', + '.project', + ); const project = path.join(TEST_LAYOUT_ROOT, 'pipenv', 'project3'); readFile.withArgs(expectedDotProjectFile).resolves(project); - const interpreterPath: string = path.join(TEST_LAYOUT_ROOT, 'pipenv', 'globalEnvironments', 'project3-2s1eXEJ2', 'Scripts', 'python.exe'); + const interpreterPath: string = path.join( + TEST_LAYOUT_ROOT, + 'pipenv', + 'globalEnvironments', + 'project3-2s1eXEJ2', + 'Scripts', + 'python.exe', + ); const folder = path.join(project, 'parent', 'child', 'folder'); const isRelated = await isPipenvEnvironmentRelatedToFolder(interpreterPath, folder); diff --git a/src/test/pythonEnvironments/discovery/locators/pipEnvHelper.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/pipEnvHelper.unit.test.ts index 56718b06f799..1b75e598fc47 100644 --- a/src/test/pythonEnvironments/discovery/locators/pipEnvHelper.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/pipEnvHelper.unit.test.ts @@ -3,7 +3,11 @@ import * as pathModule from 'path'; import * as sinon from 'sinon'; import * as platformApis from '../../../../client/common/utils/platform'; import * as externalDependencies from '../../../../client/pythonEnvironments/common/externalDependencies'; -import { _getAssociatedPipfile, isPipenvEnvironment, isPipenvEnvironmentRelatedToFolder } from '../../../../client/pythonEnvironments/discovery/locators/services/pipEnvHelper'; +import { + _getAssociatedPipfile, + isPipenvEnvironment, + isPipenvEnvironmentRelatedToFolder, +} from '../../../../client/pythonEnvironments/discovery/locators/services/pipEnvHelper'; const path = platformApis.getOSType() === platformApis.OSType.Windows ? pathModule.win32 : pathModule.posix; @@ -170,7 +174,7 @@ suite('Pipenv helper', () => { assert.equal(result, false); }); - test('If not local & the name of the project isn\'t used as a prefix in the environment folder, return false', async () => { + test("If not local & the name of the project isn't used as a prefix in the environment folder, return false", async () => { const interpreterPath = path.join('environments', 'project-2s1eXEJ2', 'Scripts', 'python.exe'); // The project name (someProjectName) isn't used as a prefix in environment folder name (project-2s1eXEJ2) const project = path.join('path', 'to', 'someProjectName'); diff --git a/src/test/pythonEnvironments/discovery/locators/pipEnvService.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/pipEnvService.unit.test.ts index e03d9fa806e2..e70a418416e0 100644 --- a/src/test/pythonEnvironments/discovery/locators/pipEnvService.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/pipEnvService.unit.test.ts @@ -10,9 +10,7 @@ import { expect } from 'chai'; import * as path from 'path'; import { SemVer } from 'semver'; import * as sinon from 'sinon'; -import { - anything, instance, mock, when, -} from 'ts-mockito'; +import { anything, instance, mock, when } from 'ts-mockito'; import * as TypeMoq from 'typemoq'; import { Uri, WorkspaceFolder } from 'vscode'; import { IApplicationShell, IWorkspaceService } from '../../../../client/common/application/types'; @@ -38,7 +36,7 @@ import { EventName } from '../../../../client/telemetry/constants'; enum OS { Mac, Windows, - Linux + Linux, } suite('Interpreters - PipEnv', () => { @@ -174,12 +172,15 @@ suite('Interpreters - PipEnv', () => { const env = {}; currentProcess.setup((c) => c.env).returns(() => env); processService - .setup((p) => p.exec(TypeMoq.It.isValue('pipenv'), TypeMoq.It.isValue(['--version']), TypeMoq.It.isAny())) + .setup((p) => + p.exec(TypeMoq.It.isValue('pipenv'), TypeMoq.It.isValue(['--version']), TypeMoq.It.isAny()), + ) .returns(() => Promise.reject(new Error())); fileSystem .setup((fs) => fs.fileExists(TypeMoq.It.isValue(path.join(rootWorkspace, 'Pipfile')))) .returns(() => Promise.resolve(true)); - const warningMessage = "Workspace contains Pipfile but 'pipenv' was not found. Make sure 'pipenv' is on the PATH."; + const warningMessage = + "Workspace contains Pipfile but 'pipenv' was not found. Make sure 'pipenv' is on the PATH."; appShell .setup((a) => a.showWarningMessage(warningMessage)) .returns(() => Promise.resolve('')) @@ -193,15 +194,20 @@ suite('Interpreters - PipEnv', () => { const env = {}; currentProcess.setup((c) => c.env).returns(() => env); processService - .setup((p) => p.exec(TypeMoq.It.isValue('pipenv'), TypeMoq.It.isValue(['--version']), TypeMoq.It.isAny())) + .setup((p) => + p.exec(TypeMoq.It.isValue('pipenv'), TypeMoq.It.isValue(['--version']), TypeMoq.It.isAny()), + ) .returns(() => Promise.resolve({ stderr: '', stdout: 'pipenv, version 2018.11.26' })); processService - .setup((p) => p.exec(TypeMoq.It.isValue('pipenv'), TypeMoq.It.isValue(['--venv']), TypeMoq.It.isAny())) + .setup((p) => + p.exec(TypeMoq.It.isValue('pipenv'), TypeMoq.It.isValue(['--venv']), TypeMoq.It.isAny()), + ) .returns(() => Promise.resolve({ stderr: 'Aborted!', stdout: '' })); fileSystem .setup((fs) => fs.fileExists(TypeMoq.It.isValue(path.join(rootWorkspace, 'Pipfile')))) .returns(() => Promise.resolve(true)); - const warningMessage = 'Workspace contains Pipfile but the associated virtual environment has not been setup. Setup the virtual environment manually if needed.'; + const warningMessage = + 'Workspace contains Pipfile but the associated virtual environment has not been setup. Setup the virtual environment manually if needed.'; appShell .setup((a) => a.showWarningMessage(warningMessage)) .returns(() => Promise.resolve('')) diff --git a/src/test/pythonEnvironments/discovery/locators/posixKnownPathsLocator.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/posixKnownPathsLocator.unit.test.ts index d6da87df4dfe..3fe80984281f 100644 --- a/src/test/pythonEnvironments/discovery/locators/posixKnownPathsLocator.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/posixKnownPathsLocator.unit.test.ts @@ -6,7 +6,10 @@ import * as sinon from 'sinon'; import * as executablesAPI from '../../../../client/common/utils/exec'; import { Architecture } from '../../../../client/common/utils/platform'; import { - PythonEnvInfo, PythonEnvKind, PythonReleaseLevel, PythonVersion, + PythonEnvInfo, + PythonEnvKind, + PythonReleaseLevel, + PythonVersion, } from '../../../../client/pythonEnvironments/base/info'; import { InterpreterInformation } from '../../../../client/pythonEnvironments/base/info/interpreter'; import { parseVersion } from '../../../../client/pythonEnvironments/base/info/pythonVersion'; @@ -25,7 +28,7 @@ suite('Posix Known Path Locator', () => { const testLocation2 = path.join(testPosixKnownPathsRoot, 'location2'); const testLocation3 = path.join(testPosixKnownPathsRoot, 'location3'); - const testFileData:Map = new Map(); + const testFileData: Map = new Map(); testFileData.set(testLocation1, ['python', 'python3']); testFileData.set(testLocation2, ['python', 'python37', 'python38']); @@ -35,9 +38,9 @@ suite('Posix Known Path Locator', () => { executable: string, sysVersion?: string, sysPrefix?: string, - versionStr?:string, + versionStr?: string, ): InterpreterInformation { - let version:PythonVersion; + let version: PythonVersion; try { version = parseVersion(versionStr ?? path.basename(executable)); if (sysVersion) { @@ -76,7 +79,7 @@ suite('Posix Known Path Locator', () => { const testLocations = [testLocation1, testLocation2, testLocation3]; getPathEnvVar.returns(testLocations); - const envs:PythonEnvInfo[] = []; + const envs: PythonEnvInfo[] = []; testLocations.forEach((location) => { const binaries = testFileData.get(location); if (binaries) { @@ -116,7 +119,6 @@ suite('Posix Known Path Locator', () => { test('resolveEnv(PythonEnvInfo)', async () => { const pythonPath = path.join(testLocation1, 'python'); const expected = { - name: '', location: '', kind: PythonEnvKind.OtherGlobal, @@ -125,7 +127,7 @@ suite('Posix Known Path Locator', () => { }; // Partially filled in env info object - const input:PythonEnvInfo = { + const input: PythonEnvInfo = { name: '', location: '', kind: PythonEnvKind.Unknown, diff --git a/src/test/pythonEnvironments/discovery/locators/progressService.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/progressService.unit.test.ts index acf904636d00..c017c603d297 100644 --- a/src/test/pythonEnvironments/discovery/locators/progressService.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/progressService.unit.test.ts @@ -6,9 +6,7 @@ // tslint:disable:no-any max-classes-per-file max-func-body-length import { expect } from 'chai'; -import { - anything, instance, mock, when, -} from 'ts-mockito'; +import { anything, instance, mock, when } from 'ts-mockito'; import { Disposable } from 'vscode'; import { createDeferred } from '../../../../client/common/utils/async'; import { noop } from '../../../../client/common/utils/misc'; @@ -30,9 +28,7 @@ suite('Interpreters - Locator Progress', () => { return Promise.resolve(this.hasInterpreterValue); } - public onLocating( - listener: (e: Promise) => unknown, - ): Disposable { + public onLocating(listener: (e: Promise) => unknown): Disposable { this.locatingCallback = listener; return { dispose: noop }; } @@ -55,9 +51,13 @@ suite('Interpreters - Locator Progress', () => { progress.register(); let refreshingInvoked = false; - progress.onRefreshing(() => { refreshingInvoked = true; }); + progress.onRefreshing(() => { + refreshingInvoked = true; + }); let refreshedInvoked = false; - progress.onRefreshed(() => { refreshedInvoked = true; }); + progress.onRefreshed(() => { + refreshedInvoked = true; + }); const locatingDeferred = createDeferred(); locator.locatingCallback!.bind(progress)(locatingDeferred.promise); @@ -72,9 +72,13 @@ suite('Interpreters - Locator Progress', () => { progress.register(); let refreshingInvoked = false; - progress.onRefreshing(() => { refreshingInvoked = true; }); + progress.onRefreshing(() => { + refreshingInvoked = true; + }); let refreshedInvoked = false; - progress.onRefreshed(() => { refreshedInvoked = true; }); + progress.onRefreshed(() => { + refreshedInvoked = true; + }); const locatingDeferred = createDeferred(); locator.locatingCallback!.bind(progress)(locatingDeferred.promise); @@ -94,9 +98,13 @@ suite('Interpreters - Locator Progress', () => { progress.register(); let refreshingInvoked = false; - progress.onRefreshing(() => { refreshingInvoked = true; }); + progress.onRefreshing(() => { + refreshingInvoked = true; + }); let refreshedInvoked = false; - progress.onRefreshed(() => { refreshedInvoked = true; }); + progress.onRefreshed(() => { + refreshedInvoked = true; + }); const locatingDeferred1 = createDeferred(); locator1.locatingCallback!.bind(progress)(locatingDeferred1.promise); diff --git a/src/test/pythonEnvironments/discovery/locators/pyenvLocator.testvirtualenvs.ts b/src/test/pythonEnvironments/discovery/locators/pyenvLocator.testvirtualenvs.ts index 409c82fe61d9..fc800c008a1a 100644 --- a/src/test/pythonEnvironments/discovery/locators/pyenvLocator.testvirtualenvs.ts +++ b/src/test/pythonEnvironments/discovery/locators/pyenvLocator.testvirtualenvs.ts @@ -15,11 +15,7 @@ suite('Pyenv Locator', async () => { pyenvRootOldValue = process.env.PYENV_ROOT; process.env.PYENV_ROOT = testPyenvRoot; }); - testLocatorWatcher( - testPyenvVersionsDir, - async () => new PyenvLocator(), - { kind: PythonEnvKind.Pyenv }, - ); + testLocatorWatcher(testPyenvVersionsDir, async () => new PyenvLocator(), { kind: PythonEnvKind.Pyenv }); suiteTeardown(() => { process.env.PYENV_ROOT = pyenvRootOldValue; }); diff --git a/src/test/pythonEnvironments/discovery/locators/pyenvLocator.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/pyenvLocator.unit.test.ts index a5af63e2a226..e69b23e04439 100644 --- a/src/test/pythonEnvironments/discovery/locators/pyenvLocator.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/pyenvLocator.unit.test.ts @@ -22,7 +22,7 @@ import { assertEnvEqual, assertEnvsEqual } from './envTestUtils'; suite('Pyenv Identifier Tests', () => { const home = platformUtils.getUserHomeDir() || ''; let getEnvVariableStub: sinon.SinonStub; - let pathExistsStub:sinon.SinonStub; + let pathExistsStub: sinon.SinonStub; let getOsTypeStub: sinon.SinonStub; setup(() => { @@ -38,10 +38,10 @@ suite('Pyenv Identifier Tests', () => { }); type PyenvUnitTestData = { - testTitle: string, - interpreterPath: string, - pyenvEnvVar?: string, - osType: platformUtils.OSType, + testTitle: string; + interpreterPath: string; + pyenvEnvVar?: string; + osType: platformUtils.OSType; }; const testData: PyenvUnitTestData[] = [ @@ -81,9 +81,7 @@ suite('Pyenv Identifier Tests', () => { }, ]; - testData.forEach(({ - testTitle, interpreterPath, pyenvEnvVar, osType, - }) => { + testData.forEach(({ testTitle, interpreterPath, pyenvEnvVar, osType }) => { test(`The environment variable is set to ${testTitle} on ${osType}, and the interpreter path is in a subfolder of the pyenv folder`, async () => { getEnvVariableStub.withArgs('PYENV_ROOT').returns(pyenvEnvVar); getEnvVariableStub.withArgs('PYENV').returns(pyenvEnvVar); @@ -129,34 +127,88 @@ suite('Pyenv Versions Parser Test', () => { { input: '3.9.0', expectedOutput: { pythonVer: '3.9.0', distro: undefined, distroVer: undefined } }, { input: '3.9-dev', expectedOutput: { pythonVer: '3.9-dev', distro: undefined, distroVer: undefined } }, { input: '3.10-dev', expectedOutput: { pythonVer: '3.10-dev', distro: undefined, distroVer: undefined } }, - { input: 'activepython-2.7.14', expectedOutput: { pythonVer: undefined, distro: 'activepython', distroVer: '2.7.14' } }, - { input: 'activepython-3.6.0', expectedOutput: { pythonVer: undefined, distro: 'activepython', distroVer: '3.6.0' } }, + { + input: 'activepython-2.7.14', + expectedOutput: { pythonVer: undefined, distro: 'activepython', distroVer: '2.7.14' }, + }, + { + input: 'activepython-3.6.0', + expectedOutput: { pythonVer: undefined, distro: 'activepython', distroVer: '3.6.0' }, + }, { input: 'anaconda-4.0.0', expectedOutput: { pythonVer: undefined, distro: 'anaconda', distroVer: '4.0.0' } }, { input: 'anaconda2-5.3.1', expectedOutput: { pythonVer: undefined, distro: 'anaconda2', distroVer: '5.3.1' } }, - { input: 'anaconda2-2019.07', expectedOutput: { pythonVer: undefined, distro: 'anaconda2', distroVer: '2019.07' } }, + { + input: 'anaconda2-2019.07', + expectedOutput: { pythonVer: undefined, distro: 'anaconda2', distroVer: '2019.07' }, + }, { input: 'anaconda3-5.3.1', expectedOutput: { pythonVer: undefined, distro: 'anaconda3', distroVer: '5.3.1' } }, - { input: 'anaconda3-2020.07', expectedOutput: { pythonVer: undefined, distro: 'anaconda3', distroVer: '2020.07' } }, - { input: 'graalpython-20.2.0', expectedOutput: { pythonVer: undefined, distro: 'graalpython', distroVer: '20.2.0' } }, + { + input: 'anaconda3-2020.07', + expectedOutput: { pythonVer: undefined, distro: 'anaconda3', distroVer: '2020.07' }, + }, + { + input: 'graalpython-20.2.0', + expectedOutput: { pythonVer: undefined, distro: 'graalpython', distroVer: '20.2.0' }, + }, { input: 'ironpython-dev', expectedOutput: { pythonVer: undefined, distro: 'ironpython', distroVer: 'dev' } }, - { input: 'ironpython-2.7.6.3', expectedOutput: { pythonVer: undefined, distro: 'ironpython', distroVer: '2.7.6.3' } }, - { input: 'ironpython-2.7.7', expectedOutput: { pythonVer: undefined, distro: 'ironpython', distroVer: '2.7.7' } }, + { + input: 'ironpython-2.7.6.3', + expectedOutput: { pythonVer: undefined, distro: 'ironpython', distroVer: '2.7.6.3' }, + }, + { + input: 'ironpython-2.7.7', + expectedOutput: { pythonVer: undefined, distro: 'ironpython', distroVer: '2.7.7' }, + }, { input: 'jython-dev', expectedOutput: { pythonVer: undefined, distro: 'jython', distroVer: 'dev' } }, { input: 'jython-2.5.0', expectedOutput: { pythonVer: undefined, distro: 'jython', distroVer: '2.5.0' } }, { input: 'jython-2.5-dev', expectedOutput: { pythonVer: undefined, distro: 'jython', distroVer: '2.5-dev' } }, - { input: 'jython-2.5.4-rc1', expectedOutput: { pythonVer: undefined, distro: 'jython', distroVer: '2.5.4-rc1' } }, + { + input: 'jython-2.5.4-rc1', + expectedOutput: { pythonVer: undefined, distro: 'jython', distroVer: '2.5.4-rc1' }, + }, { input: 'jython-2.7.2', expectedOutput: { pythonVer: undefined, distro: 'jython', distroVer: '2.7.2' } }, { input: 'micropython-dev', expectedOutput: { pythonVer: undefined, distro: 'micropython', distroVer: 'dev' } }, - { input: 'micropython-1.9.3', expectedOutput: { pythonVer: undefined, distro: 'micropython', distroVer: '1.9.3' } }, - { input: 'micropython-1.13', expectedOutput: { pythonVer: undefined, distro: 'micropython', distroVer: '1.13' } }, - { input: 'miniconda-latest', expectedOutput: { pythonVer: undefined, distro: 'miniconda', distroVer: 'latest' } }, + { + input: 'micropython-1.9.3', + expectedOutput: { pythonVer: undefined, distro: 'micropython', distroVer: '1.9.3' }, + }, + { + input: 'micropython-1.13', + expectedOutput: { pythonVer: undefined, distro: 'micropython', distroVer: '1.13' }, + }, + { + input: 'miniconda-latest', + expectedOutput: { pythonVer: undefined, distro: 'miniconda', distroVer: 'latest' }, + }, { input: 'miniconda-2.2.2', expectedOutput: { pythonVer: undefined, distro: 'miniconda', distroVer: '2.2.2' } }, - { input: 'miniconda-3.18.3', expectedOutput: { pythonVer: undefined, distro: 'miniconda', distroVer: '3.18.3' } }, - { input: 'miniconda2-latest', expectedOutput: { pythonVer: undefined, distro: 'miniconda2', distroVer: 'latest' } }, - { input: 'miniconda2-4.7.12', expectedOutput: { pythonVer: undefined, distro: 'miniconda2', distroVer: '4.7.12' } }, - { input: 'miniconda3-latest', expectedOutput: { pythonVer: undefined, distro: 'miniconda3', distroVer: 'latest' } }, - { input: 'miniconda3-4.7.12', expectedOutput: { pythonVer: undefined, distro: 'miniconda3', distroVer: '4.7.12' } }, - { input: 'pypy-c-jit-latest', expectedOutput: { pythonVer: undefined, distro: 'pypy-c-jit', distroVer: 'latest' } }, - { input: 'pypy-c-nojit-latest', expectedOutput: { pythonVer: undefined, distro: 'pypy-c-nojit', distroVer: 'latest' } }, + { + input: 'miniconda-3.18.3', + expectedOutput: { pythonVer: undefined, distro: 'miniconda', distroVer: '3.18.3' }, + }, + { + input: 'miniconda2-latest', + expectedOutput: { pythonVer: undefined, distro: 'miniconda2', distroVer: 'latest' }, + }, + { + input: 'miniconda2-4.7.12', + expectedOutput: { pythonVer: undefined, distro: 'miniconda2', distroVer: '4.7.12' }, + }, + { + input: 'miniconda3-latest', + expectedOutput: { pythonVer: undefined, distro: 'miniconda3', distroVer: 'latest' }, + }, + { + input: 'miniconda3-4.7.12', + expectedOutput: { pythonVer: undefined, distro: 'miniconda3', distroVer: '4.7.12' }, + }, + { + input: 'pypy-c-jit-latest', + expectedOutput: { pythonVer: undefined, distro: 'pypy-c-jit', distroVer: 'latest' }, + }, + { + input: 'pypy-c-nojit-latest', + expectedOutput: { pythonVer: undefined, distro: 'pypy-c-nojit', distroVer: 'latest' }, + }, { input: 'pypy-dev', expectedOutput: { pythonVer: undefined, distro: 'pypy', distroVer: 'dev' } }, { input: 'pypy-stm-2.3', expectedOutput: { pythonVer: undefined, distro: 'pypy-stm', distroVer: '2.3' } }, { input: 'pypy-stm-2.5.1', expectedOutput: { pythonVer: undefined, distro: 'pypy-stm', distroVer: '2.5.1' } }, @@ -172,23 +224,47 @@ suite('Pyenv Versions Parser Test', () => { { input: 'pypy2.7-7.3.1', expectedOutput: { pythonVer: '2.7', distro: 'pypy', distroVer: '7.3.1' } }, { input: 'pypy3-2.4.0-src', expectedOutput: { pythonVer: '3', distro: 'pypy', distroVer: '2.4.0-src' } }, { input: 'pypy3-2.4.0', expectedOutput: { pythonVer: '3', distro: 'pypy', distroVer: '2.4.0' } }, - { input: 'pypy3.3-5.2-alpha1-src', expectedOutput: { pythonVer: '3.3', distro: 'pypy', distroVer: '5.2-alpha1-src' } }, + { + input: 'pypy3.3-5.2-alpha1-src', + expectedOutput: { pythonVer: '3.3', distro: 'pypy', distroVer: '5.2-alpha1-src' }, + }, { input: 'pypy3.3-5.2-alpha1', expectedOutput: { pythonVer: '3.3', distro: 'pypy', distroVer: '5.2-alpha1' } }, - { input: 'pypy3.3-5.5-alpha-src', expectedOutput: { pythonVer: '3.3', distro: 'pypy', distroVer: '5.5-alpha-src' } }, + { + input: 'pypy3.3-5.5-alpha-src', + expectedOutput: { pythonVer: '3.3', distro: 'pypy', distroVer: '5.5-alpha-src' }, + }, { input: 'pypy3.3-5.5-alpha', expectedOutput: { pythonVer: '3.3', distro: 'pypy', distroVer: '5.5-alpha' } }, - { input: 'pypy3.5-c-jit-latest', expectedOutput: { pythonVer: '3.5', distro: 'pypy-c-jit', distroVer: 'latest' } }, - { input: 'pypy3.5-5.7-beta-src', expectedOutput: { pythonVer: '3.5', distro: 'pypy', distroVer: '5.7-beta-src' } }, + { + input: 'pypy3.5-c-jit-latest', + expectedOutput: { pythonVer: '3.5', distro: 'pypy-c-jit', distroVer: 'latest' }, + }, + { + input: 'pypy3.5-5.7-beta-src', + expectedOutput: { pythonVer: '3.5', distro: 'pypy', distroVer: '5.7-beta-src' }, + }, { input: 'pypy3.5-5.7-beta', expectedOutput: { pythonVer: '3.5', distro: 'pypy', distroVer: '5.7-beta' } }, - { input: 'pypy3.5-5.7.1-beta-src', expectedOutput: { pythonVer: '3.5', distro: 'pypy', distroVer: '5.7.1-beta-src' } }, + { + input: 'pypy3.5-5.7.1-beta-src', + expectedOutput: { pythonVer: '3.5', distro: 'pypy', distroVer: '5.7.1-beta-src' }, + }, { input: 'pypy3.5-5.7.1-beta', expectedOutput: { pythonVer: '3.5', distro: 'pypy', distroVer: '5.7.1-beta' } }, { input: 'pypy3.6-7.3.1-src', expectedOutput: { pythonVer: '3.6', distro: 'pypy', distroVer: '7.3.1-src' } }, { input: 'pypy3.6-7.3.1', expectedOutput: { pythonVer: '3.6', distro: 'pypy', distroVer: '7.3.1' } }, - { input: 'pypy-5.7.1-beta-src', expectedOutput: { pythonVer: undefined, distro: 'pypy', distroVer: '5.7.1-beta-src' } }, + { + input: 'pypy-5.7.1-beta-src', + expectedOutput: { pythonVer: undefined, distro: 'pypy', distroVer: '5.7.1-beta-src' }, + }, { input: 'pypy', expectedOutput: { pythonVer: undefined, distro: 'pypy', distroVer: undefined } }, { input: 'pyston-0.6.1', expectedOutput: { pythonVer: undefined, distro: 'pyston', distroVer: '0.6.1' } }, { input: 'stackless-dev', expectedOutput: { pythonVer: undefined, distro: 'stackless', distroVer: 'dev' } }, - { input: 'stackless-2.7-dev', expectedOutput: { pythonVer: undefined, distro: 'stackless', distroVer: '2.7-dev' } }, - { input: 'stackless-3.4-dev', expectedOutput: { pythonVer: undefined, distro: 'stackless', distroVer: '3.4-dev' } }, + { + input: 'stackless-2.7-dev', + expectedOutput: { pythonVer: undefined, distro: 'stackless', distroVer: '2.7-dev' }, + }, + { + input: 'stackless-3.4-dev', + expectedOutput: { pythonVer: undefined, distro: 'stackless', distroVer: '3.4-dev' }, + }, { input: 'stackless-3.7.5', expectedOutput: { pythonVer: undefined, distro: 'stackless', distroVer: '3.7.5' } }, { input: 'stackless', expectedOutput: { pythonVer: undefined, distro: 'stackless', distroVer: undefined } }, { input: 'unknown', expectedOutput: undefined }, @@ -218,7 +294,11 @@ suite('Pyenv Locator Tests', () => { getOsTypeStub.returns(platformUtils.OSType.Linux); watchLocationForPatternStub = sinon.stub(fsWatcher, 'watchLocationForPattern'); - watchLocationForPatternStub.returns({ dispose: () => { /* do nothing */ } }); + watchLocationForPatternStub.returns({ + dispose: () => { + /* do nothing */ + }, + }); locator = new PyenvLocator(); }); @@ -229,7 +309,7 @@ suite('Pyenv Locator Tests', () => { watchLocationForPatternStub.restore(); }); - function getExpectedPyenvInfo(name:string) : PythonEnvInfo | undefined { + function getExpectedPyenvInfo(name: string): PythonEnvInfo | undefined { if (name === '3.9.0') { const envInfo = buildEnvInfo({ kind: PythonEnvKind.Pyenv, @@ -303,15 +383,18 @@ suite('Pyenv Locator Tests', () => { getExpectedPyenvInfo('conda1'), getExpectedPyenvInfo('miniconda'), getExpectedPyenvInfo('venv1'), - ].filter((e) => e !== undefined).sort((a, b) => { - if (a && b) { - return a.executable.filename.localeCompare(b.executable.filename); - } - return 0; - }); + ] + .filter((e) => e !== undefined) + .sort((a, b) => { + if (a && b) { + return a.executable.filename.localeCompare(b.executable.filename); + } + return 0; + }); - const actualEnvs = (await getEnvs(locator.iterEnvs())) - .sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const actualEnvs = (await getEnvs(locator.iterEnvs())).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), + ); assertEnvsEqual(actualEnvs, expectedEnvs); }); @@ -327,7 +410,7 @@ suite('Pyenv Locator Tests', () => { const expected = getExpectedPyenvInfo('3.9.0'); // Partially filled in env info object - const input:PythonEnvInfo = { + const input: PythonEnvInfo = { name: '', location: '', kind: PythonEnvKind.Unknown, diff --git a/src/test/pythonEnvironments/discovery/locators/venv.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/venv.unit.test.ts index 2cd43a21a274..3ed4e3ffd016 100644 --- a/src/test/pythonEnvironments/discovery/locators/venv.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/venv.unit.test.ts @@ -72,7 +72,9 @@ suite('Virtual environments', () => { settings.setup((x) => x.venvFolders).returns(() => folders); virtualEnvMgr.setup((v) => v.getPyEnvRoot(TypeMoq.It.isAny())).returns(() => Promise.resolve(undefined)); let paths = await pathProvider.getSearchPaths(); - let expected = ['envs', '.pyenv', '.direnv', '.virtualenvs', ...folders].map((item) => path.join(homedir, item)); + let expected = ['envs', '.pyenv', '.direnv', '.virtualenvs', ...folders].map((item) => + path.join(homedir, item), + ); virtualEnvMgr.verifyAll(); expect(paths).to.deep.equal(expected, 'Global search folder list is incorrect.'); @@ -104,9 +106,7 @@ suite('Virtual environments', () => { const homedir = os.homedir(); const workonFolder = path.join('~', '.workonFolder'); - process - .setup((p) => p.env) - .returns(() => ({ WORKON_HOME: workonFolder })); + process.setup((p) => p.env).returns(() => ({ WORKON_HOME: workonFolder })); settings.setup((x) => x.venvFolders).returns(() => []); const paths = await pathProvider.getSearchPaths(); @@ -121,9 +121,7 @@ suite('Virtual environments', () => { const homedir = os.homedir(); const workonFolder = path.join('path', 'to', '.workonFolder'); - process - .setup((p) => p.env) - .returns(() => ({ WORKON_HOME: workonFolder })); + process.setup((p) => p.env).returns(() => ({ WORKON_HOME: workonFolder })); settings.setup((x) => x.venvFolders).returns(() => []); const paths = await pathProvider.getSearchPaths(); diff --git a/src/test/pythonEnvironments/discovery/locators/virtualEnvironmentIdentifier.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/virtualEnvironmentIdentifier.unit.test.ts index 13ea6d1dadfa..8fee657d89ce 100644 --- a/src/test/pythonEnvironments/discovery/locators/virtualEnvironmentIdentifier.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/virtualEnvironmentIdentifier.unit.test.ts @@ -10,7 +10,10 @@ import * as platformUtils from '../../../../client/common/utils/platform'; import { PythonReleaseLevel, PythonVersion } from '../../../../client/pythonEnvironments/base/info'; import * as fileUtils from '../../../../client/pythonEnvironments/common/externalDependencies'; import { - getPythonVersionFromPyvenvCfg, isVenvEnvironment, isVirtualenvEnvironment, isVirtualenvwrapperEnvironment, + getPythonVersionFromPyvenvCfg, + isVenvEnvironment, + isVirtualenvEnvironment, + isVirtualenvwrapperEnvironment, } from '../../../../client/pythonEnvironments/discovery/locators/services/virtualEnvironmentIdentifier'; import { TEST_DATA_ROOT, TEST_LAYOUT_ROOT } from '../../common/commonTestConstants'; import { assertVersionsEqual } from './envTestUtils'; @@ -19,7 +22,7 @@ suite('isVenvEnvironment Tests', () => { const pyvenvCfg = 'pyvenv.cfg'; const envRoot = path.join('path', 'to', 'env'); const configPath = path.join('env', pyvenvCfg); - let fileExistsStub:sinon.SinonStub; + let fileExistsStub: sinon.SinonStub; setup(() => { fileExistsStub = ImportMock.mockFunction(fileUtils, 'pathExists'); @@ -38,7 +41,7 @@ suite('isVenvEnvironment Tests', () => { test('pyvenv.cfg exists in the current folder', async () => { const interpreter = path.join(envRoot, 'python'); - fileExistsStub.callsFake((p:string) => { + fileExistsStub.callsFake((p: string) => { if (p.endsWith(configPath)) { return Promise.resolve(true); } @@ -51,7 +54,7 @@ suite('isVenvEnvironment Tests', () => { test('pyvenv.cfg exists in the parent folder', async () => { const interpreter = path.join(envRoot, 'bin', 'python'); - fileExistsStub.callsFake((p:string) => { + fileExistsStub.callsFake((p: string) => { if (p.endsWith(configPath)) { return Promise.resolve(true); } @@ -93,7 +96,7 @@ suite('isVirtualenvwrapperEnvironment Tests', () => { let getEnvVariableStub: sinon.SinonStub; let getUserHomeDirStub: sinon.SinonStub; - let pathExistsStub:sinon.SinonStub; + let pathExistsStub: sinon.SinonStub; let readDirStub: sinon.SinonStub; setup(() => { @@ -170,9 +173,9 @@ suite('Virtual Env Version Parser Tests', () => { } function getTestData(): ICondaPythonVersionTestData[] { - const data:ICondaPythonVersionTestData[] = []; + const data: ICondaPythonVersionTestData[] = []; - const cases = (fsapi.readdirSync(testDataRoot)).map((c) => path.join(testDataRoot, c)); + const cases = fsapi.readdirSync(testDataRoot).map((c) => path.join(testDataRoot, c)); const casesToVersion = new Map(); casesToVersion.set('case1', { major: 3, minor: 9, micro: 0 }); @@ -184,7 +187,10 @@ suite('Virtual Env Version Parser Tests', () => { sysVersion: undefined, }); casesToVersion.set('case3', { - major: 3, minor: 9, micro: 0, release: { level: PythonReleaseLevel.Candidate, serial: 1 }, + major: 3, + minor: 9, + micro: 0, + release: { level: PythonReleaseLevel.Candidate, serial: 1 }, }); casesToVersion.set('case4', { major: 3, diff --git a/src/test/pythonEnvironments/discovery/locators/watcherTestUtils.ts b/src/test/pythonEnvironments/discovery/locators/watcherTestUtils.ts index b622754aa97b..b6d31c95c2f2 100644 --- a/src/test/pythonEnvironments/discovery/locators/watcherTestUtils.ts +++ b/src/test/pythonEnvironments/discovery/locators/watcherTestUtils.ts @@ -119,7 +119,7 @@ export function testLocatorWatcher( * to verify it. Omitting that check in those cases as we can never deterministically say when it's * ready to check. */ - kind?: PythonEnvKind + kind?: PythonEnvKind; }, ): void { let locator: ILocator & IDisposable; diff --git a/src/test/pythonEnvironments/discovery/locators/windowsRegistryLocator.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/windowsRegistryLocator.unit.test.ts index 95dc5d5d6308..709c2fc7ae40 100644 --- a/src/test/pythonEnvironments/discovery/locators/windowsRegistryLocator.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/windowsRegistryLocator.unit.test.ts @@ -6,7 +6,11 @@ import * as path from 'path'; import * as sinon from 'sinon'; import { Architecture } from '../../../../client/common/utils/platform'; import { - PythonEnvInfo, PythonEnvKind, PythonReleaseLevel, PythonVersion, UNKNOWN_PYTHON_VERSION, + PythonEnvInfo, + PythonEnvKind, + PythonReleaseLevel, + PythonVersion, + UNKNOWN_PYTHON_VERSION, } from '../../../../client/pythonEnvironments/base/info'; import { parseVersion } from '../../../../client/pythonEnvironments/base/info/pythonVersion'; import { getEnvs } from '../../../../client/pythonEnvironments/base/locatorUtils'; @@ -29,22 +33,16 @@ suite('Windows Registry', () => { { key: '\\SOFTWARE\\Python', values: { '': '' }, - subKeys: [ - '\\SOFTWARE\\Python\\PythonCore', - '\\SOFTWARE\\Python\\ContinuumAnalytics', - ], + subKeys: ['\\SOFTWARE\\Python\\PythonCore', '\\SOFTWARE\\Python\\ContinuumAnalytics'], }, { key: '\\SOFTWARE\\Python\\PythonCore', - values: - { + values: { '': '', DisplayName: 'Python Software Foundation', SupportUrl: 'www.python.org', }, - subKeys: [ - '\\SOFTWARE\\Python\\PythonCore\\3.9', - ], + subKeys: ['\\SOFTWARE\\Python\\PythonCore\\3.9'], }, { key: '\\SOFTWARE\\Python\\PythonCore\\3.9', @@ -56,9 +54,7 @@ suite('Windows Registry', () => { SysVersion: '3.9', Version: '3.9.0rc2', }, - subKeys: [ - '\\SOFTWARE\\Python\\PythonCore\\3.9\\InstallPath', - ], + subKeys: ['\\SOFTWARE\\Python\\PythonCore\\3.9\\InstallPath'], }, { key: '\\SOFTWARE\\Python\\PythonCore\\3.9\\InstallPath', @@ -73,9 +69,7 @@ suite('Windows Registry', () => { values: { '': '', }, - subKeys: [ - '\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda38-64', - ], + subKeys: ['\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda38-64'], }, { key: '\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda38-64', @@ -87,9 +81,7 @@ suite('Windows Registry', () => { SysVersion: '3.8', Version: 'py38_4.8.3', }, - subKeys: [ - '\\SOFTWARE\\Python\\PythonCore\\Anaconda38-64\\InstallPath', - ], + subKeys: ['\\SOFTWARE\\Python\\PythonCore\\Anaconda38-64\\InstallPath'], }, { key: '\\SOFTWARE\\Python\\PythonCore\\Anaconda38-64\\InstallPath', @@ -104,21 +96,16 @@ suite('Windows Registry', () => { { key: '\\SOFTWARE\\Python', values: { '': '' }, - subKeys: [ - '\\SOFTWARE\\Python\\PythonCore', - ], + subKeys: ['\\SOFTWARE\\Python\\PythonCore'], }, { key: '\\SOFTWARE\\Python\\PythonCore', - values: - { + values: { '': '', DisplayName: 'Python Software Foundation', SupportUrl: 'www.python.org', }, - subKeys: [ - '\\SOFTWARE\\Python\\PythonCore\\3.7', - ], + subKeys: ['\\SOFTWARE\\Python\\PythonCore\\3.7'], }, { key: '\\SOFTWARE\\Python\\PythonCore\\3.7', @@ -130,9 +117,7 @@ suite('Windows Registry', () => { SysVersion: '3.7', Version: '3.7.7', }, - subKeys: [ - '\\SOFTWARE\\Python\\PythonCore\\3.7\\InstallPath', - ], + subKeys: ['\\SOFTWARE\\Python\\PythonCore\\3.7\\InstallPath'], }, { key: '\\SOFTWARE\\Python\\PythonCore\\3.7\\InstallPath', @@ -145,28 +130,21 @@ suite('Windows Registry', () => { ], }, x86: { - HKLM: [ - - ], + HKLM: [], HKCU: [ { key: '\\SOFTWARE\\Python', values: { '': '' }, - subKeys: [ - '\\SOFTWARE\\Python\\PythonCodingPack', - ], + subKeys: ['\\SOFTWARE\\Python\\PythonCodingPack'], }, { key: '\\SOFTWARE\\Python\\PythonCodingPack', - values: - { + values: { '': '', DisplayName: 'Python Software Foundation', SupportUrl: 'www.python.org', }, - subKeys: [ - '\\SOFTWARE\\Python\\PythonCodingPack\\3.8', - ], + subKeys: ['\\SOFTWARE\\Python\\PythonCodingPack\\3.8'], }, { key: '\\SOFTWARE\\Python\\PythonCodingPack\\3.8', @@ -177,9 +155,7 @@ suite('Windows Registry', () => { SysArchitecture: '32bit', SysVersion: '3.8.5', }, - subKeys: [ - '\\SOFTWARE\\Python\\PythonCodingPack\\3.8\\InstallPath', - ], + subKeys: ['\\SOFTWARE\\Python\\PythonCodingPack\\3.8\\InstallPath'], }, { key: '\\SOFTWARE\\Python\\PythonCodingPack\\3.8\\InstallPath', @@ -233,11 +209,13 @@ suite('Windows Registry', () => { async function getDataFromKey( { arch, hive, key }: winreg.Options, - org:string, - ):Promise { + org: string, + ): Promise { const data = await fakeRegistryValues({ arch, hive, key }); const subKey = (await fakeRegistryKeys({ arch, hive, key }))[0]; - const subKeyData = (await fakeRegistryValues({ arch, hive, key: subKey.key })).find((x) => x.name === 'ExecutablePath'); + const subKeyData = (await fakeRegistryValues({ arch, hive, key: subKey.key })).find( + (x) => x.name === 'ExecutablePath', + ); return Promise.resolve({ interpreterPath: subKeyData?.value ?? '', @@ -249,9 +227,9 @@ suite('Windows Registry', () => { }); } - async function createExpectedEnv(data:winutils.IRegistryInterpreterData): Promise { - const versionStr = (data.versionStr ?? data.sysVersionStr) ?? data.interpreterPath; - let version:PythonVersion; + async function createExpectedEnv(data: winutils.IRegistryInterpreterData): Promise { + const versionStr = data.versionStr ?? data.sysVersionStr ?? data.interpreterPath; + let version: PythonVersion; try { version = parseVersion(versionStr); } catch (ex) { @@ -275,10 +253,7 @@ suite('Windows Registry', () => { }; } - async function getExpectedDataFromKey( - { arch, hive, key }: winreg.Options, - org:string, - ):Promise { + async function getExpectedDataFromKey({ arch, hive, key }: winreg.Options, org: string): Promise { return createExpectedEnv(await getDataFromKey({ arch, hive, key }, org)); } @@ -296,18 +271,31 @@ suite('Windows Registry', () => { }); test('iterEnvs()', async () => { - const expectedEnvs: PythonEnvInfo[] = (await Promise.all( - [ - getExpectedDataFromKey({ arch: 'x64', hive: winreg.HKLM, key: '\\SOFTWARE\\Python\\PythonCore\\3.9' }, 'PythonCore'), - getExpectedDataFromKey({ arch: 'x64', hive: winreg.HKLM, key: '\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda38-64' }, 'ContinuumAnalytics'), - getExpectedDataFromKey({ arch: 'x64', hive: winreg.HKCU, key: '\\SOFTWARE\\Python\\PythonCore\\3.7' }, 'PythonCore'), - getExpectedDataFromKey({ arch: 'x86', hive: winreg.HKCU, key: '\\SOFTWARE\\Python\\PythonCodingPack\\3.8' }, 'PythonCodingPack'), - ], - )).sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const expectedEnvs: PythonEnvInfo[] = ( + await Promise.all([ + getExpectedDataFromKey( + { arch: 'x64', hive: winreg.HKLM, key: '\\SOFTWARE\\Python\\PythonCore\\3.9' }, + 'PythonCore', + ), + getExpectedDataFromKey( + { arch: 'x64', hive: winreg.HKLM, key: '\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda38-64' }, + 'ContinuumAnalytics', + ), + getExpectedDataFromKey( + { arch: 'x64', hive: winreg.HKCU, key: '\\SOFTWARE\\Python\\PythonCore\\3.7' }, + 'PythonCore', + ), + getExpectedDataFromKey( + { arch: 'x86', hive: winreg.HKCU, key: '\\SOFTWARE\\Python\\PythonCodingPack\\3.8' }, + 'PythonCodingPack', + ), + ]) + ).sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)) - .sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), + ); assertEnvsEqual(actualEnvs, expectedEnvs); }); @@ -318,8 +306,9 @@ suite('Windows Registry', () => { }); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)) - .sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), + ); assert.deepStrictEqual(actualEnvs, []); }); @@ -332,22 +321,32 @@ suite('Windows Registry', () => { return fakeRegistryKeys({ arch, hive, key }); }); - const expectedEnvs: PythonEnvInfo[] = (await Promise.all( - [ - getExpectedDataFromKey({ arch: 'x64', hive: winreg.HKCU, key: '\\SOFTWARE\\Python\\PythonCore\\3.7' }, 'PythonCore'), - getExpectedDataFromKey({ arch: 'x86', hive: winreg.HKCU, key: '\\SOFTWARE\\Python\\PythonCodingPack\\3.8' }, 'PythonCodingPack'), - ], - )).sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const expectedEnvs: PythonEnvInfo[] = ( + await Promise.all([ + getExpectedDataFromKey( + { arch: 'x64', hive: winreg.HKCU, key: '\\SOFTWARE\\Python\\PythonCore\\3.7' }, + 'PythonCore', + ), + getExpectedDataFromKey( + { arch: 'x86', hive: winreg.HKCU, key: '\\SOFTWARE\\Python\\PythonCodingPack\\3.8' }, + 'PythonCodingPack', + ), + ]) + ).sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)) - .sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), + ); assertEnvsEqual(actualEnvs, expectedEnvs); }); test('resolveEnv(string)', async () => { - const expected: PythonEnvInfo = await getExpectedDataFromKey({ arch: 'x64', hive: winreg.HKLM, key: '\\SOFTWARE\\Python\\PythonCore\\3.9' }, 'PythonCore'); + const expected: PythonEnvInfo = await getExpectedDataFromKey( + { arch: 'x64', hive: winreg.HKLM, key: '\\SOFTWARE\\Python\\PythonCore\\3.9' }, + 'PythonCore', + ); const interpreterPath = path.join(regTestRoot, 'py39', 'python.exe'); const actual = await locator.resolveEnv(interpreterPath); @@ -356,11 +355,14 @@ suite('Windows Registry', () => { }); test('resolveEnv(PythonEnvInfo)', async () => { - const expected: PythonEnvInfo = await getExpectedDataFromKey({ arch: 'x64', hive: winreg.HKLM, key: '\\SOFTWARE\\Python\\PythonCore\\3.9' }, 'PythonCore'); + const expected: PythonEnvInfo = await getExpectedDataFromKey( + { arch: 'x64', hive: winreg.HKLM, key: '\\SOFTWARE\\Python\\PythonCore\\3.9' }, + 'PythonCore', + ); const interpreterPath = path.join(regTestRoot, 'py39', 'python.exe'); // Partially filled in env info object - const input:PythonEnvInfo = { + const input: PythonEnvInfo = { name: '', location: '', kind: PythonEnvKind.Unknown, diff --git a/src/test/pythonEnvironments/discovery/locators/windowsRegistryService.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/windowsRegistryService.unit.test.ts index 75d9860f9680..d06d207fab4c 100644 --- a/src/test/pythonEnvironments/discovery/locators/windowsRegistryService.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/windowsRegistryService.unit.test.ts @@ -425,7 +425,10 @@ suite('Interpreters from Windows Registry (unit)', () => { values: ['\\Software\\Python\\Company Three\\6.0.0'], }, { - key: '\\Software\\Python', hive: RegistryHive.HKLM, arch: Architecture.x86, values: ['7.0.0'], + key: '\\Software\\Python', + hive: RegistryHive.HKLM, + arch: Architecture.x86, + values: ['7.0.0'], }, { key: '\\Software\\Python\\Company A', @@ -627,7 +630,10 @@ suite('Interpreters from Windows Registry (unit)', () => { values: ['\\Software\\Python\\Company Five\\8.0.0'], }, { - key: '\\Software\\Python', hive: RegistryHive.HKLM, arch: Architecture.x86, values: ['9.0.0'], + key: '\\Software\\Python', + hive: RegistryHive.HKLM, + arch: Architecture.x86, + values: ['9.0.0'], }, { key: '\\Software\\Python\\Company A', @@ -843,7 +849,10 @@ suite('Interpreters from Windows Registry (unit)', () => { values: ['\\Software\\Python\\Company Five\\Five !'], }, { - key: '\\Software\\Python', hive: RegistryHive.HKLM, arch: Architecture.x86, values: ['A'], + key: '\\Software\\Python', + hive: RegistryHive.HKLM, + arch: Architecture.x86, + values: ['A'], }, { key: '\\Software\\Python\\Company A', diff --git a/src/test/pythonEnvironments/discovery/locators/windowsStoreInterpreter.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/windowsStoreInterpreter.unit.test.ts index 85db57d36f6e..884b7254f4e8 100644 --- a/src/test/pythonEnvironments/discovery/locators/windowsStoreInterpreter.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/windowsStoreInterpreter.unit.test.ts @@ -6,9 +6,7 @@ // tslint:disable:no-any max-classes-per-file max-func-body-length import { expect } from 'chai'; -import { - anything, deepEqual, instance, mock, verify, when, -} from 'ts-mockito'; +import { anything, deepEqual, instance, mock, verify, when } from 'ts-mockito'; import { PersistentState, PersistentStateFactory } from '../../../../client/common/persistentState'; import { FileSystem } from '../../../../client/common/platform/fileSystem'; import { IFileSystem } from '../../../../client/common/platform/types'; @@ -48,7 +46,7 @@ suite('Interpreters - Windows Store Interpreter', () => { instance(serviceContainer), instance(persistanceStateFactory), instance(fs), - instance(pyenvs) + instance(pyenvs), ); }); const windowsStoreInterpreters = [ diff --git a/src/test/pythonEnvironments/discovery/locators/windowsStoreLocator.test.ts b/src/test/pythonEnvironments/discovery/locators/windowsStoreLocator.test.ts index e9c0719504b5..631634a876da 100644 --- a/src/test/pythonEnvironments/discovery/locators/windowsStoreLocator.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/windowsStoreLocator.test.ts @@ -65,13 +65,10 @@ suite('Windows Store Locator', async () => { const localAppDataOldValue = process.env.LOCALAPPDATA; async function waitForChangeToBeDetected(deferred: Deferred) { - const timeout = setTimeout( - () => { - clearTimeout(timeout); - deferred.reject(new Error('Environment not detected')); - }, - TEST_TIMEOUT, - ); + const timeout = setTimeout(() => { + clearTimeout(timeout); + deferred.reject(new Error('Environment not detected')); + }, TEST_TIMEOUT); await deferred.promise; } diff --git a/src/test/pythonEnvironments/discovery/locators/windowsStoreLocator.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/windowsStoreLocator.unit.test.ts index fd4f1ab7046c..3110aa409aab 100644 --- a/src/test/pythonEnvironments/discovery/locators/windowsStoreLocator.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/windowsStoreLocator.unit.test.ts @@ -8,12 +8,19 @@ import * as fsWatcher from '../../../../client/common/platform/fileSystemWatcher import { ExecutionResult } from '../../../../client/common/process/types'; import * as platformApis from '../../../../client/common/utils/platform'; import { - PythonEnvInfo, PythonEnvKind, PythonReleaseLevel, PythonVersion, UNKNOWN_PYTHON_VERSION, + PythonEnvInfo, + PythonEnvKind, + PythonReleaseLevel, + PythonVersion, + UNKNOWN_PYTHON_VERSION, } from '../../../../client/pythonEnvironments/base/info'; import { InterpreterInformation } from '../../../../client/pythonEnvironments/base/info/interpreter'; import { parseVersion } from '../../../../client/pythonEnvironments/base/info/pythonVersion'; import * as externalDep from '../../../../client/pythonEnvironments/common/externalDependencies'; -import { getWindowsStorePythonExes, WindowsStoreLocator } from '../../../../client/pythonEnvironments/discovery/locators/services/windowsStoreLocator'; +import { + getWindowsStorePythonExes, + WindowsStoreLocator, +} from '../../../../client/pythonEnvironments/discovery/locators/services/windowsStoreLocator'; import { getEnvs } from '../../base/common'; import { TEST_LAYOUT_ROOT } from '../../common/commonTestConstants'; import { assertEnvEqual, assertEnvsEqual } from './envTestUtils'; @@ -52,12 +59,15 @@ suite('Windows Store', () => { const testLocalAppData = path.join(TEST_LAYOUT_ROOT, 'storeApps'); const testStoreAppRoot = path.join(testLocalAppData, 'Microsoft', 'WindowsApps'); - const pathToData = new Map(); + const pathToData = new Map< + string, + { + versionInfo: (string | number)[]; + sysPrefix: string; + sysVersion: string; + is64Bit: boolean; + } + >(); const python383data = { versionInfo: [3, 8, 3, 'final', 0], @@ -80,9 +90,9 @@ suite('Windows Store', () => { executable: string, sysVersion?: string, sysPrefix?: string, - versionStr?:string, + versionStr?: string, ): InterpreterInformation { - let version:PythonVersion; + let version: PythonVersion; try { version = parseVersion(versionStr ?? path.basename(executable)); if (sysVersion) { @@ -105,7 +115,7 @@ suite('Windows Store', () => { setup(async () => { stubShellExec = sinon.stub(externalDep, 'shellExecute'); - stubShellExec.callsFake((command:string) => { + stubShellExec.callsFake((command: string) => { if (command.indexOf('notpython.exe') > 0) { return Promise.resolve>({ stdout: '' }); } @@ -119,7 +129,11 @@ suite('Windows Store', () => { getEnvVar.withArgs('LOCALAPPDATA').returns(testLocalAppData); watchLocationForPatternStub = sinon.stub(fsWatcher, 'watchLocationForPattern'); - watchLocationForPatternStub.returns({ dispose: () => { /* do nothing */ } }); + watchLocationForPatternStub.returns({ + dispose: () => { + /* do nothing */ + }, + }); locator = new WindowsStoreLocator(); }); @@ -134,7 +148,7 @@ suite('Windows Store', () => { test('iterEnvs()', async () => { const expectedEnvs = [...pathToData.keys()] .sort((a: string, b: string) => a.localeCompare(b)) - .map((k): PythonEnvInfo|undefined => { + .map((k): PythonEnvInfo | undefined => { const data = pathToData.get(k); if (data) { return { @@ -151,8 +165,9 @@ suite('Windows Store', () => { }); const iterator = locator.iterEnvs(); - const actualEnvs = (await getEnvs(iterator)) - .sort((a, b) => a.executable.filename.localeCompare(b.executable.filename)); + const actualEnvs = (await getEnvs(iterator)).sort((a, b) => + a.executable.filename.localeCompare(b.executable.filename), + ); assertEnvsEqual(actualEnvs, expectedEnvs); }); @@ -187,7 +202,7 @@ suite('Windows Store', () => { }; // Partially filled in env info object - const input:PythonEnvInfo = { + const input: PythonEnvInfo = { name: '', location: '', defaultDisplayName: undefined, diff --git a/src/test/pythonEnvironments/discovery/locators/workspaceVirtualEnvService.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/workspaceVirtualEnvService.unit.test.ts index a7b86cb239aa..5baec513d88c 100644 --- a/src/test/pythonEnvironments/discovery/locators/workspaceVirtualEnvService.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/workspaceVirtualEnvService.unit.test.ts @@ -6,9 +6,7 @@ // tslint:disable:no-any max-classes-per-file max-func-body-length import { expect } from 'chai'; -import { - anything, instance, mock, verify, when, -} from 'ts-mockito'; +import { anything, instance, mock, verify, when } from 'ts-mockito'; import { Uri } from 'vscode'; import { IInterpreterWatcher } from '../../../../client/interpreter/contracts'; import { ServiceContainer } from '../../../../client/ioc/container'; diff --git a/src/test/pythonEnvironments/discovery/locators/workspaceVirtualEnvWatcherService.unit.test.ts b/src/test/pythonEnvironments/discovery/locators/workspaceVirtualEnvWatcherService.unit.test.ts index 4373f9fdfbe5..a187eaf2d3a5 100644 --- a/src/test/pythonEnvironments/discovery/locators/workspaceVirtualEnvWatcherService.unit.test.ts +++ b/src/test/pythonEnvironments/discovery/locators/workspaceVirtualEnvWatcherService.unit.test.ts @@ -8,12 +8,8 @@ import { expect } from 'chai'; import * as path from 'path'; -import { - anything, instance, mock, verify, when, -} from 'ts-mockito'; -import { - Disposable, FileSystemWatcher, Uri, WorkspaceFolder, -} from 'vscode'; +import { anything, instance, mock, verify, when } from 'ts-mockito'; +import { Disposable, FileSystemWatcher, Uri, WorkspaceFolder } from 'vscode'; import { WorkspaceService } from '../../../../client/common/application/workspace'; import { isUnitTestExecution } from '../../../../client/common/constants'; import { PlatformService } from '../../../../client/common/platform/platformService'; diff --git a/src/test/pythonEnvironments/info/environmentInfoService.functional.test.ts b/src/test/pythonEnvironments/info/environmentInfoService.functional.test.ts index 6485a0607335..1afbb21a8b80 100644 --- a/src/test/pythonEnvironments/info/environmentInfoService.functional.test.ts +++ b/src/test/pythonEnvironments/info/environmentInfoService.functional.test.ts @@ -21,7 +21,10 @@ suite('Environment Info Service', () => { function createExpectedEnvInfo(executable: string): InterpreterInformation { return { - version: { ...parseVersion('3.8.3-final'), sysVersion: '3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)]' }, + version: { + ...parseVersion('3.8.3-final'), + sysVersion: '3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)]', + }, arch: Architecture.x64, executable: { filename: executable, diff --git a/src/test/pythonEnvironments/info/interpreter.unit.test.ts b/src/test/pythonEnvironments/info/interpreter.unit.test.ts index e6a11ac1db1e..08aaf40d7271 100644 --- a/src/test/pythonEnvironments/info/interpreter.unit.test.ts +++ b/src/test/pythonEnvironments/info/interpreter.unit.test.ts @@ -4,9 +4,7 @@ import { expect } from 'chai'; import { join as pathJoin } from 'path'; import { SemVer } from 'semver'; -import { - IMock, It as TypeMoqIt, Mock, MockBehavior, -} from 'typemoq'; +import { IMock, It as TypeMoqIt, Mock, MockBehavior } from 'typemoq'; import { StdErrError } from '../../../client/common/process/types'; import { Architecture } from '../../../client/common/utils/platform'; import { buildPythonExecInfo } from '../../../client/pythonEnvironments/exec'; diff --git a/src/test/pythonEnvironments/legacyIOC.ts b/src/test/pythonEnvironments/legacyIOC.ts index ab3f73661ae1..68f2c379d3b1 100644 --- a/src/test/pythonEnvironments/legacyIOC.ts +++ b/src/test/pythonEnvironments/legacyIOC.ts @@ -12,10 +12,7 @@ import { EnvironmentsSecurity } from '../../client/pythonEnvironments/security'; * This is here to support old tests. * @deprecated */ -export function registerForIOC( - serviceManager: IServiceManager, - serviceContainer: IServiceContainer, -): void { +export function registerForIOC(serviceManager: IServiceManager, serviceContainer: IServiceContainer): void { registerLegacyDiscoveryForIOC(serviceManager); initializeExternalDependencies(serviceContainer); // The old tests do not need real instances, directly pass in mocks. @@ -23,6 +20,6 @@ export function registerForIOC( serviceManager, instance(mock(PythonEnvironments)), instance(mock(EnvironmentsSecurity)), - [] + [], ); } diff --git a/src/test/pythonEnvironments/legacyIOC.unit.test.ts b/src/test/pythonEnvironments/legacyIOC.unit.test.ts index bde799058a28..8a317ab39057 100644 --- a/src/test/pythonEnvironments/legacyIOC.unit.test.ts +++ b/src/test/pythonEnvironments/legacyIOC.unit.test.ts @@ -5,9 +5,7 @@ // tslint:disable: no-any -import { - instance, mock, verify, -} from 'ts-mockito'; +import { instance, mock, verify } from 'ts-mockito'; import { CONDA_ENV_FILE_SERVICE, CONDA_ENV_SERVICE, @@ -64,12 +62,22 @@ import { registerLegacyDiscoveryForIOC } from '../../client/pythonEnvironments/l suite('Interpreters - Service Registry', () => { test('Registrations', () => { const serviceManager = mock(ServiceManager); - registerLegacyDiscoveryForIOC( - instance(serviceManager), - ); + registerLegacyDiscoveryForIOC(instance(serviceManager)); verify(serviceManager.addSingleton(IKnownSearchPathsForInterpreters, KnownSearchPathsForInterpreters)).once(); - verify(serviceManager.addSingleton(IVirtualEnvironmentsSearchPathProvider, GlobalVirtualEnvironmentsSearchPathProvider, 'global')).once(); - verify(serviceManager.addSingleton(IVirtualEnvironmentsSearchPathProvider, WorkspaceVirtualEnvironmentsSearchPathProvider, 'workspace')).once(); + verify( + serviceManager.addSingleton( + IVirtualEnvironmentsSearchPathProvider, + GlobalVirtualEnvironmentsSearchPathProvider, + 'global', + ), + ).once(); + verify( + serviceManager.addSingleton( + IVirtualEnvironmentsSearchPathProvider, + WorkspaceVirtualEnvironmentsSearchPathProvider, + 'workspace', + ), + ).once(); verify(serviceManager.addSingleton(ICondaService, CondaService)).once(); verify(serviceManager.addSingleton(IPipEnvServiceHelper, PipEnvServiceHelper)).once(); @@ -108,20 +116,13 @@ suite('Interpreters - Service Registry', () => { verify(serviceManager.addSingleton(IInterpreterLocatorService, PipEnvService, PIPENV_SERVICE)).once(); verify( - serviceManager.addSingleton( - IInterpreterLocatorService, - WindowsRegistryService, - WINDOWS_REGISTRY_SERVICE, - ), + serviceManager.addSingleton(IInterpreterLocatorService, WindowsRegistryService, WINDOWS_REGISTRY_SERVICE), ).once(); verify(serviceManager.addSingleton(IInterpreterLocatorService, KnownPathsService, KNOWN_PATH_SERVICE)).once(); verify(serviceManager.addSingleton(IInterpreterLocatorHelper, InterpreterLocatorHelper)).once(); verify( - serviceManager.addSingleton( - IInterpreterLocatorProgressService, - InterpreterLocatorProgressService, - ), + serviceManager.addSingleton(IInterpreterLocatorProgressService, InterpreterLocatorProgressService), ).once(); verify(serviceManager.addSingleton(WindowsStoreInterpreter, WindowsStoreInterpreter)).once(); diff --git a/src/test/refactor/extension.refactor.extract.method.test.ts b/src/test/refactor/extension.refactor.extract.method.test.ts index 48c51428673a..4812ad403104 100644 --- a/src/test/refactor/extension.refactor.extract.method.test.ts +++ b/src/test/refactor/extension.refactor.extract.method.test.ts @@ -14,7 +14,7 @@ import { TextEditorOptions, Uri, window, - workspace + workspace, } from 'vscode'; import { getTextEditsFromPatch } from '../../client/common/editor'; import { IPythonExecutionFactory, IPythonExecutionService } from '../../client/common/process/types'; @@ -37,7 +37,7 @@ const refactorSourceFile = path.join( 'pythonFiles', 'refactoring', 'standAlone', - 'refactor.py' + 'refactor.py', ); const refactorTargetFileDir = path.join( __dirname, @@ -48,7 +48,7 @@ const refactorTargetFileDir = path.join( 'test', 'pythonFiles', 'refactoring', - 'standAlone' + 'standAlone', ); interface RenameResponse { @@ -62,7 +62,7 @@ suite('Method Extraction', () => { cursorStyle: TextEditorCursorStyle.Line, insertSpaces: true, lineNumbers: TextEditorLineNumbersStyle.Off, - tabSize: 4 + tabSize: 4, }; let refactorTargetFile = ''; let ioc: UnitTestIocContainer; @@ -117,7 +117,7 @@ suite('Method Extraction', () => { 'myNewMethod', refactorTargetFile, rangeOfTextToExtract, - options + options, ); if (shouldError) { assert.fail('No error', 'Error', 'Extraction should fail with an error', ''); @@ -127,7 +127,7 @@ suite('Method Extraction', () => { assert.equal(textEdits.length, expectedTextEdits.length, 'Invalid number of Text Edits'); textEdits.forEach((edit) => { const foundEdit = expectedTextEdits.filter( - (item) => item.newText === edit.newText && item.range.isEqual(edit.range) + (item) => item.newText === edit.newText && item.range.isEqual(edit.range), ); assert.equal(foundEdit.length, 1, 'Edit not found'); }); @@ -154,7 +154,7 @@ suite('Method Extraction', () => { async function testingMethodExtractionEndToEnd( shouldError: boolean, startPos: Position, - endPos: Position + endPos: Position, ): Promise { const ch = new MockOutputChannel('Python'); const rangeOfTextToExtract = new Range(startPos, endPos); @@ -179,7 +179,7 @@ suite('Method Extraction', () => { .text.trim() .indexOf('def newmethod'), 0, - 'New Method not created' + 'New Method not created', ); assert.equal(newMethodRefLine.text.trim().startsWith('self.newmethod'), true, 'New Method not being used'); } catch (error) { diff --git a/src/test/refactor/extension.refactor.extract.var.test.ts b/src/test/refactor/extension.refactor.extract.var.test.ts index dd178ffe7906..4f50ad60200b 100644 --- a/src/test/refactor/extension.refactor.extract.var.test.ts +++ b/src/test/refactor/extension.refactor.extract.var.test.ts @@ -13,7 +13,7 @@ import { TextEditorOptions, Uri, window, - workspace + workspace, } from 'vscode'; import { getTextEditsFromPatch } from '../../client/common/editor'; import { IPythonExecutionFactory, IPythonExecutionService } from '../../client/common/process/types'; @@ -34,7 +34,7 @@ const refactorSourceFile = path.join( 'pythonFiles', 'refactoring', 'standAlone', - 'refactor.py' + 'refactor.py', ); const refactorTargetFileDir = path.join( __dirname, @@ -45,7 +45,7 @@ const refactorTargetFileDir = path.join( 'test', 'pythonFiles', 'refactoring', - 'standAlone' + 'standAlone', ); interface RenameResponse { @@ -59,7 +59,7 @@ suite('Variable Extraction', () => { cursorStyle: TextEditorCursorStyle.Line, insertSpaces: true, lineNumbers: TextEditorLineNumbersStyle.Off, - tabSize: 4 + tabSize: 4, }; let refactorTargetFile = ''; let ioc: UnitTestIocContainer; @@ -100,7 +100,7 @@ suite('Variable Extraction', () => { async function testingVariableExtraction( shouldError: boolean, startPos: Position, - endPos: Position + endPos: Position, ): Promise { const rangeOfTextToExtract = new Range(startPos, endPos); const workspaceRoot = path.dirname(refactorTargetFile); @@ -116,7 +116,7 @@ suite('Variable Extraction', () => { 'myNewVariable', refactorTargetFile, rangeOfTextToExtract, - options + options, ); if (shouldError) { assert.fail('No error', 'Error', 'Extraction should fail with an error', ''); @@ -126,7 +126,7 @@ suite('Variable Extraction', () => { assert.equal(textEdits.length, expectedTextEdits.length, 'Invalid number of Text Edits'); textEdits.forEach((edit) => { const foundEdit = expectedTextEdits.filter( - (item) => item.newText === edit.newText && item.range.isEqual(edit.range) + (item) => item.newText === edit.newText && item.range.isEqual(edit.range), ); assert.equal(foundEdit.length, 1, 'Edit not found'); }); @@ -158,7 +158,7 @@ suite('Variable Extraction', () => { async function testingVariableExtractionEndToEnd( shouldError: boolean, startPos: Position, - endPos: Position + endPos: Position, ): Promise { const ch = new MockOutputChannel('Python'); const rangeOfTextToExtract = new Range(startPos, endPos); diff --git a/src/test/refactor/rename.test.ts b/src/test/refactor/rename.test.ts index 7f88fbe17d46..31a956078a56 100644 --- a/src/test/refactor/rename.test.ts +++ b/src/test/refactor/rename.test.ts @@ -15,7 +15,7 @@ import { TextEditorOptions, Uri, window, - workspace + workspace, } from 'vscode'; import { EXTENSION_ROOT_DIR } from '../../client/common/constants'; import '../../client/common/extensions'; @@ -26,7 +26,7 @@ import { IProcessLogger, IProcessServiceFactory, IPythonExecutionFactory, - IPythonExecutionService + IPythonExecutionService, } from '../../client/common/process/types'; import { IConfigurationService, IPythonSettings } from '../../client/common/types'; import { IEnvironmentActivationService } from '../../client/interpreter/activation/types'; @@ -49,7 +49,7 @@ suite('Refactor Rename', () => { cursorStyle: TextEditorCursorStyle.Line, insertSpaces: true, lineNumbers: TextEditorLineNumbersStyle.Off, - tabSize: 4 + tabSize: 4, }; let pythonSettings: typeMoq.IMock; let serviceContainer: typeMoq.IMock; @@ -75,7 +75,7 @@ suite('Refactor Rename', () => { .returns(() => Promise.resolve(undefined)); envActivationService .setup((e) => - e.getActivatedEnvironmentVariables(typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny()) + e.getActivatedEnvironmentVariables(typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny()), ) .returns(() => Promise.resolve(undefined)); serviceContainer = typeMoq.Mock.ofType(); @@ -104,8 +104,8 @@ suite('Refactor Rename', () => { configService.object, condaService.object, undefined as any, - instance(windowsStoreInterpreter) - ) + instance(windowsStoreInterpreter), + ), ); const processLogger = typeMoq.Mock.ofType(); processLogger @@ -135,12 +135,12 @@ suite('Refactor Rename', () => { 'pythonFiles', 'refactoring', 'source folder', - 'without empty line.py' + 'without empty line.py', ); const expectedDiff = `--- a/${path.basename(sourceFile)}${EOL}+++ b/${path.basename( - sourceFile + sourceFile, )}${EOL}@@ -1,8 +1,8 @@${EOL} import os${EOL} ${EOL}-def one():${EOL}+def three():${EOL} return True${EOL} ${EOL} def two():${EOL}- if one():${EOL}- print(\"A\" + one())${EOL}+ if three():${EOL}+ print(\"A\" + three())${EOL}`.splitLines( - { removeEmptyEntries: false, trim: false } + { removeEmptyEntries: false, trim: false }, ); const workspaceRoot = path.dirname(sourceFile); @@ -153,11 +153,11 @@ suite('Refactor Rename', () => { 'three', sourceFile, new Range(7, 20, 7, 23), - options + options, ); expect(response.results).to.be.lengthOf(1); expect(response.results[0].diff.splitLines({ removeEmptyEntries: false, trim: false })).to.be.deep.equal( - expectedDiff + expectedDiff, ); }); test('Rename function in source with a trailing empty line', async () => { @@ -168,12 +168,12 @@ suite('Refactor Rename', () => { 'pythonFiles', 'refactoring', 'source folder', - 'with empty line.py' + 'with empty line.py', ); const expectedDiff = `--- a/${path.basename(sourceFile)}${EOL}+++ b/${path.basename( - sourceFile + sourceFile, )}${EOL}@@ -1,8 +1,8 @@${EOL} import os${EOL} ${EOL}-def one():${EOL}+def three():${EOL} return True${EOL} ${EOL} def two():${EOL}- if one():${EOL}- print(\"A\" + one())${EOL}+ if three():${EOL}+ print(\"A\" + three())${EOL}`.splitLines( - { removeEmptyEntries: false, trim: false } + { removeEmptyEntries: false, trim: false }, ); const workspaceRoot = path.dirname(sourceFile); @@ -186,11 +186,11 @@ suite('Refactor Rename', () => { 'three', sourceFile, new Range(7, 20, 7, 23), - options + options, ); expect(response.results).to.be.lengthOf(1); expect(response.results[0].diff.splitLines({ removeEmptyEntries: false, trim: false })).to.be.deep.equal( - expectedDiff + expectedDiff, ); }); }); diff --git a/src/test/serviceRegistry.ts b/src/test/serviceRegistry.ts index 52710c03770d..3b165cf16ab5 100644 --- a/src/test/serviceRegistry.ts +++ b/src/test/serviceRegistry.ts @@ -24,7 +24,7 @@ import { IBufferDecoder, IProcessServiceFactory, IPythonExecutionFactory, - IPythonToolExecutionService + IPythonToolExecutionService, } from '../client/common/process/types'; import { registerTypes as commonRegisterTypes } from '../client/common/serviceRegistry'; import { @@ -35,7 +35,7 @@ import { IOutputChannel, IPathUtils, IsWindows, - WORKSPACE_MEMENTO + WORKSPACE_MEMENTO, } from '../client/common/types'; import { createDeferred } from '../client/common/utils/async'; import { registerTypes as variableRegisterTypes } from '../client/common/variables/serviceRegistry'; @@ -44,7 +44,7 @@ import { EnvironmentActivationService } from '../client/interpreter/activation/s import { IEnvironmentActivationService } from '../client/interpreter/activation/types'; import { IInterpreterAutoSelectionService, - IInterpreterAutoSeletionProxyService + IInterpreterAutoSeletionProxyService, } from '../client/interpreter/autoSelection/types'; import { IInterpreterService } from '../client/interpreter/contracts'; import { InterpreterService } from '../client/interpreter/interpreterService'; @@ -189,7 +189,7 @@ export class IocContainer { this.serviceManager.addSingletonInstance( IOutputChannel, stdOutputChannel, - STANDARD_OUTPUT_CHANNEL + STANDARD_OUTPUT_CHANNEL, ); const testOutputChannel = new MockOutputChannel('Python Test - UnitTests'); this.disposables.push(testOutputChannel); @@ -197,11 +197,11 @@ export class IocContainer { this.serviceManager.addSingleton( IInterpreterAutoSelectionService, - MockAutoSelectionService + MockAutoSelectionService, ); this.serviceManager.addSingleton( IInterpreterAutoSeletionProxyService, - MockAutoSelectionService + MockAutoSelectionService, ); } public async dispose(): Promise { @@ -230,7 +230,7 @@ export class IocContainer { this.serviceManager.addSingleton( IFileSystem, // Maybe use fake vscode.workspace.filesystem API: - this.useVSCodeAPI ? FileSystem : LegacyFileSystem + this.useVSCodeAPI ? FileSystem : LegacyFileSystem, ); } public registerProcessTypes() { @@ -239,11 +239,11 @@ export class IocContainer { when(mockEnvironmentActivationService.getActivatedEnvironmentVariables(anything())).thenResolve(); when(mockEnvironmentActivationService.getActivatedEnvironmentVariables(anything(), anything())).thenResolve(); when( - mockEnvironmentActivationService.getActivatedEnvironmentVariables(anything(), anything(), anything()) + mockEnvironmentActivationService.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thenResolve(); this.serviceManager.addSingletonInstance( IEnvironmentActivationService, - instance(mockEnvironmentActivationService) + instance(mockEnvironmentActivationService), ); } public registerVariableTypes() { @@ -273,26 +273,26 @@ export class IocContainer { processServiceFactory.setup((f) => f.create(TypeMoq.It.isAny())).returns(() => Promise.resolve(processService)); this.serviceManager.addSingletonInstance( IProcessServiceFactory, - processServiceFactory.object + processServiceFactory.object, ); this.serviceManager.addSingleton(IPythonExecutionFactory, PythonExecutionFactory); this.serviceManager.addSingleton( IPythonToolExecutionService, - PythonToolExecutionService + PythonToolExecutionService, ); this.serviceManager.addSingleton( IEnvironmentActivationService, - EnvironmentActivationService + EnvironmentActivationService, ); const mockEnvironmentActivationService = mock(EnvironmentActivationService); when(mockEnvironmentActivationService.getActivatedEnvironmentVariables(anything())).thenResolve(); when(mockEnvironmentActivationService.getActivatedEnvironmentVariables(anything(), anything())).thenResolve(); when( - mockEnvironmentActivationService.getActivatedEnvironmentVariables(anything(), anything(), anything()) + mockEnvironmentActivationService.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thenResolve(); this.serviceManager.rebindInstance( IEnvironmentActivationService, - instance(mockEnvironmentActivationService) + instance(mockEnvironmentActivationService), ); } diff --git a/src/test/smoke/common.ts b/src/test/smoke/common.ts index 4292ca0a1ad6..2d74879293a6 100644 --- a/src/test/smoke/common.ts +++ b/src/test/smoke/common.ts @@ -55,7 +55,7 @@ export async function openNotebookAndWaitForLS(file: string): Promise result, (err) => { assert.fail(`Something went wrong opening the text document: ${err}`); - } + }, ); await vscode.window.showTextDocument(textDocument).then(undefined, (err) => { assert.fail(`Something went wrong showing the text document: ${err}`); @@ -80,7 +80,7 @@ export async function openFileAndWaitForLS(file: string): Promise( 'vscode.executeCompletionItemProvider', textDocument.uri, - new vscode.Position(0, 0) + new vscode.Position(0, 0), ) .then(undefined, (err) => { assert.fail(`Something went wrong opening the file: ${err}`); diff --git a/src/test/smoke/datascience.smoke.test.ts b/src/test/smoke/datascience.smoke.test.ts index 9c7bd8eefa57..833576f0d6d0 100644 --- a/src/test/smoke/datascience.smoke.test.ts +++ b/src/test/smoke/datascience.smoke.test.ts @@ -42,7 +42,7 @@ suite('Smoke Test: Interactive Window', () => { 'test', 'pythonFiles', 'datascience', - 'simple_note_book.py' + 'simple_note_book.py', ); const outputFile = path.join(path.dirname(file), 'ds.log'); if (await fs.pathExists(outputFile)) { @@ -67,12 +67,12 @@ suite('Smoke Test: Interactive Window', () => { 'test', 'pythonFiles', 'datascience', - 'simple_nb.ipynb' + 'simple_nb.ipynb', ); const fileContents = await fs.readFile(file, { encoding: 'utf-8' }); const outputFile = path.join(path.dirname(file), 'ds_n.log'); await fs.writeFile(file, fileContents.replace("'ds_n.log'", `'${outputFile.replace(/\\/g, '/')}'`), { - encoding: 'utf-8' + encoding: 'utf-8', }); if (await fs.pathExists(outputFile)) { await fs.unlink(outputFile); diff --git a/src/test/smoke/runInTerminal.smoke.test.ts b/src/test/smoke/runInTerminal.smoke.test.ts index c9c22a6a4ccd..5cd74968cfea 100644 --- a/src/test/smoke/runInTerminal.smoke.test.ts +++ b/src/test/smoke/runInTerminal.smoke.test.ts @@ -30,14 +30,14 @@ suite('Smoke Test: Run Python File In Terminal', () => { 'src', 'testMultiRootWkspc', 'smokeTests', - 'testExecInTerminal.py' + 'testExecInTerminal.py', ); const outputFile = path.join( EXTENSION_ROOT_DIR_FOR_TESTS, 'src', 'testMultiRootWkspc', 'smokeTests', - 'testExecInTerminal.log' + 'testExecInTerminal.log', ); if (await fs.pathExists(outputFile)) { await fs.unlink(outputFile); diff --git a/src/test/smokeTest.ts b/src/test/smokeTest.ts index 79e44f1dcf3d..fde5b3e050a8 100644 --- a/src/test/smokeTest.ts +++ b/src/test/smokeTest.ts @@ -25,7 +25,7 @@ class TestRunner { private async launchSmokeTests() { const env: Record = { VSC_PYTHON_SMOKE_TEST: '1', - CODE_EXTENSIONS_PATH: SMOKE_TEST_EXTENSIONS_DIR + CODE_EXTENSIONS_PATH: SMOKE_TEST_EXTENSIONS_DIR, }; await this.launchTest(env); @@ -34,7 +34,7 @@ class TestRunner { // When running smoke tests, we won't have access to unbundled files. const settings = `{ "python.languageServer": ${enable ? '"Microsoft"' : '"Jedi"'} }`; await fs.ensureDir( - path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'src', 'testMultiRootWkspc', 'smokeTests', '.vscode') + path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'src', 'testMultiRootWkspc', 'smokeTests', '.vscode'), ); await fs.writeFile( path.join( @@ -43,9 +43,9 @@ class TestRunner { 'testMultiRootWkspc', 'smokeTests', '.vscode', - 'settings.json' + 'settings.json', ), - settings + settings, ); } private async launchTest(customEnvVars: Record) { @@ -58,14 +58,14 @@ class TestRunner { EXTENSION_ROOT_DIR_FOR_TESTS, 'src', 'testMultiRootWkspc', - 'smokeTests' + 'smokeTests', ), ...process.env, - ...customEnvVars + ...customEnvVars, }; const proc = spawn('node', [path.join(__dirname, 'standardTest.js')], { cwd: EXTENSION_ROOT_DIR_FOR_TESTS, - env + env, }); proc.stdout.pipe(process.stdout); proc.stderr.pipe(process.stderr); @@ -83,7 +83,7 @@ class TestRunner { private async extractLatestExtension(targetDir: string): Promise { const extensionFile = await new Promise((resolve, reject) => - glob('*.vsix', (ex, files) => (ex ? reject(ex) : resolve(files[0]))) + glob('*.vsix', (ex, files) => (ex ? reject(ex) : resolve(files[0]))), ); await unzip(extensionFile, targetDir); } diff --git a/src/test/sourceMapSupport.test.ts b/src/test/sourceMapSupport.test.ts index db7148b20831..3f2e3058fad4 100644 --- a/src/test/sourceMapSupport.test.ts +++ b/src/test/sourceMapSupport.test.ts @@ -18,7 +18,7 @@ suite('Source Map Support', () => { const stubInfo = { configValueRetrieved: false, configValueUpdated: false, - messageDisplayed: false + messageDisplayed: false, }; const vscode = { workspace: { @@ -39,17 +39,17 @@ suite('Source Map Support', () => { ) { stubInfo.configValueUpdated = true; } - } + }, }; - } + }, }, window: { showWarningMessage: () => { stubInfo.messageDisplayed = true; return Promise.resolve(selectDisableButton ? Diagnostics.disableSourceMaps() : undefined); - } + }, }, - ConfigurationTarget: ConfigurationTarget + ConfigurationTarget: ConfigurationTarget, }; return { stubInfo, vscode }; } @@ -70,7 +70,7 @@ suite('Source Map Support', () => { disposables.push(jsFile); const mapFile = `${jsFile.filePath}.map`; disposables.push({ - dispose: () => fs.unlinkSync(mapFile) + dispose: () => fs.unlinkSync(mapFile), }); await fileSystem.writeFile(mapFile, 'ABC'); expect(await fileSystem.fileExists(mapFile)).to.be.true; diff --git a/src/test/sourceMapSupport.unit.test.ts b/src/test/sourceMapSupport.unit.test.ts index 437a7463269e..4dbef3f96fba 100644 --- a/src/test/sourceMapSupport.unit.test.ts +++ b/src/test/sourceMapSupport.unit.test.ts @@ -20,7 +20,7 @@ suite('Source Map Support', () => { const stubInfo = { configValueRetrieved: false, configValueUpdated: false, - messageDisplayed: false + messageDisplayed: false, }; const vscode = { workspace: { @@ -42,17 +42,17 @@ suite('Source Map Support', () => { ) { stubInfo.configValueUpdated = true; } - } + }, }; - } + }, }, window: { showWarningMessage: () => { stubInfo.messageDisplayed = true; return Promise.resolve(selectDisableButton ? Diagnostics.disableSourceMaps() : undefined); - } + }, }, - ConfigurationTarget: ConfigurationTarget + ConfigurationTarget: ConfigurationTarget, }; return { stubInfo, vscode }; } diff --git a/src/test/standardTest.ts b/src/test/standardTest.ts index 717cfaa9a426..716c655a22b9 100644 --- a/src/test/standardTest.ts +++ b/src/test/standardTest.ts @@ -45,7 +45,7 @@ async function installJupyterExtension(vscodeExecutablePath: string) { // For now install Jupyter from the marketplace spawnSync(cliPath, ['--install-extension', JUPYTER_EXTENSION_ID], { encoding: 'utf-8', - stdio: 'inherit' + stdio: 'inherit', }); } @@ -60,7 +60,7 @@ async function installPylanceExtension(vscodeExecutablePath: string) { // For now install pylance from the marketplace spawnSync(cliPath, ['--install-extension', PYLANCE_EXTENSION_ID], { encoding: 'utf-8', - stdio: 'inherit' + stdio: 'inherit', }); // Make sure to enable it by writing to our workspace path settings @@ -96,7 +96,7 @@ async function start() { extensionTestsPath: path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'out', 'test'), launchArgs, version: channel, - extensionTestsEnv: { ...process.env, UITEST_DISABLE_INSIDERS: '1' } + extensionTestsEnv: { ...process.env, UITEST_DISABLE_INSIDERS: '1' }, }); } start().catch((ex) => { diff --git a/src/test/startPage/mockCommandManager.ts b/src/test/startPage/mockCommandManager.ts index 91cd18311c8e..45ec2a7ae09e 100644 --- a/src/test/startPage/mockCommandManager.ts +++ b/src/test/startPage/mockCommandManager.ts @@ -22,14 +22,14 @@ export class MockCommandManager implements ICommandManager { return { dispose: () => { noop(); - } + }, }; } public registerTextEditorCommand( _command: string, _callback: (textEditor: TextEditor, edit: TextEditorEdit, ...args: any[]) => void, - _thisArg?: any + _thisArg?: any, ): Disposable { throw new Error('Method not implemented.'); } diff --git a/src/test/startPage/mockDocument.ts b/src/test/startPage/mockDocument.ts index 0daa23dacf7e..a86265862fc8 100644 --- a/src/test/startPage/mockDocument.ts +++ b/src/test/startPage/mockDocument.ts @@ -58,7 +58,7 @@ export class MockDocument implements TextDocument { contents: string, fileName: string, onSave: (doc: TextDocument) => Promise, - language?: string + language?: string, ) { this._uri = Uri.file(fileName); this._contents = contents; @@ -179,7 +179,7 @@ export class MockDocument implements TextDocument { return new MockLine( line, index, - prevLine ? prevLine.offset + prevLine.rangeIncludingLineBreak.end.character : 0 + prevLine ? prevLine.offset + prevLine.rangeIncludingLineBreak.end.character : 0, ); } diff --git a/src/test/startPage/mockDocumentManager.ts b/src/test/startPage/mockDocumentManager.ts index f19c83f406cc..0ae5440768cf 100644 --- a/src/test/startPage/mockDocumentManager.ts +++ b/src/test/startPage/mockDocumentManager.ts @@ -18,7 +18,7 @@ import { TextEditorViewColumnChangeEvent, Uri, ViewColumn, - WorkspaceEdit + WorkspaceEdit, } from 'vscode'; import { IDocumentManager } from '../../client/common/application/types'; @@ -71,7 +71,7 @@ export class MockDocumentManager implements IDocumentManager { public showTextDocument( _document: TextDocument, _column?: ViewColumn, - _preserveFocus?: boolean + _preserveFocus?: boolean, ): Thenable; public showTextDocument(_document: TextDocument | Uri, _options?: TextDocumentShowOptions): Thenable; public showTextDocument(document: any, _column?: any, _preserveFocus?: any): Thenable { @@ -115,12 +115,12 @@ export class MockDocumentManager implements IDocumentManager { range: c.range, rangeOffset: startOffset, rangeLength: endOffset - startOffset, - text: c.newText + text: c.newText, }; }); const ev: TextDocumentChangeEvent = { document: doc, - contentChanges + contentChanges, }; // Changes are applied to the doc before it's sent. ev.contentChanges.forEach(doc.edit.bind(doc)); diff --git a/src/test/startPage/mockPythonSettings.ts b/src/test/startPage/mockPythonSettings.ts index aebd6786796c..4d176d72915c 100644 --- a/src/test/startPage/mockPythonSettings.ts +++ b/src/test/startPage/mockPythonSettings.ts @@ -6,7 +6,7 @@ import { PythonSettings } from '../../client/common/configSettings'; import { IExperimentsManager, IInterpreterPathService, Resource } from '../../client/common/types'; import { IInterpreterAutoSeletionProxyService, - IInterpreterSecurityService + IInterpreterSecurityService, } from '../../client/interpreter/autoSelection/types'; export class MockPythonSettings extends PythonSettings { @@ -16,7 +16,7 @@ export class MockPythonSettings extends PythonSettings { workspace?: IWorkspaceService, experimentsManager?: IExperimentsManager, interpreterPathService?: IInterpreterPathService, - interpreterSecurityService?: IInterpreterSecurityService + interpreterSecurityService?: IInterpreterSecurityService, ) { super( workspaceFolder, @@ -24,7 +24,7 @@ export class MockPythonSettings extends PythonSettings { workspace, experimentsManager, interpreterPathService, - interpreterSecurityService + interpreterSecurityService, ); } diff --git a/src/test/startPage/mockTextEditor.ts b/src/test/startPage/mockTextEditor.ts index 244dabfef5e2..f66af9c769ed 100644 --- a/src/test/startPage/mockTextEditor.ts +++ b/src/test/startPage/mockTextEditor.ts @@ -15,7 +15,7 @@ import { TextEditorEdit, TextEditorOptions, TextEditorRevealType, - ViewColumn + ViewColumn, } from 'vscode'; import { noop } from '../../client/common/utils/misc'; @@ -29,8 +29,8 @@ class MockEditorEdit implements TextEditorEdit { this._documentManager.changeDocument(this._document.fileName, [ { range: location as Range, - newText: value - } + newText: value, + }, ]); } @@ -38,8 +38,8 @@ class MockEditorEdit implements TextEditorEdit { this._documentManager.changeDocument(this._document.fileName, [ { range: new Range(location, location), - newText: value - } + newText: value, + }, ]); } public delete(_location: Selection | Range): void { @@ -74,7 +74,7 @@ export class MockEditor implements TextEditor { } public edit( callback: (editBuilder: TextEditorEdit) => void, - _options?: { undoStopBefore: boolean; undoStopAfter: boolean } | undefined + _options?: { undoStopBefore: boolean; undoStopAfter: boolean } | undefined, ): Thenable { return new Promise((r) => { const editor = new MockEditorEdit(this._documentManager, this._document); @@ -85,13 +85,13 @@ export class MockEditor implements TextEditor { public insertSnippet( _snippet: SnippetString, _location?: Range | Position | Range[] | Position[] | undefined, - _options?: { undoStopBefore: boolean; undoStopAfter: boolean } | undefined + _options?: { undoStopBefore: boolean; undoStopAfter: boolean } | undefined, ): Thenable { throw new Error('Method not implemented.'); } public setDecorations( _decorationType: TextEditorDecorationType, - _rangesOrOptions: Range[] | DecorationOptions[] + _rangesOrOptions: Range[] | DecorationOptions[], ): void { throw new Error('Method not implemented.'); } diff --git a/src/test/startPage/mockWorkspaceConfig.ts b/src/test/startPage/mockWorkspaceConfig.ts index 2bd49eaf6db5..25f8dceb8120 100644 --- a/src/test/startPage/mockWorkspaceConfig.ts +++ b/src/test/startPage/mockWorkspaceConfig.ts @@ -33,7 +33,7 @@ export class MockWorkspaceConfiguration implements WorkspaceConfiguration { return this.values.has(section); } public inspect( - section: string + section: string, ): | { key: string; @@ -48,7 +48,7 @@ export class MockWorkspaceConfiguration implements WorkspaceConfiguration { public update( section: string, value: any, - _configurationTarget?: boolean | ConfigurationTarget | undefined + _configurationTarget?: boolean | ConfigurationTarget | undefined, ): Promise { this.values.set(section, value); return Promise.resolve(); diff --git a/src/test/startPage/mountedWebView.ts b/src/test/startPage/mountedWebView.ts index 51ef0ca136de..fb33d3f35e3f 100644 --- a/src/test/startPage/mountedWebView.ts +++ b/src/test/startPage/mountedWebView.ts @@ -7,7 +7,7 @@ import { IWebviewPanel, IWebviewPanelMessageListener, IWebviewPanelOptions, - WebviewMessage + WebviewMessage, } from '../../client/common/application/types'; import { traceError, traceInfo } from '../../client/common/logger'; import { IDisposable } from '../../client/common/types'; @@ -74,7 +74,7 @@ export class MountedWebView implements IMountedWebView, IDisposable { // tslint:disable-next-line:no-any no-empty getState: () => { return {}; - } + }, }; }; // tslint:disable-next-line:no-string-literal @@ -113,7 +113,7 @@ export class MountedWebView implements IMountedWebView, IDisposable { // handle some messages during the ctor. setTimeout(() => { this.missedMessages.forEach((m) => - this.webPanelListener ? this.webPanelListener.onMessage(m.type, m.payload) : noop() + this.webPanelListener ? this.webPanelListener.onMessage(m.type, m.payload) : noop(), ); this.missedMessages = []; }, 0); diff --git a/src/test/startPage/reactHelpers.ts b/src/test/startPage/reactHelpers.ts index 0ae321026df0..cf6d7477e940 100644 --- a/src/test/startPage/reactHelpers.ts +++ b/src/test/startPage/reactHelpers.ts @@ -108,7 +108,7 @@ class MockCanvas implements CanvasRenderingContext2D { _r0: number, _x1: number, _y1: number, - _r1: number + _r1: number, ): CanvasGradient { throw new Error('Method not implemented.'); } @@ -186,7 +186,7 @@ class MockCanvas implements CanvasRenderingContext2D { dx: number, dy: number, dw: number, - dh: number + dh: number, ): void; public drawImage( _image: any, @@ -197,7 +197,7 @@ class MockCanvas implements CanvasRenderingContext2D { _dx?: any, _dy?: any, _dw?: any, - _dh?: any + _dh?: any, ) { throw new Error('Method not implemented.'); } @@ -217,7 +217,7 @@ class MockCanvas implements CanvasRenderingContext2D { dirtyX: number, dirtyY: number, dirtyWidth: number, - dirtyHeight: number + dirtyHeight: number, ): void; public putImageData( _imagedata: any, @@ -226,7 +226,7 @@ class MockCanvas implements CanvasRenderingContext2D { _dirtyX?: any, _dirtyY?: any, _dirtyWidth?: any, - _dirtyHeight?: any + _dirtyHeight?: any, ) { throw new Error('Method not implemented.'); } @@ -251,7 +251,7 @@ class MockCanvas implements CanvasRenderingContext2D { _radius: number, _startAngle: number, _endAngle: number, - _anticlockwise?: boolean | undefined + _anticlockwise?: boolean | undefined, ): void { throw new Error('Method not implemented.'); } @@ -272,7 +272,7 @@ class MockCanvas implements CanvasRenderingContext2D { _rotation: number, _startAngle: number, _endAngle: number, - _anticlockwise?: boolean | undefined + _anticlockwise?: boolean | undefined, ): void { throw new Error('Method not implemented.'); } @@ -296,7 +296,7 @@ export function setUpDomEnvironment() { // tslint:disable-next-line:no-http-string const dom = new JSDOM('
', { pretendToBeVisual: true, - url: 'http://localhost' + url: 'http://localhost', }); const { window } = dom; @@ -332,7 +332,7 @@ export function setUpDomEnvironment() { // tslint:disable-next-line:no-string-literal no-any (global as any)['navigator'] = { userAgent: 'node.js', - platform: 'node' + platform: 'node', }; (global as any)['Event'] = window.Event; (global as any)['KeyboardEvent'] = window.KeyboardEvent; @@ -353,7 +353,7 @@ export function setUpDomEnvironment() { setEnd: (_endNode: any, _endOffset: any) => noop(), setStart: (_startNode: any, _startOffset: any) => noop(), getBoundingClientRect: () => null, - getClientRects: () => [] + getClientRects: () => [], }); // Another special case. CodeMirror needs selection @@ -385,7 +385,7 @@ export function setUpDomEnvironment() { selectAllChildren: (_parentNode: Node) => noop(), setBaseAndExtent: (_baseNode: Node, _baseOffset: number, _extentNode: Node, _extentOffset: number) => noop(), setPosition: (_parentNode: Node, _offset: number) => noop(), - toString: () => '{Selection}' + toString: () => '{Selection}', }; (global as any)['DOMParser'] = dom.window.DOMParser; @@ -488,7 +488,7 @@ const keyMap: { [key: string]: { code: number; shift: boolean } } = { '~': { code: 192, shift: true }, ' ': { code: 32, shift: false }, '\n': { code: 13, shift: false }, - '\r': { code: 0, shift: false } // remove \r from the text. + '\r': { code: 0, shift: false }, // remove \r from the text. }; export function createMessageEvent(data: any): MessageEvent { diff --git a/src/test/startPage/startPage.functional.test.tsx b/src/test/startPage/startPage.functional.test.tsx index 5fc97fcdaf83..246ac71d6b11 100644 --- a/src/test/startPage/startPage.functional.test.tsx +++ b/src/test/startPage/startPage.functional.test.tsx @@ -27,7 +27,7 @@ suite('StartPage tests', () => { // Setup our webview panel const wrapper = ioc.createWebView( () => mount(), - 'default' + 'default', ); // Make sure the plot viewer provider and execution factory in the container is created (the extension does this on startup in the extension) @@ -39,7 +39,7 @@ suite('StartPage tests', () => { // tslint:disable:no-any function runMountedTest( name: string, - testFunc: (wrapper: ReactWrapper, React.Component>) => Promise + testFunc: (wrapper: ReactWrapper, React.Component>) => Promise, ) { test(name, async () => { const wrapper = mountWebView(); diff --git a/src/test/startPage/startPage.unit.test.ts b/src/test/startPage/startPage.unit.test.ts index 0f8274245daa..7293de1617c9 100644 --- a/src/test/startPage/startPage.unit.test.ts +++ b/src/test/startPage/startPage.unit.test.ts @@ -11,7 +11,7 @@ import { ICommandManager, IDocumentManager, IWebviewPanelProvider, - IWorkspaceService + IWorkspaceService, } from '../../client/common/application/types'; import { PythonSettings } from '../../client/common/configSettings'; import { IFileSystem } from '../../client/common/platform/types'; @@ -43,7 +43,7 @@ suite('StartPage tests', () => { .setup((m) => m.update(typemoq.It.isAnyString(), typemoq.It.isAnyString())) .returns(() => Promise.resolve()); const packageJson = { - version: actualVersion + version: actualVersion, }; appEnvironment.setup((ae) => ae.packageJson).returns(() => packageJson); } @@ -81,7 +81,7 @@ suite('StartPage tests', () => { documentManager.object, appShell.object, context.object, - appEnvironment.object + appEnvironment.object, ); }); diff --git a/src/test/startPage/startPageIocContainer.ts b/src/test/startPage/startPageIocContainer.ts index 00370322576f..c0ef4cd60fca 100644 --- a/src/test/startPage/startPageIocContainer.ts +++ b/src/test/startPage/startPageIocContainer.ts @@ -18,7 +18,7 @@ import { FileSystemWatcher, Uri, WorkspaceFolder, - WorkspaceFoldersChangeEvent + WorkspaceFoldersChangeEvent, } from 'vscode'; import { LanguageServerType } from '../../client/activation/types'; @@ -31,7 +31,7 @@ import { IDocumentManager, IWebviewPanelOptions, IWebviewPanelProvider, - IWorkspaceService + IWorkspaceService, } from '../../client/common/application/types'; import { WebviewPanelProvider } from '../../client/common/application/webviewPanels/webviewPanelProvider'; import { WorkspaceService } from '../../client/common/application/workspace'; @@ -63,7 +63,7 @@ import { IPathUtils, IPythonSettings, IsWindows, - Resource + Resource, } from '../../client/common/types'; import { sleep } from '../../client/common/utils/async'; import { noop } from '../../client/common/utils/misc'; @@ -206,7 +206,7 @@ export class StartPageIocContainer extends UnitTestIocContainer { } else { this.serviceManager.addSingletonInstance( IWebviewPanelProvider, - instance(this.webPanelProvider) + instance(this.webPanelProvider), ); } @@ -222,7 +222,7 @@ export class StartPageIocContainer extends UnitTestIocContainer { configurationService.setup((c) => c.getSettings(TypeMoq.It.isAny())).returns(this.getSettings.bind(this)); this.serviceManager.addSingletonInstance( IConfigurationService, - configurationService.object + configurationService.object, ); // Setup our command list @@ -289,7 +289,7 @@ export class StartPageIocContainer extends UnitTestIocContainer { setting = new MockPythonSettings( resource, new MockAutoSelectionService(), - this.serviceManager.get(IWorkspaceService) + this.serviceManager.get(IWorkspaceService), ); this.settingsMap.set(key, setting); } else if (this.disposed) { @@ -365,7 +365,7 @@ export class StartPageIocContainer extends UnitTestIocContainer { const testWorkspaceFolder = path.join(EXTENSION_ROOT_DIR, 'src', 'test', 'startPage'); when(workspaceService.createFileSystemWatcher(anything(), anything(), anything(), anything())).thenReturn( - new MockFileSystemWatcher() + new MockFileSystemWatcher(), ); when(workspaceService.createFileSystemWatcher(anything())).thenReturn(new MockFileSystemWatcher()); when(workspaceService.hasWorkspaceFolders).thenReturn(true); @@ -404,7 +404,7 @@ export class StartPageIocContainer extends UnitTestIocContainer { executeInFileDir: false, launchArgs: [], activateEnvironment: true, - activateEnvInCurrentTerminal: false + activateEnvInCurrentTerminal: false, }; pythonSettings.languageServer = languageServerType; return pythonSettings; @@ -425,7 +425,7 @@ export class StartPageIocContainer extends UnitTestIocContainer { const output = child_process.execFileSync( process.env.CI_PYTHON_PATH || 'python', ['-c', 'import sys;print(sys.executable)'], - { encoding: 'utf8' } + { encoding: 'utf8' }, ); StartPageIocContainer.foundPythonPath = output.replace(/\r?\n/g, ''); } diff --git a/src/test/startPage/webBrowserPanel.ts b/src/test/startPage/webBrowserPanel.ts index 308103ee9e17..4424be9190b4 100644 --- a/src/test/startPage/webBrowserPanel.ts +++ b/src/test/startPage/webBrowserPanel.ts @@ -137,12 +137,12 @@ export class WebBrowserPanel implements IWebviewPanel, IDisposable { private loadFailedEmitter = new EventEmitter(); constructor( private readonly disposableRegistry: IDisposableRegistry, - private readonly options: IWebviewPanelOptions + private readonly options: IWebviewPanelOptions, ) { this.disposableRegistry.push(this); const webViewOptions: WebviewOptions = { enableScripts: true, - localResourceRoots: [Uri.file(this.options.rootPath), Uri.file(this.options.cwd)] + localResourceRoots: [Uri.file(this.options.rootPath), Uri.file(this.options.cwd)], }; if (options.webViewPanel) { this.panel = options.webViewPanel; @@ -155,8 +155,8 @@ export class WebBrowserPanel implements IWebviewPanel, IDisposable { { retainContextWhenHidden: true, enableFindWidget: true, - ...webViewOptions - } + ...webViewOptions, + }, ); } @@ -166,7 +166,7 @@ export class WebBrowserPanel implements IWebviewPanel, IDisposable { this.panel.onDidDispose(() => { this.panel = undefined; this.options.listener.dispose().ignoreErrors(); - }) + }), ); this.launchServer(this.options.cwd, this.options.rootPath) @@ -175,7 +175,7 @@ export class WebBrowserPanel implements IWebviewPanel, IDisposable { }) .catch((ex) => // tslint:disable-next-line: no-console - console.error('Failed to start Web Browser Panel', ex) + console.error('Failed to start Web Browser Panel', ex), ); } diff --git a/src/test/telemetry/envFileTelemetry.unit.test.ts b/src/test/telemetry/envFileTelemetry.unit.test.ts index 9a37cf76cc47..f03e93b64490 100644 --- a/src/test/telemetry/envFileTelemetry.unit.test.ts +++ b/src/test/telemetry/envFileTelemetry.unit.test.ts @@ -16,7 +16,7 @@ import { EnvFileTelemetryTests, sendActivationTelemetry, sendFileCreationTelemetry, - sendSettingTelemetry + sendSettingTelemetry, } from '../../client/telemetry/envFileTelemetry'; suite('Env file telemetry', () => { @@ -34,8 +34,8 @@ suite('Env file telemetry', () => { const mockWorkspaceConfig = { inspect: () => ({ - defaultValue: defaultEnvFileValue - }) + defaultValue: defaultEnvFileValue, + }), }; // tslint:disable-next-line: no-any @@ -44,11 +44,11 @@ suite('Env file telemetry', () => { const mockSendTelemetryEvent = ( eventName: EventName, _: number | undefined, - { hasCustomEnvPath }: { hasCustomEnvPath: boolean } + { hasCustomEnvPath }: { hasCustomEnvPath: boolean }, ) => { telemetryEvent = { eventName, - hasCustomEnvPath + hasCustomEnvPath, }; }; diff --git a/src/test/telemetry/index.unit.test.ts b/src/test/telemetry/index.unit.test.ts index 77c9eef0012c..0098e1eb5510 100644 --- a/src/test/telemetry/index.unit.test.ts +++ b/src/test/telemetry/index.unit.test.ts @@ -16,7 +16,7 @@ import { clearTelemetryReporter, isTelemetryDisabled, sendTelemetryEvent, - setSharedProperty + setSharedProperty, } from '../../client/telemetry'; suite('Telemetry', () => { @@ -69,13 +69,13 @@ suite('Telemetry', () => { { testName: 'Returns true when globalValue is set to false', settings: { globalValue: false }, - expectedResult: true + expectedResult: true, }, { testName: 'Returns false otherwise', settings: {}, - expectedResult: false - } + expectedResult: false, + }, ]; suite('Function isTelemetryDisabled()', () => { @@ -175,7 +175,7 @@ suite('Telemetry', () => { ...properties, errorName: error.name, errorMessage: error.message, - errorStack: error.stack + errorStack: error.stack, }; expect(Reporter.eventName).to.deep.equal([eventName]); diff --git a/src/test/tensorBoard/tensorBoardCodeActionProvider.unit.test.ts b/src/test/tensorBoard/tensorBoardCodeActionProvider.unit.test.ts index 571bd0303332..7d20e5fc2c87 100644 --- a/src/test/tensorBoard/tensorBoardCodeActionProvider.unit.test.ts +++ b/src/test/tensorBoard/tensorBoardCodeActionProvider.unit.test.ts @@ -28,7 +28,7 @@ suite('TensorBoard code action provider', () => { const codeActions = codeActionProvider.provideCodeActions(document, selection.object); assert.ok( codeActions.length > 0, - 'Failed to provide code action for Python file containing tensorboard import' + 'Failed to provide code action for Python file containing tensorboard import', ); }); test('Provides code action for Python ipynbs', () => { @@ -38,7 +38,7 @@ suite('TensorBoard code action provider', () => { const codeActions = codeActionProvider.provideCodeActions(document, selection.object); assert.ok( codeActions.length > 0, - 'Failed to provide code action for Python ipynb containing tensorboard import' + 'Failed to provide code action for Python ipynb containing tensorboard import', ); }); test('Does not provide code action if no matching import', () => { @@ -55,7 +55,7 @@ suite('TensorBoard code action provider', () => { const codeActions = codeActionProvider.provideCodeActions(document, selection.object); assert.ok( codeActions.length === 0, - 'Provided code action for file even though cursor was not on line containing import' + 'Provided code action for file even though cursor was not on line containing import', ); }); }); diff --git a/src/test/tensorBoard/tensorBoardImportTracker.unit.test.ts b/src/test/tensorBoard/tensorBoardImportTracker.unit.test.ts index b7726a4f9854..4147cae7fcbb 100644 --- a/src/test/tensorBoard/tensorBoardImportTracker.unit.test.ts +++ b/src/test/tensorBoard/tensorBoardImportTracker.unit.test.ts @@ -66,7 +66,7 @@ suite('TensorBoard import tracker', () => { const document = documentManager.addDocument( 'import tensorflow as tf\nfrom torch.utils import foo', 'foo.cpp', - 'cpp' + 'cpp', ); await documentManager.showTextDocument(document); await tensorBoardImportTracker.activate(); @@ -77,7 +77,7 @@ suite('TensorBoard import tracker', () => { `""" import tensorboard """`, - 'foo.py' + 'foo.py', ); await documentManager.showTextDocument(document); await tensorBoardImportTracker.activate(); diff --git a/src/test/terminals/activation.unit.test.ts b/src/test/terminals/activation.unit.test.ts index 3b82fed815bd..910d987ff953 100644 --- a/src/test/terminals/activation.unit.test.ts +++ b/src/test/terminals/activation.unit.test.ts @@ -38,7 +38,7 @@ suite('Terminal', () => { instance(manager), [], instance(activator), - instance(resourceService) + instance(resourceService), ); terminal = { @@ -49,7 +49,7 @@ suite('Terminal', () => { processId: Promise.resolve(0), sendText: noop, show: noop, - exitStatus: { code: 0 } + exitStatus: { code: 0 }, }; nonActivatedTerminal = { dispose: noop, @@ -59,7 +59,7 @@ suite('Terminal', () => { processId: Promise.resolve(0), sendText: noop, show: noop, - exitStatus: { code: 0 } + exitStatus: { code: 0 }, }; autoActivation.register(); }); diff --git a/src/test/terminals/codeExecution/codeExecutionManager.unit.test.ts b/src/test/terminals/codeExecution/codeExecutionManager.unit.test.ts index 196dd4fb545e..73eea2e5dd29 100644 --- a/src/test/terminals/codeExecution/codeExecutionManager.unit.test.ts +++ b/src/test/terminals/codeExecution/codeExecutionManager.unit.test.ts @@ -28,7 +28,7 @@ suite('Terminal - Code Execution Manager', () => { .setup((c) => c.onDidChangeWorkspaceFolders(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())) .returns(() => { return { - dispose: () => void 0 + dispose: () => void 0, }; }); documentManager = TypeMoq.Mock.ofType(); @@ -39,7 +39,7 @@ suite('Terminal - Code Execution Manager', () => { documentManager.object, disposables, fileSystem.object, - serviceContainer.object + serviceContainer.object, ); }); teardown(() => { @@ -70,7 +70,7 @@ suite('Terminal - Code Execution Manager', () => { Commands.Exec_In_Terminal, Commands.Exec_In_Terminal_Icon, Commands.Exec_Selection_In_Django_Shell, - Commands.Exec_Selection_In_Terminal + Commands.Exec_Selection_In_Terminal, ]); }); @@ -271,7 +271,7 @@ suite('Terminal - Code Execution Manager', () => { await commandHandler!(); executionService.verify( async (e) => e.execute(TypeMoq.It.isValue(textSelected), TypeMoq.It.isValue(activeDocumentUri)), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); helper.verifyAll(); } diff --git a/src/test/terminals/codeExecution/djangoShellCodeExect.unit.test.ts b/src/test/terminals/codeExecution/djangoShellCodeExect.unit.test.ts index 47f4a4a1f6e4..c964bada6ea3 100644 --- a/src/test/terminals/codeExecution/djangoShellCodeExect.unit.test.ts +++ b/src/test/terminals/codeExecution/djangoShellCodeExect.unit.test.ts @@ -39,7 +39,7 @@ suite('Terminal - Django Shell Code Execution', () => { .setup((c) => c.onDidChangeWorkspaceFolders(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())) .returns(() => { return { - dispose: () => void 0 + dispose: () => void 0, }; }); platform = TypeMoq.Mock.ofType(); @@ -55,7 +55,7 @@ suite('Terminal - Django Shell Code Execution', () => { platform.object, commandManager.object, fileSystem.object, - disposables + disposables, ); terminalFactory.setup((f) => f.getTerminalService(TypeMoq.It.isAny())).returns(() => terminalService.object); @@ -80,7 +80,7 @@ suite('Terminal - Django Shell Code Execution', () => { expectedPythonPath: string, terminalArgs: string[], expectedTerminalArgs: string[], - resource?: Uri + resource?: Uri, ) { platform.setup((p) => p.isWindows).returns(() => isWindows); settings.setup((s) => s.pythonPath).returns(() => pythonPath); @@ -102,7 +102,7 @@ suite('Terminal - Django Shell Code Execution', () => { pythonPath, 'c:/program files/python/python.exe', terminalArgs, - expectedTerminalArgs + expectedTerminalArgs, ); }); @@ -146,7 +146,7 @@ suite('Terminal - Django Shell Code Execution', () => { workspace.setup((w) => w.getWorkspaceFolder(TypeMoq.It.isAny())).returns(() => workspaceFolder); const expectedTerminalArgs = terminalArgs.concat( `${path.join(workspaceUri.fsPath, 'manage.py').fileToCommandArgument()}`, - 'shell' + 'shell', ); await testReplCommandArguments(true, pythonPath, pythonPath, terminalArgs, expectedTerminalArgs, Uri.file('x')); @@ -160,7 +160,7 @@ suite('Terminal - Django Shell Code Execution', () => { workspace.setup((w) => w.getWorkspaceFolder(TypeMoq.It.isAny())).returns(() => workspaceFolder); const expectedTerminalArgs = terminalArgs.concat( path.join(workspaceUri.fsPath, 'manage.py').fileToCommandArgument(), - 'shell' + 'shell', ); await testReplCommandArguments(true, pythonPath, pythonPath, terminalArgs, expectedTerminalArgs, Uri.file('x')); @@ -175,7 +175,7 @@ suite('Terminal - Django Shell Code Execution', () => { workspace.setup((w) => w.workspaceFolders).returns(() => [workspaceFolder]); const expectedTerminalArgs = terminalArgs.concat( `${path.join(workspaceUri.fsPath, 'manage.py').fileToCommandArgument()}`, - 'shell' + 'shell', ); await testReplCommandArguments(true, pythonPath, pythonPath, terminalArgs, expectedTerminalArgs, Uri.file('x')); @@ -190,7 +190,7 @@ suite('Terminal - Django Shell Code Execution', () => { workspace.setup((w) => w.workspaceFolders).returns(() => [workspaceFolder]); const expectedTerminalArgs = terminalArgs.concat( path.join(workspaceUri.fsPath, 'manage.py').fileToCommandArgument(), - 'shell' + 'shell', ); await testReplCommandArguments(true, pythonPath, pythonPath, terminalArgs, expectedTerminalArgs, Uri.file('x')); @@ -200,7 +200,7 @@ suite('Terminal - Django Shell Code Execution', () => { pythonPath: string, terminalArgs: string[], condaEnv: { name: string; path: string }, - resource?: Uri + resource?: Uri, ) { settings.setup((s) => s.pythonPath).returns(() => pythonPath); terminalSettings.setup((t) => t.launchArgs).returns(() => terminalArgs); @@ -217,7 +217,7 @@ suite('Terminal - Django Shell Code Execution', () => { execObservable: procs.execObservable, execModuleObservable: procs.execModuleObservable, exec: procs.exec, - execModule: procs.execModule + execModule: procs.execModule, }; const expectedTerminalArgs = [...terminalArgs, 'manage.py', 'shell']; pythonExecutionFactory diff --git a/src/test/terminals/codeExecution/helper.test.ts b/src/test/terminals/codeExecution/helper.test.ts index 8e32fc06dbab..410d586f3740 100644 --- a/src/test/terminals/codeExecution/helper.test.ts +++ b/src/test/terminals/codeExecution/helper.test.ts @@ -19,7 +19,7 @@ import { ProcessService } from '../../../client/common/process/proc'; import { IProcessService, IProcessServiceFactory, - ObservableExecutionResult + ObservableExecutionResult, } from '../../../client/common/process/types'; import { IExperimentService } from '../../../client/common/types'; import { Architecture } from '../../../client/common/utils/platform'; @@ -50,7 +50,7 @@ suite('Terminal - Code Execution Helper', () => { sysPrefix: 'Python', displayName: 'Python', envType: EnvironmentType.Unknown, - architecture: Architecture.x64 + architecture: Architecture.x64, }; setup(() => { @@ -139,7 +139,7 @@ suite('Terminal - Code Execution Helper', () => { processService .setup((p) => p.execObservable(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())) .returns((file, args, options) => - actualProcessService.execObservable.apply(actualProcessService, [file, args, options]) + actualProcessService.execObservable.apply(actualProcessService, [file, args, options]), ); const normalizedCode = await helper.normalizeLines(source); const normalizedExpected = expectedSource.replace(/\r\n/g, '\n'); @@ -165,7 +165,7 @@ suite('Terminal - Code Execution Helper', () => { '', '', 'print(1)', - 'print(2)' + 'print(2)', ]; const expectedCode = code.filter((line) => line.trim().length > 0).join(EOL); await ensureCodeIsNormalized(code.join(EOL), expectedCode); @@ -182,7 +182,7 @@ suite('Terminal - Code Execution Helper', () => { '', '', 'print(1)', - 'print(2)' + 'print(2)', ]; const actualProcessService = new ProcessService(new BufferDecoder()); processService @@ -194,7 +194,7 @@ suite('Terminal - Code Execution Helper', () => { const doubleCrIndex = normalizedCode.indexOf('\r\r'); expect(doubleCrIndex).to.be.equal( -1, - 'Double CR (CRCRLF) line endings detected in normalized code snippet.' + 'Double CR (CRCRLF) line endings detected in normalized code snippet.', ); }); ['', '1', '2', '3', '4', '5', '6', '7', '8'].forEach((fileNameSuffix) => { @@ -202,7 +202,7 @@ suite('Terminal - Code Execution Helper', () => { const code = await fs.readFile(path.join(TEST_FILES_PATH, `sample${fileNameSuffix}_raw.py`), 'utf8'); const expectedCode = await fs.readFile( path.join(TEST_FILES_PATH, `sample${fileNameSuffix}_normalized.py`), - 'utf8' + 'utf8', ); await ensureCodeIsNormalized(code, expectedCode); }); @@ -210,7 +210,7 @@ suite('Terminal - Code Execution Helper', () => { const code = await fs.readFile(path.join(TEST_FILES_PATH, `sample${fileNameSuffix}_raw.py`), 'utf8'); const expectedCode = await fs.readFile( path.join(TEST_FILES_PATH, `sample${fileNameSuffix}_normalized.py`), - 'utf8' + 'utf8', ); await ensureCodeIsNormalized(code + EOL, expectedCode + EOL); }); @@ -218,7 +218,7 @@ suite('Terminal - Code Execution Helper', () => { const code = await fs.readFile(path.join(TEST_FILES_PATH, `sample${fileNameSuffix}_raw.py`), 'utf8'); const expectedCode = await fs.readFile( path.join(TEST_FILES_PATH, `sample${fileNameSuffix}_normalized.py`), - 'utf8' + 'utf8', ); await ensureCodeIsNormalized(code + EOL + EOL + EOL + EOL, expectedCode + EOL); }); @@ -237,7 +237,7 @@ suite('Terminal - Code Execution Helper', () => { const code = await fs.readFile(path.join(TEST_FILES_PATH, `sample${fileNameSuffix}_raw.py`), 'utf8'); const expectedCode = await fs.readFile( path.join(TEST_FILES_PATH, `sample${fileNameSuffix}_normalized_selection.py`), - 'utf8' + 'utf8', ); await ensureCodeIsNormalized(code, expectedCode); @@ -416,12 +416,12 @@ suite('Terminal - Code Execution Helper', () => { .returns(() => 'if (m == 0):\n return n'); document .setup((d) => - d.getText(new Range(new Position(selection.start.line, 4), new Position(selection.start.line, 16))) + d.getText(new Range(new Position(selection.start.line, 4), new Position(selection.start.line, 16))), ) .returns(() => 'if (m == 0):'); document .setup((d) => - d.getText(new Range(new Position(selection.start.line, 0), new Position(selection.end.line, 20))) + d.getText(new Range(new Position(selection.start.line, 0), new Position(selection.end.line, 20))), ) .returns(() => ' if (m == 0):\n return n + 1'); @@ -453,12 +453,12 @@ suite('Terminal - Code Execution Helper', () => { .returns(() => '(m > 0\n and n == 0)'); document .setup((d) => - d.getText(new Range(new Position(selection.start.line, 7), new Position(selection.start.line, 13))) + d.getText(new Range(new Position(selection.start.line, 7), new Position(selection.start.line, 13))), ) .returns(() => '(m > 0'); document .setup((d) => - d.getText(new Range(new Position(selection.start.line, 0), new Position(selection.end.line, 19))) + d.getText(new Range(new Position(selection.start.line, 0), new Position(selection.end.line, 19))), ) .returns(() => ' if (m > 0\n and n == 0)'); diff --git a/src/test/terminals/codeExecution/terminalCodeExec.unit.test.ts b/src/test/terminals/codeExecution/terminalCodeExec.unit.test.ts index eb05531b0405..6e8fb66fc243 100644 --- a/src/test/terminals/codeExecution/terminalCodeExec.unit.test.ts +++ b/src/test/terminals/codeExecution/terminalCodeExec.unit.test.ts @@ -72,7 +72,7 @@ suite('Terminal - Code Execution', () => { configService.object, workspace.object, disposables, - platform.object + platform.object, ); break; } @@ -82,7 +82,7 @@ suite('Terminal - Code Execution', () => { configService.object, workspace.object, disposables, - platform.object + platform.object, ); expectedTerminalTitle = 'REPL'; break; @@ -91,7 +91,7 @@ suite('Terminal - Code Execution', () => { isDjangoRepl = true; workspace .setup((w) => - w.onDidChangeWorkspaceFolders(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + w.onDidChangeWorkspaceFolders(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns(() => { return { dispose: noop }; @@ -104,7 +104,7 @@ suite('Terminal - Code Execution', () => { platform.object, commandManager.object, fileSystem.object, - disposables + disposables, ); expectedTerminalTitle = 'Django Shell'; break; @@ -125,7 +125,7 @@ suite('Terminal - Code Execution', () => { async function ensureTerminalIsCreatedUponInvokingInitializeRepl( isWindows: boolean, isOsx: boolean, - isLinux: boolean + isLinux: boolean, ): Promise { platform.setup((p) => p.isWindows).returns(() => isWindows); platform.setup((p) => p.isMac).returns(() => isOsx); @@ -172,7 +172,7 @@ suite('Terminal - Code Execution', () => { terminalService.verify( async (t) => t.sendText(TypeMoq.It.isValue(`cd ${path.dirname(file.fsPath).fileToCommandArgument()}`)), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); } test('Ensure we set current directory before executing file (non windows)', async () => { @@ -205,7 +205,7 @@ suite('Terminal - Code Execution', () => { }); async function ensureWeDoNotSetCurrentDirectoryBeforeExecutingFileInSameDirectory( - isWindows: boolean + isWindows: boolean, ): Promise { const file = Uri.file(path.join('c', 'path', 'to', 'file with spaces in path', 'one.py')); terminalSettings.setup((t) => t.executeInFileDir).returns(() => true); @@ -229,7 +229,7 @@ suite('Terminal - Code Execution', () => { }); async function ensureWeSetCurrentDirectoryBeforeExecutingFileNotInSameDirectory( - isWindows: boolean + isWindows: boolean, ): Promise { const file = Uri.file(path.join('c', 'path', 'to', 'file with spaces in path', 'one.py')); terminalSettings.setup((t) => t.executeInFileDir).returns(() => true); @@ -253,7 +253,7 @@ suite('Terminal - Code Execution', () => { isWindows: boolean, pythonPath: string, terminalArgs: string[], - file: Uri + file: Uri, ): Promise { platform.setup((p) => p.isWindows).returns(() => isWindows); settings.setup((s) => s.pythonPath).returns(() => pythonPath); @@ -262,7 +262,7 @@ suite('Terminal - Code Execution', () => { workspace.setup((w) => w.getWorkspaceFolder(TypeMoq.It.isAny())).returns(() => undefined); pythonExecutionFactory .setup((p) => - p.createCondaExecutionService(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + p.createCondaExecutionService(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns(() => Promise.resolve(undefined)); @@ -272,7 +272,7 @@ suite('Terminal - Code Execution', () => { terminalService.verify( async (t) => t.sendCommand(TypeMoq.It.isValue(expectedPythonPath), TypeMoq.It.isValue(expectedArgs)), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); } @@ -300,7 +300,7 @@ suite('Terminal - Code Execution', () => { pythonPath: string, terminalArgs: string[], file: Uri, - condaEnv: { name: string; path: string } + condaEnv: { name: string; path: string }, ): Promise { settings.setup((s) => s.pythonPath).returns(() => pythonPath); terminalSettings.setup((t) => t.launchArgs).returns(() => terminalArgs); @@ -319,11 +319,11 @@ suite('Terminal - Code Execution', () => { execObservable: procs.execObservable, execModuleObservable: procs.execModuleObservable, exec: procs.exec, - execModule: procs.execModule + execModule: procs.execModule, }; pythonExecutionFactory .setup((p) => - p.createCondaExecutionService(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + p.createCondaExecutionService(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns(() => Promise.resolve(condaExecutionService)); @@ -333,7 +333,7 @@ suite('Terminal - Code Execution', () => { terminalService.verify( async (t) => t.sendCommand(TypeMoq.It.isValue(pythonPath), TypeMoq.It.isValue(expectedArgs)), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); } @@ -341,7 +341,7 @@ suite('Terminal - Code Execution', () => { const file = Uri.file(path.join('c', 'path', 'to', 'file', 'one.py')); await testCondaFileExecution(PYTHON_PATH, ['-a', '-b', '-c'], file, { name: 'foo-env', - path: 'path/to/foo-env' + path: 'path/to/foo-env', }); }); @@ -349,7 +349,7 @@ suite('Terminal - Code Execution', () => { const file = Uri.file(path.join('c', 'path', 'to', 'file', 'one.py')); await testCondaFileExecution(PYTHON_PATH, ['-a', '-b', '-c'], file, { name: '', - path: 'path/to/foo-env' + path: 'path/to/foo-env', }); }); @@ -357,11 +357,11 @@ suite('Terminal - Code Execution', () => { isWindows: boolean, pythonPath: string, expectedPythonPath: string, - terminalArgs: string[] + terminalArgs: string[], ) { pythonExecutionFactory .setup((p) => - p.createCondaExecutionService(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + p.createCondaExecutionService(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns(() => Promise.resolve(undefined)); platform.setup((p) => p.isWindows).returns(() => isWindows); @@ -413,7 +413,7 @@ suite('Terminal - Code Execution', () => { async function testReplCondaCommandArguments( pythonPath: string, terminalArgs: string[], - condaEnv: { name: string; path: string } + condaEnv: { name: string; path: string }, ) { settings.setup((s) => s.pythonPath).returns(() => pythonPath); terminalSettings.setup((t) => t.launchArgs).returns(() => terminalArgs); @@ -430,11 +430,11 @@ suite('Terminal - Code Execution', () => { execObservable: procs.execObservable, execModuleObservable: procs.execModuleObservable, exec: procs.exec, - execModule: procs.execModule + execModule: procs.execModule, }; pythonExecutionFactory .setup((p) => - p.createCondaExecutionService(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()) + p.createCondaExecutionService(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), ) .returns(() => Promise.resolve(condaExecutionService)); @@ -451,14 +451,14 @@ suite('Terminal - Code Execution', () => { test('Ensure conda args with env name are returned when building repl args with a conda env with a name', async () => { await testReplCondaCommandArguments(PYTHON_PATH, ['-a', 'b', 'c'], { name: 'foo-env', - path: 'path/to/foo-env' + path: 'path/to/foo-env', }); }); test('Ensure conda args with env path are returned when building repl args with a conda env without a name', async () => { await testReplCondaCommandArguments(PYTHON_PATH, ['-a', 'b', 'c'], { name: '', - path: 'path/to/foo-env' + path: 'path/to/foo-env', }); }); @@ -470,7 +470,7 @@ suite('Terminal - Code Execution', () => { terminalService.verify( async (t) => t.sendCommand(TypeMoq.It.isAny(), TypeMoq.It.isAny()), - TypeMoq.Times.never() + TypeMoq.Times.never(), ); terminalService.verify(async (t) => t.sendText(TypeMoq.It.isAny()), TypeMoq.Times.never()); }); @@ -491,7 +491,7 @@ suite('Terminal - Code Execution', () => { terminalService.verify( async (t) => t.sendCommand(TypeMoq.It.isValue(pythonPath), TypeMoq.It.isValue(expectedTerminalArgs)), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); }); @@ -508,7 +508,7 @@ suite('Terminal - Code Execution', () => { .returns((callback) => { closeTerminalCallback = callback; return { - dispose: noop + dispose: noop, }; }); @@ -522,7 +522,7 @@ suite('Terminal - Code Execution', () => { terminalService.verify( async (t) => t.sendCommand(TypeMoq.It.isValue(pythonPath), TypeMoq.It.isValue(expectedTerminalArgs)), - TypeMoq.Times.once() + TypeMoq.Times.once(), ); closeTerminalCallback!.call(terminalService.object); @@ -530,7 +530,7 @@ suite('Terminal - Code Execution', () => { terminalService.verify( async (t) => t.sendCommand(TypeMoq.It.isValue(pythonPath), TypeMoq.It.isValue(expectedTerminalArgs)), - TypeMoq.Times.exactly(2) + TypeMoq.Times.exactly(2), ); closeTerminalCallback!.call(terminalService.object); @@ -538,7 +538,7 @@ suite('Terminal - Code Execution', () => { terminalService.verify( async (t) => t.sendCommand(TypeMoq.It.isValue(pythonPath), TypeMoq.It.isValue(expectedTerminalArgs)), - TypeMoq.Times.exactly(3) + TypeMoq.Times.exactly(3), ); }); diff --git a/src/test/terminals/serviceRegistry.unit.test.ts b/src/test/terminals/serviceRegistry.unit.test.ts index 67446f44e601..c122fab8cb56 100644 --- a/src/test/terminals/serviceRegistry.unit.test.ts +++ b/src/test/terminals/serviceRegistry.unit.test.ts @@ -15,7 +15,7 @@ import { ICodeExecutionHelper, ICodeExecutionManager, ICodeExecutionService, - ITerminalAutoActivation + ITerminalAutoActivation, } from '../../client/terminals/types'; suite('Terminal - Service Registry', () => { @@ -28,7 +28,7 @@ suite('Terminal - Service Registry', () => { [IExtensionSingleActivationService, ExtensionActivationForTerminalActivation], [ICodeExecutionService, ReplProvider, 'repl'], [ITerminalAutoActivation, TerminalAutoActivation], - [ICodeExecutionService, TerminalCodeExecutionProvider, 'standard'] + [ICodeExecutionService, TerminalCodeExecutionProvider, 'standard'], ].forEach((args) => { if (args.length === 2) { services @@ -36,8 +36,8 @@ suite('Terminal - Service Registry', () => { s.addSingleton( // tslint:disable-next-line:no-any typemoq.It.isValue(args[0] as any), - typemoq.It.is((value) => args[1] === value) - ) + typemoq.It.is((value) => args[1] === value), + ), ) .verifiable(typemoq.Times.once()); } else { @@ -48,8 +48,8 @@ suite('Terminal - Service Registry', () => { typemoq.It.isValue(args[0] as any), typemoq.It.is((value) => args[1] === value), // tslint:disable-next-line:no-any - typemoq.It.isValue(args[2] as any) - ) + typemoq.It.isValue(args[2] as any), + ), ) .verifiable(typemoq.Times.once()); } diff --git a/src/test/testLogger.ts b/src/test/testLogger.ts index 5090e23d1faf..b268e52625b4 100644 --- a/src/test/testLogger.ts +++ b/src/test/testLogger.ts @@ -37,7 +37,7 @@ function monkeypatchConsole() { const streams = ['log', 'error', 'warn', 'info', 'debug', 'trace']; const levels: { [key: string]: LogLevel } = { error: LogLevel.Error, - warn: LogLevel.Warn + warn: LogLevel.Warn, }; // tslint:disable-next-line:no-any const consoleAny: any = console; diff --git a/src/test/testRunner.ts b/src/test/testRunner.ts index ef9acc489d5d..9673cecf71df 100644 --- a/src/test/testRunner.ts +++ b/src/test/testRunner.ts @@ -22,7 +22,7 @@ if (!tty.getWindowSize) { let mocha = new Mocha({ ui: 'tdd', - colors: true + colors: true, }); export type SetupOptions = Mocha.MochaOptions & { @@ -82,14 +82,14 @@ export async function run(): Promise { initializationScript() .then(() => mocha.run((failures) => - failures > 0 ? reject(new Error(`${failures} total failures`)) : resolve() - ) + failures > 0 ? reject(new Error(`${failures} total failures`)) : resolve(), + ), ) .catch(reject); } catch (error) { return reject(error); } - } + }, ); }); } diff --git a/src/test/testing/argsService.test.ts b/src/test/testing/argsService.test.ts index 2bddbba45cf2..ecbbe76de74b 100644 --- a/src/test/testing/argsService.test.ts +++ b/src/test/testing/argsService.test.ts @@ -87,7 +87,7 @@ suite('ArgsService: Common', () => { '1234', '--another-value-with-inline=1234', option, - 'abcd' + 'abcd', ]; const value = argumentsService.getOptionValue(args, option); expect(value).to.equal('abcd'); @@ -102,7 +102,7 @@ suite('ArgsService: Common', () => { option, 'abcd', option, - 'xyz' + 'xyz', ]; const value = argumentsService.getOptionValue(args, option); expect(value).to.deep.equal(['abcd', 'xyz']); diff --git a/src/test/testing/banners/proposeNewLanguageServerBanner.unit.test.ts b/src/test/testing/banners/proposeNewLanguageServerBanner.unit.test.ts index 426a79c847f5..5543f33a6b09 100644 --- a/src/test/testing/banners/proposeNewLanguageServerBanner.unit.test.ts +++ b/src/test/testing/banners/proposeNewLanguageServerBanner.unit.test.ts @@ -16,13 +16,13 @@ import { IExtensions, IPersistentState, IPersistentStateFactory, - IPythonSettings + IPythonSettings, } from '../../../client/common/types'; import { Common, Pylance } from '../../../client/common/utils/localize'; import { getPylanceExtensionUri, ProposeLSStateKeys, - ProposePylanceBanner + ProposePylanceBanner, } from '../../../client/languageServices/proposeLanguageServerBanner'; import * as Telemetry from '../../../client/telemetry'; import { EventName } from '../../../client/telemetry/constants'; @@ -51,13 +51,13 @@ const testData: IExperimentLsCombination[] = [ { experiment: TryPylance.jediPrompt2, lsType: LanguageServerType.None, shouldShowBanner: false }, { experiment: TryPylance.jediPrompt2, lsType: LanguageServerType.Microsoft, shouldShowBanner: false }, { experiment: TryPylance.jediPrompt2, lsType: LanguageServerType.Node, shouldShowBanner: false }, - { experiment: TryPylance.jediPrompt2, lsType: LanguageServerType.Jedi, shouldShowBanner: true } + { experiment: TryPylance.jediPrompt2, lsType: LanguageServerType.Jedi, shouldShowBanner: true }, ]; const expectedMessages = { [TryPylance.experiment]: Pylance.proposePylanceMessage(), [TryPylance.jediPrompt1]: 'Message for jediPrompt1', - [TryPylance.jediPrompt2]: 'Message for jediPrompt2' + [TryPylance.jediPrompt2]: 'Message for jediPrompt2', }; suite('Propose Pylance Banner', () => { @@ -85,7 +85,7 @@ suite('Propose Pylance Banner', () => { .callsFake((eventName: EventName, _, properties: { userAction: string }) => { telemetryEvent = { eventName, - properties + properties, }; }); }); @@ -106,7 +106,7 @@ suite('Propose Pylance Banner', () => { if (t.experiment) { expect(message).to.be.equal( t.shouldShowBanner ? expectedMessages[t.experiment] : undefined, - `getPromptMessage() returned ${message}` + `getPromptMessage() returned ${message}`, ); } else { expect(message).to.be.equal(undefined, `message should be undefined`); @@ -129,8 +129,8 @@ suite('Propose Pylance Banner', () => { typemoq.It.isValue(expectedMessages[TryPylance.experiment]), typemoq.It.isValue(yes), typemoq.It.isValue(no), - typemoq.It.isValue(later) - ) + typemoq.It.isValue(later), + ), ) .verifiable(typemoq.Times.never()); const testBanner = preparePopup( @@ -139,7 +139,7 @@ suite('Propose Pylance Banner', () => { appEnv.object, config.object, TryPylance.experiment, - false + false, ); await testBanner.showBanner(); appShell.verifyAll(); @@ -152,8 +152,8 @@ suite('Propose Pylance Banner', () => { typemoq.It.isValue(expectedMessages[TryPylance.experiment]), typemoq.It.isValue(yes), typemoq.It.isValue(no), - typemoq.It.isValue(later) - ) + typemoq.It.isValue(later), + ), ) .returns(async () => no) .verifiable(typemoq.Times.once()); @@ -165,7 +165,7 @@ suite('Propose Pylance Banner', () => { appEnv.object, config.object, TryPylance.experiment, - false + false, ); await testBanner.showBanner(); @@ -175,7 +175,7 @@ suite('Propose Pylance Banner', () => { sinon.assert.calledOnce(sendTelemetryStub); assert.deepEqual(telemetryEvent, { eventName: EventName.LANGUAGE_SERVER_TRY_PYLANCE, - properties: { userAction: 'no' } + properties: { userAction: 'no' }, }); }); test('Clicking Later should disable banner in session', async () => { @@ -186,8 +186,8 @@ suite('Propose Pylance Banner', () => { typemoq.It.isValue(expectedMessages[TryPylance.experiment]), typemoq.It.isValue(yes), typemoq.It.isValue(no), - typemoq.It.isValue(later) - ) + typemoq.It.isValue(later), + ), ) .returns(async () => later) .verifiable(typemoq.Times.once()); @@ -199,13 +199,13 @@ suite('Propose Pylance Banner', () => { appEnv.object, config.object, TryPylance.experiment, - false + false, ); await testBanner.showBanner(); expect(testBanner.enabled).to.be.equal( true, - 'Banner should not be permanently disabled when user clicked Later' + 'Banner should not be permanently disabled when user clicked Later', ); appShell.verifyAll(); @@ -213,8 +213,8 @@ suite('Propose Pylance Banner', () => { assert.deepEqual(telemetryEvent, { eventName: EventName.LANGUAGE_SERVER_TRY_PYLANCE, properties: { - userAction: 'later' - } + userAction: 'later', + }, }); }); test('Clicking Yes opens the extension marketplace entry', async () => { @@ -225,8 +225,8 @@ suite('Propose Pylance Banner', () => { typemoq.It.isValue(expectedMessages[TryPylance.experiment]), typemoq.It.isValue(yes), typemoq.It.isValue(no), - typemoq.It.isValue(later) - ) + typemoq.It.isValue(later), + ), ) .returns(async () => yes) .verifiable(typemoq.Times.once()); @@ -238,7 +238,7 @@ suite('Propose Pylance Banner', () => { appEnv.object, config.object, TryPylance.experiment, - false + false, ); await testBanner.showBanner(); @@ -249,8 +249,8 @@ suite('Propose Pylance Banner', () => { assert.deepEqual(telemetryEvent, { eventName: EventName.LANGUAGE_SERVER_TRY_PYLANCE, properties: { - userAction: 'yes' - } + userAction: 'yes', + }, }); }); }); @@ -261,7 +261,7 @@ function preparePopup( appEnv: IApplicationEnvironment, config: IConfigurationService, experiment: TryPylance | undefined, - pylanceInstalled: boolean + pylanceInstalled: boolean, ): ProposePylanceBanner { const myfactory = typemoq.Mock.ofType(); const val = typemoq.Mock.ofType>(); @@ -278,14 +278,14 @@ function preparePopup( }); myfactory .setup((a) => - a.createGlobalPersistentState(typemoq.It.isValue(ProposeLSStateKeys.ShowBanner), typemoq.It.isValue(true)) + a.createGlobalPersistentState(typemoq.It.isValue(ProposeLSStateKeys.ShowBanner), typemoq.It.isValue(true)), ) .returns(() => { return val.object; }); myfactory .setup((a) => - a.createGlobalPersistentState(typemoq.It.isValue(ProposeLSStateKeys.ShowBanner), typemoq.It.isValue(false)) + a.createGlobalPersistentState(typemoq.It.isValue(ProposeLSStateKeys.ShowBanner), typemoq.It.isValue(false)), ) .returns(() => { return val.object; diff --git a/src/test/testing/codeLenses/testFiles.unit.test.ts b/src/test/testing/codeLenses/testFiles.unit.test.ts index 861263d2b575..0fa3c00f0707 100644 --- a/src/test/testing/codeLenses/testFiles.unit.test.ts +++ b/src/test/testing/codeLenses/testFiles.unit.test.ts @@ -40,7 +40,7 @@ suite('Code lenses - Test files', () => { onDidChange, symbolProvider, testCollectionStorage.object, - serviceContainer.object + serviceContainer.object, ); }); @@ -50,7 +50,7 @@ suite('Code lenses - Test files', () => { test('Function getTestFileWhichNeedsCodeLens() returns `undefined` if there are no workspace corresponding to document', async () => { const document = { - uri: Uri.file('path/to/document') + uri: Uri.file('path/to/document'), }; workspaceService .setup((w) => w.getWorkspaceFolder(document.uri)) @@ -68,7 +68,7 @@ suite('Code lenses - Test files', () => { test('Function getTestFileWhichNeedsCodeLens() returns `undefined` if test storage is empty', async () => { const document = { - uri: Uri.file('path/to/document') + uri: Uri.file('path/to/document'), }; const workspaceUri = Uri.file('path/to/workspace'); const workspace = { uri: workspaceUri }; @@ -88,19 +88,19 @@ suite('Code lenses - Test files', () => { test('Function getTestFileWhichNeedsCodeLens() returns `undefined` if tests returned from storage does not contain document', async () => { const document = { - uri: Uri.file('path/to/document5') + uri: Uri.file('path/to/document5'), }; const workspaceUri = Uri.file('path/to/workspace'); const workspace = { uri: workspaceUri }; const tests = { testFiles: [ { - fullPath: 'path/to/document1' + fullPath: 'path/to/document1', }, { - fullPath: 'path/to/document2' - } - ] + fullPath: 'path/to/document2', + }, + ], }; workspaceService .setup((w) => w.getWorkspaceFolder(document.uri)) @@ -120,20 +120,20 @@ suite('Code lenses - Test files', () => { test('Function getTestFileWhichNeedsCodeLens() returns test file if tests returned from storage contains document', async () => { const document = { - uri: Uri.file('path/to/document2') + uri: Uri.file('path/to/document2'), }; const workspaceUri = Uri.file('path/to/workspace'); const workspace = { uri: workspaceUri }; const testFile2 = { - fullPath: Uri.file('path/to/document2').fsPath + fullPath: Uri.file('path/to/document2').fsPath, }; const tests = { testFiles: [ { - fullPath: Uri.file('path/to/document1').fsPath + fullPath: Uri.file('path/to/document1').fsPath, }, - testFile2 - ] + testFile2, + ], }; workspaceService .setup((w) => w.getWorkspaceFolder(typemoq.It.isValue(document.uri))) diff --git a/src/test/testing/common/debugLauncher.unit.test.ts b/src/test/testing/common/debugLauncher.unit.test.ts index 0abe2ce24bdb..c4749a63a0d6 100644 --- a/src/test/testing/common/debugLauncher.unit.test.ts +++ b/src/test/testing/common/debugLauncher.unit.test.ts @@ -15,7 +15,7 @@ import { IApplicationShell, IDebugService, IDocumentManager, - IWorkspaceService + IWorkspaceService, } from '../../../client/common/application/types'; import { EXTENSION_ROOT_DIR } from '../../../client/common/constants'; import '../../../client/common/extensions'; @@ -89,7 +89,7 @@ suite('Unit Tests - Debug Launcher', () => { function getNewResolver(configService: IConfigurationService) { const validator = TypeMoq.Mock.ofType( undefined, - TypeMoq.MockBehavior.Strict + TypeMoq.MockBehavior.Strict, ); validator .setup((v) => v.validatePythonPath(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())) @@ -100,13 +100,13 @@ suite('Unit Tests - Debug Launcher', () => { validator.object, platformService.object, configService, - debugEnvHelper.object + debugEnvHelper.object, ); } function setupDebugManager( workspaceFolder: WorkspaceFolder, expected: DebugConfiguration, - testProvider: TestProvider + testProvider: TestProvider, ) { platformService.setup((p) => p.isWindows).returns(() => /^win/.test(process.platform)); settings.setup((p) => p.pythonPath).returns(() => 'python'); @@ -130,7 +130,7 @@ suite('Unit Tests - Debug Launcher', () => { return { index: 0, name: path.basename(folderPath), - uri: Uri.file(folderPath) + uri: Uri.file(folderPath), }; } function getTestLauncherScript(testProvider: TestProvider) { @@ -159,14 +159,14 @@ suite('Unit Tests - Debug Launcher', () => { showReturnValue: true, redirectOutput: true, debugStdLib: false, - subProcess: true + subProcess: true, }; } function setupSuccess( options: LaunchOptions, testProvider: TestProvider, expected?: DebugConfiguration, - debugConfigs?: string | DebugConfiguration[] + debugConfigs?: string | DebugConfiguration[], ) { const testLaunchScript = getTestLauncherScript(testProvider); @@ -181,7 +181,7 @@ suite('Unit Tests - Debug Launcher', () => { if (typeof debugConfigs !== 'string') { debugConfigs = JSON.stringify({ version: '0.1.0', - configurations: debugConfigs + configurations: debugConfigs, }); } filesystem @@ -252,7 +252,7 @@ suite('Unit Tests - Debug Launcher', () => { const options = { cwd: 'one/two/three', args: ['/one/two/three/testfile.py'], - testProvider + testProvider, }; setupSuccess(options, testProvider); @@ -264,7 +264,7 @@ suite('Unit Tests - Debug Launcher', () => { const options = { cwd: 'one/two/three', args: ['/one/two/three/testfile.py', '--debug', '1'], - testProvider + testProvider, }; setupSuccess(options, testProvider); @@ -308,7 +308,7 @@ suite('Unit Tests - Debug Launcher', () => { const options: LaunchOptions = { cwd: 'one/two/three', args: ['/one/two/three/testfile.py'], - testProvider: 'unittest' + testProvider: 'unittest', }; const expected = getDefaultDebugConfig(); expected.name = 'spam'; @@ -323,7 +323,7 @@ suite('Unit Tests - Debug Launcher', () => { const options: LaunchOptions = { cwd: 'one/two/three', args: ['/one/two/three/testfile.py'], - testProvider: 'unittest' + testProvider: 'unittest', }; const expected = { name: 'my tests', @@ -337,7 +337,7 @@ suite('Unit Tests - Debug Launcher', () => { console: 'integratedTerminal', cwd: 'some/dir', env: { - SPAM: 'EGGS' + SPAM: 'EGGS', }, envFile: 'some/dir/.env', redirectOutput: false, @@ -345,7 +345,7 @@ suite('Unit Tests - Debug Launcher', () => { justMyCode: false, // added by LaunchConfigurationResolver: internalConsoleOptions: 'neverOpen', - subProcess: true + subProcess: true, }; setupSuccess(options, 'unittest', expected, [ { @@ -361,8 +361,8 @@ suite('Unit Tests - Debug Launcher', () => { envFile: expected.envFile, redirectOutput: expected.redirectOutput, debugStdLib: expected.debugStdLib, - justMyCode: undefined - } + justMyCode: undefined, + }, ]); await debugLauncher.launchDebugger(options); @@ -374,14 +374,14 @@ suite('Unit Tests - Debug Launcher', () => { const options: LaunchOptions = { cwd: 'one/two/three', args: ['/one/two/three/testfile.py'], - testProvider: 'unittest' + testProvider: 'unittest', }; const expected = getDefaultDebugConfig(); expected.name = 'spam1'; setupSuccess(options, 'unittest', expected, [ { name: 'spam1', type: DebuggerTypeName, request: 'test' }, { name: 'spam2', type: DebuggerTypeName, request: 'test' }, - { name: 'spam3', type: DebuggerTypeName, request: 'test' } + { name: 'spam3', type: DebuggerTypeName, request: 'test' }, ]); await debugLauncher.launchDebugger(options); @@ -393,7 +393,7 @@ suite('Unit Tests - Debug Launcher', () => { const options: LaunchOptions = { cwd: 'one/two/three', args: ['/one/two/three/testfile.py'], - testProvider: 'unittest' + testProvider: 'unittest', }; const expected = getDefaultDebugConfig(); setupSuccess(options, 'unittest', expected, ']'); @@ -431,7 +431,7 @@ suite('Unit Tests - Debug Launcher', () => { } \n\ ] \n\ } \n\ - ' + ', ]; for (const text of malformedFiles) { const testID = text.split('\n')[0].substring(3).trim(); @@ -439,7 +439,7 @@ suite('Unit Tests - Debug Launcher', () => { const options: LaunchOptions = { cwd: 'one/two/three', args: ['/one/two/three/testfile.py'], - testProvider: 'unittest' + testProvider: 'unittest', }; const expected = getDefaultDebugConfig(); setupSuccess(options, 'unittest', expected, text); @@ -454,7 +454,7 @@ suite('Unit Tests - Debug Launcher', () => { const options: LaunchOptions = { cwd: 'one/two/three', args: ['/one/two/three/testfile.py'], - testProvider: 'unittest' + testProvider: 'unittest', }; const expected = getDefaultDebugConfig(); // tslint:disable:no-object-literal-type-assertion @@ -465,7 +465,7 @@ suite('Unit Tests - Debug Launcher', () => { { name: 'spam3', request: 'test' } as DebugConfiguration, { type: DebuggerTypeName } as DebugConfiguration, { type: DebuggerTypeName, request: 'test' } as DebugConfiguration, - { request: 'test' } as DebugConfiguration + { request: 'test' } as DebugConfiguration, ]); // tslint:enable:no-object-literal-type-assertion @@ -478,7 +478,7 @@ suite('Unit Tests - Debug Launcher', () => { const options: LaunchOptions = { cwd: 'one/two/three', args: ['/one/two/three/testfile.py'], - testProvider: 'unittest' + testProvider: 'unittest', }; const expected = getDefaultDebugConfig(); setupSuccess(options, 'unittest', expected, [{ name: 'foo', type: 'other', request: 'bar' }]); @@ -492,7 +492,7 @@ suite('Unit Tests - Debug Launcher', () => { const options: LaunchOptions = { cwd: 'one/two/three', args: ['/one/two/three/testfile.py'], - testProvider: 'unittest' + testProvider: 'unittest', }; const expected = getDefaultDebugConfig(); setupSuccess(options, 'unittest', expected, [{ name: 'spam', type: DebuggerTypeName, request: 'bogus' }]); @@ -506,12 +506,12 @@ suite('Unit Tests - Debug Launcher', () => { const options: LaunchOptions = { cwd: 'one/two/three', args: ['/one/two/three/testfile.py'], - testProvider: 'unittest' + testProvider: 'unittest', }; const expected = getDefaultDebugConfig(); setupSuccess(options, 'unittest', expected, [ { name: 'spam', type: DebuggerTypeName, request: 'launch' }, - { name: 'spam', type: DebuggerTypeName, request: 'attach' } + { name: 'spam', type: DebuggerTypeName, request: 'attach' }, ]); await debugLauncher.launchDebugger(options); @@ -523,7 +523,7 @@ suite('Unit Tests - Debug Launcher', () => { const options: LaunchOptions = { cwd: 'one/two/three', args: ['/one/two/three/testfile.py'], - testProvider: 'unittest' + testProvider: 'unittest', }; const expected = getDefaultDebugConfig(); expected.name = 'spam2'; @@ -533,7 +533,7 @@ suite('Unit Tests - Debug Launcher', () => { { name: 'spam1', type: DebuggerTypeName, request: 'launch' }, { name: 'spam2', type: DebuggerTypeName, request: 'test' }, { name: 'spam3', type: DebuggerTypeName, request: 'attach' }, - { name: 'xyz', type: 'another', request: 'abc' } + { name: 'xyz', type: 'another', request: 'abc' }, ]); await debugLauncher.launchDebugger(options); @@ -545,7 +545,7 @@ suite('Unit Tests - Debug Launcher', () => { const options: LaunchOptions = { cwd: 'one/two/three', args: ['/one/two/three/testfile.py'], - testProvider: 'unittest' + testProvider: 'unittest', }; const expected = getDefaultDebugConfig(); expected.name = 'spam'; @@ -569,7 +569,7 @@ suite('Unit Tests - Debug Launcher', () => { } \n\ ] \n\ } \n\ - ' + ', ); await debugLauncher.launchDebugger(options); diff --git a/src/test/testing/common/managers/baseTestManager.unit.test.ts b/src/test/testing/common/managers/baseTestManager.unit.test.ts index 47adcb9809c8..35c1bfff76a7 100644 --- a/src/test/testing/common/managers/baseTestManager.unit.test.ts +++ b/src/test/testing/common/managers/baseTestManager.unit.test.ts @@ -20,7 +20,7 @@ import { IDisposableRegistry, IInstaller, IOutputChannel, - IPythonSettings + IPythonSettings, } from '../../../../client/common/types'; import { ServiceContainer } from '../../../../client/ioc/container'; import { IServiceContainer } from '../../../../client/ioc/types'; @@ -37,7 +37,7 @@ import { ITestMessageService, ITestResultsService, ITestsHelper, - ITestsStatusUpdaterService + ITestsStatusUpdaterService, } from '../../../../client/testing/common/types'; import { TestManager as NoseTestManager } from '../../../../client/testing/nosetest/main'; import { TestManager as PyTestTestManager } from '../../../../client/testing/pytest/main'; @@ -55,7 +55,7 @@ suite('Unit Tests - Base Test Manager', () => { [ { name: 'nose', class: NoseTestManager }, { name: 'pytest', class: PyTestTestManager }, - { name: 'unittest', class: UnitTestTestManager } + { name: 'unittest', class: UnitTestTestManager }, ].forEach((item) => { suite(item.name, () => { let testManager: ITestManager; @@ -94,40 +94,40 @@ suite('Unit Tests - Base Test Manager', () => { const messageService = mock(TestMessageService); when(serviceContainer.get(IConfigurationService)).thenReturn( - instance(configService) + instance(configService), ); when(serviceContainer.get(IDisposableRegistry)).thenReturn([]); when(serviceContainer.get(IOutputChannel, TEST_OUTPUT_CHANNEL)).thenReturn( - instance(outputChannel) + instance(outputChannel), ); when(serviceContainer.get(ITestCollectionStorageService)).thenReturn( - instance(storageService) + instance(storageService), ); when(serviceContainer.get(ITestResultsService)).thenReturn( - instance(resultsService) + instance(resultsService), ); when(serviceContainer.get(IWorkspaceService)).thenReturn(instance(workspaceService)); when(serviceContainer.get(ITestDiagnosticService)).thenReturn( - instance(diagnosticService) + instance(diagnosticService), ); when(serviceContainer.get(ITestsStatusUpdaterService)).thenReturn( - instance(statusUpdater) + instance(statusUpdater), ); when(serviceContainer.get(ICommandManager)).thenReturn(instance(commandManager)); when(serviceContainer.get(IArgumentsService, anything())).thenReturn( - instance(argsService) + instance(argsService), ); when(serviceContainer.get(ITestsHelper)).thenReturn(instance(testsHelper)); when(serviceContainer.get(ITestManagerRunner, anything())).thenReturn( - instance(runner) + instance(runner), ); when(serviceContainer.get(ITestMessageService, anything())).thenReturn( - instance(messageService) + instance(messageService), ); when(serviceContainer.get(ITestDiscoveryService, anything())).thenReturn( - instance(testDiscoveryService) + instance(testDiscoveryService), ); when(serviceContainer.get(IInstaller)).thenReturn(instance(installer)); diff --git a/src/test/testing/common/managers/testConfigurationManager.unit.test.ts b/src/test/testing/common/managers/testConfigurationManager.unit.test.ts index 7baa68ef07e4..685381b73cce 100644 --- a/src/test/testing/common/managers/testConfigurationManager.unit.test.ts +++ b/src/test/testing/common/managers/testConfigurationManager.unit.test.ts @@ -48,7 +48,7 @@ suite('Unit Test Configuration Manager (unit)', () => { manager = new MockTestConfigurationManager( workspaceUri, product as UnitTestProduct, - serviceContainer.object + serviceContainer.object, ); }); diff --git a/src/test/testing/common/services/configSettingService.unit.test.ts b/src/test/testing/common/services/configSettingService.unit.test.ts index 09e947efb25f..9d1547c49dc9 100644 --- a/src/test/testing/common/services/configSettingService.unit.test.ts +++ b/src/test/testing/common/services/configSettingService.unit.test.ts @@ -16,7 +16,7 @@ import { IServiceContainer } from '../../../../client/ioc/types'; import { UNIT_TEST_PRODUCTS } from '../../../../client/testing/common/constants'; import { BufferedTestConfigSettingsService, - TestConfigSettingsService + TestConfigSettingsService, } from '../../../../client/testing/common/services/configSettingService'; import { UnitTestProduct } from '../../../../client/testing/common/types'; import { ITestConfigSettingsService } from '../../../../client/testing/types'; @@ -26,7 +26,7 @@ use(chaiPromise); const updateMethods: (keyof Omit)[] = [ 'updateTestArgs', 'disable', - 'enable' + 'enable', ]; suite('Unit Tests - ConfigSettingsService', () => { @@ -133,7 +133,7 @@ suite('Unit Tests - ConfigSettingsService', () => { const pythonConfig = typeMoq.Mock.ofType(); workspaceService .setup((w) => - w.getConfiguration(typeMoq.It.isValue('python'), typeMoq.It.isValue(workspaceUri)) + w.getConfiguration(typeMoq.It.isValue('python'), typeMoq.It.isValue(workspaceUri)), ) .returns(() => pythonConfig.object) .verifiable(typeMoq.Times.once()); @@ -176,7 +176,7 @@ suite('Unit Tests - ConfigSettingsService', () => { const pythonConfig = typeMoq.Mock.ofType(); workspaceService .setup((w) => - w.getConfiguration(typeMoq.It.isValue('python'), typeMoq.It.isValue(workspaceUri)) + w.getConfiguration(typeMoq.It.isValue('python'), typeMoq.It.isValue(workspaceUri)), ) .returns(() => pythonConfig.object) .verifiable(typeMoq.Times.once()); @@ -236,8 +236,8 @@ suite('Unit Tests - BufferedTestConfigSettingsService', () => { c.updateTestArgs( typeMoq.It.isValue(testDir), typeMoq.It.isValue(Product.pytest), - typeMoq.It.isValue(newArgs) - ) + typeMoq.It.isValue(newArgs), + ), ) .returns(() => Promise.resolve()) .verifiable(typeMoq.Times.once()); diff --git a/src/test/testing/common/services/contextService.unit.test.ts b/src/test/testing/common/services/contextService.unit.test.ts index 357a46dcdae1..f40a8e41faaf 100644 --- a/src/test/testing/common/services/contextService.unit.test.ts +++ b/src/test/testing/common/services/contextService.unit.test.ts @@ -13,7 +13,7 @@ import { TestCollectionStorageService } from '../../../../client/testing/common/ import { ITestCollectionStorageService, ITestContextService, - TestStatus + TestStatus, } from '../../../../client/testing/common/types'; import { UnitTestManagementService } from '../../../../client/testing/main'; import { ITestManagementService, WorkspaceTestStatus } from '../../../../client/testing/types'; diff --git a/src/test/testing/common/services/discoveredTestParser.unit.test.ts b/src/test/testing/common/services/discoveredTestParser.unit.test.ts index 9238e75822db..dd7ca5929607 100644 --- a/src/test/testing/common/services/discoveredTestParser.unit.test.ts +++ b/src/test/testing/common/services/discoveredTestParser.unit.test.ts @@ -31,12 +31,12 @@ suite('Services - Discovered test parser', () => { testFiles: [], testFolders: [], testFunctions: [], - testSuites: [] + testSuites: [], }; const discoveredTests = [ { - root: 'path/to/testDataRoot' - } + root: 'path/to/testDataRoot', + }, ]; const buildChildren = sinon.stub(TestDiscoveredTestParser.prototype, 'buildChildren'); buildChildren.callsFake(() => undefined); @@ -55,12 +55,12 @@ suite('Services - Discovered test parser', () => { const discoveredTests = [ { root: 'path/to/testDataRoot1', - rootid: 'rootId1' + rootid: 'rootId1', }, { root: 'path/to/testDataRoot2', - rootid: 'rootId2' - } + rootid: 'rootId2', + }, ]; const workspaceUri = Uri.file('path/to/workspace'); const workspace = { uri: workspaceUri }; @@ -72,7 +72,7 @@ suite('Services - Discovered test parser', () => { time: 0, testFiles: [], resource: workspaceUri, - nameToRun: 'rootId1' + nameToRun: 'rootId1', }, { name: 'path/to/testDataRoot2', @@ -80,8 +80,8 @@ suite('Services - Discovered test parser', () => { time: 0, testFiles: [], resource: workspaceUri, - nameToRun: 'rootId2' - } + nameToRun: 'rootId2', + }, ], summary: { errors: 0, failures: 0, passed: 0, skipped: 0 }, testFiles: [], @@ -92,7 +92,7 @@ suite('Services - Discovered test parser', () => { time: 0, testFiles: [], resource: workspaceUri, - nameToRun: 'rootId1' + nameToRun: 'rootId1', }, { name: 'path/to/testDataRoot2', @@ -100,11 +100,11 @@ suite('Services - Discovered test parser', () => { time: 0, testFiles: [], resource: workspaceUri, - nameToRun: 'rootId2' - } + nameToRun: 'rootId2', + }, ], testFunctions: [], - testSuites: [] + testSuites: [], }; const buildChildren = sinon.stub(TestDiscoveredTestParser.prototype, 'buildChildren'); buildChildren.callsFake(() => undefined); diff --git a/src/test/testing/common/services/discovery.unit.test.ts b/src/test/testing/common/services/discovery.unit.test.ts index e7b54d2ec0cc..75e4fa25980e 100644 --- a/src/test/testing/common/services/discovery.unit.test.ts +++ b/src/test/testing/common/services/discovery.unit.test.ts @@ -13,7 +13,7 @@ import { ExecutionFactoryCreateWithEnvironmentOptions, IPythonExecutionFactory, IPythonExecutionService, - SpawnOptions + SpawnOptions, } from '../../../../client/common/process/types'; import { EXTENSION_ROOT_DIR } from '../../../../client/constants'; import { TestDiscoveredTestParser } from '../../../../client/testing/common/services/discoveredTestParser'; @@ -42,7 +42,7 @@ suite('Unit Tests - Common Discovery', () => { workspaceFolder: Uri.file(__dirname), ignoreCache: false, token: new CancellationTokenSource().token, - outChannel: new MockOutputChannel('Test') + outChannel: new MockOutputChannel('Test'), }; const discoveredTests: DiscoveredTests[] = [{ hello: 1 } as any]; const parsedResult = ({ done: true } as any) as Tests; @@ -60,20 +60,20 @@ suite('Unit Tests - Common Discovery', () => { workspaceFolder: Uri.file(__dirname), ignoreCache: false, token: new CancellationTokenSource().token, - outChannel: new MockOutputChannel('Test') + outChannel: new MockOutputChannel('Test'), }; const discoveredTests = '[1]'; const execService = typemoq.Mock.ofType(); execService.setup((e: any) => e.then).returns(() => undefined); const creationOptions: ExecutionFactoryCreateWithEnvironmentOptions = { allowEnvironmentFetchExceptions: false, - resource: options.workspaceFolder + resource: options.workspaceFolder, }; const pythonFile = path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'testing_tools', 'run_adapter.py'); const spawnOptions: SpawnOptions = { token: options.token, cwd: options.cwd, - throwOnStdErr: true + throwOnStdErr: true, }; when(executionFactory.createActivatedEnvironment(deepEqual(creationOptions))).thenResolve(execService.object); diff --git a/src/test/testing/common/services/storageService.unit.test.ts b/src/test/testing/common/services/storageService.unit.test.ts index 62e15894fc5e..dc8d193e68c6 100644 --- a/src/test/testing/common/services/storageService.unit.test.ts +++ b/src/test/testing/common/services/storageService.unit.test.ts @@ -13,7 +13,7 @@ import { TestFunction, Tests, TestStatus, - TestSuite + TestSuite, } from '../../../../client/testing/common/types'; import { TestDataItemType } from '../../../../client/testing/types'; import { createMockTestDataItem } from '../testUtils.unit.test'; @@ -43,23 +43,23 @@ suite('Unit Tests - Storage Service', () => { suite2.functions.push(fn3); const flattendSuite1: FlattenedTestSuite = { testSuite: suite1, - xmlClassName: suite1.xmlName + xmlClassName: suite1.xmlName, } as any; const flattendSuite2: FlattenedTestSuite = { testSuite: suite2, - xmlClassName: suite2.xmlName + xmlClassName: suite2.xmlName, } as any; const flattendFn1: FlattenedTestFunction = { testFunction: fn1, - xmlClassName: fn1.name + xmlClassName: fn1.name, } as any; const flattendFn2: FlattenedTestFunction = { testFunction: fn2, - xmlClassName: fn2.name + xmlClassName: fn2.name, } as any; const flattendFn3: FlattenedTestFunction = { testFunction: fn3, - xmlClassName: fn3.name + xmlClassName: fn3.name, } as any; testData1 = { rootTestFolders: [folder1], @@ -67,7 +67,7 @@ suite('Unit Tests - Storage Service', () => { testFiles: [file1], testFolders: [folder1], testFunctions: [flattendFn1, flattendFn2, flattendFn3], - testSuites: [flattendSuite1, flattendSuite2] + testSuites: [flattendSuite1, flattendSuite2], }; } @@ -87,23 +87,23 @@ suite('Unit Tests - Storage Service', () => { suite2.functions.push(fn3); const flattendSuite1: FlattenedTestSuite = { testSuite: suite1, - xmlClassName: suite1.xmlName + xmlClassName: suite1.xmlName, } as any; const flattendSuite2: FlattenedTestSuite = { testSuite: suite2, - xmlClassName: suite2.xmlName + xmlClassName: suite2.xmlName, } as any; const flattendFn1: FlattenedTestFunction = { testFunction: fn1, - xmlClassName: fn1.name + xmlClassName: fn1.name, } as any; const flattendFn2: FlattenedTestFunction = { testFunction: fn2, - xmlClassName: fn2.name + xmlClassName: fn2.name, } as any; const flattendFn3: FlattenedTestFunction = { testFunction: fn3, - xmlClassName: fn3.name + xmlClassName: fn3.name, } as any; testData2 = { rootTestFolders: [folder1], @@ -111,7 +111,7 @@ suite('Unit Tests - Storage Service', () => { testFiles: [file1], testFolders: [folder1], testFunctions: [flattendFn1, flattendFn2, flattendFn3], - testSuites: [flattendSuite1, flattendSuite2] + testSuites: [flattendSuite1, flattendSuite2], }; } diff --git a/src/test/testing/common/services/testResultsService.unit.test.ts b/src/test/testing/common/services/testResultsService.unit.test.ts index 880d03982ff2..6e9d831b2963 100644 --- a/src/test/testing/common/services/testResultsService.unit.test.ts +++ b/src/test/testing/common/services/testResultsService.unit.test.ts @@ -15,7 +15,7 @@ import { TestFunction, Tests, TestStatus, - TestSuite + TestSuite, } from '../../../../client/testing/common/types'; import { TestDataItemType } from '../../../../client/testing/types'; import { createMockTestDataItem } from '../testUtils.unit.test'; @@ -105,67 +105,67 @@ suite('Unit Tests - Tests Results Service', () => { suite5.functions.push(fn7); const flattendSuite1: FlattenedTestSuite = { testSuite: suite1, - xmlClassName: suite1.xmlName + xmlClassName: suite1.xmlName, } as any; const flattendSuite2: FlattenedTestSuite = { testSuite: suite2, - xmlClassName: suite2.xmlName + xmlClassName: suite2.xmlName, } as any; const flattendSuite3: FlattenedTestSuite = { testSuite: suite3, - xmlClassName: suite3.xmlName + xmlClassName: suite3.xmlName, } as any; const flattendSuite4: FlattenedTestSuite = { testSuite: suite4, - xmlClassName: suite4.xmlName + xmlClassName: suite4.xmlName, } as any; const flattendSuite5: FlattenedTestSuite = { testSuite: suite5, - xmlClassName: suite5.xmlName + xmlClassName: suite5.xmlName, } as any; const flattendFn1: FlattenedTestFunction = { testFunction: fn1, - xmlClassName: fn1.name + xmlClassName: fn1.name, } as any; const flattendFn2: FlattenedTestFunction = { testFunction: fn2, - xmlClassName: fn2.name + xmlClassName: fn2.name, } as any; const flattendFn3: FlattenedTestFunction = { testFunction: fn3, - xmlClassName: fn3.name + xmlClassName: fn3.name, } as any; const flattendFn4: FlattenedTestFunction = { testFunction: fn4, - xmlClassName: fn4.name + xmlClassName: fn4.name, } as any; const flattendFn5: FlattenedTestFunction = { testFunction: fn5, - xmlClassName: fn5.name + xmlClassName: fn5.name, } as any; const flattendFn6: FlattenedTestFunction = { testFunction: fn6, - xmlClassName: fn6.name + xmlClassName: fn6.name, } as any; const flattendFn7: FlattenedTestFunction = { testFunction: fn7, - xmlClassName: fn7.name + xmlClassName: fn7.name, } as any; const flattendFn8: FlattenedTestFunction = { testFunction: fn8, - xmlClassName: fn8.name + xmlClassName: fn8.name, } as any; const flattendFn9: FlattenedTestFunction = { testFunction: fn9, - xmlClassName: fn9.name + xmlClassName: fn9.name, } as any; const flattendFn10: FlattenedTestFunction = { testFunction: fn10, - xmlClassName: fn10.name + xmlClassName: fn10.name, } as any; const flattendFn11: FlattenedTestFunction = { testFunction: fn11, - xmlClassName: fn11.name + xmlClassName: fn11.name, } as any; tests = { rootTestFolders: [folder1], @@ -183,9 +183,9 @@ suite('Unit Tests - Tests Results Service', () => { flattendFn8, flattendFn9, flattendFn10, - flattendFn11 + flattendFn11, ], - testSuites: [flattendSuite1, flattendSuite2, flattendSuite3, flattendSuite4, flattendSuite5] + testSuites: [flattendSuite1, flattendSuite2, flattendSuite3, flattendSuite4, flattendSuite5], }; testResultsService = new TestResultsService(resultResetVisitor.object); }); diff --git a/src/test/testing/common/services/testStatusService.unit.test.ts b/src/test/testing/common/services/testStatusService.unit.test.ts index f2a689c3d5a2..515f681ac5c2 100644 --- a/src/test/testing/common/services/testStatusService.unit.test.ts +++ b/src/test/testing/common/services/testStatusService.unit.test.ts @@ -19,7 +19,7 @@ import { TestFunction, Tests, TestStatus, - TestSuite + TestSuite, } from '../../../../client/testing/common/types'; import { TestDataItem, TestDataItemType } from '../../../../client/testing/types'; import { createMockTestDataItem } from '../testUtils.unit.test'; @@ -74,43 +74,43 @@ suite('Unit Tests - Tests Status Updater', () => { suite3.functions.push(fn5); const flattendSuite1: FlattenedTestSuite = { testSuite: suite1, - xmlClassName: suite1.xmlName + xmlClassName: suite1.xmlName, } as any; const flattendSuite2: FlattenedTestSuite = { testSuite: suite2, - xmlClassName: suite2.xmlName + xmlClassName: suite2.xmlName, } as any; const flattendSuite3: FlattenedTestSuite = { testSuite: suite3, - xmlClassName: suite3.xmlName + xmlClassName: suite3.xmlName, } as any; const flattendSuite4: FlattenedTestSuite = { testSuite: suite4, - xmlClassName: suite4.xmlName + xmlClassName: suite4.xmlName, } as any; const flattendSuite5: FlattenedTestSuite = { testSuite: suite5, - xmlClassName: suite5.xmlName + xmlClassName: suite5.xmlName, } as any; const flattendFn1: FlattenedTestFunction = { testFunction: fn1, - xmlClassName: fn1.name + xmlClassName: fn1.name, } as any; const flattendFn2: FlattenedTestFunction = { testFunction: fn2, - xmlClassName: fn2.name + xmlClassName: fn2.name, } as any; const flattendFn3: FlattenedTestFunction = { testFunction: fn3, - xmlClassName: fn3.name + xmlClassName: fn3.name, } as any; const flattendFn4: FlattenedTestFunction = { testFunction: fn4, - xmlClassName: fn4.name + xmlClassName: fn4.name, } as any; const flattendFn5: FlattenedTestFunction = { testFunction: fn5, - xmlClassName: fn5.name + xmlClassName: fn5.name, } as any; tests = { rootTestFolders: [folder1], @@ -118,7 +118,7 @@ suite('Unit Tests - Tests Status Updater', () => { testFiles: [file1, file2, file3, file4], testFolders: [folder1, folder2, folder3, folder4, folder5], testFunctions: [flattendFn1, flattendFn2, flattendFn3, flattendFn4, flattendFn5], - testSuites: [flattendSuite1, flattendSuite2, flattendSuite3, flattendSuite4, flattendSuite5] + testSuites: [flattendSuite1, flattendSuite2, flattendSuite3, flattendSuite4, flattendSuite5], }; when(storage.getTests(workspaceUri)).thenReturn(tests); }); @@ -189,7 +189,7 @@ suite('Unit Tests - Tests Status Updater', () => { tests.testFunctions[2].testFunction, tests.testFunctions[3].testFunction, tests.testSuites[1].testSuite, - tests.testSuites[2].testSuite + tests.testSuites[2].testSuite, ]; failedItems.forEach((failedItem) => visitRecursive(tests, failedItem, visitor)); @@ -241,7 +241,7 @@ suite('Unit Tests - Tests Status Updater', () => { ...tests.testFolders, ...tests.testFiles, ...tests.testFunctions.map((item) => item.testFunction), - ...tests.testSuites.map((item) => item.testSuite) + ...tests.testSuites.map((item) => item.testSuite), ]; for (const item of updatedItems) { diff --git a/src/test/testing/common/testUtils.unit.test.ts b/src/test/testing/common/testUtils.unit.test.ts index 82822609856f..751ad4fba1fa 100644 --- a/src/test/testing/common/testUtils.unit.test.ts +++ b/src/test/testing/common/testUtils.unit.test.ts @@ -16,7 +16,7 @@ import { getTestFile, getTestFolder, getTestFunction, - getTestSuite + getTestSuite, } from '../../../client/testing/common/testUtils'; import { FlattenedTestFunction, @@ -26,7 +26,7 @@ import { TestFolder, TestFunction, Tests, - TestSuite + TestSuite, } from '../../../client/testing/common/types'; import { TestDataItem, TestDataItemType, TestWorkspaceFolder } from '../../../client/testing/types'; @@ -50,7 +50,7 @@ export function createMockTestDataItem( type: TestDataItemType, nameSuffix: string = '', name?: string, - nameToRun?: string + nameToRun?: string, ) { const folder: TestFolder = { resource: Uri.file(__filename), @@ -58,7 +58,7 @@ export function createMockTestDataItem( name: name || 'Some Folder' + nameSuffix, nameToRun: nameToRun || name || ' Some Folder' + nameSuffix, testFiles: [], - time: 0 + time: 0, }; const file: TestFile = { resource: Uri.file(__filename), @@ -68,13 +68,13 @@ export function createMockTestDataItem( xmlName: name || 'some xml name' + nameSuffix, functions: [], suites: [], - time: 0 + time: 0, }; const func: TestFunction = { resource: Uri.file(__filename), name: name || 'Some Function' + nameSuffix, nameToRun: nameToRun || name || ' Some Function' + nameSuffix, - time: 0 + time: 0, }; const suite: TestSuite = { resource: Uri.file(__filename), @@ -85,7 +85,7 @@ export function createMockTestDataItem( isUnitTest: false, suites: [], xmlName: name || 'some name' + nameSuffix, - time: 0 + time: 0, }; switch (type) { @@ -119,9 +119,9 @@ export function createSubtestParent(funcs: TestFunction[]): SubtestParent { isUnitTest: false, isInstance: false, xmlName: '', - time: 0 + time: 0, }, - time: 0 + time: 0, }; funcs.forEach((func) => { func.subtestParent = subtestParent; @@ -133,7 +133,7 @@ export function createTests( folders: TestFolder[], files: TestFile[], suites: TestSuite[], - funcs: TestFunction[] + funcs: TestFunction[], ): Tests { // tslint:disable:no-any return { @@ -144,15 +144,15 @@ export function createTests( testSuites: suites.map((suite) => { return { testSuite: suite, - xmlClassName: suite.xmlName + xmlClassName: suite.xmlName, } as any; }), testFunctions: funcs.map((func) => { return { testFunction: func, - xmlClassName: func.name + xmlClassName: func.name, } as any; - }) + }), }; } @@ -239,7 +239,7 @@ suite('Unit Tests - TestUtils', () => { testFiles: [], testFolders: [folder1, folder2, folder3, folder4, folder5], testFunctions: [], - testSuites: [] + testSuites: [], }; assert.equal(getParent(tests, folder1), undefined); assert.equal(getParent(tests, folder2), folder1); @@ -272,7 +272,7 @@ suite('Unit Tests - TestUtils', () => { testFiles: [file1, file2, file3, file4], testFolders: [folder1, folder2, folder3, folder4, folder5], testFunctions: [], - testSuites: [] + testSuites: [], }; assert.equal(getParent(tests, file1), folder1); assert.equal(getParent(tests, file2), folder3); @@ -306,43 +306,43 @@ suite('Unit Tests - TestUtils', () => { suite3.functions.push(fn5); const flattendSuite1: FlattenedTestSuite = { testSuite: suite1, - xmlClassName: suite1.xmlName + xmlClassName: suite1.xmlName, } as any; const flattendSuite2: FlattenedTestSuite = { testSuite: suite2, - xmlClassName: suite2.xmlName + xmlClassName: suite2.xmlName, } as any; const flattendSuite3: FlattenedTestSuite = { testSuite: suite3, - xmlClassName: suite3.xmlName + xmlClassName: suite3.xmlName, } as any; const flattendSuite4: FlattenedTestSuite = { testSuite: suite4, - xmlClassName: suite4.xmlName + xmlClassName: suite4.xmlName, } as any; const flattendSuite5: FlattenedTestSuite = { testSuite: suite5, - xmlClassName: suite5.xmlName + xmlClassName: suite5.xmlName, } as any; const flattendFn1: FlattenedTestFunction = { testFunction: fn1, - xmlClassName: fn1.name + xmlClassName: fn1.name, } as any; const flattendFn2: FlattenedTestFunction = { testFunction: fn2, - xmlClassName: fn2.name + xmlClassName: fn2.name, } as any; const flattendFn3: FlattenedTestFunction = { testFunction: fn3, - xmlClassName: fn3.name + xmlClassName: fn3.name, } as any; const flattendFn4: FlattenedTestFunction = { testFunction: fn4, - xmlClassName: fn4.name + xmlClassName: fn4.name, } as any; const flattendFn5: FlattenedTestFunction = { testFunction: fn5, - xmlClassName: fn5.name + xmlClassName: fn5.name, } as any; const tests: Tests = { rootTestFolders: [], @@ -350,7 +350,7 @@ suite('Unit Tests - TestUtils', () => { testFiles: [file1, file2, file3, file4], testFolders: [], testFunctions: [flattendFn1, flattendFn2, flattendFn3, flattendFn4, flattendFn5], - testSuites: [flattendSuite1, flattendSuite2, flattendSuite3, flattendSuite4, flattendSuite5] + testSuites: [flattendSuite1, flattendSuite2, flattendSuite3, flattendSuite4, flattendSuite5], }; // Test parent file of functions (standalone and those in suites). assert.equal(getParentFile(tests, fn1), file1); @@ -393,43 +393,43 @@ suite('Unit Tests - TestUtils', () => { suite3.functions.push(fn5); const flattendSuite1: FlattenedTestSuite = { testSuite: suite1, - xmlClassName: suite1.xmlName + xmlClassName: suite1.xmlName, } as any; const flattendSuite2: FlattenedTestSuite = { testSuite: suite2, - xmlClassName: suite2.xmlName + xmlClassName: suite2.xmlName, } as any; const flattendSuite3: FlattenedTestSuite = { testSuite: suite3, - xmlClassName: suite3.xmlName + xmlClassName: suite3.xmlName, } as any; const flattendSuite4: FlattenedTestSuite = { testSuite: suite4, - xmlClassName: suite4.xmlName + xmlClassName: suite4.xmlName, } as any; const flattendSuite5: FlattenedTestSuite = { testSuite: suite5, - xmlClassName: suite5.xmlName + xmlClassName: suite5.xmlName, } as any; const flattendFn1: FlattenedTestFunction = { testFunction: fn1, - xmlClassName: fn1.name + xmlClassName: fn1.name, } as any; const flattendFn2: FlattenedTestFunction = { testFunction: fn2, - xmlClassName: fn2.name + xmlClassName: fn2.name, } as any; const flattendFn3: FlattenedTestFunction = { testFunction: fn3, - xmlClassName: fn3.name + xmlClassName: fn3.name, } as any; const flattendFn4: FlattenedTestFunction = { testFunction: fn4, - xmlClassName: fn4.name + xmlClassName: fn4.name, } as any; const flattendFn5: FlattenedTestFunction = { testFunction: fn5, - xmlClassName: fn5.name + xmlClassName: fn5.name, } as any; const tests: Tests = { rootTestFolders: [], @@ -437,7 +437,7 @@ suite('Unit Tests - TestUtils', () => { testFiles: [file1, file2, file3, file4], testFolders: [], testFunctions: [flattendFn1, flattendFn2, flattendFn3, flattendFn4, flattendFn5], - testSuites: [flattendSuite1, flattendSuite2, flattendSuite3, flattendSuite4, flattendSuite5] + testSuites: [flattendSuite1, flattendSuite2, flattendSuite3, flattendSuite4, flattendSuite5], }; // Test parent file of functions (standalone and those in suites). assert.equal(getParentSuite(tests, fn1), undefined); @@ -459,11 +459,11 @@ suite('Unit Tests - TestUtils', () => { const fn1 = createMockTestDataItem(TestDataItemType.function); const flattendSuite1: FlattenedTestSuite = { testSuite: suite1, - xmlClassName: suite1.xmlName + xmlClassName: suite1.xmlName, } as any; const flattendFn1: FlattenedTestFunction = { testFunction: fn1, - xmlClassName: fn1.name + xmlClassName: fn1.name, } as any; const tests: Tests = { rootTestFolders: [], @@ -471,7 +471,7 @@ suite('Unit Tests - TestUtils', () => { testFiles: [file1], testFolders: [], testFunctions: [flattendFn1], - testSuites: [flattendSuite1] + testSuites: [flattendSuite1], }; assert.throws(() => getParentFile(tests, fn1), new RegExp('No parent file for provided test item')); assert.throws(() => getParentFile(tests, suite1), new RegExp('No parent file for provided test item')); @@ -482,11 +482,11 @@ suite('Unit Tests - TestUtils', () => { const fn1 = createMockTestDataItem(TestDataItemType.function); const flattendSuite1: FlattenedTestSuite = { testSuite: suite1, - xmlClassName: suite1.xmlName + xmlClassName: suite1.xmlName, } as any; const flattendFn1: FlattenedTestFunction = { testFunction: fn1, - xmlClassName: fn1.name + xmlClassName: fn1.name, } as any; const tests: Tests = { rootTestFolders: [], @@ -494,7 +494,7 @@ suite('Unit Tests - TestUtils', () => { testFiles: [file1], testFolders: [], testFunctions: [flattendFn1], - testSuites: [flattendSuite1] + testSuites: [flattendSuite1], }; assert.equal(getParent(tests, fn1), undefined); assert.equal(getParent(tests, suite1), undefined); @@ -516,23 +516,23 @@ suite('Unit Tests - TestUtils', () => { suite4.suites.push(suite5); const flattendSuite1: FlattenedTestSuite = { testSuite: suite1, - xmlClassName: suite1.xmlName + xmlClassName: suite1.xmlName, } as any; const flattendSuite2: FlattenedTestSuite = { testSuite: suite2, - xmlClassName: suite2.xmlName + xmlClassName: suite2.xmlName, } as any; const flattendSuite3: FlattenedTestSuite = { testSuite: suite3, - xmlClassName: suite3.xmlName + xmlClassName: suite3.xmlName, } as any; const flattendSuite4: FlattenedTestSuite = { testSuite: suite4, - xmlClassName: suite4.xmlName + xmlClassName: suite4.xmlName, } as any; const flattendSuite5: FlattenedTestSuite = { testSuite: suite5, - xmlClassName: suite5.xmlName + xmlClassName: suite5.xmlName, } as any; const tests: Tests = { rootTestFolders: [], @@ -540,7 +540,7 @@ suite('Unit Tests - TestUtils', () => { testFiles: [file1, file2, file3, file4], testFolders: [], testFunctions: [], - testSuites: [flattendSuite1, flattendSuite2, flattendSuite3, flattendSuite4, flattendSuite5] + testSuites: [flattendSuite1, flattendSuite2, flattendSuite3, flattendSuite4, flattendSuite5], }; assert.equal(getParent(tests, suite1), file1); assert.equal(getParent(tests, suite2), file1); @@ -575,43 +575,43 @@ suite('Unit Tests - TestUtils', () => { suite3.functions.push(fn5); const flattendSuite1: FlattenedTestSuite = { testSuite: suite1, - xmlClassName: suite1.xmlName + xmlClassName: suite1.xmlName, } as any; const flattendSuite2: FlattenedTestSuite = { testSuite: suite2, - xmlClassName: suite2.xmlName + xmlClassName: suite2.xmlName, } as any; const flattendSuite3: FlattenedTestSuite = { testSuite: suite3, - xmlClassName: suite3.xmlName + xmlClassName: suite3.xmlName, } as any; const flattendSuite4: FlattenedTestSuite = { testSuite: suite4, - xmlClassName: suite4.xmlName + xmlClassName: suite4.xmlName, } as any; const flattendSuite5: FlattenedTestSuite = { testSuite: suite5, - xmlClassName: suite5.xmlName + xmlClassName: suite5.xmlName, } as any; const flattendFn1: FlattenedTestFunction = { testFunction: fn1, - xmlClassName: fn1.name + xmlClassName: fn1.name, } as any; const flattendFn2: FlattenedTestFunction = { testFunction: fn2, - xmlClassName: fn2.name + xmlClassName: fn2.name, } as any; const flattendFn3: FlattenedTestFunction = { testFunction: fn3, - xmlClassName: fn3.name + xmlClassName: fn3.name, } as any; const flattendFn4: FlattenedTestFunction = { testFunction: fn4, - xmlClassName: fn4.name + xmlClassName: fn4.name, } as any; const flattendFn5: FlattenedTestFunction = { testFunction: fn5, - xmlClassName: fn5.name + xmlClassName: fn5.name, } as any; const tests: Tests = { rootTestFolders: [], @@ -619,7 +619,7 @@ suite('Unit Tests - TestUtils', () => { testFiles: [file1, file2, file3, file4], testFolders: [], testFunctions: [flattendFn1, flattendFn2, flattendFn3, flattendFn4, flattendFn5], - testSuites: [flattendSuite1, flattendSuite2, flattendSuite3, flattendSuite4, flattendSuite5] + testSuites: [flattendSuite1, flattendSuite2, flattendSuite3, flattendSuite4, flattendSuite5], }; assert.equal(getParent(tests, fn1), file1); assert.equal(getParent(tests, fn2), file1); diff --git a/src/test/testing/common/testVisitors/resultResetVisitor.unit.test.ts b/src/test/testing/common/testVisitors/resultResetVisitor.unit.test.ts index cb09323e87b2..d1fa7955d49b 100644 --- a/src/test/testing/common/testVisitors/resultResetVisitor.unit.test.ts +++ b/src/test/testing/common/testVisitors/resultResetVisitor.unit.test.ts @@ -23,7 +23,7 @@ suite('Result reset visitor', async () => { status: TestStatus.Fail, functionsDidNotRun: 12, functionsPassed: 1, - functionsFailed: 5 + functionsFailed: 5, }; const expectedTestFunction = { passed: undefined, @@ -33,7 +33,7 @@ suite('Result reset visitor', async () => { status: TestStatus.Unknown, functionsDidNotRun: 0, functionsPassed: 0, - functionsFailed: 0 + functionsFailed: 0, }; // tslint:disable-next-line: no-any resultResetVisitor.visitTestFunction(testFunction as any); @@ -48,7 +48,7 @@ suite('Result reset visitor', async () => { status: TestStatus.Fail, functionsDidNotRun: 12, functionsPassed: 1, - functionsFailed: 5 + functionsFailed: 5, }; const expectedTestSuite = { passed: undefined, @@ -56,7 +56,7 @@ suite('Result reset visitor', async () => { status: TestStatus.Unknown, functionsDidNotRun: 0, functionsPassed: 0, - functionsFailed: 0 + functionsFailed: 0, }; // tslint:disable-next-line: no-any resultResetVisitor.visitTestSuite(testSuite as any); @@ -71,7 +71,7 @@ suite('Result reset visitor', async () => { status: TestStatus.Fail, functionsDidNotRun: 12, functionsPassed: 1, - functionsFailed: 5 + functionsFailed: 5, }; const expectedTestFile = { passed: undefined, @@ -79,7 +79,7 @@ suite('Result reset visitor', async () => { status: TestStatus.Unknown, functionsDidNotRun: 0, functionsPassed: 0, - functionsFailed: 0 + functionsFailed: 0, }; // tslint:disable-next-line: no-any resultResetVisitor.visitTestFile(testFile as any); @@ -94,7 +94,7 @@ suite('Result reset visitor', async () => { status: TestStatus.Fail, functionsDidNotRun: 12, functionsPassed: 1, - functionsFailed: 5 + functionsFailed: 5, }; const expectedTestFolder = { passed: undefined, @@ -102,7 +102,7 @@ suite('Result reset visitor', async () => { status: TestStatus.Unknown, functionsDidNotRun: 0, functionsPassed: 0, - functionsFailed: 0 + functionsFailed: 0, }; // tslint:disable-next-line: no-any resultResetVisitor.visitTestFolder(testFolder as any); diff --git a/src/test/testing/common/trackEnablement.unit.test.ts b/src/test/testing/common/trackEnablement.unit.test.ts index f1d8c94eed80..a361215e4fbe 100644 --- a/src/test/testing/common/trackEnablement.unit.test.ts +++ b/src/test/testing/common/trackEnablement.unit.test.ts @@ -73,7 +73,7 @@ suite('Unit Tests - Track Enablement', () => { const expectedSettingsChecked = [ 'python.testing.nosetestEnabled', 'python.testing.unittestEnabled', - 'python.testing.pytestEnabled' + 'python.testing.pytestEnabled', ]; const telemetryReporter = sandbox.stub(EnablementTracker.prototype, 'sendTelemetry'); @@ -93,7 +93,7 @@ suite('Unit Tests - Track Enablement', () => { const settingsChecked = [ affectsConfiguration.args[0][0], affectsConfiguration.args[1][0], - affectsConfiguration.args[2][0] + affectsConfiguration.args[2][0], ]; assert.deepEqual(settingsChecked.sort(), expectedSettingsChecked.sort()); }); @@ -101,12 +101,12 @@ suite('Unit Tests - Track Enablement', () => { const expectedSettingsChecked = [ 'python.testing.nosetestEnabled', 'python.testing.unittestEnabled', - 'python.testing.pytestEnabled' + 'python.testing.pytestEnabled', ]; const expectedSettingsRetrieved = [ 'testing.nosetestEnabled', 'testing.unittestEnabled', - 'testing.pytestEnabled' + 'testing.pytestEnabled', ]; const telemetryReporter = sandbox.stub(EnablementTracker.prototype, 'sendTelemetry'); @@ -130,14 +130,14 @@ suite('Unit Tests - Track Enablement', () => { const settingsChecked = [ affectsConfiguration.args[0][0], affectsConfiguration.args[1][0], - affectsConfiguration.args[2][0] + affectsConfiguration.args[2][0], ]; assert.deepEqual(settingsChecked.sort(), expectedSettingsChecked.sort()); const settingsRetrieved = [ getConfigSettings.args[0][0], getConfigSettings.args[1][0], - getConfigSettings.args[2][0] + getConfigSettings.args[2][0], ]; assert.deepEqual(settingsRetrieved.sort(), expectedSettingsRetrieved.sort()); }); @@ -145,12 +145,12 @@ suite('Unit Tests - Track Enablement', () => { const expectedSettingsChecked = [ 'python.testing.nosetestEnabled', 'python.testing.unittestEnabled', - 'python.testing.pytestEnabled' + 'python.testing.pytestEnabled', ]; const expectedSettingsRetrieved = [ 'testing.nosetestEnabled', 'testing.unittestEnabled', - 'testing.pytestEnabled' + 'testing.pytestEnabled', ]; const telemetryReporter = sandbox.stub(EnablementTracker.prototype, 'sendTelemetry'); @@ -177,14 +177,14 @@ suite('Unit Tests - Track Enablement', () => { const settingsChecked = [ affectsConfiguration.args[0][0], affectsConfiguration.args[1][0], - affectsConfiguration.args[2][0] + affectsConfiguration.args[2][0], ]; assert.deepEqual(settingsChecked.sort(), expectedSettingsChecked.sort()); const settingsRetrieved = [ getConfigSettings.args[0][0], getConfigSettings.args[1][0], - getConfigSettings.args[2][0] + getConfigSettings.args[2][0], ]; assert.deepEqual(settingsRetrieved.sort(), expectedSettingsRetrieved.sort()); } diff --git a/src/test/testing/common/xUnitParser.unit.test.ts b/src/test/testing/common/xUnitParser.unit.test.ts index 5b8498acb663..513ee733f9ca 100644 --- a/src/test/testing/common/xUnitParser.unit.test.ts +++ b/src/test/testing/common/xUnitParser.unit.test.ts @@ -58,7 +58,7 @@ suite('Testing - parse JUnit XML file', () => { - `) + `), ); await parser.updateResultsFromXmlLogFile(tests, filename); @@ -91,7 +91,7 @@ suite('Testing - parse JUnit XML file', () => { - `) + `), ); await parser.updateResultsFromXmlLogFile(tests, filename); @@ -112,7 +112,7 @@ suite('Testing - parse JUnit XML file', () => { - `) + `), ); await parser.updateResultsFromXmlLogFile(tests, filename); @@ -130,7 +130,7 @@ suite('Testing - parse JUnit XML file', () => { - `) + `), ); await parser.updateResultsFromXmlLogFile(tests, filename); diff --git a/src/test/testing/configuration.unit.test.ts b/src/test/testing/configuration.unit.test.ts index fcd254ec2995..332f33fa9df9 100644 --- a/src/test/testing/configuration.unit.test.ts +++ b/src/test/testing/configuration.unit.test.ts @@ -15,7 +15,7 @@ import { IOutputChannel, IPythonSettings, ITestingSettings, - Product + Product, } from '../../client/common/types'; import { getNamesAndValues } from '../../client/common/utils/enum'; import { IServiceContainer } from '../../client/ioc/types'; @@ -27,7 +27,7 @@ import { UnitTestConfigurationService } from '../../client/testing/configuration import { ITestConfigSettingsService, ITestConfigurationManager, - ITestConfigurationManagerFactory + ITestConfigurationManagerFactory, } from '../../client/testing/types'; suite('Unit Tests - ConfigurationService', () => { @@ -46,7 +46,7 @@ suite('Unit Tests - ConfigurationService', () => { const serviceContainer = typeMoq.Mock.ofType(undefined, typeMoq.MockBehavior.Strict); const configurationService = typeMoq.Mock.ofType( undefined, - typeMoq.MockBehavior.Strict + typeMoq.MockBehavior.Strict, ); appShell = typeMoq.Mock.ofType(undefined, typeMoq.MockBehavior.Strict); const outputChannel = typeMoq.Mock.ofType(undefined, typeMoq.MockBehavior.Strict); @@ -55,7 +55,7 @@ suite('Unit Tests - ConfigurationService', () => { factory = typeMoq.Mock.ofType(undefined, typeMoq.MockBehavior.Strict); testSettingsService = typeMoq.Mock.ofType( undefined, - typeMoq.MockBehavior.Strict + typeMoq.MockBehavior.Strict, ); unitTestSettings = typeMoq.Mock.ofType(); const pythonSettings = typeMoq.Mock.ofType(undefined, typeMoq.MockBehavior.Strict); @@ -94,13 +94,13 @@ suite('Unit Tests - ConfigurationService', () => { UnitTestConfigurationService, typeMoq.MockBehavior.Loose, true, - serviceContainer.object + serviceContainer.object, ); }); test('Enable Test when setting testing.promptToConfigure is enabled', async () => { const configMgr = typeMoq.Mock.ofType( undefined, - typeMoq.MockBehavior.Strict + typeMoq.MockBehavior.Strict, ); configMgr .setup((c) => c.enable()) @@ -114,7 +114,7 @@ suite('Unit Tests - ConfigurationService', () => { const workspaceConfig = typeMoq.Mock.ofType( undefined, - typeMoq.MockBehavior.Strict + typeMoq.MockBehavior.Strict, ); workspaceService .setup((w) => w.getConfiguration(typeMoq.It.isValue('python'), workspaceUri)) @@ -136,7 +136,7 @@ suite('Unit Tests - ConfigurationService', () => { test('Enable Test when setting testing.promptToConfigure is disabled', async () => { const configMgr = typeMoq.Mock.ofType( undefined, - typeMoq.MockBehavior.Strict + typeMoq.MockBehavior.Strict, ); configMgr .setup((c) => c.enable()) @@ -150,7 +150,7 @@ suite('Unit Tests - ConfigurationService', () => { const workspaceConfig = typeMoq.Mock.ofType( undefined, - typeMoq.MockBehavior.Strict + typeMoq.MockBehavior.Strict, ); workspaceService .setup((w) => w.getConfiguration(typeMoq.It.isValue('python'), workspaceUri)) @@ -164,7 +164,7 @@ suite('Unit Tests - ConfigurationService', () => { workspaceConfig .setup((w) => - w.update(typeMoq.It.isValue('testing.promptToConfigure'), typeMoq.It.isValue(undefined)) + w.update(typeMoq.It.isValue('testing.promptToConfigure'), typeMoq.It.isValue(undefined)), ) .returns(() => Promise.resolve()) .verifiable(typeMoq.Times.once()); @@ -179,7 +179,7 @@ suite('Unit Tests - ConfigurationService', () => { test('Enable Test when setting testing.promptToConfigure is disabled and fail to update the settings', async () => { const configMgr = typeMoq.Mock.ofType( undefined, - typeMoq.MockBehavior.Strict + typeMoq.MockBehavior.Strict, ); configMgr .setup((c) => c.enable()) @@ -193,7 +193,7 @@ suite('Unit Tests - ConfigurationService', () => { const workspaceConfig = typeMoq.Mock.ofType( undefined, - typeMoq.MockBehavior.Strict + typeMoq.MockBehavior.Strict, ); workspaceService .setup((w) => w.getConfiguration(typeMoq.It.isValue('python'), workspaceUri)) @@ -209,7 +209,7 @@ suite('Unit Tests - ConfigurationService', () => { const updateFailError = new Error(errorMessage); workspaceConfig .setup((w) => - w.update(typeMoq.It.isValue('testing.promptToConfigure'), typeMoq.It.isValue(undefined)) + w.update(typeMoq.It.isValue('testing.promptToConfigure'), typeMoq.It.isValue(undefined)), ) .returns(() => Promise.reject(updateFailError)) .verifiable(typeMoq.Times.once()); @@ -318,7 +318,7 @@ suite('Unit Tests - ConfigurationService', () => { const workspaceConfig = typeMoq.Mock.ofType( undefined, - typeMoq.MockBehavior.Strict + typeMoq.MockBehavior.Strict, ); workspaceConfig .setup((w) => w.get(typeMoq.It.isAny())) @@ -345,11 +345,11 @@ suite('Unit Tests - ConfigurationService', () => { const configMgr = typeMoq.Mock.ofType( undefined, - typeMoq.MockBehavior.Strict + typeMoq.MockBehavior.Strict, ); factory .setup((f) => - f.create(typeMoq.It.isValue(workspaceUri), typeMoq.It.isValue(product), typeMoq.It.isAny()) + f.create(typeMoq.It.isValue(workspaceUri), typeMoq.It.isValue(product), typeMoq.It.isAny()), ) .returns(() => configMgr.object) .verifiable(typeMoq.Times.once()); @@ -427,11 +427,11 @@ suite('Unit Tests - ConfigurationService', () => { const configMgr = typeMoq.Mock.ofType( undefined, - typeMoq.MockBehavior.Strict + typeMoq.MockBehavior.Strict, ); factory .setup((f) => - f.create(typeMoq.It.isValue(workspaceUri), typeMoq.It.isValue(product), typeMoq.It.isAny()) + f.create(typeMoq.It.isValue(workspaceUri), typeMoq.It.isValue(product), typeMoq.It.isAny()), ) .returns(() => configMgr.object) .verifiable(typeMoq.Times.once()); @@ -461,7 +461,7 @@ suite('Unit Tests - ConfigurationService', () => { const workspaceConfig = typeMoq.Mock.ofType( undefined, - typeMoq.MockBehavior.Strict + typeMoq.MockBehavior.Strict, ); workspaceConfig .setup((w) => w.get(typeMoq.It.isAny())) @@ -488,7 +488,7 @@ suite('Unit Tests - ConfigurationService', () => { const configMgr = typeMoq.Mock.ofType(); factory .setup((f) => - f.create(typeMoq.It.isValue(workspaceUri), typeMoq.It.isValue(product), typeMoq.It.isAny()) + f.create(typeMoq.It.isValue(workspaceUri), typeMoq.It.isValue(product), typeMoq.It.isAny()), ) .returns(() => configMgr.object) .verifiable(typeMoq.Times.once()); diff --git a/src/test/testing/debugger.test.ts b/src/test/testing/debugger.test.ts index 2b8172b2a527..50b9cec3096b 100644 --- a/src/test/testing/debugger.test.ts +++ b/src/test/testing/debugger.test.ts @@ -16,7 +16,7 @@ import { CommandSource, NOSETEST_PROVIDER, PYTEST_PROVIDER, - UNITTEST_PROVIDER + UNITTEST_PROVIDER, } from '../../client/testing/common/constants'; import { TestRunner } from '../../client/testing/common/runner'; import { @@ -25,7 +25,7 @@ import { ITestMessageService, ITestRunner, IXUnitParser, - TestProvider + TestProvider, } from '../../client/testing/common/types'; import { XUnitParser } from '../../client/testing/common/xUnitParser'; import { ArgumentsService as NoseTestArgumentsService } from '../../client/testing/nosetest/services/argsService'; @@ -56,7 +56,7 @@ suite('Unit Tests - debugging', () => { await Promise.all([ updateSetting('testing.unittestArgs', defaultUnitTestArgs, rootWorkspaceUri, configTarget), updateSetting('testing.nosetestArgs', [], rootWorkspaceUri, configTarget), - updateSetting('testing.pytestArgs', [], rootWorkspaceUri, configTarget) + updateSetting('testing.pytestArgs', [], rootWorkspaceUri, configTarget), ]); }); setup(async function () { @@ -74,7 +74,7 @@ suite('Unit Tests - debugging', () => { await Promise.all([ updateSetting('testing.unittestArgs', defaultUnitTestArgs, rootWorkspaceUri, configTarget), updateSetting('testing.nosetestArgs', [], rootWorkspaceUri, configTarget), - updateSetting('testing.pytestArgs', [], rootWorkspaceUri, configTarget) + updateSetting('testing.pytestArgs', [], rootWorkspaceUri, configTarget), ]); }); @@ -115,7 +115,7 @@ suite('Unit Tests - debugging', () => { const testManager = ioc.serviceContainer.get(ITestManagerFactory)( testProvider, rootWorkspaceUri!, - testFilesPath + testFilesPath, ); const mockDebugLauncher = ioc.serviceContainer.get(ITestDebugLauncher); const tests = await testManager.discoverTests(CommandSource.commandPalette, true, true); @@ -164,7 +164,7 @@ suite('Unit Tests - debugging', () => { const testManager = ioc.serviceContainer.get(ITestManagerFactory)( testProvider, rootWorkspaceUri!, - testFilesPath + testFilesPath, ); const mockDebugLauncher = ioc.serviceContainer.get(ITestDebugLauncher); const tests = await testManager.discoverTests(CommandSource.commandPalette, true, true); @@ -180,12 +180,12 @@ suite('Unit Tests - debugging', () => { const discoveryPromise = testManager.discoverTests(CommandSource.commandPalette, true, true, true); await expect(runningPromise).to.be.rejectedWith( CANCELLATION_REASON, - 'Incorrect reason for ending the debugger' + 'Incorrect reason for ending the debugger', ); await ioc.dispose(); // will cancel test discovery await expect(discoveryPromise).to.be.rejectedWith( CANCELLATION_REASON, - 'Incorrect reason for ending the debugger' + 'Incorrect reason for ending the debugger', ); } @@ -208,7 +208,7 @@ suite('Unit Tests - debugging', () => { const testManager = ioc.serviceContainer.get(ITestManagerFactory)( testProvider, rootWorkspaceUri!, - testFilesPath + testFilesPath, ); const mockDebugLauncher = ioc.serviceContainer.get(ITestDebugLauncher); const tests = await testManager.discoverTests(CommandSource.commandPalette, true, true); diff --git a/src/test/testing/display/main.unit.test.ts b/src/test/testing/display/main.unit.test.ts index d529dc25b183..562184877e0e 100644 --- a/src/test/testing/display/main.unit.test.ts +++ b/src/test/testing/display/main.unit.test.ts @@ -121,7 +121,7 @@ suite('Unit Tests - TestResultDisplay', () => { statusBar.verifyAll(); statusBar.verify( (s) => (s.command = typeMoq.It.isValue(Commands.Tests_Ask_To_Stop_Test)), - typeMoq.Times.atLeastOnce() + typeMoq.Times.atLeastOnce(), ); statusBar.verify((s) => (s.text = typeMoq.It.isValue('$(stop) Running Tests')), typeMoq.Times.atLeastOnce()); }); @@ -142,7 +142,7 @@ suite('Unit Tests - TestResultDisplay', () => { statusBar.verifyAll(); statusBar.verify( (s) => (s.command = typeMoq.It.isValue(Commands.Tests_Ask_To_Stop_Test)), - typeMoq.Times.atLeastOnce() + typeMoq.Times.atLeastOnce(), ); statusBar.verify((s) => (s.text = typeMoq.It.isValue('$(stop) Running Tests')), typeMoq.Times.atLeastOnce()); @@ -157,7 +157,7 @@ suite('Unit Tests - TestResultDisplay', () => { appShell .setup((a) => - a.showWarningMessage(typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny()) + a.showWarningMessage(typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny()), ) .returns(() => Promise.resolve(undefined)) .verifiable(typeMoq.Times.once()); @@ -186,7 +186,7 @@ suite('Unit Tests - TestResultDisplay', () => { statusBar.verifyAll(); statusBar.verify( (s) => (s.command = typeMoq.It.isValue(Commands.Tests_Ask_To_Stop_Test)), - typeMoq.Times.atLeastOnce() + typeMoq.Times.atLeastOnce(), ); statusBar.verify((s) => (s.text = typeMoq.It.isValue('$(stop) Running Tests')), typeMoq.Times.atLeastOnce()); @@ -201,7 +201,7 @@ suite('Unit Tests - TestResultDisplay', () => { appShell .setup((a) => - a.showWarningMessage(typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny()) + a.showWarningMessage(typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny()), ) .returns(() => Promise.resolve(undefined)) .verifiable(typeMoq.Times.never()); @@ -230,7 +230,7 @@ suite('Unit Tests - TestResultDisplay', () => { statusBar.verifyAll(); statusBar.verify( (s) => (s.command = typeMoq.It.isValue(Commands.Tests_Ask_To_Stop_Test)), - typeMoq.Times.atLeastOnce() + typeMoq.Times.atLeastOnce(), ); statusBar.verify((s) => (s.text = typeMoq.It.isValue('$(stop) Running Tests')), typeMoq.Times.atLeastOnce()); @@ -260,7 +260,7 @@ suite('Unit Tests - TestResultDisplay', () => { statusBar.verifyAll(); statusBar.verify( (s) => (s.command = typeMoq.It.isValue(Commands.Tests_Ask_To_Stop_Test)), - typeMoq.Times.atLeastOnce() + typeMoq.Times.atLeastOnce(), ); statusBar.verify((s) => (s.text = typeMoq.It.isValue('$(stop) Running Tests')), typeMoq.Times.atLeastOnce()); @@ -289,11 +289,11 @@ suite('Unit Tests - TestResultDisplay', () => { statusBar.verifyAll(); statusBar.verify( (s) => (s.command = typeMoq.It.isValue(Commands.Tests_Ask_To_Stop_Discovery)), - typeMoq.Times.atLeastOnce() + typeMoq.Times.atLeastOnce(), ); statusBar.verify( (s) => (s.text = typeMoq.It.isValue('$(stop) Discovering Tests')), - typeMoq.Times.atLeastOnce() + typeMoq.Times.atLeastOnce(), ); }); test('Ensure status bar is displayed and updated with success and no tests, with ability to view ui to view results of test discovery', async () => { @@ -313,17 +313,22 @@ suite('Unit Tests - TestResultDisplay', () => { statusBar.verifyAll(); statusBar.verify( (s) => (s.command = typeMoq.It.isValue(Commands.Tests_Ask_To_Stop_Discovery)), - typeMoq.Times.atLeastOnce() + typeMoq.Times.atLeastOnce(), ); statusBar.verify( (s) => (s.text = typeMoq.It.isValue('$(stop) Discovering Tests')), - typeMoq.Times.atLeastOnce() + typeMoq.Times.atLeastOnce(), ); const tests = typeMoq.Mock.ofType(); appShell .setup((a) => - a.showInformationMessage(typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny()) + a.showInformationMessage( + typeMoq.It.isAny(), + typeMoq.It.isAny(), + typeMoq.It.isAny(), + typeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve(undefined)) .verifiable(typeMoq.Times.once()); @@ -348,8 +353,8 @@ suite('Unit Tests - TestResultDisplay', () => { c.executeCommand( typeMoq.It.isValue('setContext'), typeMoq.It.isValue('testsDiscovered'), - typeMoq.It.isValue(false) - ) + typeMoq.It.isValue(false), + ), ) .verifiable(typeMoq.Times.once()); createTestResultDisplay(); @@ -360,17 +365,22 @@ suite('Unit Tests - TestResultDisplay', () => { statusBar.verifyAll(); statusBar.verify( (s) => (s.command = typeMoq.It.isValue(Commands.Tests_Ask_To_Stop_Discovery)), - typeMoq.Times.atLeastOnce() + typeMoq.Times.atLeastOnce(), ); statusBar.verify( (s) => (s.text = typeMoq.It.isValue('$(stop) Discovering Tests')), - typeMoq.Times.atLeastOnce() + typeMoq.Times.atLeastOnce(), ); const tests = typeMoq.Mock.ofType(); appShell .setup((a) => - a.showInformationMessage(typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny()) + a.showInformationMessage( + typeMoq.It.isAny(), + typeMoq.It.isAny(), + typeMoq.It.isAny(), + typeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve(Testing.disableTests())) .verifiable(typeMoq.Times.once()); @@ -379,7 +389,7 @@ suite('Unit Tests - TestResultDisplay', () => { 'testing.promptToConfigure', 'testing.pytestEnabled', 'testing.unittestEnabled', - 'testing.nosetestsEnabled' + 'testing.nosetestsEnabled', ]) { configurationService .setup((c) => c.updateSetting(typeMoq.It.isValue(setting), typeMoq.It.isValue(false))) @@ -412,17 +422,22 @@ suite('Unit Tests - TestResultDisplay', () => { statusBar.verifyAll(); statusBar.verify( (s) => (s.command = typeMoq.It.isValue(Commands.Tests_Ask_To_Stop_Discovery)), - typeMoq.Times.atLeastOnce() + typeMoq.Times.atLeastOnce(), ); statusBar.verify( (s) => (s.text = typeMoq.It.isValue('$(stop) Discovering Tests')), - typeMoq.Times.atLeastOnce() + typeMoq.Times.atLeastOnce(), ); const tests = typeMoq.Mock.ofType(); appShell .setup((a) => - a.showInformationMessage(typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny()) + a.showInformationMessage( + typeMoq.It.isAny(), + typeMoq.It.isAny(), + typeMoq.It.isAny(), + typeMoq.It.isAny(), + ), ) .returns(() => Promise.resolve(Testing.configureTests())) .verifiable(typeMoq.Times.once()); @@ -434,8 +449,8 @@ suite('Unit Tests - TestResultDisplay', () => { typeMoq.It.isValue(Commands.Tests_Configure as any), undefinedArg, undefinedArg, - undefinedArg - ) + undefinedArg, + ), ) .returns(() => Promise.resolve() as any) .verifiable(typeMoq.Times.once()); @@ -464,11 +479,11 @@ suite('Unit Tests - TestResultDisplay', () => { statusBar.verifyAll(); statusBar.verify( (s) => (s.command = typeMoq.It.isValue(Commands.Tests_Ask_To_Stop_Discovery)), - typeMoq.Times.atLeastOnce() + typeMoq.Times.atLeastOnce(), ); statusBar.verify( (s) => (s.text = typeMoq.It.isValue('$(stop) Discovering Tests')), - typeMoq.Times.atLeastOnce() + typeMoq.Times.atLeastOnce(), ); appShell.setup((a) => a.showErrorMessage(typeMoq.It.isAny())).verifiable(typeMoq.Times.never()); @@ -497,11 +512,11 @@ suite('Unit Tests - TestResultDisplay', () => { statusBar.verifyAll(); statusBar.verify( (s) => (s.command = typeMoq.It.isValue(Commands.Tests_Ask_To_Stop_Discovery)), - typeMoq.Times.atLeastOnce() + typeMoq.Times.atLeastOnce(), ); statusBar.verify( (s) => (s.text = typeMoq.It.isValue('$(stop) Discovering Tests')), - typeMoq.Times.atLeastOnce() + typeMoq.Times.atLeastOnce(), ); appShell.setup((a) => a.showErrorMessage(typeMoq.It.isAny())).verifiable(typeMoq.Times.once()); diff --git a/src/test/testing/display/picker.functional.test.ts b/src/test/testing/display/picker.functional.test.ts index 14de3b7f66e4..bde7e9cfc997 100644 --- a/src/test/testing/display/picker.functional.test.ts +++ b/src/test/testing/display/picker.functional.test.ts @@ -33,8 +33,8 @@ suite('Testing - TestDisplay', () => { collectedTests.testFiles = [ { fullPath: fullpath ? fullpath : 'path/to/testfile', - ...anything() - } + ...anything(), + }, ]; return collectedTests; } @@ -45,7 +45,7 @@ suite('Testing - TestDisplay', () => { mockedTestCollectionStorage = mock(TestCollectionStorageService); mockedAppShell = mock(ApplicationShell); when(mockedServiceContainer.get(ITestCollectionStorageService)).thenReturn( - instance(mockedTestCollectionStorage) + instance(mockedTestCollectionStorage), ); when(mockedServiceContainer.get(IApplicationShell)).thenReturn(instance(mockedAppShell)); @@ -56,12 +56,12 @@ suite('Testing - TestDisplay', () => { const paths: { [key: string]: any } = { match: { fullPath: '/path/to/testfile', - fileName: '/path/to/testfile' + fileName: '/path/to/testfile', }, mismatch: { fullPath: '/path/to/testfile', - fileName: '/testfile/to/path' - } + fileName: '/testfile/to/path', + }, }; let tests: Tests; @@ -90,7 +90,7 @@ suite('Testing - TestDisplay', () => { wkspace, 'rootDirectory', Uri.file(fileName), - codeLensTestFunctions() + codeLensTestFunctions(), ); verify(mockedAppShell.showQuickPick(anything(), anything())).once(); @@ -105,7 +105,7 @@ suite('Testing - TestDisplay', () => { wkspace, 'rootDirectory', Uri.file(fileName), - codeLensTestFunctions() + codeLensTestFunctions(), ); verify(mockedAppShell.showQuickPick(anything(), anything())).never(); @@ -126,7 +126,7 @@ suite('Testing - TestDisplay', () => { wkspace, 'rootDirectory', Uri.file(fileName), - codeLensTestFunctions() + codeLensTestFunctions(), ); verify(mockedAppShell.showQuickPick(anything(), anything())).once(); diff --git a/src/test/testing/display/picker.unit.test.ts b/src/test/testing/display/picker.unit.test.ts index d0b77e003890..8fe6852acbf2 100644 --- a/src/test/testing/display/picker.unit.test.ts +++ b/src/test/testing/display/picker.unit.test.ts @@ -39,8 +39,8 @@ suite('Unit Tests - Picker (execution of commands)', () => { name: 'some_name', nameToRun: 'some_name_to_run', time: 0, - resource: workspaceUri - } + resource: workspaceUri, + }, ]; const selection = { type: item.value, fn: { testFunction }, fns: testFunctions }; @@ -57,7 +57,7 @@ suite('Unit Tests - Picker (execution of commands)', () => { commandSource.value, workspaceUri, selection as any, - debug + debug, ); switch (selection.type) { @@ -77,8 +77,8 @@ suite('Unit Tests - Picker (execution of commands)', () => { undefined, commandSource.value, workspaceUri, - undefined - ) + undefined, + ), ).once(); return; } @@ -90,8 +90,8 @@ suite('Unit Tests - Picker (execution of commands)', () => { commandSource.value, workspaceUri, selection.fns, - debug - ) + debug, + ), ).once(); return; } @@ -101,14 +101,18 @@ suite('Unit Tests - Picker (execution of commands)', () => { Commands.Tests_Discover, undefined, commandSource.value, - workspaceUri - ) + workspaceUri, + ), ).once(); return; } case Type.ViewTestOutput: { verify( - commandManager.executeCommand(Commands.Tests_ViewOutput, undefined, commandSource.value) + commandManager.executeCommand( + Commands.Tests_ViewOutput, + undefined, + commandSource.value, + ), ).once(); return; } @@ -118,8 +122,8 @@ suite('Unit Tests - Picker (execution of commands)', () => { Commands.Tests_Run_Failed, undefined, commandSource.value, - workspaceUri - ) + workspaceUri, + ), ).once(); return; } @@ -128,7 +132,7 @@ suite('Unit Tests - Picker (execution of commands)', () => { ? Commands.Tests_Select_And_Debug_Method : Commands.Tests_Select_And_Run_Method; verify( - commandManager.executeCommand(cmd, undefined, commandSource.value, workspaceUri) + commandManager.executeCommand(cmd, undefined, commandSource.value, workspaceUri), ).once(); return; } @@ -140,8 +144,8 @@ suite('Unit Tests - Picker (execution of commands)', () => { undefined, commandSource.value, workspaceUri, - testsToRun - ) + testsToRun, + ), ).never(); return; } @@ -153,8 +157,8 @@ suite('Unit Tests - Picker (execution of commands)', () => { undefined, commandSource.value, workspaceUri, - testsToRun - ) + testsToRun, + ), ).never(); return; } @@ -164,8 +168,8 @@ suite('Unit Tests - Picker (execution of commands)', () => { Commands.Tests_Configure, undefined, commandSource.value, - workspaceUri - ) + workspaceUri, + ), ).once(); return; } @@ -192,8 +196,8 @@ suite('Testing - TestDisplay', () => { collectedTests.testFiles = [ { fullPath: fullpath ? fullpath : 'path/to/testfile', - ...anything() - } + ...anything(), + }, ]; return collectedTests; } @@ -204,7 +208,7 @@ suite('Testing - TestDisplay', () => { mockedTestCollectionStorage = mock(TestCollectionStorageService); mockedAppShell = mock(ApplicationShell); when(mockedServiceContainer.get(ITestCollectionStorageService)).thenReturn( - instance(mockedTestCollectionStorage) + instance(mockedTestCollectionStorage), ); when(mockedServiceContainer.get(IApplicationShell)).thenReturn(instance(mockedAppShell)); @@ -241,7 +245,7 @@ suite('Testing - TestDisplay', () => { wkspace, 'rootDirectory', fileName, - codeLensTestFunctions() + codeLensTestFunctions(), ); verify(mockedAppShell.showQuickPick(anything(), anything())).once(); @@ -256,7 +260,7 @@ suite('Testing - TestDisplay', () => { wkspace, 'rootDirectory', fileName, - codeLensTestFunctions() + codeLensTestFunctions(), ); verify(mockedAppShell.showQuickPick(anything(), anything())).never(); diff --git a/src/test/testing/explorer/explorerTestData.ts b/src/test/testing/explorer/explorerTestData.ts index bd8acf2b17c1..7100f295a9c2 100644 --- a/src/test/testing/explorer/explorerTestData.ts +++ b/src/test/testing/explorer/explorerTestData.ts @@ -23,7 +23,7 @@ import { TestFolder, TestFunction, Tests, - TestSuite + TestSuite, } from '../../../client/testing/common/types'; import { TestTreeViewProvider } from '../../../client/testing/explorer/testTreeViewProvider'; import { ITestManagementService } from '../../../client/testing/types'; @@ -45,7 +45,7 @@ export function getMockTestFolder(folderPath: string, testFiles: TestFile[] = [] name: folderPath, nameToRun: folderPath, testFiles: testFiles, - time: 0 + time: 0, }; return folder; @@ -54,7 +54,7 @@ export function getMockTestFolder(folderPath: string, testFiles: TestFile[] = [] export function getMockTestFile( filePath: string, testSuites: TestSuite[] = [], - testFunctions: TestFunction[] = [] + testFunctions: TestFunction[] = [], ): TestFile { // tslint:disable-next-line:no-unnecessary-local-variable const testFile: TestFile = { @@ -65,7 +65,7 @@ export function getMockTestFile( fullPath: join(__dirname, filePath), functions: testFunctions, suites: testSuites, - xmlName: filePath.replace(/\//g, '.') + xmlName: filePath.replace(/\//g, '.'), }; return testFile; @@ -76,7 +76,7 @@ export function getMockTestSuite( testFunctions: TestFunction[] = [], subSuites: TestSuite[] = [], instance: boolean = true, - unitTest: boolean = true + unitTest: boolean = true, ): TestSuite { const suiteNameChunks = suiteNameToRun.split('::'); const suiteName = suiteNameChunks[suiteNameChunks.length - 1]; @@ -91,7 +91,7 @@ export function getMockTestSuite( nameToRun: suiteNameToRun, suites: subSuites, time: 0, - xmlName: suiteNameToRun.replace(/\//g, '.').replace(/\:\:/g, ':') + xmlName: suiteNameToRun.replace(/\//g, '.').replace(/\:\:/g, ':'), }; return testSuite; } @@ -105,7 +105,7 @@ export function getMockTestFunction(fnNameToRun: string): TestFunction { resource: Uri.file(__filename), name: fnName, nameToRun: fnNameToRun, - time: 0 + time: 0, }; return fn; @@ -231,7 +231,7 @@ export function createMockTestExplorer( testsData?: Tests, unitTestMgmtService?: ITestManagementService, workspaceService?: IWorkspaceService, - commandManager?: ICommandManager + commandManager?: ICommandManager, ): TestTreeViewProvider { if (!testStore) { testStore = createMockTestStorageService(testsData).object; @@ -256,6 +256,6 @@ export function createMockTestExplorer( unitTestMgmtService, workspaceService, commandManager, - dispRegMoq.object + dispRegMoq.object, ); } diff --git a/src/test/testing/explorer/failedTestHandler.unit.test.ts b/src/test/testing/explorer/failedTestHandler.unit.test.ts index e38715a41958..946f68f0ab1e 100644 --- a/src/test/testing/explorer/failedTestHandler.unit.test.ts +++ b/src/test/testing/explorer/failedTestHandler.unit.test.ts @@ -15,7 +15,7 @@ import { TestFolder, TestFunction, TestStatus, - TestSuite + TestSuite, } from '../../../client/testing/common/types'; import { FailedTestHandler } from '../../../client/testing/explorer/failedTestHandler'; import { noop, sleep } from '../../core'; @@ -46,14 +46,14 @@ suite('Unit Tests Test Explorer View Items', () => { time: 0, resource: uri, nameToRun: 'fn1', - status: TestStatus.Error + status: TestStatus.Error, }; const failedFunc2: TestFunction = { name: 'fn2', time: 0, resource: uri, nameToRun: 'fn2', - status: TestStatus.Fail + status: TestStatus.Fail, }; when(commandManager.executeCommand(Commands.Test_Reveal_Test_Item, anything())).thenResolve(); @@ -79,7 +79,7 @@ suite('Unit Tests Test Explorer View Items', () => { isUnitTest: false, suites: [], xmlName: 'suite1', - status: TestStatus.Error + status: TestStatus.Error, }; const failedFile: TestFile = { name: 'suite1', @@ -90,7 +90,7 @@ suite('Unit Tests Test Explorer View Items', () => { suites: [], xmlName: 'file', status: TestStatus.Error, - fullPath: '' + fullPath: '', }; const failedFolder: TestFolder = { name: 'suite1', @@ -99,7 +99,7 @@ suite('Unit Tests Test Explorer View Items', () => { nameToRun: 'file', testFiles: [], folders: [], - status: TestStatus.Error + status: TestStatus.Error, }; when(commandManager.executeCommand(Commands.Test_Reveal_Test_Item, anything())).thenResolve(); diff --git a/src/test/testing/explorer/testExplorerCommandHandler.unit.test.ts b/src/test/testing/explorer/testExplorerCommandHandler.unit.test.ts index b2b290fd10be..b3b8dadcddd7 100644 --- a/src/test/testing/explorer/testExplorerCommandHandler.unit.test.ts +++ b/src/test/testing/explorer/testExplorerCommandHandler.unit.test.ts @@ -41,13 +41,13 @@ suite('Unit Tests - Test Explorer Command Handler', () => { const disposable3 = typemoq.Mock.ofType(); when(cmdManager.registerCommand(Commands.runTestNode, anything(), commandHandler)).thenReturn( - disposable1.object + disposable1.object, ); when(cmdManager.registerCommand(Commands.debugTestNode, anything(), commandHandler)).thenReturn( - disposable2.object + disposable2.object, ); when(cmdManager.registerCommand(Commands.openTestNodeInEditor, anything(), commandHandler)).thenReturn( - disposable3.object + disposable3.object, ); commandHandler.register(); @@ -59,7 +59,7 @@ suite('Unit Tests - Test Explorer Command Handler', () => { }); async function testOpeningTestNode( data: TestFile | TestSuite | TestFunction, - expectedCommand: 'navigateToTestFunction' | 'navigateToTestSuite' | 'navigateToTestFile' + expectedCommand: 'navigateToTestFunction' | 'navigateToTestSuite' | 'navigateToTestFile', ) { const resource = Uri.file(__filename); when(testResourceMapper.getResource(data)).thenReturn(resource); @@ -87,7 +87,7 @@ suite('Unit Tests - Test Explorer Command Handler', () => { async function testRunOrDebugTestNode( data: TestFile | TestSuite | TestFunction, expectedTestRun: TestsToRun, - runType: 'run' | 'debug' + runType: 'run' | 'debug', ) { const resource = Uri.file(__filename); when(testResourceMapper.getResource(data)).thenReturn(resource); @@ -102,7 +102,7 @@ suite('Unit Tests - Test Explorer Command Handler', () => { const cmd = runType === 'run' ? Commands.Tests_Run : Commands.Tests_Debug; verify( - cmdManager.executeCommand(cmd, undefined, CommandSource.testExplorer, resource, deepEqual(expectedTestRun)) + cmdManager.executeCommand(cmd, undefined, CommandSource.testExplorer, resource, deepEqual(expectedTestRun)), ).once(); } test('Running a file will invoke correct command', async () => { diff --git a/src/test/testing/explorer/testTreeViewItem.unit.test.ts b/src/test/testing/explorer/testTreeViewItem.unit.test.ts index 423665c35d2a..3e0c0da3377f 100644 --- a/src/test/testing/explorer/testTreeViewItem.unit.test.ts +++ b/src/test/testing/explorer/testTreeViewItem.unit.test.ts @@ -51,7 +51,7 @@ suite('Unit Tests Test Explorer View Items', () => { test('Test subtest parent created into test view item', () => { const subtestParent = createSubtestParent([ createMockTestDataItem(TestDataItemType.function, 'test_x'), - createMockTestDataItem(TestDataItemType.function, 'test_y') + createMockTestDataItem(TestDataItemType.function, 'test_y'), ]); const viewItem = new TestTreeItem(resource, subtestParent.asSuite); diff --git a/src/test/testing/explorer/testTreeViewProvider.unit.test.ts b/src/test/testing/explorer/testTreeViewProvider.unit.test.ts index e38dedec2f8c..100e338432d9 100644 --- a/src/test/testing/explorer/testTreeViewProvider.unit.test.ts +++ b/src/test/testing/explorer/testTreeViewProvider.unit.test.ts @@ -20,7 +20,7 @@ import { TestFile, TestFolder, Tests, - TestStatus + TestStatus, } from '../../../client/testing/common/types'; import { TestTreeItem } from '../../../client/testing/explorer/testTreeViewItem'; import { TestTreeViewProvider } from '../../../client/testing/explorer/testTreeViewProvider'; @@ -33,7 +33,7 @@ import { getMockTestFile, getMockTestFolder, getMockTestFunction, - getMockTestSuite + getMockTestSuite, } from './explorerTestData'; // tslint:disable:no-any @@ -77,12 +77,12 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { const testTreeProvider = createMockTestTreeProvider(); expect(testTreeProvider).is.not.equal( undefined, - 'Could not create a mock test explorer, check the parameters of the test setup.' + 'Could not create a mock test explorer, check the parameters of the test setup.', ); const treeRoot = await testTreeProvider.getChildren(); expect(treeRoot.length).to.be.greaterThan( 0, - 'No children returned from default view of the TreeViewProvider.' + 'No children returned from default view of the TreeViewProvider.', ); }); @@ -100,7 +100,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { instance(testStore), testsData, undefined, - instance(workspaceService) + instance(workspaceService), ); const refreshCap = new TestExplorerCaptureRefresh(testTreeProvider, disposables); @@ -130,7 +130,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { instance(testStore), testsData, undefined, - instance(workspaceService) + instance(workspaceService), ); const refreshCap = new TestExplorerCaptureRefresh(testView, disposables); @@ -169,7 +169,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { let addedTreeItem = (await testTreeProvider.getTreeItem(fl2)) as TestTreeItem; expect(addedTreeItem).to.not.be.equal( undefined, - 'The file has been added to the tests tree but not found?' + 'The file has been added to the tests tree but not found?', ); expect(addedTreeItem.data.name).to.be.equal(`${origName}.py`); @@ -189,7 +189,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { addedTreeItem = (await testTreeProvider.getTreeItem(fl2)) as TestTreeItem; expect(addedTreeItem).to.not.be.equal( undefined, - 'The file has been updated in the tests tree but in tree view?' + 'The file has been updated in the tests tree but in tree view?', ); expect(addedTreeItem.data.name).to.be.equal(`${newName}.py`); }); @@ -226,7 +226,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { let addedTreeItem = (await testTreeProvider.getTreeItem(suite2)) as TestTreeItem; expect(addedTreeItem).to.not.be.equal( undefined, - 'The suite has been added to the tests tree but not found?' + 'The suite has been added to the tests tree but not found?', ); const newName = 'suite_two'; @@ -241,7 +241,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { addedTreeItem = (await testTreeProvider.getTreeItem(suite2)) as TestTreeItem; expect(addedTreeItem).to.not.be.equal( undefined, - 'The suite has been updated in the tests tree but in tree view?' + 'The suite has been updated in the tests tree but in tree view?', ); expect(addedTreeItem.data.name).to.be.equal(newName); }); @@ -268,7 +268,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { let unchangedItem = await testTreeProvider.getTreeItem(fn); expect(unchangedItem).to.not.be.equal( undefined, - 'The function that will always be present, is not present.' + 'The function that will always be present, is not present.', ); testData = updatedTestData; @@ -277,12 +277,12 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { unchangedItem = await testTreeProvider.getTreeItem(fn); expect(unchangedItem).to.not.be.equal( undefined, - 'The function that will always be present, is not present.' + 'The function that will always be present, is not present.', ); let addedTreeItem = (await testTreeProvider.getTreeItem(fn2)) as TestTreeItem; expect(addedTreeItem).to.not.be.equal( undefined, - 'The function has been added to the tests tree but not found?' + 'The function has been added to the tests tree but not found?', ); expect(addedTreeItem.data.name).to.be.equal('test_fn2'); @@ -295,12 +295,12 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { unchangedItem = await testTreeProvider.getTreeItem(fn); expect(unchangedItem).to.not.be.equal( undefined, - 'The function that will always be present, is not present.' + 'The function that will always be present, is not present.', ); addedTreeItem = (await testTreeProvider.getTreeItem(fn2)) as TestTreeItem; expect(addedTreeItem).to.not.be.equal( undefined, - 'The function has been updated in the tests tree but in tree view?' + 'The function has been updated in the tests tree but in tree view?', ); expect(addedTreeItem.data.name).to.be.equal(newName); }); @@ -348,7 +348,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { let parent = (await testTreeProvider.getParent(testFunction))!; expect(parent.name).to.be.equal( testSuite.name, - 'Function within a test suite not returning the suite as parent.' + 'Function within a test suite not returning the suite as parent.', ); let parentType = getTestDataItemType(parent); expect(parentType).to.be.equal(TestDataItemType.suite); @@ -356,7 +356,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { parent = (await testTreeProvider.getParent(testSuite))!; expect(parent.name).to.be.equal( testFile.name, - 'Suite within a test file not returning the test file as parent.' + 'Suite within a test file not returning the test file as parent.', ); parentType = getTestDataItemType(parent); expect(parentType).to.be.equal(TestDataItemType.file); @@ -364,7 +364,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { parent = (await testTreeProvider.getParent(outerTestFunction))!; expect(parent.name).to.be.equal( testFile.name, - 'Function within a test file not returning the test file as parent.' + 'Function within a test file not returning the test file as parent.', ); parentType = getTestDataItemType(parent); expect(parentType).to.be.equal(TestDataItemType.file); @@ -403,7 +403,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { children = await testTreeProvider.getChildren(testFile); expect(children.length).to.be.equal( 2, - 'A file with one suite and one function should have a total of 2 children.' + 'A file with one suite and one function should have a total of 2 children.', ); children.forEach((child: TestDataItem) => { expect(child.name).oneOf(['test_suite', 'test_outer_fn']); @@ -432,9 +432,9 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { isUnitTest: false, isInstance: false, xmlName: 'test_ham', - time: 0 + time: 0, }, - time: 0 + time: 0, }; file.functions.push(func2); const func3 = getMockTestFunction(`${file.name}::test_ham[3-4]`); @@ -459,9 +459,9 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { isUnitTest: false, isInstance: false, xmlName: 'test_bar', - time: 0 + time: 0, }, - time: 0 + time: 0, }; suite.functions.push(func5); // Set up the tests data. @@ -477,7 +477,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { await testExplorer.getTreeItem(file), await testExplorer.getTreeItem(suite), await testExplorer.getTreeItem(func2.subtestParent.asSuite), - await testExplorer.getTreeItem(func5.subtestParent.asSuite) + await testExplorer.getTreeItem(func5.subtestParent.asSuite), ]; expect(items).to.deep.equal([ @@ -489,7 +489,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { new TestTreeItem(file.resource, file), new TestTreeItem(suite.resource, suite), new TestTreeItem(resource, func2.subtestParent.asSuite), - new TestTreeItem(resource, func5.subtestParent.asSuite) + new TestTreeItem(resource, func5.subtestParent.asSuite), ]); }); @@ -515,9 +515,9 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { isUnitTest: false, isInstance: false, xmlName: 'test_ham', - time: 0 + time: 0, }, - time: 0 + time: 0, }; file.functions.push(func2); const func3 = getMockTestFunction(`${file.name}::test_ham[3-4]`); @@ -542,9 +542,9 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { isUnitTest: false, isInstance: false, xmlName: 'test_bar', - time: 0 + time: 0, }, - time: 0 + time: 0, }; suite.functions.push(func5); // Set up the tests data. @@ -560,7 +560,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { await testExplorer.getParent(suite), await testExplorer.getParent(func2.subtestParent.asSuite), await testExplorer.getParent(func3.subtestParent.asSuite), - await testExplorer.getParent(func5.subtestParent.asSuite) + await testExplorer.getParent(func5.subtestParent.asSuite), ]; expect(parents).to.deep.equal([ @@ -572,7 +572,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { file, file, file, - suite + suite, ]); }); test('Children for subtests are correct', async () => { @@ -597,9 +597,9 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { isUnitTest: false, isInstance: false, xmlName: 'test_ham', - time: 0 + time: 0, }, - time: 0 + time: 0, }; file.functions.push(func2); const func3 = getMockTestFunction(`${file.name}::test_ham[3-4]`); @@ -624,9 +624,9 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { isUnitTest: false, isInstance: false, xmlName: 'test_bar', - time: 0 + time: 0, }, - time: 0 + time: 0, }; suite.functions.push(func5); // Set up the tests data. @@ -643,7 +643,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { await testExplorer.getChildren(suite), await testExplorer.getChildren(func2.subtestParent.asSuite), await testExplorer.getChildren(func3.subtestParent.asSuite), - await testExplorer.getChildren(func5.subtestParent.asSuite) + await testExplorer.getChildren(func5.subtestParent.asSuite), ]; expect(childrens).to.deep.equal([ @@ -656,7 +656,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { [func4, func5.subtestParent.asSuite], [func2, func3], [func2, func3], - [func5] + [func5], ]); test('Get children will discover only once', async () => { const commandManager = mock(CommandManager); @@ -670,7 +670,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { undefined, undefined, undefined, - instance(commandManager) + instance(commandManager), ); let tests = await testTreeProvider.getChildren(testWorkspaceFolder); @@ -681,8 +681,8 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { Commands.Tests_Discover, testWorkspaceFolder, CommandSource.testExplorer, - undefined - ) + undefined, + ), ).once(); tests = await testTreeProvider.getChildren(testWorkspaceFolder); @@ -692,8 +692,8 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { Commands.Tests_Discover, testWorkspaceFolder, CommandSource.testExplorer, - undefined - ) + undefined, + ), ).once(); }); }); @@ -708,7 +708,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { undefined, undefined, undefined, - instance(commandManager) + instance(commandManager), ); // No parent @@ -722,7 +722,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { time: 0, resource: Uri.file(__filename), xmlName: '', - nameToRun: '' + nameToRun: '', }; const node = await testTreeProvider.getTreeItem(element); @@ -740,7 +740,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { undefined, undefined, undefined, - instance(commandManager) + instance(commandManager), ); // Has a workspace folder as parent. @@ -756,7 +756,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { time: 0, resource: Uri.file(__filename), xmlName: '', - nameToRun: '' + nameToRun: '', }; const node = await testTreeProvider.getTreeItem(element); @@ -774,7 +774,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { undefined, undefined, undefined, - instance(commandManager) + instance(commandManager), ); // Has a parent folder @@ -784,7 +784,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { resource: Uri.file(__filename), time: 0, testFiles: [], - folders: [] + folders: [], }; testTreeProvider.getParent = () => Promise.resolve(parentFolder); @@ -797,7 +797,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { time: 0, resource: Uri.file(__filename), xmlName: '', - nameToRun: '' + nameToRun: '', }; const node = await testTreeProvider.getTreeItem(element); @@ -820,7 +820,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { instance(managementService), instance(workspace), instance(commandManager), - [] + [], ); }); test('The root folder will not be displayed if there are no tests', async () => { @@ -835,7 +835,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { nameToRun: 'child', testFiles: [], time: 0, - resource: Uri.file(__filename) + resource: Uri.file(__filename), }; const tests: Tests = { rootTestFolders: [folder1], @@ -843,7 +843,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { testFiles: [], testFunctions: [], testFolders: [], - testSuites: [] + testSuites: [], }; const children = treeProvider.getRootNodes(tests); @@ -861,7 +861,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { resource: Uri.file('file'), suites: [], time: 0, - xmlName: 'file' + xmlName: 'file', }; const file2: TestFile = { fullPath: path.join(rootFolderPath, 'file2'), @@ -871,7 +871,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { resource: Uri.file('file2'), suites: [], time: 0, - xmlName: 'file2' + xmlName: 'file2', }; const file3: TestFile = { fullPath: path.join(child1FolderPath, 'file1'), @@ -881,7 +881,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { resource: Uri.file('file3'), suites: [], time: 0, - xmlName: 'file3' + xmlName: 'file3', }; const child2Folder: TestFolder = { folders: [], @@ -889,7 +889,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { nameToRun: 'child3', testFiles: [], time: 0, - resource: Uri.file(__filename) + resource: Uri.file(__filename), }; const child1Folder: TestFolder = { folders: [child2Folder], @@ -897,7 +897,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { nameToRun: 'child2', testFiles: [file3], time: 0, - resource: Uri.file(__filename) + resource: Uri.file(__filename), }; const rootFolder: TestFolder = { folders: [child1Folder], @@ -905,7 +905,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { nameToRun: 'child', testFiles: [file1, file2], time: 0, - resource: Uri.file(__filename) + resource: Uri.file(__filename), }; const tests: Tests = { rootTestFolders: [rootFolder], @@ -913,7 +913,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { testFiles: [file1, file2, file3], testFunctions: [], testFolders: [rootFolder, child1Folder, child2Folder], - testSuites: [] + testSuites: [], }; const children = treeProvider.getRootNodes(tests); @@ -932,7 +932,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { resource: Uri.file('file'), suites: [], time: 0, - xmlName: 'file' + xmlName: 'file', }; const file2: TestFile = { fullPath: path.join(child3FolderPath, 'file2'), @@ -942,7 +942,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { resource: Uri.file('file2'), suites: [], time: 0, - xmlName: 'file2' + xmlName: 'file2', }; const file3: TestFile = { fullPath: path.join(child3FolderPath, 'file3'), @@ -952,7 +952,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { resource: Uri.file('file3'), suites: [], time: 0, - xmlName: 'file3' + xmlName: 'file3', }; const child2Folder: TestFolder = { folders: [], @@ -960,7 +960,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { nameToRun: 'child3', testFiles: [file2], time: 0, - resource: Uri.file(__filename) + resource: Uri.file(__filename), }; const child1Folder: TestFolder = { folders: [child2Folder], @@ -968,7 +968,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { nameToRun: 'child2', testFiles: [file1], time: 0, - resource: Uri.file(__filename) + resource: Uri.file(__filename), }; const child3Folder: TestFolder = { folders: [], @@ -976,7 +976,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { nameToRun: 'child', testFiles: [file3], time: 0, - resource: Uri.file(__filename) + resource: Uri.file(__filename), }; const tests: Tests = { rootTestFolders: [child1Folder, child3Folder], @@ -984,7 +984,7 @@ suite('Unit Tests Test Explorer TestTreeViewProvider', () => { testFiles: [file1, file2, file3], testFunctions: [], testFolders: [child3Folder, child1Folder, child2Folder], - testSuites: [] + testSuites: [], }; const children = treeProvider.getRootNodes(tests); diff --git a/src/test/testing/explorer/treeView.unit.test.ts b/src/test/testing/explorer/treeView.unit.test.ts index 1222a55a238e..3fc24c53d112 100644 --- a/src/test/testing/explorer/treeView.unit.test.ts +++ b/src/test/testing/explorer/treeView.unit.test.ts @@ -31,7 +31,7 @@ suite('Unit Tests Test Explorer Tree View', () => { instance(treeViewProvider), [], instance(appShell), - instance(commandManager) + instance(commandManager), ); }); @@ -40,8 +40,8 @@ suite('Unit Tests Test Explorer Tree View', () => { verify( appShell.createTreeView( 'python_tests', - deepEqual({ showCollapseAll: true, treeDataProvider: instance(treeViewProvider) }) - ) + deepEqual({ showCollapseAll: true, treeDataProvider: instance(treeViewProvider) }), + ), ).once(); }); test('Activation will add command handlers', async () => { @@ -50,8 +50,8 @@ suite('Unit Tests Test Explorer Tree View', () => { commandManager.registerCommand( Commands.Test_Reveal_Test_Item, treeViewService.onRevealTestItem, - treeViewService - ) + treeViewService, + ), ).once(); }); test('Invoking the command handler will reveal the node in the tree', async () => { diff --git a/src/test/testing/helper.ts b/src/test/testing/helper.ts index 3f9ffbf44c89..b91de11d502a 100644 --- a/src/test/testing/helper.ts +++ b/src/test/testing/helper.ts @@ -19,7 +19,7 @@ export function lookForTestFile(tests: Tests, testFile: string) { (t) => (t.name.toUpperCase() === testFile.toUpperCase() || t.name.toUpperCase() === testFileToSearch.toUpperCase()) && - t.nameToRun.toUpperCase() === t.name.toUpperCase() + t.nameToRun.toUpperCase() === t.name.toUpperCase(), ); } else { found = tests.testFiles.some((t) => t.name === testFile && t.nameToRun === t.name); diff --git a/src/test/testing/mocks.ts b/src/test/testing/mocks.ts index b41fc3e2da6a..4c252b5b04d9 100644 --- a/src/test/testing/mocks.ts +++ b/src/test/testing/mocks.ts @@ -14,7 +14,7 @@ import { TestDiscoveryOptions, TestProvider, Tests, - TestsToRun + TestsToRun, } from '../../client/testing/common/types'; @injectable() @@ -74,7 +74,7 @@ export class MockTestManagerWithRunningTests extends BaseTestManager { product: Product, workspaceFolder: Uri, rootDirectory: string, - serviceContainer: IServiceContainer + serviceContainer: IServiceContainer, ) { super(testProvider, product, workspaceFolder, rootDirectory, serviceContainer); } @@ -87,7 +87,7 @@ export class MockTestManagerWithRunningTests extends BaseTestManager { _tests: Tests, _testsToRun?: TestsToRun, _runFailedTests?: boolean, - _debug?: boolean + _debug?: boolean, ): Promise { // tslint:disable-next-line:no-non-null-assertion this.testRunnerCancellationToken!.onCancellationRequested(() => { diff --git a/src/test/testing/navigation/commandHandlers.unit.test.ts b/src/test/testing/navigation/commandHandlers.unit.test.ts index be420ec7ab76..0aee741133d2 100644 --- a/src/test/testing/navigation/commandHandlers.unit.test.ts +++ b/src/test/testing/navigation/commandHandlers.unit.test.ts @@ -36,7 +36,7 @@ suite('Unit Tests - Navigation Command Handler', () => { instance(fileHandler), instance(functionHandler), instance(suiteHandler), - instance(disposableRegistry) + instance(disposableRegistry), ); }); test('Ensure Navigation handlers are registered', async () => { @@ -45,22 +45,22 @@ suite('Unit Tests - Navigation Command Handler', () => { cmdManager.registerCommand( Commands.navigateToTestFile, instance(fileHandler).navigateTo, - instance(fileHandler) - ) + instance(fileHandler), + ), ).once(); verify( cmdManager.registerCommand( Commands.navigateToTestFunction, instance(functionHandler).navigateTo, - instance(functionHandler) - ) + instance(functionHandler), + ), ).once(); verify( cmdManager.registerCommand( Commands.navigateToTestSuite, instance(suiteHandler).navigateTo, - instance(suiteHandler) - ) + instance(suiteHandler), + ), ).once(); }); test('Ensure handlers are disposed', async () => { @@ -71,22 +71,22 @@ suite('Unit Tests - Navigation Command Handler', () => { cmdManager.registerCommand( Commands.navigateToTestFile, instance(fileHandler).navigateTo, - instance(fileHandler) - ) + instance(fileHandler), + ), ).thenReturn(disposable1.object); when( cmdManager.registerCommand( Commands.navigateToTestFunction, instance(functionHandler).navigateTo, - instance(functionHandler) - ) + instance(functionHandler), + ), ).thenReturn(disposable2.object); when( cmdManager.registerCommand( Commands.navigateToTestSuite, instance(suiteHandler).navigateTo, - instance(suiteHandler) - ) + instance(suiteHandler), + ), ).thenReturn(disposable3.object); commandHandler.register(); diff --git a/src/test/testing/navigation/functionNavigator.unit.test.ts b/src/test/testing/navigation/functionNavigator.unit.test.ts index c883a3fb97a4..235049e22f2f 100644 --- a/src/test/testing/navigation/functionNavigator.unit.test.ts +++ b/src/test/testing/navigation/functionNavigator.unit.test.ts @@ -15,7 +15,7 @@ import { TextDocument, TextEditor, TextEditorRevealType, - Uri + Uri, } from 'vscode'; import { DocumentManager } from '../../../client/common/application/documentManager'; import { IDocumentManager } from '../../../client/common/application/types'; @@ -76,7 +76,7 @@ suite('Unit Tests - Navigation Function', () => { containerName: '', kind: SymbolKind.Function, name: 'function_name', - location: new Location(Uri.file(__filename), range) + location: new Location(Uri.file(__filename), range), }; when(helper.findSymbol(doc.object, anything(), anything())).thenResolve(symbol); @@ -87,7 +87,7 @@ suite('Unit Tests - Navigation Function', () => { expect(capture(helper.openFile).first()[0]!.fsPath).to.equal(filePath.fsPath); if (focusCode) { verify( - docManager.showTextDocument(doc.object, deepEqual({ preserveFocus: false, selection: range })) + docManager.showTextDocument(doc.object, deepEqual({ preserveFocus: false, selection: range })), ).once(); } else { editor.verify((e) => e.revealRange(typemoq.It.isAny(), TextEditorRevealType.Default), typemoq.Times.once()); diff --git a/src/test/testing/navigation/helper.unit.test.ts b/src/test/testing/navigation/helper.unit.test.ts index bd0ec9aea0d5..e9e32e8d3ae1 100644 --- a/src/test/testing/navigation/helper.unit.test.ts +++ b/src/test/testing/navigation/helper.unit.test.ts @@ -14,7 +14,7 @@ import { SymbolKind, TextDocument, TextEditor, - Uri + Uri, } from 'vscode'; import { DocumentManager } from '../../../client/common/application/documentManager'; import { IDocumentManager } from '../../../client/common/application/types'; @@ -71,7 +71,7 @@ suite('Unit Tests - Navigation Helper', () => { const symbols: SymbolInformation[] = [ { containerName: '', kind: SymbolKind.Function, name: '1', location: undefined as any }, { containerName: '', kind: SymbolKind.Class, name: '2', location: undefined as any }, - { containerName: '', kind: SymbolKind.File, name: '2', location: undefined as any } + { containerName: '', kind: SymbolKind.File, name: '2', location: undefined as any }, ]; const token = new CancellationTokenSource().token; when(symbolProvider.provideDocumentSymbols(doc.object, token)).thenResolve(symbols as any); diff --git a/src/test/testing/navigation/serviceRegistry.unit.test.ts b/src/test/testing/navigation/serviceRegistry.unit.test.ts index 85687b9c606a..7d7cedc7535b 100644 --- a/src/test/testing/navigation/serviceRegistry.unit.test.ts +++ b/src/test/testing/navigation/serviceRegistry.unit.test.ts @@ -19,7 +19,7 @@ import { ITestCodeNavigator, ITestCodeNavigatorCommandHandler, ITestNavigatorHelper, - NavigableItemType + NavigableItemType, } from '../../../client/testing/navigation/types'; use(chaisAsPromised); @@ -35,29 +35,29 @@ suite('Unit Tests - Navigation Service Registry', () => { verify( serviceManager.addSingleton( ITestCodeNavigatorCommandHandler, - TestCodeNavigatorCommandHandler - ) + TestCodeNavigatorCommandHandler, + ), ).once(); verify( serviceManager.addSingleton( ITestCodeNavigator, TestFileCodeNavigator, - NavigableItemType.testFile - ) + NavigableItemType.testFile, + ), ).once(); verify( serviceManager.addSingleton( ITestCodeNavigator, TestFunctionCodeNavigator, - NavigableItemType.testFunction - ) + NavigableItemType.testFunction, + ), ).once(); verify( serviceManager.addSingleton( ITestCodeNavigator, TestSuiteCodeNavigator, - NavigableItemType.testSuite - ) + NavigableItemType.testSuite, + ), ).once(); verify(serviceManager.addSingleton(anything(), TestFileSymbolProvider, 'test')).once(); }); diff --git a/src/test/testing/navigation/suiteNavigator.unit.test.ts b/src/test/testing/navigation/suiteNavigator.unit.test.ts index df06fba2b6b4..3d117aee5b1a 100644 --- a/src/test/testing/navigation/suiteNavigator.unit.test.ts +++ b/src/test/testing/navigation/suiteNavigator.unit.test.ts @@ -15,7 +15,7 @@ import { TextDocument, TextEditor, TextEditorRevealType, - Uri + Uri, } from 'vscode'; import { DocumentManager } from '../../../client/common/application/documentManager'; import { IDocumentManager } from '../../../client/common/application/types'; @@ -76,7 +76,7 @@ suite('Unit Tests - Navigation Suite', () => { containerName: '', kind: SymbolKind.Class, name: 'suite_name', - location: new Location(Uri.file(__filename), range) + location: new Location(Uri.file(__filename), range), }; when(helper.findSymbol(doc.object, anything(), anything())).thenResolve(symbol); @@ -87,7 +87,7 @@ suite('Unit Tests - Navigation Suite', () => { expect(capture(helper.openFile).first()[0]!.fsPath).to.equal(filePath.fsPath); if (focusCode) { verify( - docManager.showTextDocument(doc.object, deepEqual({ preserveFocus: false, selection: range })) + docManager.showTextDocument(doc.object, deepEqual({ preserveFocus: false, selection: range })), ).once(); } else { editor.verify((e) => e.revealRange(range, TextEditorRevealType.Default), typemoq.Times.once()); @@ -114,7 +114,7 @@ suite('Unit Tests - Navigation Suite', () => { expect(capture(helper.openFile).first()[0]!.fsPath).to.equal(filePath.fsPath); if (focusCode) { verify( - docManager.showTextDocument(doc.object, deepEqual({ preserveFocus: false, selection: range })) + docManager.showTextDocument(doc.object, deepEqual({ preserveFocus: false, selection: range })), ).once(); } else { editor.verify((e) => e.revealRange(range, TextEditorRevealType.Default), typemoq.Times.once()); diff --git a/src/test/testing/navigation/symbolNavigator.unit.test.ts b/src/test/testing/navigation/symbolNavigator.unit.test.ts index 744ad16b0ab2..c7c218cd1409 100644 --- a/src/test/testing/navigation/symbolNavigator.unit.test.ts +++ b/src/test/testing/navigation/symbolNavigator.unit.test.ts @@ -13,12 +13,12 @@ import { SymbolInformation, SymbolKind, TextDocument, - Uri + Uri, } from 'vscode'; import { ExecutionResult, IPythonExecutionFactory, - IPythonExecutionService + IPythonExecutionService, } from '../../../client/common/process/types'; import { IDocumentSymbolProvider } from '../../../client/common/types'; import { EXTENSION_ROOT_DIR } from '../../../client/constants'; @@ -89,10 +89,10 @@ suite('Unit Tests - Navigation Command Handler', () => { const args = [ path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'pyvsc-run-isolated.py'), path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'symbolProvider.py'), - docUri.fsPath + docUri.fsPath, ]; const proc: ExecutionResult = { - stdout: JSON.stringify({ classes: [], methods: [], functions: [] }) + stdout: JSON.stringify({ classes: [], methods: [], functions: [] }), }; doc.setup((d) => d.isUntitled) .returns(() => false) @@ -121,7 +121,7 @@ suite('Unit Tests - Navigation Command Handler', () => { const args = [ path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'pyvsc-run-isolated.py'), path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'symbolProvider.py'), - docUri.fsPath + docUri.fsPath, ]; const proc: ExecutionResult = { stdout: JSON.stringify({ @@ -130,26 +130,26 @@ suite('Unit Tests - Navigation Command Handler', () => { namespace: '1', name: 'one', kind: SymbolKind.Class, - range: { start: { line: 1, character: 2 }, end: { line: 3, character: 4 } } - } + range: { start: { line: 1, character: 2 }, end: { line: 3, character: 4 } }, + }, ], methods: [ { namespace: '2', name: 'two', kind: SymbolKind.Class, - range: { start: { line: 5, character: 6 }, end: { line: 7, character: 8 } } - } + range: { start: { line: 5, character: 6 }, end: { line: 7, character: 8 } }, + }, ], functions: [ { namespace: '3', name: 'three', kind: SymbolKind.Class, - range: { start: { line: 9, character: 10 }, end: { line: 11, character: 12 } } - } - ] - }) + range: { start: { line: 9, character: 10 }, end: { line: 11, character: 12 } }, + }, + ], + }), }; doc.setup((d) => d.isUntitled) .returns(() => false) diff --git a/src/test/testing/nosetest/nosetest.discovery.unit.test.ts b/src/test/testing/nosetest/nosetest.discovery.unit.test.ts index a6dfb25e46cb..df1c9a27852a 100644 --- a/src/test/testing/nosetest/nosetest.discovery.unit.test.ts +++ b/src/test/testing/nosetest/nosetest.discovery.unit.test.ts @@ -17,7 +17,7 @@ import { ITestsParser, Options, TestDiscoveryOptions, - Tests + Tests, } from '../../../client/testing/common/types'; import { TestDiscoveryService } from '../../../client/testing/nosetest/services/discoveryService'; import { IArgumentsService, TestFilter } from '../../../client/testing/types'; @@ -54,7 +54,7 @@ suite('Unit Tests - nose - Discovery', () => { testFunctions: [], testSuites: [], rootTestFolders: [], - testFolders: [] + testFolders: [], }; argsService .setup((a) => a.filterArguments(typeMoq.It.isValue(args), typeMoq.It.isValue(TestFilter.discovery))) @@ -95,7 +95,7 @@ suite('Unit Tests - nose - Discovery', () => { testFunctions: [], testSuites: [], rootTestFolders: [], - testFolders: [] + testFolders: [], }; argsService .setup((a) => a.filterArguments(typeMoq.It.isValue(args), typeMoq.It.isValue(TestFilter.discovery))) diff --git a/src/test/testing/nosetest/nosetest.disovery.test.ts b/src/test/testing/nosetest/nosetest.disovery.test.ts index 835f682c5747..542291e503f6 100644 --- a/src/test/testing/nosetest/nosetest.disovery.test.ts +++ b/src/test/testing/nosetest/nosetest.disovery.test.ts @@ -28,11 +28,11 @@ const UNITTEST_SINGLE_TEST_FILE_PATH = path.join( 'test', 'pythonFiles', 'testFiles', - 'single' + 'single', ); const filesToDelete = [ path.join(UNITTEST_TEST_FILES_PATH, '.noseids'), - path.join(UNITTEST_SINGLE_TEST_FILE_PATH, '.noseids') + path.join(UNITTEST_SINGLE_TEST_FILE_PATH, '.noseids'), ]; // tslint:disable-next-line:max-func-body-length @@ -79,7 +79,7 @@ suite('Unit Tests - nose - discovery with mocked process output', () => { ioc.serviceManager.addSingletonInstance( IInterpreterService, - instance(mock(InterpreterService)) + instance(mock(InterpreterService)), ); registerForIOC(ioc.serviceManager, ioc.serviceContainer); @@ -96,11 +96,11 @@ suite('Unit Tests - nose - discovery with mocked process output', () => { // Value in the test files. out = out.replace( /\/Users\/donjayamanne\/.vscode\/extensions\/pythonVSCode\/src\/test\/pythonFiles/g, - PYTHON_FILES_PATH + PYTHON_FILES_PATH, ); callback({ out, - source: 'stdout' + source: 'stdout', }); } }); @@ -128,7 +128,7 @@ suite('Unit Tests - nose - discovery with mocked process output', () => { assert.equal( tests.testSuites.every((t) => t.testSuite.name === t.testSuite.nameToRun.split(':')[1]), true, - 'Suite name does not match class name' + 'Suite name does not match class name', ); }); test('Discover Tests (-m=test)', async () => { diff --git a/src/test/testing/nosetest/nosetest.run.test.ts b/src/test/testing/nosetest/nosetest.run.test.ts index e9b0c84ee6cf..66639f60edb0 100644 --- a/src/test/testing/nosetest/nosetest.run.test.ts +++ b/src/test/testing/nosetest/nosetest.run.test.ts @@ -21,11 +21,11 @@ const UNITTEST_SINGLE_TEST_FILE_PATH = path.join( 'test', 'pythonFiles', 'testFiles', - 'single' + 'single', ); const filesToDelete = [ path.join(UNITTEST_TEST_FILES_PATH, '.noseids'), - path.join(UNITTEST_SINGLE_TEST_FILE_PATH, '.noseids') + path.join(UNITTEST_SINGLE_TEST_FILE_PATH, '.noseids'), ]; // tslint:disable-next-line:max-func-body-length @@ -83,9 +83,9 @@ suite('Unit Tests - nose - run against actual python process', () => { .readFileSync(path.join(UNITTEST_TEST_FILES_PATH, outputFileName), 'utf8') .replace( /\/Users\/donjayamanne\/.vscode\/extensions\/pythonVSCode\/src\/test\/pythonFiles\/testFiles\/noseFiles/g, - UNITTEST_TEST_FILES_PATH + UNITTEST_TEST_FILES_PATH, ), - source: 'stdout' + source: 'stdout', }); } }); @@ -175,7 +175,7 @@ suite('Unit Tests - nose - run against actual python process', () => { testFile: [], testFolder: [], testFunction: [], - testSuite: [testSuiteToRun!.testSuite] + testSuite: [testSuiteToRun!.testSuite], }; const results = await testManager.runTest(CommandSource.ui, testSuite); assert.equal(results.summary.errors, 0, 'Errors'); @@ -198,7 +198,7 @@ suite('Unit Tests - nose - run against actual python process', () => { testFile: [], testFolder: [], testFunction: [testFnToRun!.testFunction], - testSuite: [] + testSuite: [], }; const results = await testManager.runTest(CommandSource.ui, testFn); assert.equal(results.summary.errors, 0, 'Errors'); diff --git a/src/test/testing/nosetest/nosetest.test.ts b/src/test/testing/nosetest/nosetest.test.ts index 305ee65d75ab..6415b545e458 100644 --- a/src/test/testing/nosetest/nosetest.test.ts +++ b/src/test/testing/nosetest/nosetest.test.ts @@ -17,11 +17,11 @@ const UNITTEST_SINGLE_TEST_FILE_PATH = path.join( 'test', 'pythonFiles', 'testFiles', - 'single' + 'single', ); const filesToDelete = [ path.join(UNITTEST_TEST_FILES_PATH, '.noseids'), - path.join(UNITTEST_SINGLE_TEST_FILE_PATH, '.noseids') + path.join(UNITTEST_SINGLE_TEST_FILE_PATH, '.noseids'), ]; // tslint:disable-next-line:max-func-body-length diff --git a/src/test/testing/pytest/pytest.discovery.test.ts b/src/test/testing/pytest/pytest.discovery.test.ts index 51c3a0e5ed30..e761ba399035 100644 --- a/src/test/testing/pytest/pytest.discovery.test.ts +++ b/src/test/testing/pytest/pytest.discovery.test.ts @@ -16,7 +16,7 @@ import { IBufferDecoder, IProcessServiceFactory, IPythonExecutionFactory, - IPythonExecutionService + IPythonExecutionService, } from '../../../client/common/process/types'; import { IConfigurationService } from '../../../client/common/types'; import { IEnvironmentActivationService } from '../../../client/interpreter/activation/types'; @@ -40,7 +40,7 @@ const UNITTEST_SINGLE_TEST_FILE_PATH = path.join( 'test', 'pythonFiles', 'testFiles', - 'single' + 'single', ); const UNITTEST_TEST_FILES_PATH_WITH_CONFIGS = path.join( EXTENSION_ROOT_DIR, @@ -48,7 +48,7 @@ const UNITTEST_TEST_FILES_PATH_WITH_CONFIGS = path.join( 'test', 'pythonFiles', 'testFiles', - 'unittestsWithConfigs' + 'unittestsWithConfigs', ); const unitTestTestFilesCwdPath = path.join(EXTENSION_ROOT_DIR, 'src', 'test', 'pythonFiles', 'testFiles', 'cwd', 'src'); @@ -72,7 +72,7 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { @inject(IConfigurationService) private readonly _configService: IConfigurationService, @inject(ICondaService) condaService: ICondaService, @inject(WindowsStoreInterpreter) windowsStoreInterpreter: WindowsStoreInterpreter, - @inject(IBufferDecoder) decoder: IBufferDecoder + @inject(IBufferDecoder) decoder: IBufferDecoder, ) { super( _serviceContainer, @@ -81,11 +81,11 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { _configService, condaService, decoder, - windowsStoreInterpreter + windowsStoreInterpreter, ); } public async createActivatedEnvironment( - options: ExecutionFactoryCreateWithEnvironmentOptions + options: ExecutionFactoryCreateWithEnvironmentOptions, ): Promise { const pythonPath = options.interpreter ? options.interpreter.path @@ -104,7 +104,7 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { execObservable: (a, o) => procs.execObservable(a, o), execModuleObservable: (m, a, o) => procs.execModuleObservable(m, a, o), exec: (a, o) => procs.exec(a, o), - execModule: (m, a, o) => procs.execModule(m, a, o) + execModule: (m, a, o) => procs.execModule(m, a, o), }; } } @@ -132,7 +132,7 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { ioc.registerInterpreterStorageTypes(); ioc.serviceManager.addSingletonInstance( IInterpreterService, - instance(mock(InterpreterService)) + instance(mock(InterpreterService)), ); ioc.serviceManager.rebind(IPythonExecutionFactory, ExecutionFactory); registerForIOC(ioc.serviceManager, ioc.serviceContainer); @@ -146,7 +146,7 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { procService.onExec((_file, args, _options, callback) => { if (args.indexOf('discover') >= 0 && args.indexOf('pytest') >= 0) { callback({ - stdout: output + stdout: output, }); } }); @@ -165,34 +165,34 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { kind: 'file', name: 'test_root.py', relpath: './test_root.py', - parentid: '.' + parentid: '.', }, { id: './test_root.py::Test_Root_test1', kind: 'suite', name: 'Test_Root_test1', - parentid: './test_root.py' + parentid: './test_root.py', }, { id: './tests', kind: 'folder', name: 'tests', relpath: './tests', - parentid: '.' + parentid: '.', }, { id: './tests/test_one.py', kind: 'file', name: 'test_one.py', relpath: './tests/test_one.py', - parentid: './tests' + parentid: './tests', }, { id: './tests/test_one.py::Test_test1', kind: 'suite', name: 'Test_test1', - parentid: './tests/test_one.py' - } + parentid: './tests/test_one.py', + }, ], tests: [ { @@ -200,46 +200,46 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { name: 'test_Root_A', source: './test_root.py:6', markers: [], - parentid: './test_root.py::Test_Root_test1' + parentid: './test_root.py::Test_Root_test1', }, { id: './test_root.py::Test_Root_test1::test_Root_B', name: 'test_Root_B', source: './test_root.py:9', markers: [], - parentid: './test_root.py::Test_Root_test1' + parentid: './test_root.py::Test_Root_test1', }, { id: './test_root.py::Test_Root_test1::test_Root_c', name: 'test_Root_c', source: './test_root.py:12', markers: [], - parentid: './test_root.py::Test_Root_test1' + parentid: './test_root.py::Test_Root_test1', }, { id: './tests/test_one.py::Test_test1::test_A', name: 'test_A', source: 'tests/test_one.py:6', markers: [], - parentid: './tests/test_one.py::Test_test1' + parentid: './tests/test_one.py::Test_test1', }, { id: './tests/test_one.py::Test_test1::test_B', name: 'test_B', source: 'tests/test_one.py:9', markers: [], - parentid: './tests/test_one.py::Test_test1' + parentid: './tests/test_one.py::Test_test1', }, { id: './tests/test_one.py::Test_test1::test_c', name: 'test_c', source: 'tests/test_one.py:12', markers: [], - parentid: './tests/test_one.py::Test_test1' - } - ] - } - ]) + parentid: './tests/test_one.py::Test_test1', + }, + ], + }, + ]), ); const factory = ioc.serviceContainer.get(ITestManagerFactory); const testManager = factory('pytest', rootWorkspaceUri!, UNITTEST_SINGLE_TEST_FILE_PATH); @@ -255,12 +255,12 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { assert.equal( tests.testFiles.some((t) => t.name === 'test_one.py'), true, - 'Test File not found' + 'Test File not found', ); assert.equal( tests.testFiles.some((t) => t.name === 'test_root.py'), true, - 'Test File not found' + 'Test File not found', ); }); @@ -277,136 +277,137 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { relpath: './test_root.py', kind: 'file', name: 'test_root.py', - parentid: '.' + parentid: '.', }, { id: './test_root.py::Test_Root_test1', kind: 'suite', name: 'Test_Root_test1', - parentid: './test_root.py' + parentid: './test_root.py', }, { id: './tests', relpath: './tests', kind: 'folder', name: 'tests', - parentid: '.' + parentid: '.', }, { id: './tests/test_another_pytest.py', relpath: './tests/test_another_pytest.py', kind: 'file', name: 'test_another_pytest.py', - parentid: './tests' + parentid: './tests', }, { id: './tests/test_another_pytest.py::test_parametrized_username', kind: 'function', name: 'test_parametrized_username', - parentid: './tests/test_another_pytest.py' + parentid: './tests/test_another_pytest.py', }, { id: './tests/test_foreign_nested_tests.py', relpath: './tests/test_foreign_nested_tests.py', kind: 'file', name: 'test_foreign_nested_tests.py', - parentid: './tests' + parentid: './tests', }, { id: './tests/test_foreign_nested_tests.py::TestNestedForeignTests', kind: 'suite', name: 'TestNestedForeignTests', - parentid: './tests/test_foreign_nested_tests.py' + parentid: './tests/test_foreign_nested_tests.py', }, { id: './tests/test_foreign_nested_tests.py::TestNestedForeignTests::TestInheritingHere', kind: 'suite', name: 'TestInheritingHere', - parentid: './tests/test_foreign_nested_tests.py::TestNestedForeignTests' + parentid: './tests/test_foreign_nested_tests.py::TestNestedForeignTests', }, { id: './tests/test_foreign_nested_tests.py::TestNestedForeignTests::TestInheritingHere::TestExtraNestedForeignTests', kind: 'suite', name: 'TestExtraNestedForeignTests', - parentid: './tests/test_foreign_nested_tests.py::TestNestedForeignTests::TestInheritingHere' + parentid: + './tests/test_foreign_nested_tests.py::TestNestedForeignTests::TestInheritingHere', }, { id: './tests/test_pytest.py', relpath: './tests/test_pytest.py', kind: 'file', name: 'test_pytest.py', - parentid: './tests' + parentid: './tests', }, { id: './tests/test_pytest.py::Test_CheckMyApp', kind: 'suite', name: 'Test_CheckMyApp', - parentid: './tests/test_pytest.py' + parentid: './tests/test_pytest.py', }, { id: './tests/test_pytest.py::Test_CheckMyApp::Test_NestedClassA', kind: 'suite', name: 'Test_NestedClassA', - parentid: './tests/test_pytest.py::Test_CheckMyApp' + parentid: './tests/test_pytest.py::Test_CheckMyApp', }, { id: './tests/test_pytest.py::Test_CheckMyApp::Test_NestedClassA::Test_nested_classB_Of_A', kind: 'suite', name: 'Test_nested_classB_Of_A', - parentid: './tests/test_pytest.py::Test_CheckMyApp::Test_NestedClassA' + parentid: './tests/test_pytest.py::Test_CheckMyApp::Test_NestedClassA', }, { id: './tests/test_pytest.py::test_parametrized_username', kind: 'function', name: 'test_parametrized_username', - parentid: './tests/test_pytest.py' + parentid: './tests/test_pytest.py', }, { id: './tests/test_unittest_one.py', relpath: './tests/test_unittest_one.py', kind: 'file', name: 'test_unittest_one.py', - parentid: './tests' + parentid: './tests', }, { id: './tests/test_unittest_one.py::Test_test1', kind: 'suite', name: 'Test_test1', - parentid: './tests/test_unittest_one.py' + parentid: './tests/test_unittest_one.py', }, { id: './tests/test_unittest_two.py', relpath: './tests/test_unittest_two.py', kind: 'file', name: 'test_unittest_two.py', - parentid: './tests' + parentid: './tests', }, { id: './tests/test_unittest_two.py::Test_test2', kind: 'suite', name: 'Test_test2', - parentid: './tests/test_unittest_two.py' + parentid: './tests/test_unittest_two.py', }, { id: './tests/test_unittest_two.py::Test_test2a', kind: 'suite', name: 'Test_test2a', - parentid: './tests/test_unittest_two.py' + parentid: './tests/test_unittest_two.py', }, { id: './tests/unittest_three_test.py', relpath: './tests/unittest_three_test.py', kind: 'file', name: 'unittest_three_test.py', - parentid: './tests' + parentid: './tests', }, { id: './tests/unittest_three_test.py::Test_test3', kind: 'suite', name: 'Test_test3', - parentid: './tests/unittest_three_test.py' - } + parentid: './tests/unittest_three_test.py', + }, ], tests: [ { @@ -414,49 +415,49 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { name: 'test_Root_A', source: './test_root.py:6', markers: [], - parentid: './test_root.py::Test_Root_test1' + parentid: './test_root.py::Test_Root_test1', }, { id: './test_root.py::Test_Root_test1::test_Root_B', name: 'test_Root_B', source: './test_root.py:9', markers: [], - parentid: './test_root.py::Test_Root_test1' + parentid: './test_root.py::Test_Root_test1', }, { id: './test_root.py::Test_Root_test1::test_Root_c', name: 'test_Root_c', source: './test_root.py:12', markers: [], - parentid: './test_root.py::Test_Root_test1' + parentid: './test_root.py::Test_Root_test1', }, { id: './tests/test_another_pytest.py::test_username', name: 'test_username', source: 'tests/test_another_pytest.py:12', markers: [], - parentid: './tests/test_another_pytest.py' + parentid: './tests/test_another_pytest.py', }, { id: './tests/test_another_pytest.py::test_parametrized_username[one]', name: 'test_parametrized_username[one]', source: 'tests/test_another_pytest.py:15', markers: [], - parentid: './tests/test_another_pytest.py::test_parametrized_username' + parentid: './tests/test_another_pytest.py::test_parametrized_username', }, { id: './tests/test_another_pytest.py::test_parametrized_username[two]', name: 'test_parametrized_username[two]', source: 'tests/test_another_pytest.py:15', markers: [], - parentid: './tests/test_another_pytest.py::test_parametrized_username' + parentid: './tests/test_another_pytest.py::test_parametrized_username', }, { id: './tests/test_another_pytest.py::test_parametrized_username[three]', name: 'test_parametrized_username[three]', source: 'tests/test_another_pytest.py:15', markers: [], - parentid: './tests/test_another_pytest.py::test_parametrized_username' + parentid: './tests/test_another_pytest.py::test_parametrized_username', }, { id: @@ -465,7 +466,7 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { source: 'tests/external.py:2', markers: [], parentid: - './tests/test_foreign_nested_tests.py::TestNestedForeignTests::TestInheritingHere::TestExtraNestedForeignTests' + './tests/test_foreign_nested_tests.py::TestNestedForeignTests::TestInheritingHere::TestExtraNestedForeignTests', }, { id: @@ -473,7 +474,8 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { name: 'test_foreign_test', source: 'tests/external.py:4', markers: [], - parentid: './tests/test_foreign_nested_tests.py::TestNestedForeignTests::TestInheritingHere' + parentid: + './tests/test_foreign_nested_tests.py::TestNestedForeignTests::TestInheritingHere', }, { id: @@ -481,35 +483,36 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { name: 'test_nested_normal', source: 'tests/test_foreign_nested_tests.py:5', markers: [], - parentid: './tests/test_foreign_nested_tests.py::TestNestedForeignTests::TestInheritingHere' + parentid: + './tests/test_foreign_nested_tests.py::TestNestedForeignTests::TestInheritingHere', }, { id: './tests/test_foreign_nested_tests.py::TestNestedForeignTests::test_normal', name: 'test_normal', source: 'tests/test_foreign_nested_tests.py:7', markers: [], - parentid: './tests/test_foreign_nested_tests.py::TestNestedForeignTests' + parentid: './tests/test_foreign_nested_tests.py::TestNestedForeignTests', }, { id: './tests/test_pytest.py::Test_CheckMyApp::test_simple_check', name: 'test_simple_check', source: 'tests/test_pytest.py:6', markers: [], - parentid: './tests/test_pytest.py::Test_CheckMyApp' + parentid: './tests/test_pytest.py::Test_CheckMyApp', }, { id: './tests/test_pytest.py::Test_CheckMyApp::test_complex_check', name: 'test_complex_check', source: 'tests/test_pytest.py:9', markers: [], - parentid: './tests/test_pytest.py::Test_CheckMyApp' + parentid: './tests/test_pytest.py::Test_CheckMyApp', }, { id: './tests/test_pytest.py::Test_CheckMyApp::Test_NestedClassA::test_nested_class_methodB', name: 'test_nested_class_methodB', source: 'tests/test_pytest.py:13', markers: [], - parentid: './tests/test_pytest.py::Test_CheckMyApp::Test_NestedClassA' + parentid: './tests/test_pytest.py::Test_CheckMyApp::Test_NestedClassA', }, { id: @@ -518,137 +521,137 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { source: 'tests/test_pytest.py:16', markers: [], parentid: - './tests/test_pytest.py::Test_CheckMyApp::Test_NestedClassA::Test_nested_classB_Of_A' + './tests/test_pytest.py::Test_CheckMyApp::Test_NestedClassA::Test_nested_classB_Of_A', }, { id: './tests/test_pytest.py::Test_CheckMyApp::Test_NestedClassA::test_nested_class_methodC', name: 'test_nested_class_methodC', source: 'tests/test_pytest.py:18', markers: [], - parentid: './tests/test_pytest.py::Test_CheckMyApp::Test_NestedClassA' + parentid: './tests/test_pytest.py::Test_CheckMyApp::Test_NestedClassA', }, { id: './tests/test_pytest.py::Test_CheckMyApp::test_simple_check2', name: 'test_simple_check2', source: 'tests/test_pytest.py:21', markers: [], - parentid: './tests/test_pytest.py::Test_CheckMyApp' + parentid: './tests/test_pytest.py::Test_CheckMyApp', }, { id: './tests/test_pytest.py::Test_CheckMyApp::test_complex_check2', name: 'test_complex_check2', source: 'tests/test_pytest.py:23', markers: [], - parentid: './tests/test_pytest.py::Test_CheckMyApp' + parentid: './tests/test_pytest.py::Test_CheckMyApp', }, { id: './tests/test_pytest.py::test_username', name: 'test_username', source: 'tests/test_pytest.py:35', markers: [], - parentid: './tests/test_pytest.py' + parentid: './tests/test_pytest.py', }, { id: './tests/test_pytest.py::test_parametrized_username[one]', name: 'test_parametrized_username[one]', source: 'tests/test_pytest.py:38', markers: [], - parentid: './tests/test_pytest.py::test_parametrized_username' + parentid: './tests/test_pytest.py::test_parametrized_username', }, { id: './tests/test_pytest.py::test_parametrized_username[two]', name: 'test_parametrized_username[two]', source: 'tests/test_pytest.py:38', markers: [], - parentid: './tests/test_pytest.py::test_parametrized_username' + parentid: './tests/test_pytest.py::test_parametrized_username', }, { id: './tests/test_pytest.py::test_parametrized_username[three]', name: 'test_parametrized_username[three]', source: 'tests/test_pytest.py:38', markers: [], - parentid: './tests/test_pytest.py::test_parametrized_username' + parentid: './tests/test_pytest.py::test_parametrized_username', }, { id: './tests/test_unittest_one.py::Test_test1::test_A', name: 'test_A', source: 'tests/test_unittest_one.py:6', markers: [], - parentid: './tests/test_unittest_one.py::Test_test1' + parentid: './tests/test_unittest_one.py::Test_test1', }, { id: './tests/test_unittest_one.py::Test_test1::test_B', name: 'test_B', source: 'tests/test_unittest_one.py:9', markers: [], - parentid: './tests/test_unittest_one.py::Test_test1' + parentid: './tests/test_unittest_one.py::Test_test1', }, { id: './tests/test_unittest_one.py::Test_test1::test_c', name: 'test_c', source: 'tests/test_unittest_one.py:12', markers: [], - parentid: './tests/test_unittest_one.py::Test_test1' + parentid: './tests/test_unittest_one.py::Test_test1', }, { id: './tests/test_unittest_two.py::Test_test2::test_A2', name: 'test_A2', source: 'tests/test_unittest_two.py:3', markers: [], - parentid: './tests/test_unittest_two.py::Test_test2' + parentid: './tests/test_unittest_two.py::Test_test2', }, { id: './tests/test_unittest_two.py::Test_test2::test_B2', name: 'test_B2', source: 'tests/test_unittest_two.py:6', markers: [], - parentid: './tests/test_unittest_two.py::Test_test2' + parentid: './tests/test_unittest_two.py::Test_test2', }, { id: './tests/test_unittest_two.py::Test_test2::test_C2', name: 'test_C2', source: 'tests/test_unittest_two.py:9', markers: [], - parentid: './tests/test_unittest_two.py::Test_test2' + parentid: './tests/test_unittest_two.py::Test_test2', }, { id: './tests/test_unittest_two.py::Test_test2::test_D2', name: 'test_D2', source: 'tests/test_unittest_two.py:12', markers: [], - parentid: './tests/test_unittest_two.py::Test_test2' + parentid: './tests/test_unittest_two.py::Test_test2', }, { id: './tests/test_unittest_two.py::Test_test2a::test_222A2', name: 'test_222A2', source: 'tests/test_unittest_two.py:17', markers: [], - parentid: './tests/test_unittest_two.py::Test_test2a' + parentid: './tests/test_unittest_two.py::Test_test2a', }, { id: './tests/test_unittest_two.py::Test_test2a::test_222B2', name: 'test_222B2', source: 'tests/test_unittest_two.py:20', markers: [], - parentid: './tests/test_unittest_two.py::Test_test2a' + parentid: './tests/test_unittest_two.py::Test_test2a', }, { id: './tests/unittest_three_test.py::Test_test3::test_A', name: 'test_A', source: 'tests/unittest_three_test.py:4', markers: [], - parentid: './tests/unittest_three_test.py::Test_test3' + parentid: './tests/unittest_three_test.py::Test_test3', }, { id: './tests/unittest_three_test.py::Test_test3::test_B', name: 'test_B', source: 'tests/unittest_three_test.py:7', markers: [], - parentid: './tests/unittest_three_test.py::Test_test3' - } - ] - } - ]) + parentid: './tests/unittest_three_test.py::Test_test3', + }, + ], + }, + ]), ); await updateSetting('testing.pytestArgs', ['-k=test_'], rootWorkspaceUri, configTarget); const factory = ioc.serviceContainer.get(ITestManagerFactory); @@ -665,37 +668,37 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { assert.equal( tests.testFiles.some((t) => t.name === 'test_foreign_nested_tests.py'), true, - 'Test File not found' + 'Test File not found', ); assert.equal( tests.testFiles.some((t) => t.name === 'test_unittest_one.py'), true, - 'Test File not found' + 'Test File not found', ); assert.equal( tests.testFiles.some((t) => t.name === 'test_unittest_two.py'), true, - 'Test File not found' + 'Test File not found', ); assert.equal( tests.testFiles.some((t) => t.name === 'unittest_three_test.py'), true, - 'Test File not found' + 'Test File not found', ); assert.equal( tests.testFiles.some((t) => t.name === 'test_pytest.py'), true, - 'Test File not found' + 'Test File not found', ); assert.equal( tests.testFiles.some((t) => t.name === 'test_another_pytest.py'), true, - 'Test File not found' + 'Test File not found', ); assert.equal( tests.testFiles.some((t) => t.name === 'test_root.py'), true, - 'Test File not found' + 'Test File not found', ); }); @@ -712,21 +715,21 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { kind: 'folder', name: 'tests', relpath: './tests', - parentid: '.' + parentid: '.', }, { id: './tests/unittest_three_test.py', kind: 'file', name: 'unittest_three_test.py', relpath: './tests/unittest_three_test.py', - parentid: './tests' + parentid: './tests', }, { id: './tests/unittest_three_test.py::Test_test3', kind: 'suite', name: 'Test_test3', - parentid: './tests/unittest_three_test.py' - } + parentid: './tests/unittest_three_test.py', + }, ], tests: [ { @@ -734,18 +737,18 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { name: 'test_A', source: 'tests/unittest_three_test.py:4', markers: [], - parentid: './tests/unittest_three_test.py::Test_test3' + parentid: './tests/unittest_three_test.py::Test_test3', }, { id: './tests/unittest_three_test.py::Test_test3::test_B', name: 'test_B', source: 'tests/unittest_three_test.py:7', markers: [], - parentid: './tests/unittest_three_test.py::Test_test3' - } - ] - } - ]) + parentid: './tests/unittest_three_test.py::Test_test3', + }, + ], + }, + ]), ); await updateSetting('testing.pytestArgs', ['-k=_test.py'], rootWorkspaceUri, configTarget); const factory = ioc.serviceContainer.get(ITestManagerFactory); @@ -762,7 +765,7 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { assert.equal( tests.testFiles.some((t) => t.name === 'unittest_three_test.py'), true, - 'Test File not found' + 'Test File not found', ); }); @@ -779,52 +782,52 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { relpath: './other', kind: 'folder', name: 'other', - parentid: '.' + parentid: '.', }, { id: './other/test_pytest.py', relpath: './other/test_pytest.py', kind: 'file', name: 'test_pytest.py', - parentid: './other' + parentid: './other', }, { id: './other/test_pytest.py::Test_CheckMyApp', kind: 'suite', name: 'Test_CheckMyApp', - parentid: './other/test_pytest.py' + parentid: './other/test_pytest.py', }, { id: './other/test_pytest.py::Test_CheckMyApp::Test_NestedClassA', kind: 'suite', name: 'Test_NestedClassA', - parentid: './other/test_pytest.py::Test_CheckMyApp' + parentid: './other/test_pytest.py::Test_CheckMyApp', }, { id: './other/test_pytest.py::Test_CheckMyApp::Test_NestedClassA::Test_nested_classB_Of_A', kind: 'suite', name: 'Test_nested_classB_Of_A', - parentid: './other/test_pytest.py::Test_CheckMyApp::Test_NestedClassA' + parentid: './other/test_pytest.py::Test_CheckMyApp::Test_NestedClassA', }, { id: './other/test_pytest.py::test_parametrized_username', kind: 'function', name: 'test_parametrized_username', - parentid: './other/test_pytest.py' + parentid: './other/test_pytest.py', }, { id: './other/test_unittest_one.py', relpath: './other/test_unittest_one.py', kind: 'file', name: 'test_unittest_one.py', - parentid: './other' + parentid: './other', }, { id: './other/test_unittest_one.py::Test_test1', kind: 'suite', name: 'Test_test1', - parentid: './other/test_unittest_one.py' - } + parentid: './other/test_unittest_one.py', + }, ], tests: [ { @@ -832,21 +835,21 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { name: 'test_simple_check', source: 'other/test_pytest.py:6', markers: [], - parentid: './other/test_pytest.py::Test_CheckMyApp' + parentid: './other/test_pytest.py::Test_CheckMyApp', }, { id: './other/test_pytest.py::Test_CheckMyApp::test_complex_check', name: 'test_complex_check', source: 'other/test_pytest.py:9', markers: [], - parentid: './other/test_pytest.py::Test_CheckMyApp' + parentid: './other/test_pytest.py::Test_CheckMyApp', }, { id: './other/test_pytest.py::Test_CheckMyApp::Test_NestedClassA::test_nested_class_methodB', name: 'test_nested_class_methodB', source: 'other/test_pytest.py:13', markers: [], - parentid: './other/test_pytest.py::Test_CheckMyApp::Test_NestedClassA' + parentid: './other/test_pytest.py::Test_CheckMyApp::Test_NestedClassA', }, { id: @@ -855,81 +858,81 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { source: 'other/test_pytest.py:16', markers: [], parentid: - './other/test_pytest.py::Test_CheckMyApp::Test_NestedClassA::Test_nested_classB_Of_A' + './other/test_pytest.py::Test_CheckMyApp::Test_NestedClassA::Test_nested_classB_Of_A', }, { id: './other/test_pytest.py::Test_CheckMyApp::Test_NestedClassA::test_nested_class_methodC', name: 'test_nested_class_methodC', source: 'other/test_pytest.py:18', markers: [], - parentid: './other/test_pytest.py::Test_CheckMyApp::Test_NestedClassA' + parentid: './other/test_pytest.py::Test_CheckMyApp::Test_NestedClassA', }, { id: './other/test_pytest.py::Test_CheckMyApp::test_simple_check2', name: 'test_simple_check2', source: 'other/test_pytest.py:21', markers: [], - parentid: './other/test_pytest.py::Test_CheckMyApp' + parentid: './other/test_pytest.py::Test_CheckMyApp', }, { id: './other/test_pytest.py::Test_CheckMyApp::test_complex_check2', name: 'test_complex_check2', source: 'other/test_pytest.py:23', markers: [], - parentid: './other/test_pytest.py::Test_CheckMyApp' + parentid: './other/test_pytest.py::Test_CheckMyApp', }, { id: './other/test_pytest.py::test_username', name: 'test_username', source: 'other/test_pytest.py:35', markers: [], - parentid: './other/test_pytest.py' + parentid: './other/test_pytest.py', }, { id: './other/test_pytest.py::test_parametrized_username[one]', name: 'test_parametrized_username[one]', source: 'other/test_pytest.py:38', markers: [], - parentid: './other/test_pytest.py::test_parametrized_username' + parentid: './other/test_pytest.py::test_parametrized_username', }, { id: './other/test_pytest.py::test_parametrized_username[two]', name: 'test_parametrized_username[two]', source: 'other/test_pytest.py:38', markers: [], - parentid: './other/test_pytest.py::test_parametrized_username' + parentid: './other/test_pytest.py::test_parametrized_username', }, { id: './other/test_pytest.py::test_parametrized_username[three]', name: 'test_parametrized_username[three]', source: 'other/test_pytest.py:38', markers: [], - parentid: './other/test_pytest.py::test_parametrized_username' + parentid: './other/test_pytest.py::test_parametrized_username', }, { id: './other/test_unittest_one.py::Test_test1::test_A', name: 'test_A', source: 'other/test_unittest_one.py:6', markers: [], - parentid: './other/test_unittest_one.py::Test_test1' + parentid: './other/test_unittest_one.py::Test_test1', }, { id: './other/test_unittest_one.py::Test_test1::test_B', name: 'test_B', source: 'other/test_unittest_one.py:9', markers: [], - parentid: './other/test_unittest_one.py::Test_test1' + parentid: './other/test_unittest_one.py::Test_test1', }, { id: './other/test_unittest_one.py::Test_test1::test_c', name: 'test_c', source: 'other/test_unittest_one.py:12', markers: [], - parentid: './other/test_unittest_one.py::Test_test1' - } - ] - } - ]) + parentid: './other/test_unittest_one.py::Test_test1', + }, + ], + }, + ]), ); await updateSetting('testing.pytestArgs', [], rootWorkspaceUri, configTarget); const factory = ioc.serviceContainer.get(ITestManagerFactory); @@ -946,12 +949,12 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { assert.equal( tests.testFiles.some((t) => t.name === 'test_unittest_one.py'), true, - 'Test File not found' + 'Test File not found', ); assert.equal( tests.testFiles.some((t) => t.name === 'test_pytest.py'), true, - 'Test File not found' + 'Test File not found', ); }); @@ -968,21 +971,21 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { kind: 'folder', name: 'tests', relpath: './tests', - parentid: '.' + parentid: '.', }, { id: './tests/test_cwd.py', kind: 'file', name: 'test_cwd.py', relpath: './tests/test_cwd.py', - parentid: './tests' + parentid: './tests', }, { id: './tests/test_cwd.py::Test_Current_Working_Directory', kind: 'suite', name: 'Test_Current_Working_Directory', - parentid: './tests/test_cwd.py' - } + parentid: './tests/test_cwd.py', + }, ], tests: [ { @@ -990,11 +993,11 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { name: 'test_cwd', source: 'tests/test_cwd.py:6', markers: [], - parentid: './tests/test_cwd.py::Test_Current_Working_Directory' - } - ] - } - ]) + parentid: './tests/test_cwd.py::Test_Current_Working_Directory', + }, + ], + }, + ]), ); await updateSetting('testing.pytestArgs', ['-k=test_'], rootWorkspaceUri, configTarget); const factory = ioc.serviceContainer.get(ITestManagerFactory); diff --git a/src/test/testing/pytest/pytest.run.test.ts b/src/test/testing/pytest/pytest.run.test.ts index 39d30bfe464f..6ad4f64884e3 100644 --- a/src/test/testing/pytest/pytest.run.test.ts +++ b/src/test/testing/pytest/pytest.run.test.ts @@ -17,7 +17,7 @@ import { IBufferDecoder, IProcessServiceFactory, IPythonExecutionFactory, - IPythonExecutionService + IPythonExecutionService, } from '../../../client/common/process/types'; import { IConfigurationService } from '../../../client/common/types'; import { IEnvironmentActivationService } from '../../../client/interpreter/activation/types'; @@ -34,7 +34,7 @@ import { ITestManagerFactory, Tests, TestStatus, - TestsToRun + TestsToRun, } from '../../../client/testing/common/types'; import { rootWorkspaceUri, updateSetting } from '../../common'; import { TEST_TIMEOUT } from '../../constants'; @@ -54,7 +54,7 @@ const PYTEST_RESULTS_PATH = path.join( 'pythonFiles', 'testFiles', 'pytestFiles', - 'results' + 'results', ); interface IResultsSummaryCount { @@ -81,7 +81,7 @@ async function getScenarioTestsToRun(scenario: ITestScenarioDetails, tests: Test testFolder: [], testFile: [], testSuite: [], - testFunction: [] + testFunction: [], }; if (scenario.testSuiteIndex) { scenario.testsToRun.testSuite!.push(tests.testSuites[scenario.testSuiteIndex].testSuite); @@ -106,7 +106,7 @@ async function getScenarioTestsToRun(scenario: ITestScenarioDetails, tests: Test async function getResultsFromTestManagerRunTest( testManager: ITestManager, testsToRun: TestsToRun, - failedRun: boolean = false + failedRun: boolean = false, ): Promise { if (failedRun) { return testManager.runTest(CommandSource.ui, undefined, true); @@ -129,7 +129,7 @@ function getExpectedSummaryCount(testDetails: ITestDetails[], failedRun: boolean passes: 0, skips: 0, failures: 0, - errors: 0 + errors: 0, }; testDetails.forEach((td) => { let tStatus = td.status; @@ -189,7 +189,7 @@ function getRelevantTestDetailsForFile(testDetails: ITestDetails[], fileName: st function getIssueCountFromRelevantTestDetails( testDetails: ITestDetails[], skippedTestDetails: ITestDetails[], - failedRun: boolean = false + failedRun: boolean = false, ): number { const relevantIssueDetails = testDetails.filter((td) => { return td.status !== TestStatus.Pass && !(failedRun && td.passOnFailedRun); @@ -206,7 +206,7 @@ function getIssueCountFromRelevantTestDetails( */ function getDiagnosticForTestFunc( diagnostics: readonly vscode.Diagnostic[], - testFunc: FlattenedTestFunction + testFunc: FlattenedTestFunction, ): vscode.Diagnostic { return diagnostics.find((diag) => { return testFunc.testFunction.nameToRun === diag.code; @@ -251,7 +251,7 @@ function getTestFuncFromResultsByTestFileAndName( ioc: UnitTestIocContainer, results: Tests, testFileUri: vscode.Uri, - testDetails: ITestDetails + testDetails: ITestDetails, ): FlattenedTestFunction { const fileSystem = ioc.serviceContainer.get(IFileSystem); return results.testFunctions.find((test) => { @@ -291,23 +291,23 @@ async function getExpectedDiagnosticFromTestDetails(testDetails: ITestDetails): relatedInfo.push( new vscode.DiagnosticRelatedInformation( new vscode.Location(testFileUri, testDetails.classDefRange!), - testDetails.simpleClassName! - ) + testDetails.simpleClassName!, + ), ); expectedDiagRange = testDetails.classDefRange; } relatedInfo.push( new vscode.DiagnosticRelatedInformation( new vscode.Location(expectedSourceTestFileUri, testDetails.testDefRange!), - testDetails.sourceTestName - ) + testDetails.sourceTestName, + ), ); if (testDetails.status !== TestStatus.Skipped) { relatedInfo.push( new vscode.DiagnosticRelatedInformation( new vscode.Location(expectedSourceTestFileUri, testDetails.issueRange!), - testDetails.issueLineText! - ) + testDetails.issueLineText!, + ), ); } else { expectedSeverity = vscode.DiagnosticSeverity.Information; @@ -338,46 +338,46 @@ async function testDiagnostic(diagnostic: vscode.Diagnostic, expectedDiagnostic: assert.equal( diagnostic.range.start.character, expectedDiagnostic.range.start.character, - 'Diagnostic range start character' + 'Diagnostic range start character', ); assert.equal(diagnostic.range.end.line, expectedDiagnostic.range.end.line, 'Diagnostic range end line'); assert.equal( diagnostic.range.end.character, expectedDiagnostic.range.end.character, - 'Diagnostic range end character' + 'Diagnostic range end character', ); assert.equal(diagnostic.source, expectedDiagnostic.source, 'Diagnostic source'); assert.equal( diagnostic.relatedInformation!.length, expectedDiagnostic.relatedInformation!.length, - 'DiagnosticRelatedInformation count' + 'DiagnosticRelatedInformation count', ); } async function testDiagnosticRelatedInformation( relatedInfo: vscode.DiagnosticRelatedInformation, - expectedRelatedInfo: vscode.DiagnosticRelatedInformation + expectedRelatedInfo: vscode.DiagnosticRelatedInformation, ) { assert.equal(relatedInfo.message, expectedRelatedInfo.message, 'DiagnosticRelatedInfo definition'); assert.equal( relatedInfo.location.range.start.line, expectedRelatedInfo.location.range.start.line, - 'DiagnosticRelatedInfo definition range start line' + 'DiagnosticRelatedInfo definition range start line', ); assert.equal( relatedInfo.location.range.start.character, expectedRelatedInfo.location.range.start.character, - 'DiagnosticRelatedInfo definition range start character' + 'DiagnosticRelatedInfo definition range start character', ); assert.equal( relatedInfo.location.range.end.line, expectedRelatedInfo.location.range.end.line, - 'DiagnosticRelatedInfo definition range end line' + 'DiagnosticRelatedInfo definition range end line', ); assert.equal( relatedInfo.location.range.end.character, expectedRelatedInfo.location.range.end.character, - 'DiagnosticRelatedInfo definition range end character' + 'DiagnosticRelatedInfo definition range end character', ); } @@ -395,7 +395,7 @@ suite('Unit Tests - pytest - run with mocked process output', () => { @inject(IConfigurationService) private readonly _configService: IConfigurationService, @inject(ICondaService) condaService: ICondaService, @inject(WindowsStoreInterpreter) windowsStoreInterpreter: WindowsStoreInterpreter, - @inject(IBufferDecoder) decoder: IBufferDecoder + @inject(IBufferDecoder) decoder: IBufferDecoder, ) { super( _serviceContainer, @@ -404,11 +404,11 @@ suite('Unit Tests - pytest - run with mocked process output', () => { _configService, condaService, decoder, - windowsStoreInterpreter + windowsStoreInterpreter, ); } public async createActivatedEnvironment( - options: ExecutionFactoryCreateWithEnvironmentOptions + options: ExecutionFactoryCreateWithEnvironmentOptions, ): Promise { const pythonPath = options.interpreter ? options.interpreter.path @@ -427,7 +427,7 @@ suite('Unit Tests - pytest - run with mocked process output', () => { execObservable: (a, o) => procs.execObservable(a, o), execModuleObservable: (m, a, o) => procs.execModuleObservable(m, a, o), exec: (a, o) => procs.exec(a, o), - execModule: (m, a, o) => procs.execModule(m, a, o) + execModule: (m, a, o) => procs.execModule(m, a, o), }; } } @@ -454,7 +454,7 @@ suite('Unit Tests - pytest - run with mocked process output', () => { ioc.serviceManager.addSingletonInstance( IInterpreterService, - instance(mock(InterpreterService)) + instance(mock(InterpreterService)), ); ioc.serviceManager.rebind(IPythonExecutionFactory, ExecutionFactory); @@ -471,7 +471,7 @@ suite('Unit Tests - pytest - run with mocked process output', () => { let stdout = fs.readFileSync(path.join(PYTEST_RESULTS_PATH, outputFileName), 'utf8'); stdout = stdout.replace( /\/Users\/donjayamanne\/.vscode-insiders\/extensions\/pythonVSCode\/src\/test\/pythonFiles\/testFiles/g, - path.dirname(UNITTEST_TEST_FILES_PATH) + path.dirname(UNITTEST_TEST_FILES_PATH), ); stdout = stdout.replace(/\\/g, '/'); callback({ stdout }); @@ -552,7 +552,7 @@ suite('Unit Tests - pytest - run with mocked process output', () => { const relevantTestDetails = getRelevantTestDetailsForFile(testDetails, fileName); const relevantSkippedIssues = getRelevantSkippedIssuesFromTestDetailsForFile( scenario.testDetails!, - fileName + fileName, ); suiteSetup(async () => { testFileUri = vscode.Uri.file(path.join(UNITTEST_TEST_FILES_PATH, fileName)); @@ -560,7 +560,7 @@ suite('Unit Tests - pytest - run with mocked process output', () => { getIssueCountFromRelevantTestDetails( relevantTestDetails, relevantSkippedIssues, - failedRun + failedRun, ); }); // test('Test DiagnosticCollection', async () => { assert.equal(diagnostics.length, expectedDiagnosticCount, 'Diagnostics count'); }); @@ -575,7 +575,7 @@ suite('Unit Tests - pytest - run with mocked process output', () => { ioc, results, testFileUri, - td + td, )!; expectedStatus = failedRun && td.passOnFailedRun ? TestStatus.Pass : td.status; }); @@ -598,14 +598,14 @@ suite('Unit Tests - pytest - run with mocked process output', () => { test('Class Definition', async () => { await testDiagnosticRelatedInformation( diagnostic.relatedInformation![0], - expectedDiagnostic.relatedInformation![0] + expectedDiagnostic.relatedInformation![0], ); }); } test('Test Function Definition', async () => { await testDiagnosticRelatedInformation( diagnostic.relatedInformation![td.imported ? 1 : 0], - expectedDiagnostic.relatedInformation![td.imported ? 1 : 0] + expectedDiagnostic.relatedInformation![td.imported ? 1 : 0], ); }); if (td.status !== TestStatus.Skipped) { @@ -614,7 +614,7 @@ suite('Unit Tests - pytest - run with mocked process output', () => { diagnostic.relatedInformation![(td.imported ? 1 : 0) + 1], expectedDiagnostic.relatedInformation![ (td.imported ? 1 : 0) + 1 - ] + ], ); }); } diff --git a/src/test/testing/pytest/pytest.test.ts b/src/test/testing/pytest/pytest.test.ts index 489612b889e9..e9b9ac36a4e5 100644 --- a/src/test/testing/pytest/pytest.test.ts +++ b/src/test/testing/pytest/pytest.test.ts @@ -14,7 +14,7 @@ const UNITTEST_SINGLE_TEST_FILE_PATH = path.join( 'test', 'pythonFiles', 'testFiles', - 'single' + 'single', ); // tslint:disable-next-line:max-func-body-length @@ -56,12 +56,12 @@ suite('Unit Tests - pytest - discovery against actual python process', () => { assert.equal( tests.testFiles.some((t) => t.name === 'test_one.py'), true, - 'Test File not found' + 'Test File not found', ); assert.equal( tests.testFiles.some((t) => t.name === 'test_root.py'), true, - 'Test File not found' + 'Test File not found', ); }); }); diff --git a/src/test/testing/pytest/pytest.testMessageService.test.ts b/src/test/testing/pytest/pytest.testMessageService.test.ts index 8396db04bf88..7876e121d130 100644 --- a/src/test/testing/pytest/pytest.testMessageService.test.ts +++ b/src/test/testing/pytest/pytest.testMessageService.test.ts @@ -26,7 +26,7 @@ import { TestMessageService } from '../../../client/testing/pytest/services/test import { ILocationStackFrameDetails, IPythonTestMessage, - PythonTestMessageSeverity + PythonTestMessageSeverity, } from '../../../client/testing/types'; import { rootWorkspaceUri, updateSetting } from '../../common'; import { initialize, initializeTest, IS_MULTI_ROOT_TEST } from '../../initialize'; @@ -43,7 +43,7 @@ const PYTEST_RESULTS_PATH = path.join( 'pythonFiles', 'testFiles', 'pytestFiles', - 'results' + 'results', ); const filterdTestScenarios = testScenarios.filter((ts) => { @@ -54,7 +54,7 @@ async function testMessageProperties( message: IPythonTestMessage, expectedMessage: IPythonTestMessage, imported: boolean = false, - status: TestStatus + status: TestStatus, ) { assert.equal(message.code, expectedMessage.code, 'IPythonTestMessage code'); assert.equal(message.message, expectedMessage.message, 'IPythonTestMessage message'); @@ -67,35 +67,35 @@ async function testMessageProperties( assert.equal( message.locationStack![0].lineText, expectedMessage.locationStack![0].lineText, - 'IPythonTestMessage line text' + 'IPythonTestMessage line text', ); assert.equal( message.locationStack![0].location.uri.fsPath, expectedMessage.locationStack![0].location.uri.fsPath, - 'IPythonTestMessage locationStack fsPath' + 'IPythonTestMessage locationStack fsPath', ); if (status !== TestStatus.Skipped) { assert.equal( message.locationStack![1].lineText, expectedMessage.locationStack![1].lineText, - 'IPythonTestMessage line text' + 'IPythonTestMessage line text', ); assert.equal( message.locationStack![1].location.uri.fsPath, expectedMessage.locationStack![1].location.uri.fsPath, - 'IPythonTestMessage locationStack fsPath' + 'IPythonTestMessage locationStack fsPath', ); } if (imported) { assert.equal( message.locationStack![2].lineText, expectedMessage.locationStack![2].lineText, - 'IPythonTestMessage imported line text' + 'IPythonTestMessage imported line text', ); assert.equal( message.locationStack![2].location.uri.fsPath, expectedMessage.locationStack![2].location.uri.fsPath, - 'IPythonTestMessage imported location fsPath' + 'IPythonTestMessage imported location fsPath', ); } } @@ -109,7 +109,7 @@ async function testMessageProperties( * @param testDetails Test details for a specific test. */ async function getExpectedLocationStackFromTestDetails( - testDetails: ITestDetails + testDetails: ITestDetails, ): Promise { const locationStack: ILocationStackFrameDetails[] = []; const testFilePath = path.join(UNITTEST_TEST_FILES_PATH, testDetails.fileName); @@ -123,17 +123,17 @@ async function getExpectedLocationStackFromTestDetails( // Stack should include the class furthest down the chain from the file that was executed. locationStack.push({ location: new vscode.Location(testFileUri, testDetails.classDefRange!), - lineText: testDetails.simpleClassName! + lineText: testDetails.simpleClassName!, }); } locationStack.push({ location: new vscode.Location(expectedSourceTestFileUri, testDetails.testDefRange!), - lineText: testDetails.sourceTestName + lineText: testDetails.sourceTestName, }); if (testDetails.status !== TestStatus.Skipped) { locationStack.push({ location: new vscode.Location(expectedSourceTestFileUri, testDetails.issueRange!), - lineText: testDetails.issueLineText! + lineText: testDetails.issueLineText!, }); } return locationStack; @@ -160,7 +160,7 @@ suite('Unit Tests - PyTest - TestMessageService', () => { ioc.serviceManager.addSingletonInstance(ICondaService, instance(mock(CondaService))); ioc.serviceManager.addSingletonInstance( IInterpreterService, - instance(mock(InterpreterService)) + instance(mock(InterpreterService)), ); } // Build tests for the test data that is relevant for this platform. @@ -181,7 +181,7 @@ suite('Unit Tests - PyTest - TestMessageService', () => { ignoreCache: true, outChannel: outChannel.object, token: cancelToken.object, - workspaceFolder: vscode.Uri.file(__dirname) + workspaceFolder: vscode.Uri.file(__dirname), }; // Setup the parser. const workspaceService = ioc.serviceContainer.get(IWorkspaceService); @@ -190,7 +190,7 @@ suite('Unit Tests - PyTest - TestMessageService', () => { .readFileSync(path.join(PYTEST_RESULTS_PATH, scenario.discoveryOutput), 'utf8') .replace( /\/Users\/donjayamanne\/.vscode-insiders\/extensions\/pythonVSCode\/src\/test\/pythonFiles\/testFiles/g, - path.dirname(UNITTEST_TEST_FILES_PATH) + path.dirname(UNITTEST_TEST_FILES_PATH), ) .replace(/\\/g, '/'); const discoveredTest: DiscoveredTests[] = JSON.parse(discoveryOutput); @@ -199,7 +199,7 @@ suite('Unit Tests - PyTest - TestMessageService', () => { const xUnitParser = new XUnitParser(filesystem); await xUnitParser.updateResultsFromXmlLogFile( parsedTests, - path.join(PYTEST_RESULTS_PATH, scenario.runOutput) + path.join(PYTEST_RESULTS_PATH, scenario.runOutput), ); const testResultsService = new TestResultsService(testVisitor.object); testResultsService.updateResults(parsedTests); @@ -232,7 +232,7 @@ suite('Unit Tests - PyTest - TestMessageService', () => { testTime: 0, status: td.status, locationStack: expectedLocationStack, - testFilePath: path.join(UNITTEST_TEST_FILES_PATH, td.fileName) + testFilePath: path.join(UNITTEST_TEST_FILES_PATH, td.fileName), }; testMessage = testMessages.find((tm) => tm.code === td.nameToRun)!; }); diff --git a/src/test/testing/pytest/pytest_run_tests_data.ts b/src/test/testing/pytest/pytest_run_tests_data.ts index 33114b43569a..6c43467f6db0 100644 --- a/src/test/testing/pytest/pytest_run_tests_data.ts +++ b/src/test/testing/pytest/pytest_run_tests_data.ts @@ -43,7 +43,7 @@ export const allTestDetails: ITestDetails[] = [ issueLineText: 'self.fail("Not implemented")', message: 'AssertionError: Not implemented', imported: false, - status: TestStatus.Fail + status: TestStatus.Fail, }, { className: 'test_root.Test_Root_test1', @@ -52,7 +52,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_Root_B', sourceTestName: 'test_Root_B', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'test_root.Test_Root_test1', @@ -63,7 +63,7 @@ export const allTestDetails: ITestDetails[] = [ testDefRange: new vscode.Range(13, 8, 13, 19), message: 'demonstrating skipping', imported: false, - status: TestStatus.Skipped + status: TestStatus.Skipped, }, { className: 'tests.test_another_pytest', @@ -72,7 +72,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_username', sourceTestName: 'test_username', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'tests.test_another_pytest', @@ -81,7 +81,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_parametrized_username[one]', sourceTestName: 'test_parametrized_username', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'tests.test_another_pytest', @@ -90,7 +90,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_parametrized_username[two]', sourceTestName: 'test_parametrized_username', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'tests.test_another_pytest', @@ -103,7 +103,7 @@ export const allTestDetails: ITestDetails[] = [ issueLineText: "assert non_parametrized_username in ['one', 'two', 'threes']", message: "AssertionError: assert 'three' in ['one', 'two', 'threes']", imported: false, - status: TestStatus.Fail + status: TestStatus.Fail, }, { className: @@ -121,7 +121,7 @@ export const allTestDetails: ITestDetails[] = [ issueLineText: 'assert False', message: 'AssertionError', imported: true, - status: TestStatus.Fail + status: TestStatus.Fail, }, { className: 'tests.test_foreign_nested_tests.TestNestedForeignTests.TestInheritingHere.()', @@ -138,7 +138,7 @@ export const allTestDetails: ITestDetails[] = [ issueLineText: 'assert False', message: 'AssertionError', imported: true, - status: TestStatus.Fail + status: TestStatus.Fail, }, { className: 'tests.test_foreign_nested_tests.TestNestedForeignTests.TestInheritingHere.()', @@ -148,7 +148,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_nested_normal', sourceTestName: 'test_nested_normal', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'tests.test_foreign_nested_tests.TestNestedForeignTests', @@ -157,7 +157,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_normal', sourceTestName: 'test_normal', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'tests.test_pytest.Test_CheckMyApp', @@ -168,7 +168,7 @@ export const allTestDetails: ITestDetails[] = [ testDefRange: new vscode.Range(7, 8, 7, 25), message: 'demonstrating skipping', imported: false, - status: TestStatus.Skipped + status: TestStatus.Skipped, }, { className: 'tests.test_pytest.Test_CheckMyApp', @@ -177,7 +177,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_complex_check', sourceTestName: 'test_complex_check', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'tests.test_pytest.Test_CheckMyApp.Test_NestedClassA.()', @@ -186,7 +186,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_nested_class_methodB', sourceTestName: 'test_nested_class_methodB', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'tests.test_pytest.Test_CheckMyApp.Test_NestedClassA.().Test_nested_classB_Of_A.()', @@ -195,7 +195,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_d', sourceTestName: 'test_d', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'tests.test_pytest.Test_CheckMyApp.Test_NestedClassA.()', @@ -204,7 +204,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_nested_class_methodC', sourceTestName: 'test_nested_class_methodC', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'tests.test_pytest.Test_CheckMyApp', @@ -213,7 +213,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_simple_check2', sourceTestName: 'test_simple_check2', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'tests.test_pytest.Test_CheckMyApp', @@ -222,7 +222,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_complex_check2', sourceTestName: 'test_complex_check2', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'tests.test_pytest', @@ -231,7 +231,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_username', sourceTestName: 'test_username', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'tests.test_pytest', @@ -240,7 +240,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_parametrized_username[one]', sourceTestName: 'test_parametrized_username', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'tests.test_pytest', @@ -249,7 +249,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_parametrized_username[two]', sourceTestName: 'test_parametrized_username', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'tests.test_pytest', @@ -262,7 +262,7 @@ export const allTestDetails: ITestDetails[] = [ issueLineText: "assert non_parametrized_username in ['one', 'two', 'threes']", message: "AssertionError: assert 'three' in ['one', 'two', 'threes']", imported: false, - status: TestStatus.Fail + status: TestStatus.Fail, }, { className: 'tests.test_unittest_one.Test_test1', @@ -275,7 +275,7 @@ export const allTestDetails: ITestDetails[] = [ issueLineText: 'self.fail("Not implemented")', message: 'AssertionError: Not implemented', imported: false, - status: TestStatus.Fail + status: TestStatus.Fail, }, { className: 'tests.test_unittest_one.Test_test1', @@ -284,7 +284,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_B', sourceTestName: 'test_B', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'tests.test_unittest_one.Test_test1', @@ -295,7 +295,7 @@ export const allTestDetails: ITestDetails[] = [ testDefRange: new vscode.Range(13, 8, 13, 14), message: 'demonstrating skipping', imported: false, - status: TestStatus.Skipped + status: TestStatus.Skipped, }, { className: 'tests.test_unittest_two.Test_test2', @@ -308,7 +308,7 @@ export const allTestDetails: ITestDetails[] = [ issueLineText: 'self.fail("Not implemented")', message: 'AssertionError: Not implemented', imported: false, - status: TestStatus.Fail + status: TestStatus.Fail, }, { className: 'tests.test_unittest_two.Test_test2', @@ -317,7 +317,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_B2', sourceTestName: 'test_B2', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'tests.test_unittest_two.Test_test2', @@ -330,7 +330,7 @@ export const allTestDetails: ITestDetails[] = [ issueLineText: "self.assertEqual(1,2,'Not equal')", message: 'AssertionError: 1 != 2 : Not equal', imported: false, - status: TestStatus.Fail + status: TestStatus.Fail, }, { className: 'tests.test_unittest_two.Test_test2', @@ -343,7 +343,7 @@ export const allTestDetails: ITestDetails[] = [ issueLineText: 'raise ArithmeticError()', message: 'ArithmeticError', imported: false, - status: TestStatus.Fail + status: TestStatus.Fail, }, { className: 'tests.test_unittest_two.Test_test2a', @@ -357,7 +357,7 @@ export const allTestDetails: ITestDetails[] = [ message: 'AssertionError: Not implemented', imported: false, passOnFailedRun: true, - status: TestStatus.Fail + status: TestStatus.Fail, }, { className: 'tests.test_unittest_two.Test_test2a', @@ -366,7 +366,7 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_222B2', sourceTestName: 'test_222B2', imported: false, - status: TestStatus.Pass + status: TestStatus.Pass, }, { className: 'tests.unittest_three_test.Test_test3', @@ -379,7 +379,7 @@ export const allTestDetails: ITestDetails[] = [ issueLineText: 'self.fail("Not implemented")', message: 'AssertionError: Not implemented', imported: false, - status: TestStatus.Fail + status: TestStatus.Fail, }, { className: 'tests.unittest_three_test.Test_test3', @@ -388,8 +388,8 @@ export const allTestDetails: ITestDetails[] = [ testName: 'test_B', sourceTestName: 'test_B', imported: false, - status: TestStatus.Pass - } + status: TestStatus.Pass, + }, ]; export interface ITestScenarioDetails { @@ -412,7 +412,7 @@ export const testScenarios: ITestScenarioDetails[] = [ testsToRun: undefined as any, testDetails: allTestDetails.filter(() => { return true; - }) + }), }, { scenarioName: 'Run Specific Test File', @@ -427,16 +427,16 @@ export const testScenarios: ITestScenarioDetails[] = [ xmlName: 'tests/test_another_pytest.py', functions: [], suites: [], - time: 0 - } + time: 0, + }, ], testFolder: [], testFunction: [], - testSuite: [] + testSuite: [], }, testDetails: allTestDetails.filter((td) => { return td.fileName === path.join('tests', 'test_another_pytest.py'); - }) + }), }, { scenarioName: 'Run Specific Test Suite', @@ -446,7 +446,7 @@ export const testScenarios: ITestScenarioDetails[] = [ testSuiteIndex: 0, testDetails: allTestDetails.filter((td) => { return td.className === 'test_root.Test_Root_test1'; - }) + }), }, { scenarioName: 'Run Specific Test Function', @@ -456,7 +456,7 @@ export const testScenarios: ITestScenarioDetails[] = [ testFunctionIndex: 0, testDetails: allTestDetails.filter((td) => { return td.testName === 'test_Root_A'; - }) + }), }, { scenarioName: 'Run Failed Tests', @@ -467,6 +467,6 @@ export const testScenarios: ITestScenarioDetails[] = [ return true; }), shouldRunFailed: true, - failedRunOutput: 'two.again.xml' - } + failedRunOutput: 'two.again.xml', + }, ]; diff --git a/src/test/testing/pytest/pytest_unittest_parser_data.ts b/src/test/testing/pytest/pytest_unittest_parser_data.ts index 30bdf9d1cec4..f564320440c0 100644 --- a/src/test/testing/pytest/pytest_unittest_parser_data.ts +++ b/src/test/testing/pytest/pytest_unittest_parser_data.ts @@ -10,7 +10,7 @@ export enum PytestDataPlatformType { NonWindows = 'non-windows', - Windows = 'windows' + Windows = 'windows', } export type PytestDiscoveryScenario = { @@ -33,7 +33,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ rootdir: '/home/user/test/pytest_scenario', test_functions: [ 'src/test_things.py::test_things_major', - 'test/this/is/deep/testing/test_very_deeply.py::test_math_works' + 'test/this/is/deep/testing/test_very_deeply.py::test_math_works', ], functionCount: 9, stdout: [ @@ -58,8 +58,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ "", " ", '', - '========================= no tests ran in 0.02 seconds =========================' - ] + '========================= no tests ran in 0.02 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -69,7 +69,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ rootdir: '/home/user/test/pytest_scenario', test_functions: [ 'src/test_things.py::test_things_major', - 'test/this/is/deep/testing/test_very_deeply.py::test_math_works' + 'test/this/is/deep/testing/test_very_deeply.py::test_math_works', ], functionCount: 9, stdout: [ @@ -94,8 +94,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ "", " ", '', - '========================= no tests ran in 0.18 seconds =========================' - ] + '========================= no tests ran in 0.18 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -105,7 +105,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ rootdir: '/home/user/test/pytest_scenario', test_functions: [ 'src/test_things.py::test_things_major', - 'test/this/is/deep/testing/test_very_deeply.py::test_math_works' + 'test/this/is/deep/testing/test_very_deeply.py::test_math_works', ], functionCount: 9, stdout: [ @@ -130,8 +130,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ '', ' ', '', - '========================= no tests ran in 0.18 seconds =========================' - ] + '========================= no tests ran in 0.18 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -155,8 +155,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ "", " ", '', - '========================= no tests ran in 0.05 seconds =========================' - ] + '========================= no tests ran in 0.05 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -180,8 +180,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ "", " ", '', - '========================= no tests ran in 0.03 seconds =========================' - ] + '========================= no tests ran in 0.03 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -205,8 +205,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ '', ' ', '', - '========================= no tests ran in 0.03 seconds =========================' - ] + '========================= no tests ran in 0.03 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -230,8 +230,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ "", " ", '', - '========================= no tests ran in 0.12 seconds =========================' - ] + '========================= no tests ran in 0.12 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -255,8 +255,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ "", " ", '', - '========================= no tests ran in 0.12 seconds =========================' - ] + '========================= no tests ran in 0.12 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -280,8 +280,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ '', ' ', '', - '========================= no tests ran in 0.12 seconds =========================' - ] + '========================= no tests ran in 0.12 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -300,8 +300,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ "", " ", '', - '========================= no tests ran in 0.06 seconds =========================' - ] + '========================= no tests ran in 0.06 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -320,8 +320,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ "", " ", '', - '========================= no tests ran in 0.05 seconds =========================' - ] + '========================= no tests ran in 0.05 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -340,8 +340,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ '', ' ', '', - '========================= no tests ran in 0.05 seconds =========================' - ] + '========================= no tests ran in 0.05 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -360,8 +360,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ "", " ", '', - '========================= no tests ran in 0.05 seconds =========================' - ] + '========================= no tests ran in 0.05 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -380,8 +380,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ "", " ", '', - '========================= no tests ran in 0.05 seconds =========================' - ] + '========================= no tests ran in 0.05 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -400,8 +400,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ '', ' ', '', - '========================= no tests ran in 0.05 seconds =========================' - ] + '========================= no tests ran in 0.05 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -412,7 +412,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ test_functions: [ 'test_basic_root.py::test_basic_major', 'test/test_other_basic.py::test_basic_major_minor_internal', - 'test/subdir/under/another/subdir/test_other_basic_sub.py::test_basic_major_minor' + 'test/subdir/under/another/subdir/test_other_basic_sub.py::test_basic_major_minor', ], functionCount: 16, stdout: [ @@ -445,8 +445,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '========================= no tests ran in 0.07 seconds =========================' - ] + '========================= no tests ran in 0.07 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -458,7 +458,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'test_basic_root.py::test_basic_major', 'test/test_other_basic.py::test_basic_major_minor_internal', 'test/subdir/under/another/subdir/test_other_basic_sub.py::test_basic_major_minor', - 'test/uneven/folders/test_other_basic_uneven.py::test_basic_major_minor_internal_uneven' + 'test/uneven/folders/test_other_basic_uneven.py::test_basic_major_minor_internal_uneven', ], functionCount: 16, stdout: [ @@ -499,8 +499,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '========================= no tests ran in 0.13 seconds =========================' - ] + '========================= no tests ran in 0.13 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -512,7 +512,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'test_basic_root.py::test_basic_major', 'test/test_other_basic.py::test_basic_major_minor_internal', 'test/subdir/under/another/subdir/test_other_basic_sub.py::test_basic_major_minor', - 'test/uneven/folders/test_other_basic_uneven.py::test_basic_major_minor_internal_uneven' + 'test/uneven/folders/test_other_basic_uneven.py::test_basic_major_minor_internal_uneven', ], functionCount: 16, stdout: [ @@ -553,8 +553,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ ' ', ' ', '', - '========================= no tests ran in 0.13 seconds =========================' - ] + '========================= no tests ran in 0.13 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -564,7 +564,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ rootdir: '/home/user/test/pytest_scenario', test_functions: [ 'test/test_other_basic.py::test_basic_major_minor_internal', - 'test/subdir/test_other_basic_sub.py::test_basic_major_minor' + 'test/subdir/test_other_basic_sub.py::test_basic_major_minor', ], functionCount: 12, stdout: [ @@ -591,8 +591,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '========================= no tests ran in 0.18 seconds =========================' - ] + '========================= no tests ran in 0.18 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -602,7 +602,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ rootdir: '/home/user/test/pytest_scenario', test_functions: [ 'test/test_other_basic.py::test_basic_major_minor_internal', - 'test/subdir/test_other_basic_sub.py::test_basic_major_minor' + 'test/subdir/test_other_basic_sub.py::test_basic_major_minor', ], functionCount: 12, stdout: [ @@ -632,8 +632,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '========================= no tests ran in 0.07 seconds =========================' - ] + '========================= no tests ran in 0.07 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -643,7 +643,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ rootdir: '/home/user/test/pytest_scenario', test_functions: [ 'test/test_other_basic.py::test_basic_major_minor_internal', - 'test/subdir/test_other_basic_sub.py::test_basic_major_minor' + 'test/subdir/test_other_basic_sub.py::test_basic_major_minor', ], functionCount: 12, stdout: [ @@ -673,8 +673,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ ' ', ' ', '', - '========================= no tests ran in 0.07 seconds =========================' - ] + '========================= no tests ran in 0.07 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -683,7 +683,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ rootdir: '/home/user/test/pytest_scenario', test_functions: [ 'test_other_basic_root.py::test_basic_major_minor_internal', - 'test/test_other_basic_sub.py::test_basic_major_minor' + 'test/test_other_basic_sub.py::test_basic_major_minor', ], functionCount: 12, stdout: [ @@ -710,8 +710,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '========================= no tests ran in 0.18 seconds =========================' - ] + '========================= no tests ran in 0.18 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -721,7 +721,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ test_functions: [ 'test_other_basic_root.py::test_basic_major_minor_internal', 'test/test_basic_sub.py::test_basic_major', - 'test/test_basic_sub.py::test_basic_minor' + 'test/test_basic_sub.py::test_basic_minor', ], functionCount: 12, stdout: [ @@ -750,8 +750,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '========================= no tests ran in 0.22 seconds =========================' - ] + '========================= no tests ran in 0.22 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -761,7 +761,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ test_functions: [ 'test_other_basic_root.py::test_basic_major_minor_internal', 'test/test_basic_sub.py::test_basic_major', - 'test/test_basic_sub.py::test_basic_minor' + 'test/test_basic_sub.py::test_basic_minor', ], functionCount: 12, stdout: [ @@ -790,8 +790,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ ' ', ' ', '', - '========================= no tests ran in 0.22 seconds =========================' - ] + '========================= no tests ran in 0.22 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -802,7 +802,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'test/test_basic.py::test_basic_minor', 'test/test_other_basic.py::test_basic_major_minor', 'test/test_other_basic_root.py::test_basic_major_minor', - 'test/test_other_basic_sub.py::test_basic_major_minor_internal' + 'test/test_other_basic_sub.py::test_basic_major_minor_internal', ], functionCount: 12, stdout: [ @@ -829,8 +829,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '========================= no tests ran in 0.15 seconds =========================' - ] + '========================= no tests ran in 0.15 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -841,7 +841,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'test/test_basic.py::test_basic_minor', 'test/test_other_basic.py::test_basic_major_minor', 'test/test_other_basic_root.py::test_basic_major_minor', - 'test/test_other_basic_sub.py::test_basic_major_minor_internal' + 'test/test_other_basic_sub.py::test_basic_major_minor_internal', ], functionCount: 12, stdout: [ @@ -870,8 +870,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '========================= no tests ran in 0.15 seconds =========================' - ] + '========================= no tests ran in 0.15 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -882,7 +882,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'test/test_basic.py::test_basic_minor', 'test/test_other_basic.py::test_basic_major_minor', 'test/test_other_basic_root.py::test_basic_major_minor', - 'test/test_other_basic_sub.py::test_basic_major_minor_internal' + 'test/test_other_basic_sub.py::test_basic_major_minor_internal', ], functionCount: 12, stdout: [ @@ -911,8 +911,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ ' ', ' ', '', - '========================= no tests ran in 0.15 seconds =========================' - ] + '========================= no tests ran in 0.15 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -923,7 +923,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'test_basic.py::test_basic_major', 'test_basic_root.py::test_basic_major', 'test_other_basic_root.py::test_basic_major_minor', - 'test_other_basic_sub.py::test_basic_major_minor_internal' + 'test_other_basic_sub.py::test_basic_major_minor_internal', ], functionCount: 12, stdout: [ @@ -950,8 +950,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '========================= no tests ran in 0.23 seconds =========================' - ] + '========================= no tests ran in 0.23 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -962,7 +962,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'test_basic.py::test_basic_major', 'test_basic_root.py::test_basic_major', 'test_other_basic_root.py::test_basic_major_minor', - 'test_other_basic_sub.py::test_basic_major_minor_internal' + 'test_other_basic_sub.py::test_basic_major_minor_internal', ], functionCount: 12, stdout: [ @@ -990,8 +990,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '========================= no tests ran in 0.16 seconds =========================' - ] + '========================= no tests ran in 0.16 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -1002,7 +1002,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'test_basic.py::test_basic_major', 'test_basic_root.py::test_basic_major', 'test_other_basic_root.py::test_basic_major_minor', - 'test_other_basic_sub.py::test_basic_major_minor_internal' + 'test_other_basic_sub.py::test_basic_major_minor_internal', ], functionCount: 12, stdout: [ @@ -1030,8 +1030,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ ' ', ' ', '', - '========================= no tests ran in 0.16 seconds =========================' - ] + '========================= no tests ran in 0.16 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -1046,7 +1046,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/further_tests/test_multiply.py::test_times_10', 'tests/further_tests/test_multiply.py::test_times_2', 'tests/further_tests/deeper/test_more_multiply.py::test_times_100', - 'tests/further_tests/deeper/test_more_multiply.py::test_times_negative_1' + 'tests/further_tests/deeper/test_more_multiply.py::test_times_negative_1', ], functionCount: 7, stdout: [ @@ -1066,8 +1066,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.30 seconds =========================' - ] + '======================== no tests ran in 0.30 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -1082,7 +1082,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/further_tests/test_multiply.py::test_times_10', 'tests/further_tests/test_multiply.py::test_times_2', 'tests/further_tests/deeper/test_more_multiply.py::test_times_100', - 'tests/further_tests/deeper/test_more_multiply.py::test_times_negative_1' + 'tests/further_tests/deeper/test_more_multiply.py::test_times_negative_1', ], functionCount: 7, stdout: [ @@ -1107,8 +1107,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.42 seconds =========================' - ] + '======================== no tests ran in 0.42 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -1123,7 +1123,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/further_tests/test_multiply.py::test_times_10', 'tests/further_tests/test_multiply.py::test_times_2', 'tests/further_tests/deeper/test_more_multiply.py::test_times_100', - 'tests/further_tests/deeper/test_more_multiply.py::test_times_negative_1' + 'tests/further_tests/deeper/test_more_multiply.py::test_times_negative_1', ], functionCount: 7, stdout: [ @@ -1148,8 +1148,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ ' ', ' ', '', - '======================== no tests ran in 0.42 seconds =========================' - ] + '======================== no tests ran in 0.42 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -1164,7 +1164,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/further_tests/test_multiply.py::test_times_10', 'tests/further_tests/test_multiply.py::test_times_2', 'tests/further_tests/deeper/test_more_multiply.py::test_times_100', - 'tests/further_tests/deeper/test_more_multiply.py::test_times_negative_1' + 'tests/further_tests/deeper/test_more_multiply.py::test_times_negative_1', ], functionCount: 7, stdout: [ @@ -1184,8 +1184,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.11 seconds =========================' - ] + '======================== no tests ran in 0.11 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -1200,7 +1200,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/further_tests/test_multiply.py::test_times_10', 'tests/further_tests/test_multiply.py::test_times_2', 'tests/further_tests/deeper/test_more_multiply.py::test_times_100', - 'tests/further_tests/deeper/test_more_multiply.py::test_times_negative_1' + 'tests/further_tests/deeper/test_more_multiply.py::test_times_negative_1', ], functionCount: 7, stdout: [ @@ -1220,8 +1220,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.17 seconds =========================' - ] + '======================== no tests ran in 0.17 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -1236,7 +1236,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/further_tests/test_multiply.py::test_times_10', 'tests/further_tests/test_multiply.py::test_times_2', 'tests/further_tests/deeper/test_more_multiply.py::test_times_100', - 'tests/further_tests/deeper/test_more_multiply.py::test_times_negative_1' + 'tests/further_tests/deeper/test_more_multiply.py::test_times_negative_1', ], functionCount: 7, stdout: [ @@ -1256,8 +1256,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ ' ', ' ', '', - '======================== no tests ran in 0.17 seconds =========================' - ] + '======================== no tests ran in 0.17 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -1272,7 +1272,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/further_tests/test_more_multiply.py::test_times_100', 'tests/further_tests/test_more_multiply.py::test_times_negative_1', 'tests/further_tests/test_multiply.py::test_times_10', - 'tests/further_tests/test_multiply.py::test_times_2' + 'tests/further_tests/test_multiply.py::test_times_2', ], functionCount: 7, stdout: [ @@ -1292,8 +1292,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.26 seconds =========================' - ] + '======================== no tests ran in 0.26 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -1308,7 +1308,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/further_tests/test_more_multiply.py::test_times_100', 'tests/further_tests/test_more_multiply.py::test_times_negative_1', 'tests/further_tests/test_multiply.py::test_times_10', - 'tests/further_tests/test_multiply.py::test_times_2' + 'tests/further_tests/test_multiply.py::test_times_2', ], functionCount: 7, stdout: [ @@ -1331,8 +1331,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.38 seconds =========================' - ] + '======================== no tests ran in 0.38 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -1347,7 +1347,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/further_tests/test_more_multiply.py::test_times_100', 'tests/further_tests/test_more_multiply.py::test_times_negative_1', 'tests/further_tests/test_multiply.py::test_times_10', - 'tests/further_tests/test_multiply.py::test_times_2' + 'tests/further_tests/test_multiply.py::test_times_2', ], functionCount: 7, stdout: [ @@ -1370,8 +1370,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ ' ', ' ', '', - '======================== no tests ran in 0.38 seconds =========================' - ] + '======================== no tests ran in 0.38 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -1385,7 +1385,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/further_tests/test_more_multiply.py::test_times_100', 'tests/further_tests/test_more_multiply.py::test_times_negative_1', 'tests/further_tests/test_multiply.py::test_times_10', - 'tests/further_tests/test_multiply.py::test_times_2' + 'tests/further_tests/test_multiply.py::test_times_2', ], functionCount: 7, stdout: [ @@ -1405,8 +1405,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.17 seconds =========================' - ] + '======================== no tests ran in 0.17 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -1420,7 +1420,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/further_tests/test_more_multiply.py::test_times_100', 'tests/further_tests/test_more_multiply.py::test_times_negative_1', 'tests/further_tests/test_multiply.py::test_times_10', - 'tests/further_tests/test_multiply.py::test_times_2' + 'tests/further_tests/test_multiply.py::test_times_2', ], functionCount: 7, stdout: [ @@ -1440,8 +1440,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.20 seconds =========================' - ] + '======================== no tests ran in 0.20 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -1455,7 +1455,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/further_tests/test_more_multiply.py::test_times_100', 'tests/further_tests/test_more_multiply.py::test_times_negative_1', 'tests/further_tests/test_multiply.py::test_times_10', - 'tests/further_tests/test_multiply.py::test_times_2' + 'tests/further_tests/test_multiply.py::test_times_2', ], functionCount: 7, stdout: [ @@ -1475,8 +1475,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ ' ', ' ', '', - '======================== no tests ran in 0.20 seconds =========================' - ] + '======================== no tests ran in 0.20 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -1489,7 +1489,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/test_multiply.py::test_times_10', 'tests/test_multiply.py::test_times_2', 'tests/test_more_multiply.py::test_times_100', - 'tests/test_more_multiply.py::test_times_negative_1' + 'tests/test_more_multiply.py::test_times_negative_1', ], functionCount: 7, stdout: [ @@ -1509,8 +1509,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.26 seconds =========================' - ] + '======================== no tests ran in 0.26 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -1523,7 +1523,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/test_multiply.py::test_times_10', 'tests/test_multiply.py::test_times_2', 'tests/test_more_multiply.py::test_times_100', - 'tests/test_more_multiply.py::test_times_negative_1' + 'tests/test_more_multiply.py::test_times_negative_1', ], functionCount: 7, stdout: [ @@ -1545,8 +1545,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.66 seconds =========================' - ] + '======================== no tests ran in 0.66 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -1559,7 +1559,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/test_multiply.py::test_times_10', 'tests/test_multiply.py::test_times_2', 'tests/test_more_multiply.py::test_times_100', - 'tests/test_more_multiply.py::test_times_negative_1' + 'tests/test_more_multiply.py::test_times_negative_1', ], functionCount: 7, stdout: [ @@ -1581,8 +1581,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ ' ', ' ', '', - '======================== no tests ran in 0.66 seconds =========================' - ] + '======================== no tests ran in 0.66 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -1595,7 +1595,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/test_multiply.py::test_times_10', 'tests/test_multiply.py::test_times_2', 'tests/test_more_multiply.py::test_times_100', - 'tests/test_more_multiply.py::test_times_negative_1' + 'tests/test_more_multiply.py::test_times_negative_1', ], functionCount: 7, stdout: [ @@ -1615,8 +1615,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.11 seconds =========================' - ] + '======================== no tests ran in 0.11 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -1629,7 +1629,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/test_multiply.py::test_times_10', 'tests/test_multiply.py::test_times_2', 'tests/test_more_multiply.py::test_times_100', - 'tests/test_more_multiply.py::test_times_negative_1' + 'tests/test_more_multiply.py::test_times_negative_1', ], functionCount: 7, stdout: [ @@ -1649,8 +1649,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.41 seconds =========================' - ] + '======================== no tests ran in 0.41 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -1663,7 +1663,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/test_multiply.py::test_times_10', 'tests/test_multiply.py::test_times_2', 'tests/test_more_multiply.py::test_times_100', - 'tests/test_more_multiply.py::test_times_negative_1' + 'tests/test_more_multiply.py::test_times_negative_1', ], functionCount: 7, stdout: [ @@ -1683,8 +1683,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ ' ', ' ', '', - '======================== no tests ran in 0.41 seconds =========================' - ] + '======================== no tests ran in 0.41 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -1698,7 +1698,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/test_more_multiply.py::test_times_100', 'tests/test_more_multiply.py::test_times_negative_1', 'tests/test_multiply.py::test_times_10', - 'tests/test_multiply.py::test_times_2' + 'tests/test_multiply.py::test_times_2', ], functionCount: 7, stdout: [ @@ -1718,8 +1718,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.20 seconds =========================' - ] + '======================== no tests ran in 0.20 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -1733,7 +1733,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/test_more_multiply.py::test_times_100', 'tests/test_more_multiply.py::test_times_negative_1', 'tests/test_multiply.py::test_times_10', - 'tests/test_multiply.py::test_times_2' + 'tests/test_multiply.py::test_times_2', ], functionCount: 7, stdout: [ @@ -1755,8 +1755,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.26 seconds =========================' - ] + '======================== no tests ran in 0.26 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -1770,7 +1770,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/test_more_multiply.py::test_times_100', 'tests/test_more_multiply.py::test_times_negative_1', 'tests/test_multiply.py::test_times_10', - 'tests/test_multiply.py::test_times_2' + 'tests/test_multiply.py::test_times_2', ], functionCount: 7, stdout: [ @@ -1792,8 +1792,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ ' ', ' ', '', - '======================== no tests ran in 0.26 seconds =========================' - ] + '======================== no tests ran in 0.26 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -1807,7 +1807,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/test_more_multiply.py::test_times_100', 'tests/test_more_multiply.py::test_times_negative_1', 'tests/test_multiply.py::test_times_10', - 'tests/test_multiply.py::test_times_2' + 'tests/test_multiply.py::test_times_2', ], functionCount: 7, stdout: [ @@ -1827,8 +1827,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.26 seconds =========================' - ] + '======================== no tests ran in 0.26 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -1842,7 +1842,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/test_more_multiply.py::test_times_100', 'tests/test_more_multiply.py::test_times_negative_1', 'tests/test_multiply.py::test_times_10', - 'tests/test_multiply.py::test_times_2' + 'tests/test_multiply.py::test_times_2', ], functionCount: 7, stdout: [ @@ -1862,8 +1862,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.26 seconds =========================' - ] + '======================== no tests ran in 0.26 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -1877,7 +1877,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'tests/test_more_multiply.py::test_times_100', 'tests/test_more_multiply.py::test_times_negative_1', 'tests/test_multiply.py::test_times_10', - 'tests/test_multiply.py::test_times_2' + 'tests/test_multiply.py::test_times_2', ], functionCount: 7, stdout: [ @@ -1897,8 +1897,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ ' ', ' ', '', - '======================== no tests ran in 0.26 seconds =========================' - ] + '======================== no tests ran in 0.26 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -1909,7 +1909,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'test_base_stuff.py::test_do_test', 'test_base_stuff.py::test_do_other_test', 'test_multiply.py::test_times_10', - 'test_multiply.py::test_times_2' + 'test_multiply.py::test_times_2', ], functionCount: 4, stdout: [ @@ -1924,8 +1924,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.17 seconds =========================' - ] + '======================== no tests ran in 0.17 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -1936,7 +1936,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'test_base_stuff.py::test_do_test', 'test_base_stuff.py::test_do_other_test', 'test_multiply.py::test_times_10', - 'test_multiply.py::test_times_2' + 'test_multiply.py::test_times_2', ], functionCount: 4, stdout: [ @@ -1952,8 +1952,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.37 seconds =========================' - ] + '======================== no tests ran in 0.37 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -1964,7 +1964,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'test_base_stuff.py::test_do_test', 'test_base_stuff.py::test_do_other_test', 'test_multiply.py::test_times_10', - 'test_multiply.py::test_times_2' + 'test_multiply.py::test_times_2', ], functionCount: 4, stdout: [ @@ -1980,8 +1980,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ ' ', ' ', '', - '======================== no tests ran in 0.37 seconds =========================' - ] + '======================== no tests ran in 0.37 seconds =========================', + ], }, { pytest_version_spec: '< 3.7', @@ -1992,7 +1992,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'test_base_stuff.py::test_do_test', 'test_base_stuff.py::test_do_other_test', 'test_multiply.py::test_times_10', - 'test_multiply.py::test_times_2' + 'test_multiply.py::test_times_2', ], functionCount: 4, stdout: [ @@ -2007,8 +2007,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.18 seconds =========================' - ] + '======================== no tests ran in 0.18 seconds =========================', + ], }, { pytest_version_spec: '>= 3.7 < 4.1', @@ -2019,7 +2019,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'test_base_stuff.py::test_do_test', 'test_base_stuff.py::test_do_other_test', 'test_multiply.py::test_times_10', - 'test_multiply.py::test_times_2' + 'test_multiply.py::test_times_2', ], functionCount: 4, stdout: [ @@ -2034,8 +2034,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ " ", " ", '', - '======================== no tests ran in 0.36 seconds =========================' - ] + '======================== no tests ran in 0.36 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -2046,7 +2046,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ 'test_base_stuff.py::test_do_test', 'test_base_stuff.py::test_do_other_test', 'test_multiply.py::test_times_10', - 'test_multiply.py::test_times_2' + 'test_multiply.py::test_times_2', ], functionCount: 4, stdout: [ @@ -2061,8 +2061,8 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ ' ', ' ', '', - '======================== no tests ran in 0.36 seconds =========================' - ] + '======================== no tests ran in 0.36 seconds =========================', + ], }, { pytest_version_spec: '>= 4.1', @@ -2081,7 +2081,7 @@ export const pytestScenarioData: PytestDiscoveryScenario[] = [ ' ', ' ', '', - '========================= no tests ran in 0.02 seconds =========================' - ] - } + '========================= no tests ran in 0.02 seconds =========================', + ], + }, ]; diff --git a/src/test/testing/pytest/services/discoveryService.unit.test.ts b/src/test/testing/pytest/services/discoveryService.unit.test.ts index ea46e70c4bb4..6a868311c1e2 100644 --- a/src/test/testing/pytest/services/discoveryService.unit.test.ts +++ b/src/test/testing/pytest/services/discoveryService.unit.test.ts @@ -17,7 +17,7 @@ import { ITestDiscoveryService, ITestsHelper, TestDiscoveryOptions, - Tests + Tests, } from '../../../../client/testing/common/types'; import { ArgumentsService } from '../../../../client/testing/pytest/services/argsService'; import { TestDiscoveryService } from '../../../../client/testing/pytest/services/discoveryService'; @@ -44,7 +44,7 @@ suite('Unit Tests - PyTest - Discovery', () => { argsService = mock(ArgumentsService); when(serviceContainer.get(IArgumentsService, PYTEST_PROVIDER)).thenReturn( - instance(argsService) + instance(argsService), ); when(serviceContainer.get(ITestsHelper)).thenReturn(instance(helper)); discoveryService = new DiscoveryService(instance(serviceContainer)); @@ -56,7 +56,7 @@ suite('Unit Tests - PyTest - Discovery', () => { ignoreCache: true, outChannel: new MockOutputChannel('Tests'), token: new CancellationTokenSource().token, - workspaceFolder: Uri.file(__dirname) + workspaceFolder: Uri.file(__dirname), }; const args = ['1', '2', '3']; const discoveredTests = ('Hello World' as any) as Tests; @@ -75,7 +75,7 @@ suite('Unit Tests - PyTest - Discovery', () => { ignoreCache: true, outChannel: new MockOutputChannel('Tests'), token: new CancellationTokenSource().token, - workspaceFolder: Uri.file(__dirname) + workspaceFolder: Uri.file(__dirname), }; const args = ['1', '2', '3']; discoveryService.buildTestCollectionArgs = () => args; @@ -92,7 +92,7 @@ suite('Unit Tests - PyTest - Discovery', () => { }; when(argsService.getTestFolders(deepEqual(options.args))).thenReturn(directories); when(helper.mergeTests(deepEqual([('Result A' as any) as Tests, ('Result B' as any) as Tests]))).thenReturn( - 'mergedTests' as any + 'mergedTests' as any, ); const tests = await discoveryService.discoverTests(options); @@ -107,7 +107,7 @@ suite('Unit Tests - PyTest - Discovery', () => { ignoreCache: false, outChannel: new MockOutputChannel('Tests'), token: new CancellationTokenSource().token, - workspaceFolder: Uri.file(__dirname) + workspaceFolder: Uri.file(__dirname), }; const filteredArgs = options.args; @@ -126,7 +126,7 @@ suite('Unit Tests - PyTest - Discovery', () => { ignoreCache: true, outChannel: new MockOutputChannel('Tests'), token: new CancellationTokenSource().token, - workspaceFolder: Uri.file(__dirname) + workspaceFolder: Uri.file(__dirname), }; const filteredArgs = options.args; @@ -145,7 +145,7 @@ suite('Unit Tests - PyTest - Discovery', () => { ignoreCache: true, outChannel: new MockOutputChannel('Tests'), token: new CancellationTokenSource().token, - workspaceFolder: Uri.file(__dirname) + workspaceFolder: Uri.file(__dirname), }; const filteredArgs = options.args; @@ -164,7 +164,7 @@ suite('Unit Tests - PyTest - Discovery', () => { ignoreCache: true, outChannel: new MockOutputChannel('Tests'), token: new CancellationTokenSource().token, - workspaceFolder: Uri.file(__dirname) + workspaceFolder: Uri.file(__dirname), }; const expectedDiscoveryArgs = ['discover', 'pytest', '--', ...options.args]; const discoveryOptions = { ...options }; @@ -173,7 +173,7 @@ suite('Unit Tests - PyTest - Discovery', () => { const commonDiscoveryService = mock(TestsDiscoveryService); const discoveredTests = ('Hello' as any) as Tests; when(serviceContainer.get(ITestDiscoveryService, 'common')).thenReturn( - instance(commonDiscoveryService) + instance(commonDiscoveryService), ); when(commonDiscoveryService.discoverTests(deepEqual(discoveryOptions))).thenResolve(discoveredTests); diff --git a/src/test/testing/rediscover.test.ts b/src/test/testing/rediscover.test.ts index fe6a82e43b63..70ebec1160e1 100644 --- a/src/test/testing/rediscover.test.ts +++ b/src/test/testing/rediscover.test.ts @@ -66,7 +66,7 @@ suite('Unit Tests re-discovery', () => { const testManager = ioc.serviceContainer.get(ITestManagerFactory)( testProvider, rootWorkspaceUri!, - testFilesPath + testFilesPath, ); let tests = await testManager.discoverTests(CommandSource.ui, true, true); assert.equal(tests.testFiles.length, 2, 'Incorrect number of test files'); diff --git a/src/test/testing/results.ts b/src/test/testing/results.ts index 824ef1c1fa4a..5c5eae8053c4 100644 --- a/src/test/testing/results.ts +++ b/src/test/testing/results.ts @@ -18,7 +18,7 @@ import { Tests, TestStatus, TestSuite, - TestSummary + TestSummary, } from '../../client/testing/common/types'; import { fixPath, getDedentedLines, getIndent, RESOURCE } from './helper'; @@ -39,13 +39,13 @@ export function createEmptyResults(): Tests { passed: 0, failures: 0, errors: 0, - skipped: 0 + skipped: 0, }, testFiles: [], testFunctions: [], testSuites: [], testFolders: [], - rootTestFolders: [] + rootTestFolders: [], }; } @@ -105,7 +105,7 @@ export function flattenSuite(node: TestSuite, parents: TestNode[]): FlattenedTes return { testSuite: node, parentTestFile: parentFile, - xmlClassName: node.xmlName + xmlClassName: node.xmlName, }; } @@ -121,7 +121,7 @@ export function flattenFunction(node: TestFunction, parents: TestNode[]): Flatte testFunction: node, parentTestFile: parentFile, parentTestSuite: parentSuite, - xmlClassName: parentSuite ? parentSuite.xmlName : '' + xmlClassName: parentSuite ? parentSuite.xmlName : '', }; } @@ -147,7 +147,7 @@ export namespace nodes { testType: TestingType.folder, // result time: 0, - status: TestStatus.Unknown + status: TestStatus.Unknown, }; } @@ -155,7 +155,7 @@ export namespace nodes { filename: string, nameToRun?: string, xmlName?: string, - resource: Uri = RESOURCE + resource: Uri = RESOURCE, ): TestNode { filename = fixPath(filename); if (!xmlName) { @@ -175,7 +175,7 @@ export namespace nodes { testType: TestingType.file, // result time: 0, - status: TestStatus.Unknown + status: TestStatus.Unknown, }; } @@ -185,7 +185,7 @@ export namespace nodes { xmlName?: string, provider: TestProvider = 'pytest', isInstance: boolean = false, - resource: Uri = RESOURCE + resource: Uri = RESOURCE, ): TestNode { return { resource: resource, @@ -199,7 +199,7 @@ export namespace nodes { testType: TestingType.suite, // result time: 0, - status: TestStatus.Unknown + status: TestStatus.Unknown, }; } @@ -207,7 +207,7 @@ export namespace nodes { name: string, nameToRun?: string, subtestParent?: SubtestParent, - resource: Uri = RESOURCE + resource: Uri = RESOURCE, ): TestNode { return { resource: resource, @@ -217,7 +217,7 @@ export namespace nodes { testType: TestingType.function, // result time: 0, - status: TestStatus.Unknown + status: TestStatus.Unknown, }; } @@ -228,7 +228,7 @@ export namespace nodes { parent: TestFolder, basename: string, nameToRun?: string, - resource?: Uri + resource?: Uri, ): TestNode { const dirname = path.join(parent.name, fixPath(basename)); const subFolder = createFolderResults(dirname, nameToRun, resource || parent.resource || RESOURCE); @@ -241,7 +241,7 @@ export namespace nodes { basename: string, nameToRun?: string, xmlName?: string, - resource?: Uri + resource?: Uri, ): TestNode { const filename = path.join(parent.name, fixPath(basename)); const file = createFileResults(filename, nameToRun, xmlName, resource || parent.resource || RESOURCE); @@ -256,7 +256,7 @@ export namespace nodes { xmlName?: string, provider: TestProvider = 'pytest', isInstance?: boolean, - resource?: Uri + resource?: Uri, ): TestNode { if (!nameToRun) { const sep = provider === 'pytest' ? '::' : '.'; @@ -268,7 +268,7 @@ export namespace nodes { xmlName || `${parent.xmlName}.${name}`, provider, isInstance, - resource || parent.resource || RESOURCE + resource || parent.resource || RESOURCE, ); parent.suites.push(suite as TestSuite); return suite; @@ -279,7 +279,7 @@ export namespace nodes { name: string, nameToRun?: string, provider: TestProvider = 'pytest', - resource?: Uri + resource?: Uri, ): TestNode { if (!nameToRun) { const sep = provider === 'pytest' ? '::' : '.'; @@ -295,7 +295,7 @@ export namespace nodes { name: string, nameToRun?: string, provider: TestProvider = 'pytest', - resource?: Uri + resource?: Uri, ): TestNode { const subtest = createTestResults( name, @@ -309,11 +309,11 @@ export namespace nodes { '', provider, false, - parent.resource + parent.resource, ) as TestSuite, - time: 0 + time: 0, }, - resource || parent.resource || RESOURCE + resource || parent.resource || RESOURCE, ); (subtest as TestFunction).subtestParent!.asSuite.functions.push(subtest); parent.subtests.push(subtest as TestFunction); @@ -425,7 +425,7 @@ namespace declarative { // Parse the results. const result: TestResult = { - time: 0 + time: 0, }; if (parts.length !== 0 && testType !== TestingType.function) { throw Error('non-test nodes do not have results'); @@ -471,7 +471,7 @@ namespace declarative { indent: indent, name: name, testType: testType, - result: result + result: result, }; } @@ -511,7 +511,7 @@ namespace declarative { name: string, testType: TestingType, provider: TestProvider, - resource?: Uri + resource?: Uri, ): TestNode { switch (testType) { case TestingType.folder: diff --git a/src/test/testing/serviceRegistry.ts b/src/test/testing/serviceRegistry.ts index 17da82b15d02..e141803d9b7a 100644 --- a/src/test/testing/serviceRegistry.ts +++ b/src/test/testing/serviceRegistry.ts @@ -10,7 +10,7 @@ import { InterpreterSecurityStorage } from '../../client/interpreter/autoSelecti import { IInterpreterEvaluation, IInterpreterSecurityService, - IInterpreterSecurityStorage + IInterpreterSecurityStorage, } from '../../client/interpreter/autoSelection/types'; import { IInterpreterHelper } from '../../client/interpreter/contracts'; import { InterpreterHelper } from '../../client/interpreter/helpers'; @@ -42,7 +42,7 @@ import { ITestsStatusUpdaterService, ITestVisitor, IUnitTestSocketServer, - TestProvider + TestProvider, } from '../../client/testing/common/types'; import { TestManager as NoseTestManager } from '../../client/testing/nosetest/main'; import { TestDiscoveryService as NoseTestDiscoveryService } from '../../client/testing/nosetest/services/discoveryService'; @@ -77,7 +77,7 @@ export class UnitTestIocContainer extends IocContainer { this.serviceManager.add(ITestVisitor, TestResultResetVisitor, 'TestResultResetVisitor'); this.serviceManager.addSingleton( ITestsStatusUpdaterService, - TestsStatusUpdaterService + TestsStatusUpdaterService, ); this.serviceManager.addSingleton(ITestContextService, TestContextService); } @@ -85,7 +85,7 @@ export class UnitTestIocContainer extends IocContainer { public registerTestStorage() { this.serviceManager.addSingleton( ITestCollectionStorageService, - TestCollectionStorageService + TestCollectionStorageService, ); } @@ -106,17 +106,17 @@ export class UnitTestIocContainer extends IocContainer { this.serviceManager.add( ITestDiscoveryService, UnitTestTestDiscoveryService, - UNITTEST_PROVIDER + UNITTEST_PROVIDER, ); this.serviceManager.add( ITestDiscoveryService, PytestTestDiscoveryService, - PYTEST_PROVIDER + PYTEST_PROVIDER, ); this.serviceManager.add( ITestDiscoveryService, NoseTestDiscoveryService, - NOSETEST_PROVIDER + NOSETEST_PROVIDER, ); this.serviceManager.add(ITestDiscoveryService, TestsDiscoveryService, 'common'); this.serviceManager.add(ITestDiscoveredTestParser, TestDiscoveredTestParser); diff --git a/src/test/testing/stoppingDiscoverAndTest.test.ts b/src/test/testing/stoppingDiscoverAndTest.test.ts index c10bc5f1c69c..f057e7662327 100644 --- a/src/test/testing/stoppingDiscoverAndTest.test.ts +++ b/src/test/testing/stoppingDiscoverAndTest.test.ts @@ -22,13 +22,13 @@ const EmptyTests = { passed: 0, failures: 0, errors: 0, - skipped: 0 + skipped: 0, }, testFiles: [], testFunctions: [], testSuites: [], testFolders: [], - rootTestFolders: [] + rootTestFolders: [], }; // tslint:disable-next-line:max-func-body-length @@ -63,12 +63,12 @@ suite('Unit Tests Stopping Discovery and Runner', () => { Product.unittest, Uri.file(testFilesPath), testFilesPath, - ioc.serviceContainer + ioc.serviceContainer, ); ioc.serviceManager.addSingletonInstance( ITestDiscoveryService, new MockDiscoveryService(mockTestManager.discoveryDeferred.promise), - UNITTEST_PROVIDER + UNITTEST_PROVIDER, ); const discoveryPromise = mockTestManager.discoverTests(CommandSource.auto); @@ -100,12 +100,12 @@ suite('Unit Tests Stopping Discovery and Runner', () => { Product.unittest, Uri.file(testFilesPath), testFilesPath, - ioc.serviceContainer + ioc.serviceContainer, ); ioc.serviceManager.addSingletonInstance( ITestDiscoveryService, new MockDiscoveryService(mockTestManager.discoveryDeferred.promise), - UNITTEST_PROVIDER + UNITTEST_PROVIDER, ); mockTestManager.discoveryDeferred.resolve(EmptyTests); await mockTestManager.discoverTests(CommandSource.auto); diff --git a/src/test/testing/unittest/unittest.discovery.test.ts b/src/test/testing/unittest/unittest.discovery.test.ts index 5a02735c5ec9..b66be822cf6c 100644 --- a/src/test/testing/unittest/unittest.discovery.test.ts +++ b/src/test/testing/unittest/unittest.discovery.test.ts @@ -60,7 +60,7 @@ suite('Unit Tests - unittest - discovery with mocked process output', () => { ioc.registerInterpreterStorageTypes(); ioc.serviceManager.addSingletonInstance( IInterpreterService, - instance(mock(InterpreterService)) + instance(mock(InterpreterService)), ); registerForIOC(ioc.serviceManager, ioc.serviceContainer); ioc.serviceManager.rebindInstance(ICondaService, instance(mock(CondaService))); @@ -83,7 +83,7 @@ suite('Unit Tests - unittest - discovery with mocked process output', () => { .split(/\r?\n/g) .map((item) => item.trim()) .join(EOL), - source: 'stdout' + source: 'stdout', }); } }); @@ -106,14 +106,14 @@ suite('Unit Tests - unittest - discovery with mocked process output', () => { assert.equal( tests.testFiles.some((t) => t.name === 'test_one.py' && t.nameToRun === 'test_one'), true, - 'Test File not found' + 'Test File not found', ); assert.equal( tests.testFunctions.some( - (t) => t.testFunction.name === 'test_A' && t.testFunction.nameToRun === 'test_one.Test_test1.test_A' + (t) => t.testFunction.name === 'test_A' && t.testFunction.nameToRun === 'test_one.Test_test1.test_A', ), true, - 'Test File not found' + 'Test File not found', ); }); @@ -140,30 +140,30 @@ suite('Unit Tests - unittest - discovery with mocked process output', () => { assert.equal( tests.testFiles.some((t) => t.name === 'test_unittest_one.py' && t.nameToRun === 'test_unittest_one'), true, - 'Test File not found' + 'Test File not found', ); assert.equal( tests.testFiles.some((t) => t.name === 'test_unittest_two.py' && t.nameToRun === 'test_unittest_two'), true, - 'Test File not found' + 'Test File not found', ); assert.equal( tests.testFunctions.some( (t) => t.testFunction.name === 'test_A' && - t.testFunction.nameToRun === 'test_unittest_one.Test_test1.test_A' + t.testFunction.nameToRun === 'test_unittest_one.Test_test1.test_A', ), true, - 'Test File not found' + 'Test File not found', ); assert.equal( tests.testFunctions.some( (t) => t.testFunction.name === 'test_A2' && - t.testFunction.nameToRun === 'test_unittest_two.Test_test2.test_A2' + t.testFunction.nameToRun === 'test_unittest_two.Test_test2.test_A2', ), true, - 'Test File not found' + 'Test File not found', ); }); @@ -183,16 +183,16 @@ suite('Unit Tests - unittest - discovery with mocked process output', () => { assert.equal( tests.testFiles.some((t) => t.name === 'unittest_three_test.py' && t.nameToRun === 'unittest_three_test'), true, - 'Test File not found' + 'Test File not found', ); assert.equal( tests.testFunctions.some( (t) => t.testFunction.name === 'test_A' && - t.testFunction.nameToRun === 'unittest_three_test.Test_test3.test_A' + t.testFunction.nameToRun === 'unittest_three_test.Test_test3.test_A', ), true, - 'Test File not found' + 'Test File not found', ); }); diff --git a/src/test/testing/unittest/unittest.discovery.unit.test.ts b/src/test/testing/unittest/unittest.discovery.unit.test.ts index 1d03baada13e..3cdd3fea9fa0 100644 --- a/src/test/testing/unittest/unittest.discovery.unit.test.ts +++ b/src/test/testing/unittest/unittest.discovery.unit.test.ts @@ -21,7 +21,7 @@ import { Options, TestDiscoveryOptions, Tests, - UnitTestParserOptions + UnitTestParserOptions, } from '../../../client/testing/common/types'; import { IArgumentsHelper } from '../../../client/testing/types'; import { TestDiscoveryService } from '../../../client/testing/unittest/services/discoveryService'; @@ -61,7 +61,7 @@ suite('Unit Tests - Unittest - Discovery', () => { testFunctions: [], testSuites: [], rootTestFolders: [], - testFolders: [] + testFolders: [], }; argsHelper .setup((a) => a.getOptionValues(typeMoq.It.isValue(args), typeMoq.It.isValue('-s'))) @@ -103,7 +103,7 @@ suite('Unit Tests - Unittest - Discovery', () => { testFunctions: [], testSuites: [], rootTestFolders: [], - testFolders: [] + testFolders: [], }; argsHelper .setup((a) => a.getOptionValues(typeMoq.It.isValue(args), typeMoq.It.isValue('-s'))) @@ -149,7 +149,7 @@ suite('Unit Tests - Unittest - Discovery', () => { testFunctions: [], testSuites: [], rootTestFolders: [], - testFolders: [] + testFolders: [], }; argsHelper .setup((a) => a.getOptionValues(typeMoq.It.isValue(args), typeMoq.It.isValue('-s'))) @@ -195,7 +195,7 @@ suite('Unit Tests - Unittest - Discovery', () => { testFunctions: [], testSuites: [], rootTestFolders: [], - testFolders: [] + testFolders: [], }; argsHelper .setup((a) => a.getOptionValues(typeMoq.It.isValue(args), typeMoq.It.isValue('-p'))) @@ -237,7 +237,7 @@ suite('Unit Tests - Unittest - Discovery', () => { testFunctions: [], testSuites: [], rootTestFolders: [], - testFolders: [] + testFolders: [], }; argsHelper .setup((a) => a.getOptionValues(typeMoq.It.isValue(args), typeMoq.It.isValue('-p'))) @@ -283,7 +283,7 @@ suite('Unit Tests - Unittest - Discovery', () => { testFunctions: [], testSuites: [], rootTestFolders: [], - testFolders: [] + testFolders: [], }; argsHelper .setup((a) => a.getOptionValues(typeMoq.It.isValue(args), typeMoq.It.isValue('-p'))) @@ -329,7 +329,7 @@ suite('Unit Tests - Unittest - Discovery', () => { testFunctions: [], testSuites: [], rootTestFolders: [], - testFolders: [] + testFolders: [], }; argsHelper .setup((a) => a.getOptionValues(typeMoq.It.isValue(args), typeMoq.It.isValue('-p'))) @@ -383,7 +383,7 @@ suite('Unit Tests - Unittest - Discovery', () => { 'apptests.debug.first.class_name.FirstLevelClassName.test_first_other', 'apptests.debug.first.second.class_name.SecondLevelClassName.test_second', 'apptests.debug.first.second.class_name.SecondLevelClassName.test_second_other', - '' + '', ].join('\n'); const tests: Tests = testsParser.parse(discoveryOutput, opts.object); @@ -402,8 +402,8 @@ suite('Unit Tests - Unittest - Discovery', () => { [ `function ${fn.testFunction.name} has a parent suite ${fn.parentTestSuite.name}, `, `but the parent suite 'nameToRun' (${fn.parentTestSuite.nameToRun}) isn't the `, - `prefix to the functions 'nameToRun' (${fn.testFunction.nameToRun})` - ].join('') + `prefix to the functions 'nameToRun' (${fn.testFunction.nameToRun})`, + ].join(''), ); } }); @@ -430,7 +430,7 @@ suite('Unit Tests - Unittest - Discovery', () => { 'apptests.debug.first.class_name.FirstLevelClassName.test_first_other', 'apptests.debug.first.second.class_name.SecondLevelClassName.test_second', 'apptests.debug.first.second.class_name.SecondLevelClassName.test_second_other', - '' + '', ].join('\n'); const tests: Tests = testsParser.parse(discoveryOutput, opts.object); @@ -449,8 +449,8 @@ suite('Unit Tests - Unittest - Discovery', () => { [ `function ${fn.testFunction.name} was found in file ${fn.parentTestFile.name}, `, `but the parent file 'nameToRun' (${fn.parentTestFile.nameToRun}) isn't the `, - `prefix to the functions 'nameToRun' (${fn.testFunction.nameToRun})` - ].join('') + `prefix to the functions 'nameToRun' (${fn.testFunction.nameToRun})`, + ].join(''), ); } }); @@ -477,7 +477,7 @@ suite('Unit Tests - Unittest - Discovery', () => { 'apptests.debug.first.class_name.FirstLevelClassName.test_first_other', 'apptests.debug.first.second.class_name.SecondLevelClassName.test_second', 'apptests.debug.first.second.class_name.SecondLevelClassName.test_second_other', - '' + '', ].join('\n'); const tests: Tests = testsParser.parse(discoveryOutput, opts.object); @@ -496,8 +496,8 @@ suite('Unit Tests - Unittest - Discovery', () => { [ `function ${fn.testFunction.name} has a parent suite ${fn.parentTestSuite.name}, `, `but the parent suite 'nameToRun' (${fn.parentTestSuite.nameToRun}) isn't the `, - `prefix to the functions 'nameToRun' (${fn.testFunction.nameToRun})` - ].join('') + `prefix to the functions 'nameToRun' (${fn.testFunction.nameToRun})`, + ].join(''), ); } }); @@ -524,7 +524,7 @@ suite('Unit Tests - Unittest - Discovery', () => { 'apptests.debug.first.class_name.FirstLevelClassName.test_first_other', 'apptests.debug.first.second.class_name.SecondLevelClassName.test_second', 'apptests.debug.first.second.class_name.SecondLevelClassName.test_second_other', - '' + '', ].join('\n'); const tests: Tests = testsParser.parse(discoveryOutput, opts.object); @@ -543,8 +543,8 @@ suite('Unit Tests - Unittest - Discovery', () => { [ `function ${fn.testFunction.name} has a parent suite ${fn.parentTestSuite.name}, `, `but the parent suite 'nameToRun' (${fn.parentTestSuite.nameToRun}) isn't the `, - `prefix to the functions 'nameToRun' (${fn.testFunction.nameToRun})` - ].join('') + `prefix to the functions 'nameToRun' (${fn.testFunction.nameToRun})`, + ].join(''), ); } }); @@ -589,7 +589,7 @@ suite('Unit Tests - Unittest - Discovery', () => { 'allikbrilkpdbfkdfbalk;nfm', '', ';;h,spmn,nlikmslkjls.bmnl;klkjna;jdfngad,lmvnjkldfhb', - '' + '', ].join('\n'); const tests: Tests = testsParser.parse(discoveryOutput, opts.object); diff --git a/src/test/testing/unittest/unittest.run.test.ts b/src/test/testing/unittest/unittest.run.test.ts index fc2ce43ab4c6..e6dcdbd76822 100644 --- a/src/test/testing/unittest/unittest.run.test.ts +++ b/src/test/testing/unittest/unittest.run.test.ts @@ -19,13 +19,13 @@ import { ITestManagerFactory, ITestRunner, IUnitTestSocketServer, - TestsToRun + TestsToRun, } from '../../../client/testing/common/types'; import { IArgumentsHelper, IArgumentsService, ITestManagerRunner, - IUnitTestHelper + IUnitTestHelper, } from '../../../client/testing/types'; import { UnitTestHelper } from '../../../client/testing/unittest/helper'; import { TestManagerRunner } from '../../../client/testing/unittest/runner'; @@ -78,7 +78,7 @@ suite('Unit Tests - unittest - run with mocked process output', () => { ['-s', '--start - directory'].forEach((s) => { switches.push({ patternSwitch: p, - startDirSwitch: s + startDirSwitch: s, }); }); }); @@ -113,7 +113,7 @@ suite('Unit Tests - unittest - run with mocked process output', () => { ioc.serviceManager.add(IUnitTestHelper, UnitTestHelper); ioc.serviceManager.addSingletonInstance( IInterpreterService, - instance(mock(InterpreterService)) + instance(mock(InterpreterService)), ); registerForIOC(ioc.serviceManager, ioc.serviceContainer); ioc.serviceManager.rebindInstance(ICondaService, instance(mock(CondaService))); @@ -147,7 +147,7 @@ suite('Unit Tests - unittest - run with mocked process output', () => { .split(/\r?\n/g) .map((item) => item.trim()) .join(EOL), - source: 'stdout' + source: 'stdout', }); } }); @@ -166,7 +166,7 @@ suite('Unit Tests - unittest - run with mocked process output', () => { 'testing.unittestArgs', ['-v', cfg.startDirSwitch, './tests', cfg.patternSwitch, 'test_unittest*.py'], rootWorkspaceUri, - configTarget + configTarget, ); // tslint:disable-next-line:no-multiline-string await injectTestDiscoveryOutput(`start @@ -185,7 +185,7 @@ suite('Unit Tests - unittest - run with mocked process output', () => { outcome: 'failed', traceback: 'AssertionError: Not implemented\n', message: 'Not implemented', - test: 'test_unittest_one.Test_test1.test_A' + test: 'test_unittest_one.Test_test1.test_A', }, { outcome: 'passed', traceback: null, message: null, test: 'test_unittest_one.Test_test1.test_B' }, { outcome: 'skipped', traceback: null, message: null, test: 'test_unittest_one.Test_test1.test_c' }, @@ -193,28 +193,28 @@ suite('Unit Tests - unittest - run with mocked process output', () => { outcome: 'failed', traceback: 'raise self.failureException(msg)\nAssertionError: Not implemented\n', message: 'Not implemented', - test: 'test_unittest_two.Test_test2.test_A2' + test: 'test_unittest_two.Test_test2.test_A2', }, { outcome: 'passed', traceback: null, message: null, test: 'test_unittest_two.Test_test2.test_B2' }, { outcome: 'failed', traceback: 'raise self.failureException(msg)\nAssertionError: 1 != 2 : Not equal\n', message: '1 != 2 : Not equal', - test: 'test_unittest_two.Test_test2.test_C2' + test: 'test_unittest_two.Test_test2.test_C2', }, { outcome: 'error', traceback: 'raise ArithmeticError()\nArithmeticError\n', message: '', - test: 'test_unittest_two.Test_test2.test_D2' + test: 'test_unittest_two.Test_test2.test_D2', }, { outcome: 'failed', traceback: 'raise self.failureException(msg)\nAssertionError: Not implemented\n', message: 'Not implemented', - test: 'test_unittest_two.Test_test2a.test_222A2' + test: 'test_unittest_two.Test_test2a.test_222A2', }, - { outcome: 'passed', traceback: null, message: null, test: 'test_unittest_two.Test_test2a.test_222B2' } + { outcome: 'passed', traceback: null, message: null, test: 'test_unittest_two.Test_test2a.test_222B2' }, ]; injectTestSocketServerResults(resultsToSend); @@ -233,7 +233,7 @@ suite('Unit Tests - unittest - run with mocked process output', () => { 'testing.unittestArgs', [`${cfg.startDirSwitch}=./tests`, `${cfg.patternSwitch}=test_unittest*.py`], rootWorkspaceUri, - configTarget + configTarget, ); // tslint:disable-next-line:no-multiline-string await injectTestDiscoveryOutput(`start @@ -253,7 +253,7 @@ suite('Unit Tests - unittest - run with mocked process output', () => { outcome: 'failed', traceback: 'raise self.failureException(msg)\nAssertionError: Not implemented\n', message: 'Not implemented', - test: 'test_unittest_one.Test_test1.test_A' + test: 'test_unittest_one.Test_test1.test_A', }, { outcome: 'passed', traceback: null, message: null, test: 'test_unittest_one.Test_test1.test_B' }, { outcome: 'skipped', traceback: null, message: null, test: 'test_unittest_one.Test_test1.test_c' }, @@ -261,28 +261,28 @@ suite('Unit Tests - unittest - run with mocked process output', () => { outcome: 'failed', traceback: 'raise self.failureException(msg)\nAssertionError: Not implemented\n', message: 'Not implemented', - test: 'test_unittest_two.Test_test2.test_A2' + test: 'test_unittest_two.Test_test2.test_A2', }, { outcome: 'passed', traceback: null, message: null, test: 'test_unittest_two.Test_test2.test_B2' }, { outcome: 'failed', traceback: 'raise self.failureException(msg)\nAssertionError: 1 != 2 : Not equal\n', message: '1 != 2 : Not equal', - test: 'test_unittest_two.Test_test2.test_C2' + test: 'test_unittest_two.Test_test2.test_C2', }, { outcome: 'error', traceback: 'raise ArithmeticError()\nArithmeticError\n', message: '', - test: 'test_unittest_two.Test_test2.test_D2' + test: 'test_unittest_two.Test_test2.test_D2', }, { outcome: 'failed', traceback: 'raise self.failureException(msg)\nAssertionError: Not implemented\n', message: 'Not implemented', - test: 'test_unittest_two.Test_test2a.test_222A2' + test: 'test_unittest_two.Test_test2a.test_222A2', }, - { outcome: 'passed', traceback: null, message: null, test: 'test_unittest_two.Test_test2a.test_222B2' } + { outcome: 'passed', traceback: null, message: null, test: 'test_unittest_two.Test_test2a.test_222B2' }, ]; injectTestSocketServerResults(resultsToSend); @@ -299,32 +299,32 @@ suite('Unit Tests - unittest - run with mocked process output', () => { outcome: 'failed', traceback: 'raise self.failureException(msg)\nAssertionError: Not implemented\n', message: 'Not implemented', - test: 'test_unittest_one.Test_test1.test_A' + test: 'test_unittest_one.Test_test1.test_A', }, { outcome: 'failed', traceback: 'raise self.failureException(msg)\nAssertionError: Not implemented\n', message: 'Not implemented', - test: 'test_unittest_two.Test_test2.test_A2' + test: 'test_unittest_two.Test_test2.test_A2', }, { outcome: 'failed', traceback: 'raise self.failureException(msg)\nAssertionError: 1 != 2 : Not equal\n', message: '1 != 2 : Not equal', - test: 'test_unittest_two.Test_test2.test_C2' + test: 'test_unittest_two.Test_test2.test_C2', }, { outcome: 'error', traceback: 'raise ArithmeticError()\nArithmeticError\n', message: '', - test: 'test_unittest_two.Test_test2.test_D2' + test: 'test_unittest_two.Test_test2.test_D2', }, { outcome: 'failed', traceback: 'raise self.failureException(msg)\nAssertionError: Not implemented\n', message: 'Not implemented', - test: 'test_unittest_two.Test_test2a.test_222A2' - } + test: 'test_unittest_two.Test_test2a.test_222A2', + }, ]; injectTestSocketServerResults(failedResultsToSend); @@ -340,7 +340,7 @@ suite('Unit Tests - unittest - run with mocked process output', () => { 'testing.unittestArgs', [`${cfg.startDirSwitch}=./tests`, `${cfg.patternSwitch}=test_unittest*.py`], rootWorkspaceUri, - configTarget + configTarget, ); // tslint:disable-next-line:no-multiline-string @@ -360,26 +360,26 @@ suite('Unit Tests - unittest - run with mocked process output', () => { outcome: 'passed', traceback: null, message: null, - test: 'test_unittest_one.Test_test_one_1.test_1_1_1' + test: 'test_unittest_one.Test_test_one_1.test_1_1_1', }, { outcome: 'failed', traceback: 'AssertionError: 1 != 2 : Not equal\n', message: '1 != 2 : Not equal', - test: 'test_unittest_one.Test_test_one_1.test_1_1_2' + test: 'test_unittest_one.Test_test_one_1.test_1_1_2', }, { outcome: 'skipped', traceback: null, message: null, - test: 'test_unittest_one.Test_test_one_1.test_1_1_3' + test: 'test_unittest_one.Test_test_one_1.test_1_1_3', }, { outcome: 'passed', traceback: null, message: null, - test: 'test_unittest_one.Test_test_one_2.test_1_2_1' - } + test: 'test_unittest_one.Test_test_one_2.test_1_2_1', + }, ]; injectTestSocketServerResults(resultsToSend); @@ -393,7 +393,7 @@ suite('Unit Tests - unittest - run with mocked process output', () => { testFile: [testFileToTest], testFolder: [], testFunction: [], - testSuite: [] + testSuite: [], }; const results = await testManager.runTest(CommandSource.ui, testFile); @@ -408,7 +408,7 @@ suite('Unit Tests - unittest - run with mocked process output', () => { 'testing.unittestArgs', [`${cfg.startDirSwitch}=./tests`, `${cfg.patternSwitch}=test_unittest*.py`], rootWorkspaceUri, - configTarget + configTarget, ); // tslint:disable-next-line:no-multiline-string await injectTestDiscoveryOutput(`start @@ -427,26 +427,26 @@ suite('Unit Tests - unittest - run with mocked process output', () => { outcome: 'passed', traceback: null, message: null, - test: 'test_unittest_one.Test_test_one_1.test_1_1_1' + test: 'test_unittest_one.Test_test_one_1.test_1_1_1', }, { outcome: 'failed', traceback: 'AssertionError: 1 != 2 : Not equal\n', message: '1 != 2 : Not equal', - test: 'test_unittest_one.Test_test_one_1.test_1_1_2' + test: 'test_unittest_one.Test_test_one_1.test_1_1_2', }, { outcome: 'skipped', traceback: null, message: null, - test: 'test_unittest_one.Test_test_one_1.test_1_1_3' + test: 'test_unittest_one.Test_test_one_1.test_1_1_3', }, { outcome: 'passed', traceback: null, message: null, - test: 'test_unittest_one.Test_test_one_2.test_1_2_1' - } + test: 'test_unittest_one.Test_test_one_2.test_1_2_1', + }, ]; injectTestSocketServerResults(resultsToSend); @@ -460,7 +460,7 @@ suite('Unit Tests - unittest - run with mocked process output', () => { testFile: [], testFolder: [], testFunction: [], - testSuite: [testSuiteToTest] + testSuite: [testSuiteToTest], }; const results = await testManager.runTest(CommandSource.ui, testSuite); @@ -475,7 +475,7 @@ suite('Unit Tests - unittest - run with mocked process output', () => { 'testing.unittestArgs', [`${cfg.startDirSwitch}=./tests`, `${cfg.patternSwitch}=test_unittest*.py`], rootWorkspaceUri, - configTarget + configTarget, ); // tslint:disable-next-line:no-multiline-string await injectTestDiscoveryOutput(`start @@ -495,8 +495,8 @@ suite('Unit Tests - unittest - run with mocked process output', () => { outcome: 'failed', traceback: 'AssertionError: Not implemented\n', message: 'Not implemented', - test: 'test_unittest_one.Test_test1.test_A' - } + test: 'test_unittest_one.Test_test1.test_A', + }, ]; injectTestSocketServerResults(resultsToSend); @@ -507,7 +507,7 @@ suite('Unit Tests - unittest - run with mocked process output', () => { testFile: [], testFolder: [], testFunction: [tests.testFunctions[0].testFunction], - testSuite: [] + testSuite: [], }; const results = await testManager.runTest(CommandSource.ui, testFn); assert.equal(results.summary.errors, 0, 'Errors'); diff --git a/src/test/testing/unittest/unittest.test.ts b/src/test/testing/unittest/unittest.test.ts index 858cefbc0a91..cf88e94a7a5e 100644 --- a/src/test/testing/unittest/unittest.test.ts +++ b/src/test/testing/unittest/unittest.test.ts @@ -60,11 +60,11 @@ suite('Unit Tests - unittest - discovery against actual python process', () => { when(mockEnvironmentActivationService.getActivatedEnvironmentVariables(anything())).thenResolve(); when(mockEnvironmentActivationService.getActivatedEnvironmentVariables(anything(), anything())).thenResolve(); when( - mockEnvironmentActivationService.getActivatedEnvironmentVariables(anything(), anything(), anything()) + mockEnvironmentActivationService.getActivatedEnvironmentVariables(anything(), anything(), anything()), ).thenResolve(); ioc.serviceManager.rebindInstance( IEnvironmentActivationService, - instance(mockEnvironmentActivationService) + instance(mockEnvironmentActivationService), ); } @@ -79,14 +79,14 @@ suite('Unit Tests - unittest - discovery against actual python process', () => { assert.equal( tests.testFiles.some((t) => t.name === 'test_one.py' && t.nameToRun === 'test_one'), true, - 'Test File not found' + 'Test File not found', ); assert.equal( tests.testFunctions.some( - (t) => t.testFunction.name === 'test_A' && t.testFunction.nameToRun === 'test_one.Test_test1.test_A' + (t) => t.testFunction.name === 'test_A' && t.testFunction.nameToRun === 'test_one.Test_test1.test_A', ), true, - 'Test File not found' + 'Test File not found', ); }); @@ -101,40 +101,40 @@ suite('Unit Tests - unittest - discovery against actual python process', () => { assert.equal( tests.testFiles.some((t) => t.name === 'test_one.py' && t.nameToRun === 'test_one'), true, - 'Test File one not found' + 'Test File one not found', ); assert.equal( tests.testFiles.some((t) => t.name === 'test_two.py' && t.nameToRun === 'test_two'), true, - 'Test File two not found' + 'Test File two not found', ); assert.equal( tests.testFiles.some((t) => t.name === 'test_three.py' && t.nameToRun === 'more_tests.test_three'), true, - 'Test File three not found' + 'Test File three not found', ); assert.equal( tests.testFunctions.some( - (t) => t.testFunction.name === 'test_A' && t.testFunction.nameToRun === 'test_one.Test_test1.test_A' + (t) => t.testFunction.name === 'test_A' && t.testFunction.nameToRun === 'test_one.Test_test1.test_A', ), true, - 'Test File one not found' + 'Test File one not found', ); assert.equal( tests.testFunctions.some( - (t) => t.testFunction.name === 'test_2A' && t.testFunction.nameToRun === 'test_two.Test_test2.test_2A' + (t) => t.testFunction.name === 'test_2A' && t.testFunction.nameToRun === 'test_two.Test_test2.test_2A', ), true, - 'Test File two not found' + 'Test File two not found', ); assert.equal( tests.testFunctions.some( (t) => t.testFunction.name === 'test_3A' && - t.testFunction.nameToRun === 'more_tests.test_three.Test_test3.test_3A' + t.testFunction.nameToRun === 'more_tests.test_three.Test_test3.test_3A', ), true, - 'Test File three not found' + 'Test File three not found', ); }); @@ -144,34 +144,34 @@ suite('Unit Tests - unittest - discovery against actual python process', () => { const testManager = factory('unittest', rootWorkspaceUri!, UNITTEST_MULTI_TEST_FILE_PATH); const testsDiscovered: Tests = await testManager.discoverTests(CommandSource.ui, true, true); const testFile: TestFile | undefined = testsDiscovered.testFiles.find((value: TestFile) => - value.nameToRun.endsWith('_three') + value.nameToRun.endsWith('_three'), ); assert.notEqual(testFile, undefined, 'No test file suffixed with _3A in test files.'); assert.equal(testFile!.suites.length, 1, 'Expected only 1 test suite in test file three.'); const testFunc: TestFunction | undefined = testFile!.suites[0].functions.find( - (value: TestFunction) => value.name === 'test_3A' + (value: TestFunction) => value.name === 'test_3A', ); assert.notEqual(testFunc, undefined, 'No test in file test_three.py named test_3A'); const testsToRun: TestsToRun = { - testFunction: [testFunc!] + testFunction: [testFunc!], }; const testRunResult: Tests = await testManager.runTest(CommandSource.ui, testsToRun); assert.equal( testRunResult.summary.failures + testRunResult.summary.passed + testRunResult.summary.skipped, 1, - 'Expected to see only 1 test run in the summary for tests run.' + 'Expected to see only 1 test run in the summary for tests run.', ); assert.equal(testRunResult.summary.errors, 0, 'Unexpected: Test file ran with errors.'); assert.equal(testRunResult.summary.failures, 0, 'Unexpected: Test has failed during test run.'); assert.equal( testRunResult.summary.passed, 1, - `Only one test should have passed during our test run. Instead, ${testRunResult.summary.passed} passed.` + `Only one test should have passed during our test run. Instead, ${testRunResult.summary.passed} passed.`, ); assert.equal( testRunResult.summary.skipped, 0, - `Expected to have skipped 0 tests during this test-run. Instead, ${testRunResult.summary.skipped} where skipped.` + `Expected to have skipped 0 tests during this test-run. Instead, ${testRunResult.summary.skipped} where skipped.`, ); }); @@ -184,16 +184,16 @@ suite('Unit Tests - unittest - discovery against actual python process', () => { const testManager = factory('unittest', rootWorkspaceUri!, UNITTEST_COUNTS_TEST_FILE_PATH); const testsDiscovered: Tests = await testManager.discoverTests(CommandSource.ui, true, true); const testsFile: TestFile | undefined = testsDiscovered.testFiles.find((value: TestFile) => - value.name.startsWith('test_unit_test_counter') + value.name.startsWith('test_unit_test_counter'), ); assert.notEqual( testsFile, undefined, - `No test file suffixed with _counter in test files. Looked in ${UNITTEST_COUNTS_TEST_FILE_PATH}.` + `No test file suffixed with _counter in test files. Looked in ${UNITTEST_COUNTS_TEST_FILE_PATH}.`, ); assert.equal(testsFile!.suites.length, 1, 'Expected only 1 test suite in counter test file.'); const testsToRun: TestsToRun = { - testFolder: [testsDiscovered.testFolders[0]] + testFolder: [testsDiscovered.testFolders[0]], }; // ensure that each re-run of the unit tests in question result in the same summary count information. @@ -201,24 +201,24 @@ suite('Unit Tests - unittest - discovery against actual python process', () => { assert.equal( testRunResult.summary.failures, 2, - 'This test was written assuming there was 2 tests run that would fail. (iteration 1)' + 'This test was written assuming there was 2 tests run that would fail. (iteration 1)', ); assert.equal( testRunResult.summary.passed, 2, - 'This test was written assuming there was 2 tests run that would succeed. (iteration 1)' + 'This test was written assuming there was 2 tests run that would succeed. (iteration 1)', ); testRunResult = await testManager.runTest(CommandSource.ui, testsToRun); assert.equal( testRunResult.summary.failures, 2, - 'This test was written assuming there was 2 tests run that would fail. (iteration 2)' + 'This test was written assuming there was 2 tests run that would fail. (iteration 2)', ); assert.equal( testRunResult.summary.passed, 2, - 'This test was written assuming there was 2 tests run that would succeed. (iteration 2)' + 'This test was written assuming there was 2 tests run that would succeed. (iteration 2)', ); }); @@ -231,16 +231,16 @@ suite('Unit Tests - unittest - discovery against actual python process', () => { const testManager = factory('unittest', rootWorkspaceUri!, UNITTEST_COUNTS_TEST_FILE_PATH); const testsDiscovered: Tests = await testManager.discoverTests(CommandSource.ui, true, true); const testsFile: TestFile | undefined = testsDiscovered.testFiles.find((value: TestFile) => - value.name.startsWith('test_unit_test_counter') + value.name.startsWith('test_unit_test_counter'), ); assert.notEqual( testsFile, undefined, - `No test file suffixed with _counter in test files. Looked in ${UNITTEST_COUNTS_TEST_FILE_PATH}.` + `No test file suffixed with _counter in test files. Looked in ${UNITTEST_COUNTS_TEST_FILE_PATH}.`, ); assert.equal(testsFile!.suites.length, 1, 'Expected only 1 test suite in counter test file.'); const testsToRun: TestsToRun = { - testFolder: [testsDiscovered.testFolders[0]] + testFolder: [testsDiscovered.testFolders[0]], }; // ensure that each re-run of the unit tests in question result in the same summary count information. @@ -248,19 +248,19 @@ suite('Unit Tests - unittest - discovery against actual python process', () => { assert.equal( testRunResult.summary.failures, 2, - 'This test was written assuming there was 2 tests run that would fail. (iteration 1)' + 'This test was written assuming there was 2 tests run that would fail. (iteration 1)', ); assert.equal( testRunResult.summary.passed, 2, - 'This test was written assuming there was 2 tests run that would succeed. (iteration 1)' + 'This test was written assuming there was 2 tests run that would succeed. (iteration 1)', ); testRunResult = await testManager.runTest(CommandSource.ui, testsToRun, true); assert.equal( testRunResult.summary.failures, 2, - 'This test was written assuming there was 2 tests run that would fail. (iteration 2)' + 'This test was written assuming there was 2 tests run that would fail. (iteration 2)', ); }); }); diff --git a/src/test/testing/unittest/unittest.unit.test.ts b/src/test/testing/unittest/unittest.unit.test.ts index 58d771ca9c60..73cbce1b5fb4 100644 --- a/src/test/testing/unittest/unittest.unit.test.ts +++ b/src/test/testing/unittest/unittest.unit.test.ts @@ -13,7 +13,7 @@ import { IConfigurationService, IDisposableRegistry, IOutputChannel, - IPythonSettings + IPythonSettings, } from '../../../client/common/types'; import { ServiceContainer } from '../../../client/ioc/container'; import { IServiceContainer } from '../../../client/ioc/types'; @@ -35,13 +35,13 @@ import { TestFunction, Tests, TestStatus, - TestSuite + TestSuite, } from '../../../client/testing/common/types'; import { IArgumentsHelper, IArgumentsService, ITestManagerRunner, - TestDataItemType + TestDataItemType, } from '../../../client/testing/types'; import { TestManager } from '../../../client/testing/unittest/main'; import { TestManagerRunner } from '../../../client/testing/unittest/runner'; @@ -99,43 +99,43 @@ suite('Unit Tests - unittest - run failed tests', () => { suite3.functions.push(fn5); const flattendSuite1: FlattenedTestSuite = { testSuite: suite1, - xmlClassName: suite1.xmlName + xmlClassName: suite1.xmlName, } as any; const flattendSuite2: FlattenedTestSuite = { testSuite: suite2, - xmlClassName: suite2.xmlName + xmlClassName: suite2.xmlName, } as any; const flattendSuite3: FlattenedTestSuite = { testSuite: suite3, - xmlClassName: suite3.xmlName + xmlClassName: suite3.xmlName, } as any; const flattendSuite4: FlattenedTestSuite = { testSuite: suite4, - xmlClassName: suite4.xmlName + xmlClassName: suite4.xmlName, } as any; const flattendSuite5: FlattenedTestSuite = { testSuite: suite5, - xmlClassName: suite5.xmlName + xmlClassName: suite5.xmlName, } as any; const flattendFn1: FlattenedTestFunction = { testFunction: fn1, - xmlClassName: fn1.name + xmlClassName: fn1.name, } as any; const flattendFn2: FlattenedTestFunction = { testFunction: fn2, - xmlClassName: fn2.name + xmlClassName: fn2.name, } as any; const flattendFn3: FlattenedTestFunction = { testFunction: fn3, - xmlClassName: fn3.name + xmlClassName: fn3.name, } as any; const flattendFn4: FlattenedTestFunction = { testFunction: fn4, - xmlClassName: fn4.name + xmlClassName: fn4.name, } as any; const flattendFn5: FlattenedTestFunction = { testFunction: fn5, - xmlClassName: fn5.name + xmlClassName: fn5.name, } as any; tests = { rootTestFolders: [folder1], @@ -143,7 +143,7 @@ suite('Unit Tests - unittest - run failed tests', () => { testFiles: [file1, file2, file3, file4], testFolders: [folder1, folder2, folder3, folder4, folder5], testFunctions: [flattendFn1, flattendFn2, flattendFn3, flattendFn4, flattendFn5], - testSuites: [flattendSuite1, flattendSuite2, flattendSuite3, flattendSuite4, flattendSuite5] + testSuites: [flattendSuite1, flattendSuite2, flattendSuite3, flattendSuite4, flattendSuite5], }; } setup(() => { @@ -159,17 +159,17 @@ suite('Unit Tests - unittest - run failed tests', () => { when(serviceContainer.get(IWorkspaceService)).thenReturn(instance(workspaceService)); when(serviceContainer.get(IArgumentsHelper)).thenReturn(new ArgumentsHelper()); when(serviceContainer.get(IArgumentsService, anything())).thenReturn( - new ArgumentsService(svcInstance) + new ArgumentsService(svcInstance), ); when(serviceContainer.get(ITestsHelper)).thenReturn(instance(testsHelper)); when(serviceContainer.get(ITestManagerRunner, anything())).thenReturn( - instance(testManagerRunner) + instance(testManagerRunner), ); when(serviceContainer.get(ITestsStatusUpdaterService)).thenReturn( - new TestsStatusUpdaterService(instance(testStorage)) + new TestsStatusUpdaterService(instance(testStorage)), ); when(serviceContainer.get(ITestResultsService)).thenReturn( - new TestResultsService(new TestResultResetVisitor()) + new TestResultsService(new TestResultResetVisitor()), ); when(serviceContainer.get(IOutputChannel)).thenReturn(instance(mock(MockOutputChannel))); when(serviceContainer.get(IOutputChannel)).thenReturn(instance(mock(MockOutputChannel))); @@ -177,8 +177,8 @@ suite('Unit Tests - unittest - run failed tests', () => { const settingsService = mock(ConfigurationService); const settings: IPythonSettings = { testing: { - unittestArgs: [] - } + unittestArgs: [], + }, } as any; when(settingsService.getSettings(anything())).thenReturn(settings); when(serviceContainer.get(IConfigurationService)).thenReturn(instance(settingsService)); diff --git a/src/test/textUtils.ts b/src/test/textUtils.ts index 36c877887130..85308213fd56 100644 --- a/src/test/textUtils.ts +++ b/src/test/textUtils.ts @@ -22,6 +22,6 @@ export function compareFiles(expectedContent: string, actualContent: string) { actualLines.length, expectedLines.length > actualLines.length ? 'Actual contains more lines than expected' - : 'Expected contains more lines than the actual' + : 'Expected contains more lines than the actual', ).to.be.equal(expectedLines.length); } diff --git a/src/test/utils/fs.ts b/src/test/utils/fs.ts index f92ffbfd91c6..cd9453beed07 100644 --- a/src/test/utils/fs.ts +++ b/src/test/utils/fs.ts @@ -7,7 +7,7 @@ import * as tmp from 'tmp'; export function createTemporaryFile( extension: string, - temporaryDirectory?: string + temporaryDirectory?: string, ): Promise<{ filePath: string; cleanupCallback: Function }> { // tslint:disable-next-line:no-any const options: any = { postfix: extension }; diff --git a/src/test/utils/interpreters.ts b/src/test/utils/interpreters.ts index c9bf2004c890..e499c85ca96e 100644 --- a/src/test/utils/interpreters.ts +++ b/src/test/utils/interpreters.ts @@ -23,6 +23,6 @@ export function createPythonInterpreter(info?: Partial): Pyth sysPrefix: `someSysPrefix${rnd}`, sysVersion: `1.1.1`, envType: EnvironmentType.Unknown, - ...(info || {}) + ...(info || {}), }; } diff --git a/src/test/workspaceSymbols/common.ts b/src/test/workspaceSymbols/common.ts index b9635d0d139d..765c586cc4da 100644 --- a/src/test/workspaceSymbols/common.ts +++ b/src/test/workspaceSymbols/common.ts @@ -4,7 +4,7 @@ import { PythonSettings } from '../../client/common/configSettings'; export async function enableDisableWorkspaceSymbols( resource: Uri, enabled: boolean, - configTarget: ConfigurationTarget + configTarget: ConfigurationTarget, ) { const settings = workspace.getConfiguration('python', resource); await settings.update('workspaceSymbols.enabled', enabled, configTarget); diff --git a/src/test/workspaceSymbols/generator.unit.test.ts b/src/test/workspaceSymbols/generator.unit.test.ts index 6bfa1d77301a..f9ef24d0c627 100644 --- a/src/test/workspaceSymbols/generator.unit.test.ts +++ b/src/test/workspaceSymbols/generator.unit.test.ts @@ -48,7 +48,7 @@ suite('Workspace Symbols Generator', () => { instance(shell), instance(fs), factory.object, - instance(configurationService) + instance(configurationService), ); }); test('should be disabled', () => { @@ -75,7 +75,7 @@ suite('Workspace Symbols Generator', () => { enabled: true, tagFilePath: '1234', exclusionPatterns: [], - ctagsPath + ctagsPath, } as any; pythonSettings.setup((p) => p.workspaceSymbols).returns(() => workspaceSymbols); when(fs.directoryExists(anything())).thenResolve(true); @@ -84,8 +84,8 @@ suite('Workspace Symbols Generator', () => { subscribe: (cb: (out: Output) => void, _errorCb: any, done: Function) => { cb({ source: 'stderr', out: 'KABOOM' }); done(); - } - } + }, + }, }; when(processService.execObservable(ctagsPath, anything(), anything())).thenReturn(observable as any); @@ -99,7 +99,7 @@ suite('Workspace Symbols Generator', () => { enabled: true, tagFilePath: '1234', exclusionPatterns: [], - ctagsPath + ctagsPath, } as any; pythonSettings.setup((p) => p.workspaceSymbols).returns(() => workspaceSymbols); when(fs.directoryExists(anything())).thenResolve(true); @@ -108,8 +108,8 @@ suite('Workspace Symbols Generator', () => { subscribe: (cb: (out: Output) => void, _errorCb: any, done: Function) => { cb({ source: 'stdout', out: '' }); done(); - } - } + }, + }, }; when(processService.execObservable(ctagsPath, anything(), anything())).thenReturn(observable as any); diff --git a/src/test/workspaceSymbols/main.unit.test.ts b/src/test/workspaceSymbols/main.unit.test.ts index 35b8f101d2d7..6dfd1710bbc9 100644 --- a/src/test/workspaceSymbols/main.unit.test.ts +++ b/src/test/workspaceSymbols/main.unit.test.ts @@ -15,7 +15,7 @@ import { IApplicationShell, ICommandManager, IDocumentManager, - IWorkspaceService + IWorkspaceService, } from '../../client/common/application/types'; import { WorkspaceService } from '../../client/common/application/workspace'; import { ConfigurationService } from '../../client/common/configuration/service'; @@ -40,7 +40,7 @@ suite('Workspace symbols main', () => { const mockDisposable = { dispose: () => { return; - } + }, }; const ctagsPath = 'CTAG_PATH'; const observable = { @@ -48,8 +48,8 @@ suite('Workspace symbols main', () => { subscribe: (cb: (out: Output) => void, _errorCb: any, done: Function) => { cb({ source: 'stdout', out: '' }); done(); - } - } + }, + }, }; let outputChannel: IOutputChannel; @@ -96,17 +96,17 @@ suite('Workspace symbols main', () => { }); when(serviceContainer.get(IOutputChannel, STANDARD_OUTPUT_CHANNEL)).thenReturn( - instance(outputChannel) + instance(outputChannel), ); when(serviceContainer.get(ICommandManager)).thenReturn(instance(commandManager)); when(serviceContainer.get(IFileSystem)).thenReturn(instance(fileSystem)); when(serviceContainer.get(IWorkspaceService)).thenReturn(instance(workspaceService)); when(serviceContainer.get(IProcessServiceFactory)).thenReturn( - instance(processServiceFactory) + instance(processServiceFactory), ); when(serviceContainer.get(IApplicationShell)).thenReturn(instance(applicationShell)); when(serviceContainer.get(IConfigurationService)).thenReturn( - instance(configurationService) + instance(configurationService), ); when(serviceContainer.get(IDocumentManager)).thenReturn(instance(documentManager)); }); @@ -118,7 +118,7 @@ suite('Workspace symbols main', () => { test('Should not rebuild on start if the setting is disabled', () => { when(workspaceService.workspaceFolders).thenReturn(workspaceFolders); when(configurationService.getSettings(anything())).thenReturn({ - workspaceSymbols: { rebuildOnStart: false } + workspaceSymbols: { rebuildOnStart: false }, } as any); workspaceSymbols = new WorkspaceSymbols(instance(serviceContainer)); @@ -129,7 +129,7 @@ suite('Workspace symbols main', () => { test("Should not rebuild on start if we don't have a workspace folder", () => { when(workspaceService.workspaceFolders).thenReturn([]); when(configurationService.getSettings(anything())).thenReturn({ - workspaceSymbols: { rebuildOnStart: false } + workspaceSymbols: { rebuildOnStart: false }, } as any); workspaceSymbols = new WorkspaceSymbols(instance(serviceContainer)); @@ -145,8 +145,8 @@ suite('Workspace symbols main', () => { enabled: true, exclusionPatterns: [], rebuildOnStart: true, - tagFilePath: 'foo' - } + tagFilePath: 'foo', + }, } as any); workspaceSymbols = new WorkspaceSymbols(instance(serviceContainer)); @@ -164,8 +164,8 @@ suite('Workspace symbols main', () => { enabled: true, exclusionPatterns: [], rebuildOnFileSave: true, - tagFilePath: 'foo' - } + tagFilePath: 'foo', + }, } as any); workspaceSymbols = new WorkspaceSymbols(instance(serviceContainer)); @@ -185,8 +185,8 @@ suite('Workspace symbols main', () => { enabled: true, exclusionPatterns: [], rebuildOnFileSave: true, - tagFilePath: 'foo' - } + tagFilePath: 'foo', + }, } as any); reset(commandManager); when(commandManager.registerCommand(anything(), anything())).thenCall((commandID, cb) => { @@ -196,7 +196,7 @@ suite('Workspace symbols main', () => { }); reset(applicationShell); when(applicationShell.setStatusBarMessage(anyString(), anything())).thenThrow( - new Error('Generating workspace tags failed with Error') + new Error('Generating workspace tags failed with Error'), ); workspaceSymbols = new WorkspaceSymbols(instance(serviceContainer)); @@ -215,8 +215,8 @@ suite('Workspace symbols main', () => { enabled: true, exclusionPatterns: [], rebuildOnFileSave: false, - tagFilePath: 'foo' - } + tagFilePath: 'foo', + }, } as any); workspaceSymbols = new WorkspaceSymbols(instance(serviceContainer)); diff --git a/src/test/workspaceSymbols/provider.unit.test.ts b/src/test/workspaceSymbols/provider.unit.test.ts index e2974a21a511..c7c81c902f5a 100644 --- a/src/test/workspaceSymbols/provider.unit.test.ts +++ b/src/test/workspaceSymbols/provider.unit.test.ts @@ -108,12 +108,12 @@ suite('Workspace Symbols Provider', () => { assert.notEqual( symbols.findIndex((sym) => sym.location.uri.fsPath.endsWith('childFile.py')), -1, - 'File with symbol not found in child workspace folder' + 'File with symbol not found in child workspace folder', ); assert.notEqual( symbols.findIndex((sym) => sym.location.uri.fsPath.endsWith('workspace2File.py')), -1, - 'File with symbol not found in child workspace folder' + 'File with symbol not found in child workspace folder', ); const symbolsForMeth = await provider.provideWorkspaceSymbols('meth', new CancellationTokenSource().token); @@ -121,17 +121,17 @@ suite('Workspace Symbols Provider', () => { assert.notEqual( symbolsForMeth.findIndex((sym) => sym.location.uri.fsPath.endsWith('childFile.py')), -1, - 'Symbols not returned for childFile.py' + 'Symbols not returned for childFile.py', ); assert.notEqual( symbolsForMeth.findIndex((sym) => sym.location.uri.fsPath.endsWith('workspace2File.py')), -1, - 'Symbols not returned for workspace2File.py' + 'Symbols not returned for workspace2File.py', ); assert.notEqual( symbolsForMeth.findIndex((sym) => sym.location.uri.fsPath.endsWith('file.py')), -1, - 'Symbols not returned for file.py' + 'Symbols not returned for file.py', ); }); });