Fix circular dependency tree (TypeError: Class extends value undefined is not a constructor or null)

- First moving the mock object import in index.ts resolved the dependency loading order problem where classes were being imported out of order

- Then, removing the getInstallKey function out of the worker prevented loading the vscode module which will always cause a failure in the library tests

- Also cleans up imports and adds whitespace

Some problems remain post refactor which I will fix next
This commit is contained in:
Noah Gilson 2023-11-08 14:51:56 -08:00
Родитель 48ebedcf28
Коммит d7b0ea9bdc
22 изменённых файлов: 156 добавлений и 108 удалений

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

@ -5,7 +5,8 @@
import * as cp from 'child_process';
import * as isOnline from 'is-online';
import * as os from 'os';
import { IEventStream } from '../EventStream/EventStream';
import path = require('path');
import {
DotnetAcquisitionCompleted,
DotnetAcquisitionInstallError,
@ -13,23 +14,21 @@ import {
DotnetAcquisitionScriptOutput,
DotnetAcquisitionTimeoutError,
DotnetAcquisitionUnexpectedError,
DotnetAlternativeCommandFoundEvent,
DotnetCommandFallbackArchitectureEvent,
DotnetCommandNotFoundEvent,
DotnetOfflineFailure,
} from '../EventStream/EventStreamEvents';
import { timeoutConstants } from '../Utils/ErrorHandler';
import { IAcquisitionInvoker } from './IAcquisitionInvoker';
import { IDotnetInstallationContext } from './IDotnetInstallationContext';
import { IInstallScriptAcquisitionWorker } from './IInstallScriptAcquisitionWorker';
import { InstallScriptAcquisitionWorker } from './InstallScriptAcquisitionWorker';
import { TelemetryUtilities } from '../EventStream/TelemetryUtilities';
import { DotnetCoreAcquisitionWorker } from './DotnetCoreAcquisitionWorker';
import { FileUtilities } from '../Utils/FileUtilities';
import { CommandExecutor } from '../Utils/CommandExecutor';
import { IUtilityContext } from '../Utils/IUtilityContext';
import path = require('path');
import { IAcquisitionWorkerContext } from './IAcquisitionWorkerContext';
import { IAcquisitionInvoker } from './IAcquisitionInvoker';
import { IDotnetInstallationContext } from './IDotnetInstallationContext';
import { IInstallScriptAcquisitionWorker } from './IInstallScriptAcquisitionWorker';
export class AcquisitionInvoker extends IAcquisitionInvoker {
protected readonly scriptWorker: IInstallScriptAcquisitionWorker;

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

@ -32,20 +32,21 @@ import {
DotnetFakeSDKEnvironmentVariableTriggered,
SuppressedAcquisitionError
} from '../EventStream/EventStreamEvents';
import { GlobalInstallerResolver } from './GlobalInstallerResolver';
import { WinMacGlobalInstaller } from './WinMacGlobalInstaller';
import { LinuxGlobalInstaller } from './LinuxGlobalInstaller';
import { TelemetryUtilities } from '../EventStream/TelemetryUtilities';
import { Debugging } from '../Utils/Debugging';
import { IDotnetAcquireContext} from '../IDotnetAcquireContext';
import { IGlobalInstaller } from './IGlobalInstaller';
import { IVSCodeExtensionContext } from '../IVSCodeExtensionContext';
import { IUtilityContext } from '../Utils/IUtilityContext';
import { IAcquisitionInvoker } from './IAcquisitionInvoker';
import { IDotnetAcquireResult } from '../IDotnetAcquireResult';
import { IAcquisitionWorkerContext } from './IAcquisitionWorkerContext';
import { IDotnetCoreAcquisitionWorker } from './IDotnetCoreAcquisitionWorker';
import { IDotnetInstallationContext } from './IDotnetInstallationContext';
import { GlobalInstallerResolver } from './GlobalInstallerResolver';
import { WinMacGlobalInstaller } from './WinMacGlobalInstaller';
import { IGlobalInstaller } from './IGlobalInstaller';
import { LinuxGlobalInstaller } from './LinuxGlobalInstaller';
import { Debugging } from '../Utils/Debugging';
import { IDotnetAcquireContext} from '../IDotnetAcquireContext';
import { IVSCodeExtensionContext } from '../IVSCodeExtensionContext';
import { IUtilityContext } from '../Utils/IUtilityContext';
import { TelemetryUtilities } from '../EventStream/TelemetryUtilities';
import { IAcquisitionInvoker } from './IAcquisitionInvoker';
/* tslint:disable:no-any */
export class DotnetCoreAcquisitionWorker implements IDotnetCoreAcquisitionWorker

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

@ -5,9 +5,9 @@
* ------------------------------------------------------------------------------------------ */
import * as path from 'path';
import { CommandExecutor } from '../Utils/CommandExecutor';
import { CommandExecutorCommand } from '../Utils/CommandExecutorCommand';
import { DotnetDistroSupportStatus } from './LinuxVersionResolver';
import { LinuxInstallType } from './LinuxInstallType';
import { CommandExecutorCommand } from '../Utils/ICommandExecutor';
import { IDistroDotnetSDKProvider } from './IDistroDotnetSDKProvider';
/* tslint:disable:no-any */
@ -150,7 +150,7 @@ export class GenericDistroSDKProvider extends IDistroDotnetSDKProvider
if(this.myVersionDetails().hasOwnProperty(this.preinstallCommandKey))
{
// If preinstall commmands exist ( to add the msft feed ) then it's a microsoft feed.
// If preinstall commands exist ( to add the msft feed ) then it's a microsoft feed.
return Promise.resolve(DotnetDistroSupportStatus.Microsoft);
}
else

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

@ -3,10 +3,12 @@
* The .NET Foundation licenses this file to you under the MIT license.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import { WebRequestWorker } from '../Utils/WebRequestWorker';
import * as os from 'os';
import * as path from 'path';
import { WebRequestWorker } from '../Utils/WebRequestWorker';
import { VersionResolver } from './VersionResolver';
import { getInstallKeyFromContext } from '../Utils/InstallKeyGenerator';
import { DotnetFeatureBandDoesNotExistError,
DotnetFileIntegrityCheckEvent,
DotnetInvalidReleasesJSONError,
@ -17,8 +19,8 @@ import { DotnetFeatureBandDoesNotExistError,
DotnetVersionResolutionError
} from '../EventStream/EventStreamEvents';
import { FileUtilities } from '../Utils/FileUtilities';
import { IAcquisitionWorkerContext } from './IAcquisitionWorkerContext';
import { getInstallKeyFromContext } from '..';
/* tslint:disable:no-any */
/* tslint:disable:only-arrow-functions */

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

@ -2,10 +2,10 @@
* Licensed to the .NET Foundation under one or more agreements.
* The .NET Foundation licenses this file to you under the MIT license.
*--------------------------------------------------------------------------------------------*/
import { InstallationValidator } from './InstallationValidator';
import { IEventStream } from '../EventStream/EventStream';
import { IDotnetInstallationContext } from './IDotnetInstallationContext';
import { IInstallationValidator } from './IInstallationValidator';
import { InstallationValidator } from './InstallationValidator';
export abstract class IAcquisitionInvoker {
public readonly installationValidator: IInstallationValidator;

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

@ -8,7 +8,8 @@ import { IExtensionState } from '../IExtensionState';
import { IInstallationDirectoryProvider } from './IInstallationDirectoryProvider';
import { IInstallationValidator } from './IInstallationValidator';
export interface IAcquisitionWorkerContext {
export interface IAcquisitionWorkerContext
{
storagePath: string;
extensionState: IExtensionState;
eventStream: IEventStream;

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

@ -11,11 +11,12 @@ import path = require('path');
import { DistroVersionPair, DotnetDistroSupportStatus } from './LinuxVersionResolver';
import { DotnetAcquisitionDistroUnknownError, DotnetVersionResolutionError } from '../EventStream/EventStreamEvents';
import { VersionResolver } from './VersionResolver';
import { CommandExecutorCommand } from '../Utils/CommandExecutorCommand';
import { DotnetCoreAcquisitionWorker } from './DotnetCoreAcquisitionWorker';
import { CommandExecutor } from '../Utils/CommandExecutor';
import { LinuxInstallType } from './LinuxInstallType';
import { LinuxPackageCollection } from './LinuxPackageCollection';
import { CommandExecutorCommand, ICommandExecutor } from '../Utils/ICommandExecutor';
import { ICommandExecutor } from '../Utils/ICommandExecutor';
import { IAcquisitionWorkerContext } from './IAcquisitionWorkerContext';
import { IUtilityContext } from '../Utils/IUtilityContext';
/* tslint:disable:no-any */

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

@ -5,26 +5,18 @@
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import * as lockfile from 'proper-lockfile';
import { IEventStream } from '../EventStream/EventStream';
import {
DotnetFallbackInstallScriptUsed,
DotnetFileWriteRequestEvent,
DotnetInstallScriptAcquisitionCompleted,
DotnetInstallScriptAcquisitionError,
DotnetLockAcquiredEvent,
DotnetLockAttemptingAcquireEvent,
DotnetLockErrorEvent,
DotnetLockReleasedEvent,
} from '../EventStream/EventStreamEvents';
import { IExtensionState } from '../IExtensionState';
import { WebRequestWorker } from '../Utils/WebRequestWorker';
import { Debugging } from '../Utils/Debugging';
import { IInstallScriptAcquisitionWorker } from './IInstallScriptAcquisitionWorker';
import { FileUtilities } from '../Utils/FileUtilities';
import { DotnetCoreAcquisitionWorker } from './DotnetCoreAcquisitionWorker';
import { getInstallKeyFromContext } from '../Utils/InstallKeyGenerator';
import { IInstallScriptAcquisitionWorker } from './IInstallScriptAcquisitionWorker';
import { IAcquisitionWorkerContext } from './IAcquisitionWorkerContext';
import { IDotnetAcquireContext, getInstallKeyFromContext } from '..';
export class InstallScriptAcquisitionWorker implements IInstallScriptAcquisitionWorker {
protected webWorker: WebRequestWorker;

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

@ -5,16 +5,23 @@
* ------------------------------------------------------------------------------------------ */
import * as fs from 'fs';
import path = require('path');
import { DotnetAcquisitionDistroUnknownError, DotnetConflictingLinuxInstallTypesError, DotnetCustomLinuxInstallExistsError } from '../EventStream/EventStreamEvents';
import
{
DotnetAcquisitionDistroUnknownError,
DotnetConflictingLinuxInstallTypesError,
DotnetCustomLinuxInstallExistsError
} from '../EventStream/EventStreamEvents';
import { GenericDistroSDKProvider } from './GenericDistroSDKProvider'
import { VersionResolver } from './VersionResolver';
import { CommandExecutor } from '../Utils/CommandExecutor';
import { RedHatDistroSDKProvider } from './RedHatDistroSDKProvider';
import { IAcquisitionWorkerContext } from './IAcquisitionWorkerContext';
import { IDistroDotnetSDKProvider } from './IDistroDotnetSDKProvider';
import { ICommandExecutor } from '../Utils/ICommandExecutor';
import { IUtilityContext } from '../Utils/IUtilityContext';
import { IDotnetAcquireContext, getInstallKeyFromContext } from '../IDotnetAcquireContext'
import { RedHatDistroSDKProvider } from './RedHatDistroSDKProvider';
import { IDotnetAcquireContext } from '../IDotnetAcquireContext'
import { getInstallKeyFromContext } from '../Utils/InstallKeyGenerator';
/**
* An enumeration type representing all distros with their versions that we recognize.

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

@ -4,16 +4,18 @@
*--------------------------------------------------------------------------------------------*/
import * as semver from 'semver';
import { IEventStream } from '../EventStream/EventStream';
import {
DotnetFeatureBandDoesNotExistError,
DotnetInvalidReleasesJSONError,
DotnetOfflineFailure,
DotnetVersionResolutionCompleted,
DotnetVersionResolutionError,
DotnetVersionParseEvent
} from '../EventStream/EventStreamEvents';
import { IExtensionState } from '../IExtensionState';
import { WebRequestWorker } from '../Utils/WebRequestWorker';
import { getInstallKeyFromContext } from '../Utils/InstallKeyGenerator';
import { Debugging } from '../Utils/Debugging';
import { IVersionResolver } from './IVersionResolver';
import { DotnetVersionSupportPhase,
DotnetVersionSupportStatus,
@ -21,9 +23,7 @@ import { DotnetVersionSupportPhase,
IDotnetListVersionsResult,
IDotnetVersion
} from '../IDotnetListVersionsContext';
import { Debugging } from '../Utils/Debugging';
import { IAcquisitionWorkerContext } from './IAcquisitionWorkerContext';
import { DotnetVersionParseEvent, SuppressedAcquisitionError, getInstallKeyFromContext } from '..';
/* tslint:disable:no-any */
export class VersionResolver implements IVersionResolver {

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

@ -7,16 +7,23 @@ import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import { FileUtilities } from '../Utils/FileUtilities';
import { IGlobalInstaller } from './IGlobalInstaller';
import { IAcquisitionWorkerContext } from './IAcquisitionWorkerContext';
import { VersionResolver } from './VersionResolver';
import { DotnetConflictingGlobalWindowsInstallError, DotnetFileIntegrityCheckEvent, DotnetUnexpectedInstallerOSError, OSXOpenNotAvailableError, SuppressedAcquisitionError } from '../EventStream/EventStreamEvents';
import { ICommandExecutor } from '../Utils/ICommandExecutor';
import { CommandExecutor } from '../Utils/CommandExecutor';
import { IFileUtilities } from '../Utils/IFileUtilities';
import { WebRequestWorker } from '../Utils/WebRequestWorker';
import { getInstallKeyFromContext } from '../Utils/InstallKeyGenerator';
import { CommandExecutor } from '../Utils/CommandExecutor';
import {
DotnetConflictingGlobalWindowsInstallError,
DotnetFileIntegrityCheckEvent,
DotnetUnexpectedInstallerOSError,
OSXOpenNotAvailableError,
SuppressedAcquisitionError
} from '../EventStream/EventStreamEvents';
import { IGlobalInstaller } from './IGlobalInstaller';
import { ICommandExecutor } from '../Utils/ICommandExecutor';
import { IFileUtilities } from '../Utils/IFileUtilities';
import { IUtilityContext } from '../Utils/IUtilityContext';
import { DotnetCoreAcquisitionWorker, getInstallKeyFromContext } from '..';
import { IAcquisitionWorkerContext } from './IAcquisitionWorkerContext';
/* tslint:disable:only-arrow-functions */
/* tslint:disable:no-empty */
/* tslint:disable:no-any */

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

@ -6,7 +6,8 @@
import { DotnetCoreAcquisitionWorker } from './Acquisition/DotnetCoreAcquisitionWorker';
import { AcquireErrorConfiguration } from './Utils/ErrorHandler';
export interface IDotnetAcquireContext {
export interface IDotnetAcquireContext
{
/**
* @remarks
* The data required to acquire either the sdk or the runtime.
@ -42,9 +43,4 @@ export interface IDotnetAcquireContext {
* @remarks
* Defines if an install should be global on the machine or local to a specific local folder/user.
*/
export type DotnetInstallType = 'local' | 'global';
export function getInstallKeyFromContext(ctx : IDotnetAcquireContext) : string
{
return DotnetCoreAcquisitionWorker.getInstallKeyCustomArchitecture(ctx.version, ctx.architecture, ctx.installType ? ctx.installType === 'global' : false);
}
export type DotnetInstallType = 'local' | 'global';

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

@ -5,8 +5,8 @@
* ------------------------------------------------------------------------------------------ */
import * as proc from 'child_process';
import * as fs from 'fs';
import open = require('open');
import * as os from 'os';
import open = require('open');
import path = require('path');
import {
@ -23,12 +23,15 @@ import {
DotnetWSLSecurityError
} from '../EventStream/EventStreamEvents';
import {exec} from '@vscode/sudo-prompt';
import { CommandExecutorCommand } from './CommandExecutorCommand';
import { getInstallKeyFromContext } from '../Utils/InstallKeyGenerator';
import { ICommandExecutor } from './ICommandExecutor';
import { IVSCodeExtensionContext } from '../IVSCodeExtensionContext';
import { IUtilityContext } from './IUtilityContext';
import { IVSCodeExtensionContext } from '../IVSCodeExtensionContext';
import { IWindowDisplayWorker } from '../EventStream/IWindowDisplayWorker';
import { CommandExecutorCommand } from './ICommandExecutor';
import { getInstallKeyFromContext } from '../IDotnetAcquireContext';
import { IAcquisitionWorkerContext } from '../Acquisition/IAcquisitionWorkerContext';
/* tslint:disable:no-any */

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

@ -0,0 +1,20 @@
/* --------------------------------------------------------------------------------------------
* Licensed to the .NET Foundation under one or more agreements.
* The .NET Foundation licenses this file to you under the MIT license.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
export type CommandExecutorCommand =
{
/**
* @property commandRoot
* The command first 'word' to run, example: 'dotnet --info' has a first word of 'dotnet'
* @property commandParts
* The remaining strings in the command to execute, example: 'dotnet build foo.csproj' will be ['build', 'foo.csproj']
* @property runUnderSudo
* Use this if the command should be executed under sudo on linux.
*/
commandRoot : string,
commandParts : string[],
runUnderSudo : boolean
}

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

@ -7,13 +7,15 @@ import * as open from 'open';
import {
DotnetCommandFailed,
DotnetCommandSucceeded,
DotnetNotInstallRelatedCommandFailed
} from '../EventStream/EventStreamEvents';
import { getInstallKeyFromContext } from '../Utils/InstallKeyGenerator';
import { ExistingPathKeys, IExistingPath } from '../IExtensionContext';
import { IIssueContext } from './IIssueContext';
import { formatIssueUrl } from './IssueReporter';
import { DotnetNotInstallRelatedCommandFailed } from '../EventStream/EventStreamEvents';
import { IAcquisitionWorkerContext } from '../Acquisition/IAcquisitionWorkerContext';
import { getInstallKeyFromContext } from '../IDotnetAcquireContext';
export enum AcquireErrorConfiguration {
DisplayAllErrorPopups = 0,

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

@ -1,30 +1,15 @@
/* --------------------------------------------------------------------------------------------
* Licensed to the .NET Foundation under one or more agreements.
* The .NET Foundation licenses this file to you under the MIT license.
* The .NET Foundation licenses this file to you under the MIT license.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/* tslint:disable:no-any */
/*
tslint:disable:no-any */
import { IDotnetAcquireContext } from '..';
import { CommandExecutorCommand } from './CommandExecutorCommand';
import { IAcquisitionWorkerContext } from '../Acquisition/IAcquisitionWorkerContext';
import { IEventStream } from '../EventStream/EventStream';
import { IUtilityContext } from './IUtilityContext';
export type CommandExecutorCommand =
{
/**
* @property commandRoot
* The command first 'word' to run, example: 'dotnet --info' has a first word of 'dotnet'
* @property commandParts
* The remaining strings in the command to execute, example: 'dotnet build foo.csproj' will be ['build', 'foo.csproj']
* @property runUnderSudo
* Use this if the command should be executed under sudo on linux.
*/
commandRoot : string,
commandParts : string[],
runUnderSudo : boolean
}
export abstract class ICommandExecutor
{
constructor(protected readonly context : IAcquisitionWorkerContext, utilContext : IUtilityContext)

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

@ -0,0 +1,13 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import { DotnetCoreAcquisitionWorker } from "../Acquisition/DotnetCoreAcquisitionWorker";
import { IDotnetAcquireContext } from "../IDotnetAcquireContext";
export function getInstallKeyFromContext(ctx : IDotnetAcquireContext) : string
{
return DotnetCoreAcquisitionWorker.getInstallKeyCustomArchitecture(ctx.version, ctx.architecture,
ctx.installType ? ctx.installType === 'global' : false);
}

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

@ -2,19 +2,20 @@
* Licensed to the .NET Foundation under one or more agreements.
* The .NET Foundation licenses this file to you under the MIT license.
*--------------------------------------------------------------------------------------------*/
import * as fs from 'fs';
import Axios from 'axios';
import axiosRetry from 'axios-retry';
import { promisify } from 'util';
import stream = require('stream');
import { HttpsProxyAgent } from 'https-proxy-agent';
import { getProxySettings } from 'get-proxy-settings';
import { AxiosCacheInstance, buildStorage, setupCache, StorageValue } from 'axios-cache-interceptor';
import {SuppressedAcquisitionError, WebRequestError, WebRequestSent } from '../EventStream/EventStreamEvents';
import { getInstallKeyFromContext } from '../Utils/InstallKeyGenerator';
import { IExtensionState } from '../IExtensionState';
import { Debugging } from '../Utils/Debugging';
import * as fs from 'fs';
import { promisify } from 'util';
import stream = require('stream');
import { getInstallKeyFromContext } from '../IDotnetAcquireContext';
import { IAcquisitionWorkerContext } from '../Acquisition/IAcquisitionWorkerContext';
import { Debugging } from '../Utils/Debugging';
/* tslint:disable:no-any */
/*

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

@ -3,10 +3,6 @@
* The .NET Foundation licenses this file to you under the MIT license.
*--------------------------------------------------------------------------------------------*/
export * from './test/mocks/MockObjects';
export * from './test/mocks/MockWindowDisplayWorker';
export * from './test/mocks/MockEnvironmentVariableCollection';
export * from './test/unit/TestUtility';
export * from './IExtensionContext';
export * from './IDotnetAcquireContext';
export * from './IDotnetListVersionsContext';
@ -25,6 +21,7 @@ export * from './EventStream/EventStreamEvents';
export * from './Utils/CommandExecutor';
export * from './Utils/Debugging';
export * from './Utils/ErrorHandler';
export * from './Utils/ExtensionConfigurationWorker';
export * from './Utils/FileUtilities';
export * from './Utils/ICommandExecutor';
export * from './Utils/IFileUtilities';
@ -45,8 +42,10 @@ export * from './Acquisition/IVersionResolver';
export * from './Acquisition/LinuxGlobalInstaller';
export * from './Acquisition/VersionResolver';
export * from './Acquisition/WinMacGlobalInstaller';
export * from './Utils/ExtensionConfigurationWorker';
export * from './Utils/WebRequestWorker';
export * from './Acquisition/ExistingPathResolver';
export * from './Acquisition/SdkInstallationDirectoryProvider';
export * from './Acquisition/RuntimeInstallationDirectoryProvider';
export * from './test/mocks/MockObjects';
export * from './test/mocks/MockWindowDisplayWorker';
export * from './test/mocks/MockEnvironmentVariableCollection';
export * from './test/unit/TestUtility';

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

@ -5,32 +5,34 @@
import * as fs from 'fs';
import * as path from 'path';
import { IAcquisitionInvoker } from '../../Acquisition/IAcquisitionInvoker';
import { IDotnetInstallationContext } from '../../Acquisition/IDotnetInstallationContext';
import { IInstallationValidator } from '../../Acquisition/IInstallationValidator';
import { InstallScriptAcquisitionWorker } from '../../Acquisition/InstallScriptAcquisitionWorker';
import { VersionResolver } from '../../Acquisition/VersionResolver';
import { IEventStream } from '../../EventStream/EventStream';
import { DotnetCoreAcquisitionWorker } from '../../Acquisition/DotnetCoreAcquisitionWorker';
import { DotnetAcquisitionCompleted, TestAcquireCalled } from '../../EventStream/EventStreamEvents';
import { IEvent } from '../../EventStream/IEvent';
import { ILoggingObserver } from '../../EventStream/ILoggingObserver';
import { ITelemetryReporter } from '../../EventStream/TelemetryObserver';
import { IExistingPath, IExtensionConfiguration } from '../../IExtensionContext';
import { IExtensionState } from '../../IExtensionState';
import { FileUtilities } from '../../Utils/FileUtilities';
import { WebRequestWorker } from '../../Utils/WebRequestWorker';
import { CommandExecutorCommand, ICommandExecutor } from '../../Utils/ICommandExecutor';
import { CommandExecutor } from '../../Utils/CommandExecutor';
import { AcquisitionInvoker } from '../../Acquisition/AcquisitionInvoker';
import { LinuxInstallType } from '../../Acquisition/LinuxInstallType';
import { GenericDistroSDKProvider } from '../../Acquisition/GenericDistroSDKProvider';
import { getMockUtilityContext } from '../unit/TestUtility';
import { DistroVersionPair, DotnetDistroSupportStatus } from '../../Acquisition/LinuxVersionResolver';
import { CommandExecutorCommand } from '../../Utils/CommandExecutorCommand';
import { IAcquisitionInvoker } from '../../Acquisition/IAcquisitionInvoker';
import { ICommandExecutor } from '../../Utils/ICommandExecutor';
import { IEvent } from '../../EventStream/IEvent';
import { IEventStream } from '../../EventStream/EventStream';
import { IExistingPath, IExtensionConfiguration } from '../../IExtensionContext';
import { IExtensionState } from '../../IExtensionState';
import { IDotnetInstallationContext } from '../../Acquisition/IDotnetInstallationContext';
import { IInstallationValidator } from '../../Acquisition/IInstallationValidator';
import { IDistroDotnetSDKProvider } from '../../Acquisition/IDistroDotnetSDKProvider';
import { ILoggingObserver } from '../../EventStream/ILoggingObserver';
import { IAcquisitionWorkerContext } from '../../Acquisition/IAcquisitionWorkerContext';
import { FileUtilities } from '../../Utils/FileUtilities';
import { IFileUtilities } from '../../Utils/IFileUtilities';
import { IVSCodeExtensionContext } from '../../IVSCodeExtensionContext';
import { ITelemetryReporter } from '../../EventStream/TelemetryObserver';
import { IUtilityContext } from '../../Utils/IUtilityContext';
import { IVSCodeEnvironment } from '../../Utils/IVSCodeEnvironment';

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

@ -4,14 +4,16 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import { IDotnetAcquireContext } from '../../IDotnetAcquireContext';
import { IAcquisitionWorkerContext } from '../../Acquisition/IAcquisitionWorkerContext';
import { RuntimeInstallationDirectoryProvider } from '../../Acquisition/RuntimeInstallationDirectoryProvider';
import { SdkInstallationDirectoryProvider } from '../../Acquisition/SdkInstallationDirectoryProvider';
import { IUtilityContext } from '../../Utils/IUtilityContext';
import { MockDotnetCoreAcquisitionWorker, MockEventStream, MockExtensionContext, MockInstallationValidator, MockVSCodeEnvironment, MockVSCodeExtensionContext, NoInstallAcquisitionInvoker } from '../mocks/MockObjects';
import { MockWindowDisplayWorker } from '../mocks/MockWindowDisplayWorker';
import { MockDotnetCoreAcquisitionWorker, MockEventStream, MockExtensionContext, MockInstallationValidator, MockVSCodeEnvironment, MockVSCodeExtensionContext } from '../mocks/MockObjects';
import { IDotnetAcquireContext } from '../../IDotnetAcquireContext';
import { IAcquisitionWorkerContext } from '../../Acquisition/IAcquisitionWorkerContext';
import { IEventStream } from '../../EventStream/EventStream';
import { IUtilityContext } from '../../Utils/IUtilityContext';
const standardTimeoutTime = 100000;
export function getMockAcquisitionContext(runtimeInstall: boolean, timeoutTime : number = standardTimeoutTime, customEventStream? : IEventStream,

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

@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as path from 'path';
import * as os from 'os';
import { runTests } from 'vscode-test';
@ -16,9 +17,23 @@ async function main() {
// The path to the extension test runner script
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, './index');
let platformValue = '';
switch(os.platform())
{
case 'win32':
platformValue = 'win32-x64-archive';
break;
case 'darwin':
platformValue = 'darwin';
break;
case 'linux':
platformValue = 'linux-x64';
break;
}
// Download VS Code, unzip it and run the integration test
await runTests({
...(platformValue !== '' && {platform: platformValue}),
extensionDevelopmentPath,
extensionTestsPath,
launchArgs: [