From 6ce1d1a9045c5a200c6da874cfcfbf90977719da Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Wed, 21 Aug 2024 10:55:28 -0400 Subject: [PATCH 1/7] WIP Remove remaining references to V1 profiles Signed-off-by: Timothy Johnson --- .../cli-test-utils/src/TestUtils.ts | 4 +- __tests__/__src__/TestConstants.ts | 25 ++ __tests__/__src__/mocks/ZosmfProfileMock.ts | 55 ---- .../DeleteInstance.handler.unit.test.ts | 8 +- .../CatalogTemplates.handler.unit.test.ts | 8 +- .../InstanceInfo.handler.unit.test.ts | 8 +- .../InstanceVariables.handler.unit.test.ts | 8 +- .../RegistryInstances.handler.unit.test.ts | 8 +- .../TemplateInfo.handler.unit.test.ts | 8 +- .../action/Action.handler.unit.test.ts | 8 +- .../template/Template.handler.unit.test.ts | 8 +- .../compare/ds/Dataset.handler.unit.test.ts | 2 +- .../LocalfileDataset.handler.unit.test.ts | 2 +- .../LocalfileSpooldd.handler.unit.test.ts | 2 +- .../lf-uss/LocalfileUss.handler.unit.test.ts | 2 +- .../compare/sdd/Spooldd.handler.unit.test.ts | 2 +- .../compare/uss/UssFile.handler.unit.test.ts | 2 +- .../dsclp/TargetProfile.handler.unit.test.ts | 8 +- .../binaryPds/BinaryPDS.handler.unit.test.ts | 2 +- .../create/cPds/CPDS.handler.unit.test.ts | 2 +- .../ClassicPDS.handler.unit.test.ts | 2 +- .../create/ds/ds.handler.unit.test.ts | 2 +- .../create/pds/Pds.handler.unit.test.ts | 2 +- .../create/ps/Ps.handler.unit.test.ts | 2 +- .../create/ussDir/ussDir.handler.unit.test.ts | 2 +- .../ussFile/ussFile.handler.unit.test.ts | 2 +- .../create/vsam/Vsam.handler.unit.test.ts | 2 +- .../create/zfs/zfs.handler.unit.test.ts | 2 +- .../am/AllMembers.handler.unit.test.ts | 2 +- .../download/ds/Dataset.handler.unit.test.ts | 2 +- .../dsm/DataSetMatching.handler.unit.test.ts | 5 +- .../download/uss/UssFile.handler.unit.test.ts | 2 +- .../ussdir/UssDir.handler.unit.test.ts | 2 +- .../__unit__/edit/Edit.handler.unit.test.ts | 5 +- .../__unit__/edit/Edit.utils.unit.test.ts | 8 +- .../amsFile/AmsFile.handler.unit.test.ts | 2 +- .../AmsStatements.handler.unit.test.ts | 2 +- .../list/am/AllMembers.handler.unit.test.ts | 2 +- .../list/ds/Dataset.handler.unit.test.ts | 2 +- .../__unit__/list/fs/Fs.handler.unit.test.ts | 2 +- .../list/uss/Uss.handler.unit.test.ts | 2 +- .../__unit__/mount/fs/fs.handler.unit.test.ts | 2 +- .../search/ds/Datasets.handler.unit.test.ts | 2 +- .../upload/dtp/DirToPds.handler.unit.test.ts | 2 +- .../upload/dtu/DirToUSS.handler.unit.test.ts | 2 +- .../ftds/FileToDataSet.handler.unit.test.ts | 2 +- .../upload/ftu/FileToUSS.handler.unit.test.ts | 2 +- .../stds/StdinToDataSet.handler.unit.test.ts | 2 +- .../view/ds/Dataset.handler.unit.test.ts | 2 +- .../view/uss/USSFiles.handler.unit.test.ts | 2 +- .../cancel/job/Job.handler.unit.test.ts | 8 +- .../delete/job/Job.handler.unit.test.ts | 8 +- .../old-jobs/OldJobs.handler.unit.test.ts | 8 +- .../Output.handler.unit.test.ts | 8 +- .../list/jobs/Jobs.handler.unit.test.ts | 8 +- .../SpoolFilesByJobid.handler.unit.test.ts | 8 +- .../modify/job/Job.handler.unit.test.ts | 8 +- .../search/job/JobSearch.handler.unit.test.ts | 8 +- .../submit/Submit.shared.handler.unit.test.ts | 14 +- .../AllSpoolContent.handler.unit.test.ts | 5 +- .../job/JobStatusByJobid.handler.unit.test.ts | 8 +- .../SpoolFileById.handler.unit.test.ts | 5 +- .../list/logs/Logs.handler.unit.test.ts | 8 +- .../check/status/Status.handler.unit.test.ts | 8 +- .../list/systems/Systems.handler.unit.test.ts | 8 +- .../command/Command.handler.unit.test.ts | 9 +- .../AddressSpace.handler.unit.test.ts | 8 +- .../AddressSpace.handler.unit.test.ts | 8 +- .../AddressSpace.handler.unit.test.ts | 28 +- .../AddressSpace.handler.unit.test.ts | 8 +- .../issue/ssh/Ssh.handler.unit.test.ts | 55 +--- ...i.invalid.profile-spec.integration.test.ts | 40 --- .../cli/invalid/__scripts__/profile-spec.sh | 3 - .../Cmd.cli.root.integration.test.ts.snap | 9 - .../cmd/src/cli/invalid/Invalid.definition.ts | 4 +- .../profile-spec/ProfileSpec.definition.ts | 21 -- .../profile-spec/ProfileSpec.handler.ts | 19 -- .../cmd/src/cli/read/Read.definition.ts | 23 -- .../cli/read/profile/Profile.definition.ts | 23 -- .../src/cli/read/profile/Profile.handler.ts | 20 -- .../CliProfileManager.integration.test.ts | 2 + .../__tests__/CommandProcessor.unit.test.ts | 309 ++---------------- .../profiles/CliProfileManager.unit.test.ts | 2 + .../CommandProfileLoader.unit.test.ts | 2 + .../profiles/CommandProfiles.unit.test.ts | 2 + .../profileHandlers/AddTwoNumbersHandler.ts | 20 -- .../profileHandlers/DoNothingHandler.ts | 19 -- .../profileHandlers/ThrowErrorHandler.ts | 18 - .../src/cmd/src/CommandProcessor.ts | 179 +++------- .../cmd/src/doc/handler/IHandlerParameters.ts | 10 - .../doc/response/response/ICommandPrepared.ts | 33 -- .../src/cmd/src/profiles/CliProfileManager.ts | 1 + .../cmd/src/profiles/CommandProfileLoader.ts | 4 + .../src/cmd/src/profiles/CommandProfiles.ts | 1 + .../DefaultRootCommandHandler.unit.test.ts | 3 - .../src/imperative/src/api/ImperativeApi.ts | 15 - .../utilities/__tests__/CliUtils.unit.test.ts | 9 + .../imperative/src/utilities/src/CliUtils.ts | 82 ++++- .../__unit__/SshBaseHandler.unit.test.ts | 55 +--- 99 files changed, 310 insertions(+), 1098 deletions(-) create mode 100644 __tests__/__src__/TestConstants.ts delete mode 100644 __tests__/__src__/mocks/ZosmfProfileMock.ts delete mode 100644 packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/Cmd.cli.invalid.profile-spec.integration.test.ts delete mode 100644 packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__scripts__/profile-spec.sh delete mode 100644 packages/imperative/__tests__/__integration__/cmd/src/cli/invalid/profile-spec/ProfileSpec.definition.ts delete mode 100644 packages/imperative/__tests__/__integration__/cmd/src/cli/invalid/profile-spec/ProfileSpec.handler.ts delete mode 100644 packages/imperative/__tests__/__integration__/cmd/src/cli/read/Read.definition.ts delete mode 100644 packages/imperative/__tests__/__integration__/cmd/src/cli/read/profile/Profile.definition.ts delete mode 100644 packages/imperative/__tests__/__integration__/cmd/src/cli/read/profile/Profile.handler.ts delete mode 100644 packages/imperative/src/cmd/__tests__/profiles/profileHandlers/AddTwoNumbersHandler.ts delete mode 100644 packages/imperative/src/cmd/__tests__/profiles/profileHandlers/DoNothingHandler.ts delete mode 100644 packages/imperative/src/cmd/__tests__/profiles/profileHandlers/ThrowErrorHandler.ts delete mode 100644 packages/imperative/src/cmd/src/doc/response/response/ICommandPrepared.ts diff --git a/__tests__/__packages__/cli-test-utils/src/TestUtils.ts b/__tests__/__packages__/cli-test-utils/src/TestUtils.ts index 30d3fc0eb6..6952abcc7c 100644 --- a/__tests__/__packages__/cli-test-utils/src/TestUtils.ts +++ b/__tests__/__packages__/cli-test-utils/src/TestUtils.ts @@ -12,7 +12,7 @@ import * as fs from "fs"; import { spawnSync, SpawnSyncReturns, ExecFileException } from "child_process"; import { ITestEnvironment } from "./environment/doc/response/ITestEnvironment"; -import { CommandProfiles, ICommandDefinition, IHandlerParameters } from "@zowe/imperative"; +import { ICommandDefinition, IHandlerParameters } from "@zowe/imperative"; /** * Execute a CLI script @@ -135,8 +135,6 @@ export function mockHandlerParameters(params: PartialHandlerParameters): IHandle ...params.arguments || {} }, positionals: params.positionals || [], - // eslint-disable-next-line deprecation/deprecation - profiles: params.profiles || new CommandProfiles(new Map()), definition: params.definition, fullDefinition: params.definition, stdin: process.stdin, diff --git a/__tests__/__src__/TestConstants.ts b/__tests__/__src__/TestConstants.ts new file mode 100644 index 0000000000..e87e89998a --- /dev/null +++ b/__tests__/__src__/TestConstants.ts @@ -0,0 +1,25 @@ +/* +* This program and the accompanying materials are made available under the terms of the +* Eclipse Public License v2.0 which accompanies this distribution, and is available at +* https://www.eclipse.org/legal/epl-v20.html +* +* SPDX-License-Identifier: EPL-2.0 +* +* Copyright Contributors to the Zowe Project. +* +*/ + +// Some test constants that are needed by multiple packages for unit tests + +// Mocked profile options to be added to args +export const UNIT_TEST_ZOSMF_PROF_OPTS = { + host: "somewhere.com", + port: "43443", + user: "someone", + password: "somesecret" +}; + +export const UNIT_TEST_TSO_PROF_OPTS = { + password: "fake", + account: "fake" +}; diff --git a/__tests__/__src__/mocks/ZosmfProfileMock.ts b/__tests__/__src__/mocks/ZosmfProfileMock.ts deleted file mode 100644 index 844d10a7f6..0000000000 --- a/__tests__/__src__/mocks/ZosmfProfileMock.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { IProfile, CommandProfiles } from "@zowe/imperative"; -// Some test constants that are needed by multiple packages for unit tests - -// Mocked profile options to be added to args -export const UNIT_TEST_ZOSMF_PROF_OPTS = { - host: "somewhere.com", - port: "43443", - user: "someone", - password: "somesecret" -}; - -export const UNIT_TEST_TSO_PROF_OPTS = { - password: "fake", - account: "fake" -}; - -// A mocked profile map with zosmf profile -export const UNIT_TEST_PROFILE_MAP = new Map(); -UNIT_TEST_PROFILE_MAP.set( - "zosmf", [{ - name: "zosmf", - type: "zosmf", - ...UNIT_TEST_ZOSMF_PROF_OPTS - }] -); -export const UNIT_TEST_PROFILES_ZOSMF: CommandProfiles = new CommandProfiles(UNIT_TEST_PROFILE_MAP); - -// A mocked profile map with both -export const UNIT_TEST_PROFILE_MAP_ZOSMF_TSO = new Map(); -UNIT_TEST_PROFILE_MAP_ZOSMF_TSO.set( - "zosmf", [{ - name: "zosmf", - type: "zosmf", - ...UNIT_TEST_ZOSMF_PROF_OPTS - }] -); -UNIT_TEST_PROFILE_MAP_ZOSMF_TSO.set( - "tso", [{ - name: "tso", - type: "tso", - ...UNIT_TEST_TSO_PROF_OPTS - }] -); -export const UNIT_TEST_PROFILES_ZOSMF_TSO: CommandProfiles = new CommandProfiles(UNIT_TEST_PROFILE_MAP_ZOSMF_TSO); diff --git a/packages/cli/__tests__/provisioning/__unit__/delete/instance/DeleteInstance.handler.unit.test.ts b/packages/cli/__tests__/provisioning/__unit__/delete/instance/DeleteInstance.handler.unit.test.ts index 383b7df853..a82af61b33 100644 --- a/packages/cli/__tests__/provisioning/__unit__/delete/instance/DeleteInstance.handler.unit.test.ts +++ b/packages/cli/__tests__/provisioning/__unit__/delete/instance/DeleteInstance.handler.unit.test.ts @@ -19,17 +19,13 @@ import { ListRegistryInstances, ProvisioningConstants } from "@zowe/provisioning-for-zowe-sdk"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["provisioning", "delete", "instance"], - definition: DeleteInstanceDefinition.DeleteInstanceDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: DeleteInstanceDefinition.DeleteInstanceDefinition }); describe("delete deprovisioned instance handler tests", () => { diff --git a/packages/cli/__tests__/provisioning/__unit__/list/catalogTemplates/CatalogTemplates.handler.unit.test.ts b/packages/cli/__tests__/provisioning/__unit__/list/catalogTemplates/CatalogTemplates.handler.unit.test.ts index ee68d4ddc1..ad11da8448 100644 --- a/packages/cli/__tests__/provisioning/__unit__/list/catalogTemplates/CatalogTemplates.handler.unit.test.ts +++ b/packages/cli/__tests__/provisioning/__unit__/list/catalogTemplates/CatalogTemplates.handler.unit.test.ts @@ -14,10 +14,7 @@ import { ListCatalogTemplates } from "@zowe/provisioning-for-zowe-sdk"; import { IHandlerParameters } from "@zowe/imperative"; import * as Handler from "../../../../../src/provisioning/list/catalogTemplates/CatalogTemplates.handler"; import { catalogTemplates } from "../../../../../src/provisioning/list/catalogTemplates/CatalogTemplates.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; jest.mock("../../../../../../../packages/provisioning/src/ListCatalogTemplates"); @@ -25,8 +22,7 @@ jest.mock("../../../../../../../packages/provisioning/src/ListCatalogTemplates") const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["provisioning", "list", "catalog-templates"], - definition: catalogTemplates, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: catalogTemplates }); describe("list catalog templates handler tests", () => { diff --git a/packages/cli/__tests__/provisioning/__unit__/list/instanceInfo/InstanceInfo.handler.unit.test.ts b/packages/cli/__tests__/provisioning/__unit__/list/instanceInfo/InstanceInfo.handler.unit.test.ts index a590bc1d97..b0c60c198d 100644 --- a/packages/cli/__tests__/provisioning/__unit__/list/instanceInfo/InstanceInfo.handler.unit.test.ts +++ b/packages/cli/__tests__/provisioning/__unit__/list/instanceInfo/InstanceInfo.handler.unit.test.ts @@ -18,17 +18,13 @@ import { import * as Handler from "../../../../../src/provisioning/list/instanceInfo/InstanceInfo.handler"; import { instanceInfo } from "../../../../../src/provisioning/list/instanceInfo/InstanceInfo.definition"; import { ProvisioningListMocks } from "../../../__resources__/ProvisioningListMocks"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["provisioning", "list", "instance-info"], - definition: instanceInfo, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: instanceInfo }); describe("list instance info handler tests", () => { diff --git a/packages/cli/__tests__/provisioning/__unit__/list/instanceVars/InstanceVariables.handler.unit.test.ts b/packages/cli/__tests__/provisioning/__unit__/list/instanceVars/InstanceVariables.handler.unit.test.ts index 631ec695a0..ac0b24d4b9 100644 --- a/packages/cli/__tests__/provisioning/__unit__/list/instanceVars/InstanceVariables.handler.unit.test.ts +++ b/packages/cli/__tests__/provisioning/__unit__/list/instanceVars/InstanceVariables.handler.unit.test.ts @@ -16,17 +16,13 @@ import { IHandlerParameters } from "@zowe/imperative"; import * as Handler from "../../../../../src/provisioning/list/instanceVariables/InstanceVariables.handler"; import { instanceVariables } from "../../../../../src/provisioning/list/instanceVariables/InstanceVariables.definition"; import { ProvisioningListMocks } from "../../../__resources__/ProvisioningListMocks"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["provisioning", "list", "instance-variables"], - definition: instanceVariables, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: instanceVariables }); describe("list instance variables handler tests", () => { diff --git a/packages/cli/__tests__/provisioning/__unit__/list/registryInstances/RegistryInstances.handler.unit.test.ts b/packages/cli/__tests__/provisioning/__unit__/list/registryInstances/RegistryInstances.handler.unit.test.ts index b333e6cb3b..8136f7560b 100644 --- a/packages/cli/__tests__/provisioning/__unit__/list/registryInstances/RegistryInstances.handler.unit.test.ts +++ b/packages/cli/__tests__/provisioning/__unit__/list/registryInstances/RegistryInstances.handler.unit.test.ts @@ -13,10 +13,7 @@ import { ListRegistryInstances } from "@zowe/provisioning-for-zowe-sdk"; import { IHandlerParameters } from "@zowe/imperative"; import * as Handler from "../../../../../src/provisioning/list/registry/RegistryInstances.handler"; import { registryInstances } from "../../../../../src/provisioning/list/registry/RegistryInstances.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; jest.mock("@zowe/provisioning-for-zowe-sdk"); @@ -24,8 +21,7 @@ jest.mock("@zowe/provisioning-for-zowe-sdk"); const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["provisioning", "list", "catalog-templates"], - definition: registryInstances, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: registryInstances }); describe("list registry instances handler tests", () => { diff --git a/packages/cli/__tests__/provisioning/__unit__/list/templateInfo/TemplateInfo.handler.unit.test.ts b/packages/cli/__tests__/provisioning/__unit__/list/templateInfo/TemplateInfo.handler.unit.test.ts index 21165a3998..35b25fb87e 100644 --- a/packages/cli/__tests__/provisioning/__unit__/list/templateInfo/TemplateInfo.handler.unit.test.ts +++ b/packages/cli/__tests__/provisioning/__unit__/list/templateInfo/TemplateInfo.handler.unit.test.ts @@ -14,17 +14,13 @@ import { ListTemplateInfo } from "@zowe/provisioning-for-zowe-sdk"; import { IHandlerParameters } from "@zowe/imperative"; import * as Handler from "../../../../../src/provisioning/list/templateInfo/TemplateInfo.handler"; import { templateInfo } from "../../../../../src/provisioning/list/templateInfo/TemplateInfo.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["provisioning", "list", "catalog-templates"], - definition: templateInfo, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: templateInfo }); describe("list template info handler tests", () => { diff --git a/packages/cli/__tests__/provisioning/__unit__/perform/action/Action.handler.unit.test.ts b/packages/cli/__tests__/provisioning/__unit__/perform/action/Action.handler.unit.test.ts index fed787cf42..6f52fccf58 100644 --- a/packages/cli/__tests__/provisioning/__unit__/perform/action/Action.handler.unit.test.ts +++ b/packages/cli/__tests__/provisioning/__unit__/perform/action/Action.handler.unit.test.ts @@ -20,17 +20,13 @@ import { import { IHandlerParameters } from "@zowe/imperative"; import * as ActionHandler from "../../../../../src/provisioning/perform/action/Action.handler"; import * as ActionDefinition from "../../../../../src/provisioning/perform/action/Action.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["provisioning", "perform", "action"], - definition: ActionDefinition.ActionDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: ActionDefinition.ActionDefinition }); describe("perform action handler tests", () => { diff --git a/packages/cli/__tests__/provisioning/__unit__/provision/template/Template.handler.unit.test.ts b/packages/cli/__tests__/provisioning/__unit__/provision/template/Template.handler.unit.test.ts index dc8d39cb4d..42337c91ce 100644 --- a/packages/cli/__tests__/provisioning/__unit__/provision/template/Template.handler.unit.test.ts +++ b/packages/cli/__tests__/provisioning/__unit__/provision/template/Template.handler.unit.test.ts @@ -18,17 +18,13 @@ import { ProvisionTemplateData } from "../../../__resources__/ProvisionTemplateD import { IHandlerParameters, ImperativeError } from "@zowe/imperative"; import * as TemplateHandler from "../../../../../src/provisioning/provision/template/Template.handler"; import * as TemplateDefinition from "../../../../../src/provisioning/provision/template/Template.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["provisioning", "provision", "template"], - definition: TemplateDefinition.TemplateDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: TemplateDefinition.TemplateDefinition }); describe("provision template handler tests", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/compare/ds/Dataset.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/compare/ds/Dataset.handler.unit.test.ts index 74d90159a8..c831d710a5 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/compare/ds/Dataset.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/compare/ds/Dataset.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Get } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { DiffUtils, IDiffOptions, ImperativeError } from "@zowe/imperative"; describe("Compare data set handler", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/compare/lf-ds/LocalfileDataset.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/compare/lf-ds/LocalfileDataset.handler.unit.test.ts index 108b0544fc..c5f1f32ccb 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/compare/lf-ds/LocalfileDataset.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/compare/lf-ds/LocalfileDataset.handler.unit.test.ts @@ -12,7 +12,7 @@ jest.mock("fs"); import { Get } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { DiffUtils, IDiffOptions, ImperativeError } from "@zowe/imperative"; import * as fs from "fs"; describe("Compare local-file and data-set handler", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/compare/lf-sdd/LocalfileSpooldd.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/compare/lf-sdd/LocalfileSpooldd.handler.unit.test.ts index 79eadc9972..e7c137a664 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/compare/lf-sdd/LocalfileSpooldd.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/compare/lf-sdd/LocalfileSpooldd.handler.unit.test.ts @@ -12,7 +12,7 @@ jest.mock("fs"); import { GetJobs } from "@zowe/zos-jobs-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { DiffUtils, IDiffOptions, ImperativeError } from "@zowe/imperative"; import * as fs from "fs"; diff --git a/packages/cli/__tests__/zosfiles/__unit__/compare/lf-uss/LocalfileUss.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/compare/lf-uss/LocalfileUss.handler.unit.test.ts index 2fd4591f18..567d13e921 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/compare/lf-uss/LocalfileUss.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/compare/lf-uss/LocalfileUss.handler.unit.test.ts @@ -12,7 +12,7 @@ jest.mock("fs"); import { Get } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { DiffUtils, IDiffOptions } from "@zowe/imperative"; import * as fs from "fs"; diff --git a/packages/cli/__tests__/zosfiles/__unit__/compare/sdd/Spooldd.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/compare/sdd/Spooldd.handler.unit.test.ts index d71b72dd4f..9b71ec2b96 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/compare/sdd/Spooldd.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/compare/sdd/Spooldd.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { GetJobs } from "@zowe/zos-jobs-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { DiffUtils, IDiffOptions, ImperativeError } from "@zowe/imperative"; describe("Compare spooldd handler", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/compare/uss/UssFile.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/compare/uss/UssFile.handler.unit.test.ts index de4ac64f24..8117ec2719 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/compare/uss/UssFile.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/compare/uss/UssFile.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Get } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { DiffUtils, IDiffOptions, ImperativeError } from "@zowe/imperative"; describe("Compare data set handler", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/copy/dsclp/TargetProfile.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/copy/dsclp/TargetProfile.handler.unit.test.ts index 4a756e9d0d..9feccd3f0f 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/copy/dsclp/TargetProfile.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/copy/dsclp/TargetProfile.handler.unit.test.ts @@ -12,17 +12,13 @@ import { IHandlerParameters, ImperativeConfig, ImperativeError } from "@zowe/imperative"; import TargetProfileHandler from "../../../../../src/zosfiles/copy/dsclp/TargetProfile.handler"; import { DsclpDefinition } from "../../../../../src/zosfiles/copy/dsclp/Dsclp.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["files", "copy", "data-set-cross-lpar"], - definition: DsclpDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: DsclpDefinition }); describe("TargetProfileHandler", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/create/binaryPds/BinaryPDS.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/create/binaryPds/BinaryPDS.handler.unit.test.ts index 04231126d3..44c96a8651 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/create/binaryPds/BinaryPDS.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/create/binaryPds/BinaryPDS.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Create, CreateDataSetTypeEnum } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("Create binary PDS data set handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/create/cPds/CPDS.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/create/cPds/CPDS.handler.unit.test.ts index 52ea562e68..56b9800230 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/create/cPds/CPDS.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/create/cPds/CPDS.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Create, CreateDataSetTypeEnum } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("Create C-code PDS data set handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/create/classicPds/ClassicPDS.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/create/classicPds/ClassicPDS.handler.unit.test.ts index 100a1f0269..6bf9932aa7 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/create/classicPds/ClassicPDS.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/create/classicPds/ClassicPDS.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Create, CreateDataSetTypeEnum } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("Create classic PDS data set handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/create/ds/ds.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/create/ds/ds.handler.unit.test.ts index 1c8ce8705e..998ca33757 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/create/ds/ds.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/create/ds/ds.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Create, CreateDataSetTypeEnum } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("Create data set handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/create/pds/Pds.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/create/pds/Pds.handler.unit.test.ts index 2f389193ac..d59d95b08b 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/create/pds/Pds.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/create/pds/Pds.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Create, CreateDataSetTypeEnum } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("Create PDS data set handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/create/ps/Ps.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/create/ps/Ps.handler.unit.test.ts index e830b6cf71..0ebd8da55e 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/create/ps/Ps.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/create/ps/Ps.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Create, CreateDataSetTypeEnum } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("Create PS data set handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/create/ussDir/ussDir.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/create/ussDir/ussDir.handler.unit.test.ts index 299a0b6d28..8062b8d143 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/create/ussDir/ussDir.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/create/ussDir/ussDir.handler.unit.test.ts @@ -11,7 +11,7 @@ import { Create, IZosFilesOptions } from "@zowe/zos-files-for-zowe-sdk"; // import { CreateDataSetTypeEnum } from "../../../../src/api/methods/create/CreateDataSetType.enum"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("Create USS Directory", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/create/ussFile/ussFile.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/create/ussFile/ussFile.handler.unit.test.ts index 765570d70d..05ebca4e72 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/create/ussFile/ussFile.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/create/ussFile/ussFile.handler.unit.test.ts @@ -11,7 +11,7 @@ import { Create, IZosFilesOptions } from "@zowe/zos-files-for-zowe-sdk"; // import { CreateDataSetTypeEnum } from "../../../../src/api/methods/create/CreateDataSetType.enum"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("Create USS file", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/create/vsam/Vsam.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/create/vsam/Vsam.handler.unit.test.ts index 85a782fde4..cdcdf06c1d 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/create/vsam/Vsam.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/create/vsam/Vsam.handler.unit.test.ts @@ -11,7 +11,7 @@ import { Create } from "@zowe/zos-files-for-zowe-sdk"; import { ImperativeError } from "@zowe/imperative"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; const message: string = "Dummy error message"; diff --git a/packages/cli/__tests__/zosfiles/__unit__/create/zfs/zfs.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/create/zfs/zfs.handler.unit.test.ts index 2c789f1fc7..d206a06c20 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/create/zfs/zfs.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/create/zfs/zfs.handler.unit.test.ts @@ -11,7 +11,7 @@ import { Create } from "@zowe/zos-files-for-zowe-sdk"; import { ImperativeError } from "@zowe/imperative"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; const message: string = "Dummy error message"; diff --git a/packages/cli/__tests__/zosfiles/__unit__/download/am/AllMembers.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/download/am/AllMembers.handler.unit.test.ts index f838bc33a1..42a1e5352b 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/download/am/AllMembers.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/download/am/AllMembers.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Download } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("Download AllMembers handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/download/ds/Dataset.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/download/ds/Dataset.handler.unit.test.ts index 372231a04e..0bc6a28354 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/download/ds/Dataset.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/download/ds/Dataset.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Download } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("Download data set handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/download/dsm/DataSetMatching.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/download/dsm/DataSetMatching.handler.unit.test.ts index 3f8b8c87ca..ce1ae9cb95 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/download/dsm/DataSetMatching.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/download/dsm/DataSetMatching.handler.unit.test.ts @@ -13,14 +13,13 @@ import { IHandlerParameters, Session } from "@zowe/imperative"; import { Download, IDownloadOptions, IDsmListOptions, List } from "@zowe/zos-files-for-zowe-sdk"; import * as DataSetMatchingDefinition from "../../../../../src/zosfiles/download/dsm/DataSetMatching.definition"; import * as DataSetMatchingHandler from "../../../../../src/zosfiles/download/dsm/DataSetMatching.handler"; -import { UNIT_TEST_ZOSMF_PROF_OPTS, UNIT_TEST_PROFILES_ZOSMF } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-jobs", "download", "output"], - definition: DataSetMatchingDefinition.DataSetMatchingDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: DataSetMatchingDefinition.DataSetMatchingDefinition }); const fakeListOptions: IDsmListOptions = { diff --git a/packages/cli/__tests__/zosfiles/__unit__/download/uss/UssFile.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/download/uss/UssFile.handler.unit.test.ts index e99676bec2..55afdf6edf 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/download/uss/UssFile.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/download/uss/UssFile.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Download } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("Download uss file handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/download/ussdir/UssDir.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/download/ussdir/UssDir.handler.unit.test.ts index 64857d28ba..9619831883 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/download/ussdir/UssDir.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/download/ussdir/UssDir.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Download, IDownloadOptions, IUSSListOptions } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; const defaultListObj: IUSSListOptions = { name: "*", diff --git a/packages/cli/__tests__/zosfiles/__unit__/edit/Edit.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/edit/Edit.handler.unit.test.ts index e60b145612..7a30a79836 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/edit/Edit.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/edit/Edit.handler.unit.test.ts @@ -15,7 +15,7 @@ import {ILocalFile, import { mockHandlerParameters } from "@zowe/cli-test-utils"; import { EditDefinition } from "../../../../src/zosfiles/edit/Edit.definition"; import EditHandler from "../../../../src/zosfiles/edit/Edit.handler"; -import { UNIT_TEST_PROFILES_ZOSMF, UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../__tests__/__src__/TestConstants"; import stripAnsi = require("strip-ansi"); describe("Files Edit Group Handler", () => { @@ -27,8 +27,7 @@ describe("Files Edit Group Handler", () => { const commandParameters: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-files", "edit", "ds"], - definition: EditDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: EditDefinition }); const localFile: ILocalFile = { diff --git a/packages/cli/__tests__/zosfiles/__unit__/edit/Edit.utils.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/edit/Edit.utils.unit.test.ts index ade6752d11..a68cb87fa2 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/edit/Edit.utils.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/edit/Edit.utils.unit.test.ts @@ -11,7 +11,7 @@ import { mockHandlerParameters } from "@zowe/cli-test-utils"; import { AbstractSession, CliUtils, GuiResult, IHandlerParameters, ImperativeError, ProcessUtils } from "@zowe/imperative"; -import { UNIT_TEST_ZOSMF_PROF_OPTS, UNIT_TEST_PROFILES_ZOSMF } from "../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../__tests__/__src__/TestConstants"; import { EditDefinition } from "../../../../src/zosfiles/edit/Edit.definition"; import { EditUtilities, ILocalFile, Prompt } from "../../../../src/zosfiles/edit/Edit.utils"; import { cloneDeep } from "lodash"; @@ -26,15 +26,13 @@ describe("Files Edit Utilities", () => { const commandParametersDs: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-files", "edit", "ds"], - definition: EditDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: EditDefinition }); const commandParametersUss: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-files", "edit", "uss"], - definition: EditDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: EditDefinition }); commandParametersDs.arguments["dataSetName"] = commandParametersUss.arguments["file"] = 'fake'; diff --git a/packages/cli/__tests__/zosfiles/__unit__/invoke/amsFile/AmsFile.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/invoke/amsFile/AmsFile.handler.unit.test.ts index 5d84602ce3..f915990226 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/invoke/amsFile/AmsFile.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/invoke/amsFile/AmsFile.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Invoke, IZosFilesOptions } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("Invoke AMS files handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/invoke/amsStatements/AmsStatements.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/invoke/amsStatements/AmsStatements.handler.unit.test.ts index df59cc5cff..4b3773a186 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/invoke/amsStatements/AmsStatements.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/invoke/amsStatements/AmsStatements.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Invoke } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("Invoke AMS statements handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/list/am/AllMembers.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/list/am/AllMembers.handler.unit.test.ts index 55871bc2ab..cf11e3a249 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/list/am/AllMembers.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/list/am/AllMembers.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { List } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { IHandlerParameters } from "@zowe/imperative"; describe("List AllMembers handler", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/list/ds/Dataset.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/list/ds/Dataset.handler.unit.test.ts index e87a31e6d2..75f217a634 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/list/ds/Dataset.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/list/ds/Dataset.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { List } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("List Dataset handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/list/fs/Fs.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/list/fs/Fs.handler.unit.test.ts index 53e27e5c44..a052f68a63 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/list/fs/Fs.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/list/fs/Fs.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { List } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("fs handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/list/uss/Uss.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/list/uss/Uss.handler.unit.test.ts index 20ab8f4c07..54f0eba9de 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/list/uss/Uss.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/list/uss/Uss.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { List } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("USS file handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/mount/fs/fs.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/mount/fs/fs.handler.unit.test.ts index 5340676739..2a4fdee14a 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/mount/fs/fs.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/mount/fs/fs.handler.unit.test.ts @@ -11,7 +11,7 @@ import { Mount } from "@zowe/zos-files-for-zowe-sdk"; import { ImperativeError } from "@zowe/imperative"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; const message: string = "Dummy error message"; diff --git a/packages/cli/__tests__/zosfiles/__unit__/search/ds/Datasets.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/search/ds/Datasets.handler.unit.test.ts index 521d47f2d4..d3ed3f18c0 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/search/ds/Datasets.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/search/ds/Datasets.handler.unit.test.ts @@ -11,7 +11,7 @@ import { Search } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { TaskStage } from "@zowe/imperative"; describe("Search Datasets handler", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/upload/dtp/DirToPds.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/upload/dtp/DirToPds.handler.unit.test.ts index aba9173262..a544f56b6c 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/upload/dtp/DirToPds.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/upload/dtp/DirToPds.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Upload } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("Upload dir-to-pds handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/upload/dtu/DirToUSS.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/upload/dtu/DirToUSS.handler.unit.test.ts index a90a269155..f1965a7d8d 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/upload/dtu/DirToUSS.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/upload/dtu/DirToUSS.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Upload, ZosFilesAttributes } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import * as fs from "fs"; describe("Upload dir-to-uss handler", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/upload/ftds/FileToDataSet.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/upload/ftds/FileToDataSet.handler.unit.test.ts index cddbc54373..c71ada1d52 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/upload/ftds/FileToDataSet.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/upload/ftds/FileToDataSet.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Upload } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("Upload file-to-data-set handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/upload/ftu/FileToUSS.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/upload/ftu/FileToUSS.handler.unit.test.ts index 9e027cd02c..c4eedd2bd4 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/upload/ftu/FileToUSS.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/upload/ftu/FileToUSS.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Upload } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("Upload file-to-uss handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/upload/stds/StdinToDataSet.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/upload/stds/StdinToDataSet.handler.unit.test.ts index 51b8e92c49..fbd3bdd65f 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/upload/stds/StdinToDataSet.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/upload/stds/StdinToDataSet.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Upload } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("Upload stdin-to-data-set handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/view/ds/Dataset.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/view/ds/Dataset.handler.unit.test.ts index 828246841e..a2b544a611 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/view/ds/Dataset.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/view/ds/Dataset.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Get } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("View data set handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosfiles/__unit__/view/uss/USSFiles.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/view/uss/USSFiles.handler.unit.test.ts index cdb40f7868..a3069f959c 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/view/uss/USSFiles.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/view/uss/USSFiles.handler.unit.test.ts @@ -10,7 +10,7 @@ */ import { Get } from "@zowe/zos-files-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; describe("View USS file handler", () => { describe("process method", () => { diff --git a/packages/cli/__tests__/zosjobs/__unit__/cancel/job/Job.handler.unit.test.ts b/packages/cli/__tests__/zosjobs/__unit__/cancel/job/Job.handler.unit.test.ts index df8c2da150..4c6a80e43b 100644 --- a/packages/cli/__tests__/zosjobs/__unit__/cancel/job/Job.handler.unit.test.ts +++ b/packages/cli/__tests__/zosjobs/__unit__/cancel/job/Job.handler.unit.test.ts @@ -15,10 +15,7 @@ import { GetJobs, CancelJobs, IJobFeedback } from "@zowe/zos-jobs-for-zowe-sdk"; import { GetJobsData } from "../../../__resources__/GetJobsData"; import * as JobHandler from "../../../../../src/zosjobs/cancel/job/Job.handler"; import * as JobDefinition from "../../../../../src/zosjobs/cancel/job/Job.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; process.env.FORCE_COLOR = "0"; @@ -26,8 +23,7 @@ process.env.FORCE_COLOR = "0"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-jobs", "cancel", "job"], - definition: JobDefinition.JobDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: JobDefinition.JobDefinition }); const DEFAULT_RESPONSE_FEEDBACK: IJobFeedback = { diff --git a/packages/cli/__tests__/zosjobs/__unit__/delete/job/Job.handler.unit.test.ts b/packages/cli/__tests__/zosjobs/__unit__/delete/job/Job.handler.unit.test.ts index 4ac9c09ec3..d1945ef98f 100644 --- a/packages/cli/__tests__/zosjobs/__unit__/delete/job/Job.handler.unit.test.ts +++ b/packages/cli/__tests__/zosjobs/__unit__/delete/job/Job.handler.unit.test.ts @@ -15,10 +15,7 @@ import { GetJobs, DeleteJobs, IJobFeedback } from "@zowe/zos-jobs-for-zowe-sdk"; import { GetJobsData } from "../../../__resources__/GetJobsData"; import * as JobHandler from "../../../../../src/zosjobs/delete/job/Job.handler"; import * as JobDefinition from "../../../../../src/zosjobs/delete/job/Job.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; process.env.FORCE_COLOR = "0"; @@ -26,8 +23,7 @@ process.env.FORCE_COLOR = "0"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-jobs", "delete", "job"], - definition: JobDefinition.JobDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: JobDefinition.JobDefinition }); const DEFAULT_RESPONSE_FEEDBACK: IJobFeedback = { diff --git a/packages/cli/__tests__/zosjobs/__unit__/delete/old-jobs/OldJobs.handler.unit.test.ts b/packages/cli/__tests__/zosjobs/__unit__/delete/old-jobs/OldJobs.handler.unit.test.ts index bc43ad6499..608efa2c0d 100644 --- a/packages/cli/__tests__/zosjobs/__unit__/delete/old-jobs/OldJobs.handler.unit.test.ts +++ b/packages/cli/__tests__/zosjobs/__unit__/delete/old-jobs/OldJobs.handler.unit.test.ts @@ -15,10 +15,7 @@ import { GetJobs, DeleteJobs } from "@zowe/zos-jobs-for-zowe-sdk"; import { GetJobsData } from "../../../__resources__/GetJobsData"; import * as OldJobsHandler from "../../../../../src/zosjobs/delete/old-jobs/OldJobs.handler"; import * as OldJobsDefinition from "../../../../../src/zosjobs/delete/old-jobs/OldJobs.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; process.env.FORCE_COLOR = "0"; @@ -26,8 +23,7 @@ process.env.FORCE_COLOR = "0"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-jobs", "delete", "old-jobs"], - definition: OldJobsDefinition.OldJobsDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: OldJobsDefinition.OldJobsDefinition }); describe("delete old-jobs handler tests", () => { diff --git a/packages/cli/__tests__/zosjobs/__unit__/download/download-output/Output.handler.unit.test.ts b/packages/cli/__tests__/zosjobs/__unit__/download/download-output/Output.handler.unit.test.ts index ea7378a4ff..b2bc1e02a9 100644 --- a/packages/cli/__tests__/zosjobs/__unit__/download/download-output/Output.handler.unit.test.ts +++ b/packages/cli/__tests__/zosjobs/__unit__/download/download-output/Output.handler.unit.test.ts @@ -16,10 +16,7 @@ jest.mock("@zowe/zos-jobs-for-zowe-sdk"); import { IHandlerParameters, ImperativeError, Session } from "@zowe/imperative"; import * as OutputHandler from "../../../../../src/zosjobs/download/download-output/Output.handler"; import * as OutputDefinition from "../../../../../src/zosjobs/download/download-output/Output.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; process.env.FORCE_COLOR = "0"; @@ -27,8 +24,7 @@ process.env.FORCE_COLOR = "0"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-jobs", "download", "output"], - definition: OutputDefinition.OutputDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: OutputDefinition.OutputDefinition }); describe("download output handler tests", () => { diff --git a/packages/cli/__tests__/zosjobs/__unit__/list/jobs/Jobs.handler.unit.test.ts b/packages/cli/__tests__/zosjobs/__unit__/list/jobs/Jobs.handler.unit.test.ts index 1dbca8370e..edad84edbc 100644 --- a/packages/cli/__tests__/zosjobs/__unit__/list/jobs/Jobs.handler.unit.test.ts +++ b/packages/cli/__tests__/zosjobs/__unit__/list/jobs/Jobs.handler.unit.test.ts @@ -16,10 +16,7 @@ jest.mock("@zowe/zos-jobs-for-zowe-sdk"); import { IHandlerParameters, ImperativeError, Session } from "@zowe/imperative"; import * as JobsHandler from "../../../../../src/zosjobs/list/jobs/Jobs.handler"; import * as JobsDefinition from "../../../../../src/zosjobs/list/jobs/Jobs.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; process.env.FORCE_COLOR = "0"; @@ -27,8 +24,7 @@ process.env.FORCE_COLOR = "0"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-jobs", "view", "job"], - definition: JobsDefinition.JobsDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: JobsDefinition.JobsDefinition }); describe("list jobs handler tests", () => { diff --git a/packages/cli/__tests__/zosjobs/__unit__/list/spool-files-by-jobid/SpoolFilesByJobid.handler.unit.test.ts b/packages/cli/__tests__/zosjobs/__unit__/list/spool-files-by-jobid/SpoolFilesByJobid.handler.unit.test.ts index 18e8e481d1..88f1d40a60 100644 --- a/packages/cli/__tests__/zosjobs/__unit__/list/spool-files-by-jobid/SpoolFilesByJobid.handler.unit.test.ts +++ b/packages/cli/__tests__/zosjobs/__unit__/list/spool-files-by-jobid/SpoolFilesByJobid.handler.unit.test.ts @@ -15,10 +15,7 @@ import { GetJobs } from "@zowe/zos-jobs-for-zowe-sdk"; import { GetJobsData } from "../../../__resources__/GetJobsData"; import { SpoolFilesByJobidDefinition } from "../../../../../src/zosjobs/list/spool-files-by-jobid/SpoolFilesByJobid.definition"; import * as SpoolFilesHandler from "../../../../../src/zosjobs/list/spool-files-by-jobid/SpoolFilesByJobid.handler"; -import { - UNIT_TEST_PROFILES_ZOSMF, - UNIT_TEST_ZOSMF_PROF_OPTS -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; // Disable coloring for the snapshots @@ -27,8 +24,7 @@ process.env.FORCE_COLOR = "0"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-jobs", "list", "spool-files"], - definition: SpoolFilesByJobidDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: SpoolFilesByJobidDefinition }); describe("zos-jobs list spool-files-by-jobid handler", () => { diff --git a/packages/cli/__tests__/zosjobs/__unit__/modify/job/Job.handler.unit.test.ts b/packages/cli/__tests__/zosjobs/__unit__/modify/job/Job.handler.unit.test.ts index fc0b1a4d2a..b703740e85 100644 --- a/packages/cli/__tests__/zosjobs/__unit__/modify/job/Job.handler.unit.test.ts +++ b/packages/cli/__tests__/zosjobs/__unit__/modify/job/Job.handler.unit.test.ts @@ -14,10 +14,7 @@ import { IHandlerParameters, ImperativeError } from "@zowe/imperative"; import { GetJobs, IJob, IJobFeedback, ModifyJobs } from "@zowe/zos-jobs-for-zowe-sdk"; import * as ModifyDefintion from "../../../../../src/zosjobs/modify/job/Job.definition"; import * as ModifyHandler from "../../../../../src/zosjobs/modify/job/Job.handler"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; process.env.FORCE_COLOR = "0"; @@ -25,8 +22,7 @@ process.env.FORCE_COLOR = "0"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-jobs", "modify", "job"], - definition: ModifyDefintion.JobDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: ModifyDefintion.JobDefinition }); const SAMPLE_COMPLETE_JOB: IJob= { diff --git a/packages/cli/__tests__/zosjobs/__unit__/search/job/JobSearch.handler.unit.test.ts b/packages/cli/__tests__/zosjobs/__unit__/search/job/JobSearch.handler.unit.test.ts index 1d9a126d96..9b426a8201 100644 --- a/packages/cli/__tests__/zosjobs/__unit__/search/job/JobSearch.handler.unit.test.ts +++ b/packages/cli/__tests__/zosjobs/__unit__/search/job/JobSearch.handler.unit.test.ts @@ -14,10 +14,7 @@ import { IHandlerParameters, ImperativeError } from "@zowe/imperative"; import { SearchJobs } from "@zowe/zos-jobs-for-zowe-sdk"; import * as JobHandler from "../../../../../src/zosjobs/search/job/Job.handler"; import * as JobDefinition from "../../../../../src/zosjobs/search/job/Job.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; process.env.FORCE_COLOR = "0"; @@ -28,8 +25,7 @@ const mockSearchData: string = "This job contains RC=0000"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-jobs", "search", "job"], - definition: JobDefinition.JobDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: JobDefinition.JobDefinition }); describe("search job handler tests", () => { diff --git a/packages/cli/__tests__/zosjobs/__unit__/submit/Submit.shared.handler.unit.test.ts b/packages/cli/__tests__/zosjobs/__unit__/submit/Submit.shared.handler.unit.test.ts index dc0135c776..a6ec8b0933 100644 --- a/packages/cli/__tests__/zosjobs/__unit__/submit/Submit.shared.handler.unit.test.ts +++ b/packages/cli/__tests__/zosjobs/__unit__/submit/Submit.shared.handler.unit.test.ts @@ -13,10 +13,7 @@ jest.mock("@zowe/zos-jobs-for-zowe-sdk"); import { MonitorJobs, SubmitJobs, ISubmitJobUSSParms, ISubmitJobParms } from "@zowe/zos-jobs-for-zowe-sdk"; import { IHandlerParameters, ImperativeError, IO } from "@zowe/imperative"; import * as SubmitDefinition from "../../../../src/zosjobs/submit/Submit.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; process.env.FORCE_COLOR = "0"; @@ -29,22 +26,19 @@ describe("submit shared handler", () => { DEFAULT_PARAMETERS = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-jobs", "submit", "data-set"], - definition: SubmitDefinition.SubmitDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: SubmitDefinition.SubmitDefinition }); USSFILE_PARAMETERS = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-jobs", "submit", "uss-file"], - definition: SubmitDefinition.SubmitDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: SubmitDefinition.SubmitDefinition }); LOCALFILE_PARAMETERS = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-jobs", "submit", "local-file"], - definition: SubmitDefinition.SubmitDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: SubmitDefinition.SubmitDefinition }); }); diff --git a/packages/cli/__tests__/zosjobs/__unit__/view/all-spool-content/AllSpoolContent.handler.unit.test.ts b/packages/cli/__tests__/zosjobs/__unit__/view/all-spool-content/AllSpoolContent.handler.unit.test.ts index c7cb2b4b33..432c0b22dd 100644 --- a/packages/cli/__tests__/zosjobs/__unit__/view/all-spool-content/AllSpoolContent.handler.unit.test.ts +++ b/packages/cli/__tests__/zosjobs/__unit__/view/all-spool-content/AllSpoolContent.handler.unit.test.ts @@ -16,7 +16,7 @@ import { GetJobsData } from "../../../__resources__/GetJobsData"; import { AllSpoolContentDefinition } from "../../../../../src/zosjobs/view/all-spool-content/AllSpoolContent.definition"; import * as fs from "fs"; import { ZosmfSession } from "@zowe/zosmf-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS, UNIT_TEST_PROFILES_ZOSMF } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; import * as AllSpoolContentHandler from "../../../../../src/zosjobs/view/all-spool-content/AllSpoolContent.handler"; @@ -27,8 +27,7 @@ const TEST_RESOURCES_DIR = __dirname + "/../../../__resources__"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-jobs", "view", "spool-file-by-id"], - definition: AllSpoolContentDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF, + definition: AllSpoolContentDefinition }); describe("zos-jobs view all-spool-content handler", () => { diff --git a/packages/cli/__tests__/zosjobs/__unit__/view/job/JobStatusByJobid.handler.unit.test.ts b/packages/cli/__tests__/zosjobs/__unit__/view/job/JobStatusByJobid.handler.unit.test.ts index 6e23fc4557..305b21e1ae 100644 --- a/packages/cli/__tests__/zosjobs/__unit__/view/job/JobStatusByJobid.handler.unit.test.ts +++ b/packages/cli/__tests__/zosjobs/__unit__/view/job/JobStatusByJobid.handler.unit.test.ts @@ -15,10 +15,7 @@ import { GetJobs } from "@zowe/zos-jobs-for-zowe-sdk"; import { GetJobsData } from "../../../__resources__/GetJobsData"; import * as JobStatusByJobidHandler from "../../../../../src/zosjobs/view/job-status-by-jobid/JobStatusByJobid.handler"; import * as JobStatusByJobidDefinition from "../../../../../src/zosjobs/view/job-status-by-jobid/JobStatusByJobid.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; process.env.FORCE_COLOR = "0"; @@ -27,8 +24,7 @@ process.env.FORCE_COLOR = "0"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-jobs", "view", "job"], - definition: JobStatusByJobidDefinition.JobStatusByJobidDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: JobStatusByJobidDefinition.JobStatusByJobidDefinition }); describe("view job-status-by-jobid handler tests", () => { diff --git a/packages/cli/__tests__/zosjobs/__unit__/view/spool-file-by-id/SpoolFileById.handler.unit.test.ts b/packages/cli/__tests__/zosjobs/__unit__/view/spool-file-by-id/SpoolFileById.handler.unit.test.ts index 094cc6e9ed..6d6582727f 100644 --- a/packages/cli/__tests__/zosjobs/__unit__/view/spool-file-by-id/SpoolFileById.handler.unit.test.ts +++ b/packages/cli/__tests__/zosjobs/__unit__/view/spool-file-by-id/SpoolFileById.handler.unit.test.ts @@ -17,7 +17,7 @@ import { SpoolFilesByJobidDefinition } from "../../../../../src/zosjobs/list/spo import * as SpoolFileByIdHandler from "../../../../../src/zosjobs/view/spool-file-by-id/SpoolFileById.handler"; import * as fs from "fs"; import { ZosmfSession } from "@zowe/zosmf-for-zowe-sdk"; -import { UNIT_TEST_ZOSMF_PROF_OPTS, UNIT_TEST_PROFILES_ZOSMF } from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; import { cloneDeep } from "lodash"; @@ -28,8 +28,7 @@ const TEST_RESOURCES_DIR = __dirname + "/../../../__resources__"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-jobs", "view", "spool-file-by-id"], - definition: SpoolFilesByJobidDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: SpoolFilesByJobidDefinition }); describe("zos-jobs view spool-file-by-id handler", () => { diff --git a/packages/cli/__tests__/zoslogs/__unit__/list/logs/Logs.handler.unit.test.ts b/packages/cli/__tests__/zoslogs/__unit__/list/logs/Logs.handler.unit.test.ts index f262d4d8ce..5fb4912fc3 100644 --- a/packages/cli/__tests__/zoslogs/__unit__/list/logs/Logs.handler.unit.test.ts +++ b/packages/cli/__tests__/zoslogs/__unit__/list/logs/Logs.handler.unit.test.ts @@ -15,10 +15,7 @@ import { IHandlerParameters, ImperativeError, Session, Imperative } from "@zowe/ import * as LogsHandler from "../../../../../src/zoslogs/list/logs/Logs.handler"; import * as LogsDefinition from "../../../../../src/zoslogs/list/logs/Logs.definition"; import { GetZosLog, IZosLogParms } from "@zowe/zos-logs-for-zowe-sdk"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; process.env.FORCE_COLOR = "0"; @@ -29,8 +26,7 @@ const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ ...UNIT_TEST_ZOSMF_PROF_OPTS }, positionals: ["zos-logs", "list", "logs"], - definition: LogsDefinition.LogsDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: LogsDefinition.LogsDefinition }); describe("get logs handler tests", () => { diff --git a/packages/cli/__tests__/zosmf/__unit__/check/status/Status.handler.unit.test.ts b/packages/cli/__tests__/zosmf/__unit__/check/status/Status.handler.unit.test.ts index 6741cf64ca..e3800ce919 100644 --- a/packages/cli/__tests__/zosmf/__unit__/check/status/Status.handler.unit.test.ts +++ b/packages/cli/__tests__/zosmf/__unit__/check/status/Status.handler.unit.test.ts @@ -14,17 +14,13 @@ import { CheckStatus } from "@zowe/zosmf-for-zowe-sdk"; import { ICommandHandler, IHandlerParameters } from "@zowe/imperative"; import CmdHandler from "../../../../../src/zosmf/check/status/Status.handler"; import * as cmdDef from "../../../../../src/zosmf/check/status/Status.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; const goodCmdParms: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zosmf", "check", "status"], - definition: cmdDef.StatusDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: cmdDef.StatusDefinition }); let checkStatHandler: ICommandHandler = null; diff --git a/packages/cli/__tests__/zosmf/__unit__/list/systems/Systems.handler.unit.test.ts b/packages/cli/__tests__/zosmf/__unit__/list/systems/Systems.handler.unit.test.ts index c25c6c7280..fa2c8e5a32 100644 --- a/packages/cli/__tests__/zosmf/__unit__/list/systems/Systems.handler.unit.test.ts +++ b/packages/cli/__tests__/zosmf/__unit__/list/systems/Systems.handler.unit.test.ts @@ -15,17 +15,13 @@ import { ListDefinedSystems } from "@zowe/zosmf-for-zowe-sdk"; import { ICommandHandler, IHandlerParameters } from "@zowe/imperative"; import CmdHandler from "../../../../../src/zosmf/list/systems/Systems.handler"; import * as cmdDef from "../../../../../src/zosmf/list/systems/Systems.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; const goodCmdParms: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zosmf", "check", "status"], - definition: cmdDef.SystemsDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: cmdDef.SystemsDefinition }); let listSystemsHandler: ICommandHandler = null; diff --git a/packages/cli/__tests__/zostso/__unit__/issue/command/Command.handler.unit.test.ts b/packages/cli/__tests__/zostso/__unit__/issue/command/Command.handler.unit.test.ts index 6bf449c70d..7d82689383 100644 --- a/packages/cli/__tests__/zostso/__unit__/issue/command/Command.handler.unit.test.ts +++ b/packages/cli/__tests__/zostso/__unit__/issue/command/Command.handler.unit.test.ts @@ -15,11 +15,7 @@ import { IHandlerParameters, ImperativeError } from "@zowe/imperative"; import * as Command from "../../../../../src/zostso/issue/command/Command.handler"; import { CommandDefinition } from "../../../../../src/zostso/issue/command/Command.definition"; import { StartTsoData } from "../../../__resources__/StartTsoData"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF_TSO, - UNIT_TEST_TSO_PROF_OPTS -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS, UNIT_TEST_TSO_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ @@ -28,8 +24,7 @@ const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ ...UNIT_TEST_TSO_PROF_OPTS }, positionals: ["zos-tso", "issue", "address-space"], - definition: CommandDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF_TSO + definition: CommandDefinition }); describe("issue command handler tests", () => { diff --git a/packages/cli/__tests__/zostso/__unit__/ping/address-space/AddressSpace.handler.unit.test.ts b/packages/cli/__tests__/zostso/__unit__/ping/address-space/AddressSpace.handler.unit.test.ts index d8a0b0aa38..1c63e55c73 100644 --- a/packages/cli/__tests__/zostso/__unit__/ping/address-space/AddressSpace.handler.unit.test.ts +++ b/packages/cli/__tests__/zostso/__unit__/ping/address-space/AddressSpace.handler.unit.test.ts @@ -16,17 +16,13 @@ import { PingTso } from "@zowe/zos-tso-for-zowe-sdk"; import { IHandlerParameters, ImperativeError } from "@zowe/imperative"; import * as PingAddressSpaceHandler from "../../../../../src/zostso/ping/address_space/PingAddressSpace.handler"; import { PingAddressSpaceCommandDefinition } from "../../../../../src/zostso/ping/address_space/PingAddressSpace.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-tso", "ping", "address-space"], - definition: PingAddressSpaceCommandDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: PingAddressSpaceCommandDefinition }); describe("ping address-space handler tests", () => { diff --git a/packages/cli/__tests__/zostso/__unit__/send/address-space/AddressSpace.handler.unit.test.ts b/packages/cli/__tests__/zostso/__unit__/send/address-space/AddressSpace.handler.unit.test.ts index c439ca7aee..584e3ab655 100644 --- a/packages/cli/__tests__/zostso/__unit__/send/address-space/AddressSpace.handler.unit.test.ts +++ b/packages/cli/__tests__/zostso/__unit__/send/address-space/AddressSpace.handler.unit.test.ts @@ -16,17 +16,13 @@ import { SendTso } from "@zowe/zos-tso-for-zowe-sdk"; import { IHandlerParameters, ImperativeError } from "@zowe/imperative"; import * as SendToAddressSpace from "../../../../../src/zostso/send/address_space/SendToAddressSpace.handler"; import { SendToAddressSpaceCommandDefinition } from "../../../../../src/zostso/send/address_space/SendToAddressSpace.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-tso", "send", "address-space"], - definition: SendToAddressSpaceCommandDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: SendToAddressSpaceCommandDefinition }); describe("send address-space handler tests", () => { diff --git a/packages/cli/__tests__/zostso/__unit__/start/address-space/AddressSpace.handler.unit.test.ts b/packages/cli/__tests__/zostso/__unit__/start/address-space/AddressSpace.handler.unit.test.ts index 5bd864a64f..3b9411ee08 100644 --- a/packages/cli/__tests__/zostso/__unit__/start/address-space/AddressSpace.handler.unit.test.ts +++ b/packages/cli/__tests__/zostso/__unit__/start/address-space/AddressSpace.handler.unit.test.ts @@ -11,23 +11,12 @@ import { StartTso } from "@zowe/zos-tso-for-zowe-sdk"; import { StartTsoData } from "../../../__resources__/StartTsoData"; -import { CommandProfiles, IHandlerParameters, ImperativeError, IProfile } from "@zowe/imperative"; +import { IHandlerParameters, ImperativeError } from "@zowe/imperative"; import * as AddressSpaceHandler from "../../../../../src/zostso/start/address-space/AddressSpace.handler"; import * as AddressSpaceDefinition from "../../../../../src/zostso/start/address-space/AddressSpace.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; -const PROFILE_MAP = new Map(); -PROFILE_MAP.set( - "zosmf", [{ - name: "zosmf", - type: "zosmf", - ...UNIT_TEST_ZOSMF_PROF_OPTS - }] -); - const TSO_PROF_OPTS = { logonProcedure: "IZUFPROC", characterSet: "697", @@ -38,21 +27,10 @@ const TSO_PROF_OPTS = { account: "DEFAULT" }; -PROFILE_MAP.set( - "tso", [{ - name: "tso", - type: "tso", - ...TSO_PROF_OPTS - }] -); - -const PROFILES: CommandProfiles = new CommandProfiles(PROFILE_MAP); - const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-tso", "start", "address-space"], - definition: AddressSpaceDefinition.AddressSpaceDefinition, - profiles: PROFILES + definition: AddressSpaceDefinition.AddressSpaceDefinition }); describe("start address-space handler tests", () => { diff --git a/packages/cli/__tests__/zostso/__unit__/stop/address-space/AddressSpace.handler.unit.test.ts b/packages/cli/__tests__/zostso/__unit__/stop/address-space/AddressSpace.handler.unit.test.ts index 978f739e01..80c78c1acf 100644 --- a/packages/cli/__tests__/zostso/__unit__/stop/address-space/AddressSpace.handler.unit.test.ts +++ b/packages/cli/__tests__/zostso/__unit__/stop/address-space/AddressSpace.handler.unit.test.ts @@ -15,17 +15,13 @@ import { StopTsoData } from "../../../__resources__/StopTsoData"; import { IHandlerParameters, ImperativeError } from "@zowe/imperative"; import * as AddressSpaceHandler from "../../../../../src/zostso/stop/address-space/AddressSpace.handler"; import * as AddressSpaceDefinition from "../../../../../src/zostso/stop/address-space/AddressSpace.definition"; -import { - UNIT_TEST_ZOSMF_PROF_OPTS, - UNIT_TEST_PROFILES_ZOSMF -} from "../../../../../../../__tests__/__src__/mocks/ZosmfProfileMock"; +import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_ZOSMF_PROF_OPTS, positionals: ["zos-tso", "stop", "address-space"], - definition: AddressSpaceDefinition.AddressSpaceDefinition, - profiles: UNIT_TEST_PROFILES_ZOSMF + definition: AddressSpaceDefinition.AddressSpaceDefinition }); describe("stop address-space handler tests", () => { diff --git a/packages/cli/__tests__/zosuss/__unit__/issue/ssh/Ssh.handler.unit.test.ts b/packages/cli/__tests__/zosuss/__unit__/issue/ssh/Ssh.handler.unit.test.ts index 58c1fedba0..c7bdc2efab 100644 --- a/packages/cli/__tests__/zosuss/__unit__/issue/ssh/Ssh.handler.unit.test.ts +++ b/packages/cli/__tests__/zosuss/__unit__/issue/ssh/Ssh.handler.unit.test.ts @@ -11,7 +11,7 @@ jest.mock("../../../../../../zosuss/lib/Shell"); -import { IHandlerParameters, IProfile, CommandProfiles, ConnectionPropsForSessCfg } from "@zowe/imperative"; +import { IHandlerParameters, ConnectionPropsForSessCfg } from "@zowe/imperative"; import SshHandler from "../../../../../src/zosuss/issue/ssh/Ssh.handler"; import * as SshDefinition from "../../../../../src/zosuss/issue/ssh/Ssh.definition"; import { Shell } from "@zowe/zos-uss-for-zowe-sdk"; @@ -47,73 +47,28 @@ const UNIT_TEST_SSH_PROF_OPTS_PRIVATE_KEY_WITH_PASSPHRASE_NO_USER = { keyPassPhrase: "dummyPassPhrase123" }; - -// A mocked profile map with ssh profile -const UNIT_TEST_PROFILE_MAP = new Map(); -UNIT_TEST_PROFILE_MAP.set( - "ssh", [{ - name: "ssh", - type: "ssh", - ...UNIT_TEST_SSH_PROF_OPTS - }] -); -const UNIT_TEST_PROFILES_SSH = new CommandProfiles(UNIT_TEST_PROFILE_MAP); - -const UNIT_TEST_PROFILE_MAP_PRIVATE_KEY = new Map(); -UNIT_TEST_PROFILE_MAP_PRIVATE_KEY.set( - "ssh", [{ - name: "ssh", - type: "ssh", - ...UNIT_TEST_SSH_PROF_OPTS_PRIVATE_KEY - }] -); -const UNIT_TEST_PROFILE_MAP_PRIVATE_KEY_WITH_PASSPHRASE = new Map(); -UNIT_TEST_PROFILE_MAP_PRIVATE_KEY_WITH_PASSPHRASE.set( - "ssh", [{ - name: "ssh", - type: "ssh", - ...UNIT_TEST_SSH_PROF_OPTS_PRIVATE_KEY_WITH_PASSPHRASE - }] -); -const UNIT_TEST_PROFILE_MAP_PRIVATE_KEY_WITH_PASSPHRASE_NO_USER = new Map(); -UNIT_TEST_PROFILE_MAP_PRIVATE_KEY_WITH_PASSPHRASE.set( - "ssh", [{ - name: "ssh", - type: "ssh", - ...UNIT_TEST_SSH_PROF_OPTS_PRIVATE_KEY_WITH_PASSPHRASE_NO_USER - }] -); - -const UNIT_TEST_PROFILES_SSH_PRIVATE_KEY = new CommandProfiles(UNIT_TEST_PROFILE_MAP_PRIVATE_KEY); -const UNIT_TEST_PROFILES_SSH_PRIVATE_KEY_WITH_PASSPHRASE = new CommandProfiles(UNIT_TEST_PROFILE_MAP_PRIVATE_KEY_WITH_PASSPHRASE); -const UNIT_TEST_PROFILES_SSH_PRIVATE_KEY_WITH_PASSPHRASE_NO_USER = new CommandProfiles(UNIT_TEST_PROFILE_MAP_PRIVATE_KEY_WITH_PASSPHRASE_NO_USER); - // Mocked parameters for the unit tests const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_SSH_PROF_OPTS, positionals: ["zos-uss", "issue", "ssh"], - definition: SshDefinition.SshDefinition, - profiles: UNIT_TEST_PROFILES_SSH + definition: SshDefinition.SshDefinition }); const DEFAULT_PARAMETERS_PRIVATE_KEY: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_SSH_PROF_OPTS_PRIVATE_KEY, positionals: ["zos-uss", "issue", "ssh"], - definition: SshDefinition.SshDefinition, - profiles: UNIT_TEST_PROFILES_SSH_PRIVATE_KEY + definition: SshDefinition.SshDefinition }); const DEFAULT_PARAMETERS_KEY_PASSPHRASE: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_SSH_PROF_OPTS_PRIVATE_KEY_WITH_PASSPHRASE, positionals: ["zos-uss", "issue", "ssh"], - definition: SshDefinition.SshDefinition, - profiles: UNIT_TEST_PROFILES_SSH_PRIVATE_KEY_WITH_PASSPHRASE, + definition: SshDefinition.SshDefinition }); const DEFAULT_PARAMETERS_KEY_PASSPHRASE_NO_USER: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_SSH_PROF_OPTS_PRIVATE_KEY_WITH_PASSPHRASE_NO_USER, positionals: ["zos-uss", "issue", "ssh"], - definition: SshDefinition.SshDefinition, - profiles: UNIT_TEST_PROFILES_SSH_PRIVATE_KEY_WITH_PASSPHRASE_NO_USER, + definition: SshDefinition.SshDefinition }); const testOutput = "TEST OUTPUT"; diff --git a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/Cmd.cli.invalid.profile-spec.integration.test.ts b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/Cmd.cli.invalid.profile-spec.integration.test.ts deleted file mode 100644 index fb1f2c2c38..0000000000 --- a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/Cmd.cli.invalid.profile-spec.integration.test.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ITestEnvironment } from "../../../../../../__src__/environment/doc/response/ITestEnvironment"; -import { SetupTestEnvironment } from "../../../../../../__src__/environment/SetupTestEnvironment"; -import { runCliScript } from "../../../../../../src/TestUtil"; - - -let TEST_ENVIRONMENT: ITestEnvironment; - -describe("cmd-cli invalid profile-spec", () => { - // Create the unique test environment - beforeAll(async () => { - TEST_ENVIRONMENT = await SetupTestEnvironment.createTestEnv({ - cliHomeEnvVar: "CMD_CLI_CLI_HOME", - testName: "cmd_cli_invalid_profile_spec" - }); - }); - - it("should fail the command if the profile property is not supplied and the handler requests a profile", () => { - const response = runCliScript(__dirname + "/__scripts__/profile-spec.sh", TEST_ENVIRONMENT.workingDir); - expect(response.stdout.toString()).toBe(''); - expect(response.stderr.toString()).toContain('Internal Error: No profiles of type "blah" were loaded for this command.'); - expect(response.status).toBe(1); - expect(response.stderr.toString()).toContain('This error can occur for one of two reasons:'); - expect(response.stderr.toString()).toContain('- The "profile" property on the command definition document ' + - 'does NOT specify the requested profile type'); - expect(response.stderr.toString()).toContain('- The profile type is marked "optional", ' + - 'no profiles of type "blah" have been created, ' + - 'and the command handler requested a profile of type "blah" with "failNotFound=true"'); - }); -}); diff --git a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__scripts__/profile-spec.sh b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__scripts__/profile-spec.sh deleted file mode 100644 index 1879d239cd..0000000000 --- a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__scripts__/profile-spec.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -cmd-cli invalid profile-spec -exit $? \ No newline at end of file diff --git a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/root/__snapshots__/Cmd.cli.root.integration.test.ts.snap b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/root/__snapshots__/Cmd.cli.root.integration.test.ts.snap index 8606fe3568..0a4eb0e99b 100644 --- a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/root/__snapshots__/Cmd.cli.root.integration.test.ts.snap +++ b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/root/__snapshots__/Cmd.cli.root.integration.test.ts.snap @@ -196,11 +196,6 @@ cmd-cli invalid no-handler This will never get invoked. No handler specified on this definition. -cmd-cli invalid profile-spec - - Command handler attempts to load a profile that wasn't specified on the command - definition - cmd-cli invoke exit-143 Test handler that exits with status code 143 @@ -260,10 +255,6 @@ cmd-cli profile mapping-positional Tests Imperative's profile to CLI mapping capabilities. -cmd-cli read profile - - Read some profiles - cmd-cli respond with-data-array Formulates a string array object to pass back when response format JSON is diff --git a/packages/imperative/__tests__/__integration__/cmd/src/cli/invalid/Invalid.definition.ts b/packages/imperative/__tests__/__integration__/cmd/src/cli/invalid/Invalid.definition.ts index d6ca7fef31..6c0fa036ba 100644 --- a/packages/imperative/__tests__/__integration__/cmd/src/cli/invalid/Invalid.definition.ts +++ b/packages/imperative/__tests__/__integration__/cmd/src/cli/invalid/Invalid.definition.ts @@ -12,15 +12,13 @@ import { ICommandDefinition } from "../../../../../../lib/index"; import { NoHandlerDefinition } from "./no-handler/NoHandler.definition"; import { InvalidHandlerDefinition } from "./invalid-handler/InvalidHandler.definition"; -import { ProfileSpecDefinition } from "./profile-spec/ProfileSpec.definition"; export const definition: ICommandDefinition = { name: "invalid", description: "Attempt to invoke commands that have poorly coded definitions.", summary: "Invalid definitions", type: "group", - children: [NoHandlerDefinition, InvalidHandlerDefinition, - ProfileSpecDefinition] + children: [NoHandlerDefinition, InvalidHandlerDefinition] }; module.exports = definition; diff --git a/packages/imperative/__tests__/__integration__/cmd/src/cli/invalid/profile-spec/ProfileSpec.definition.ts b/packages/imperative/__tests__/__integration__/cmd/src/cli/invalid/profile-spec/ProfileSpec.definition.ts deleted file mode 100644 index a14f67bb4c..0000000000 --- a/packages/imperative/__tests__/__integration__/cmd/src/cli/invalid/profile-spec/ProfileSpec.definition.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandDefinition } from "../../../../../../../lib"; - - -export const ProfileSpecDefinition: ICommandDefinition = { - name: "profile-spec", - aliases: ["ao"], - description: "Command handler attempts to load a profile that wasn't specified on the command definition", - type: "command", - handler: __dirname + "/ProfileSpec.handler" -}; diff --git a/packages/imperative/__tests__/__integration__/cmd/src/cli/invalid/profile-spec/ProfileSpec.handler.ts b/packages/imperative/__tests__/__integration__/cmd/src/cli/invalid/profile-spec/ProfileSpec.handler.ts deleted file mode 100644 index 750248d6c4..0000000000 --- a/packages/imperative/__tests__/__integration__/cmd/src/cli/invalid/profile-spec/ProfileSpec.handler.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandHandler, IHandlerParameters } from "../../../../../../../lib"; - -export default class ProfileSpecHandler implements ICommandHandler { - public async process(params: IHandlerParameters): Promise { - // eslint-disable-next-line deprecation/deprecation - params.profiles.get("blah"); - } -} diff --git a/packages/imperative/__tests__/__integration__/cmd/src/cli/read/Read.definition.ts b/packages/imperative/__tests__/__integration__/cmd/src/cli/read/Read.definition.ts deleted file mode 100644 index d10a2b8121..0000000000 --- a/packages/imperative/__tests__/__integration__/cmd/src/cli/read/Read.definition.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandDefinition } from "../../../../../../lib"; -import { ProfileCommand } from "./profile/Profile.definition"; - -export const definition: ICommandDefinition = { - name: "read", - description: "Read some profiles", - summary: "Read some profiles", - type: "group", - children: [ProfileCommand], -}; - -module.exports = definition; diff --git a/packages/imperative/__tests__/__integration__/cmd/src/cli/read/profile/Profile.definition.ts b/packages/imperative/__tests__/__integration__/cmd/src/cli/read/profile/Profile.definition.ts deleted file mode 100644 index f8a0337eef..0000000000 --- a/packages/imperative/__tests__/__integration__/cmd/src/cli/read/profile/Profile.definition.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandDefinition } from "../../../../../../../lib"; - -export const ProfileCommand: ICommandDefinition = { - name: "profile", - description: "Read some profiles", - summary: "Read some profiles", - type: "command", - handler: __dirname + "/Profile.handler", - profile: { - required: ["insecure"] - } -}; diff --git a/packages/imperative/__tests__/__integration__/cmd/src/cli/read/profile/Profile.handler.ts b/packages/imperative/__tests__/__integration__/cmd/src/cli/read/profile/Profile.handler.ts deleted file mode 100644 index 18da0fe758..0000000000 --- a/packages/imperative/__tests__/__integration__/cmd/src/cli/read/profile/Profile.handler.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { IHandlerParameters, ICommandHandler, TextUtils } from "../../../../../../../lib/index"; - -export default class FirstGroupCommandOneHandler implements ICommandHandler { - public async process(params: IHandlerParameters): Promise { - // eslint-disable-next-line deprecation/deprecation - const prof = params.profiles.get("insecure"); - params.response.console.log(TextUtils.prettyJson(prof)); - } -} diff --git a/packages/imperative/__tests__/src/packages/cmd/__integration__/CliProfileManager.integration.test.ts b/packages/imperative/__tests__/src/packages/cmd/__integration__/CliProfileManager.integration.test.ts index 22ebad1b72..4f5ce662af 100644 --- a/packages/imperative/__tests__/src/packages/cmd/__integration__/CliProfileManager.integration.test.ts +++ b/packages/imperative/__tests__/src/packages/cmd/__integration__/CliProfileManager.integration.test.ts @@ -9,6 +9,8 @@ * */ +/* eslint-disable deprecation/deprecation */ + import * as TestUtil from "../../../TestUtil"; import { TestLogger } from "../../../../src/TestLogger"; import { CliProfileManager } from "../../../../../src/cmd/src/profiles/CliProfileManager"; diff --git a/packages/imperative/src/cmd/__tests__/CommandProcessor.unit.test.ts b/packages/imperative/src/cmd/__tests__/CommandProcessor.unit.test.ts index be3f7bfe2a..a333af0ebf 100644 --- a/packages/imperative/src/cmd/__tests__/CommandProcessor.unit.test.ts +++ b/packages/imperative/src/cmd/__tests__/CommandProcessor.unit.test.ts @@ -18,7 +18,6 @@ import { IHelpGenerator } from "../src/help/doc/IHelpGenerator"; import { ImperativeError } from "../../error"; import { ICommandValidatorResponse } from "../src/doc/response/response/ICommandValidatorResponse"; import { SharedOptions } from "../src/utils/SharedOptions"; -import { CommandProfileLoader } from "../src/profiles/CommandProfileLoader"; import { CliUtils } from "../../utilities/src/CliUtils"; import { WebHelpManager } from "../src/help/WebHelpManager"; import { ImperativeConfig } from "../../utilities/src/ImperativeConfig"; @@ -789,43 +788,6 @@ describe("Command Processor", () => { expect(logOutput).toContain("--user **** --password **** --token-value **** --cert-file-passphrase **** --cert-key-file ****"); }); - it("should handle an error thrown from the profile loader", async () => { - // Allocate the command processor - const processor: CommandProcessor = new CommandProcessor({ - envVariablePrefix: ENV_VAR_PREFIX, - fullDefinition: SAMPLE_COMPLEX_COMMAND, - definition: SAMPLE_COMMAND_REAL_HANDLER, - helpGenerator: FAKE_HELP_GENERATOR, - rootCommandName: SAMPLE_ROOT_COMMAND, - commandLine: "", - promptPhrase: "dummydummy" - }); - - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - - // Mock the profile loader - CommandProfileLoader.loader = jest.fn((args) => { - throw new ImperativeError({ msg: "Profile loading failed!" }); - }); - - const parms: any = { - arguments: { _: ["check", "for", "banana"], $0: "", valid: true }, - responseFormat: "json", silent: true - }; - const commandResponse: ICommandResponse = await processor.invoke(parms); - - expect(commandResponse).toBeDefined(); - const stderrText = (commandResponse.stderr as Buffer).toString(); - expect(stderrText).toContain("Command Preparation Failed:"); - expect(stderrText).toContain("Profile loading failed!"); - expect(commandResponse.message).toEqual("Profile loading failed!"); - expect(commandResponse.error?.msg).toEqual("Profile loading failed!"); - expect(commandResponse.error?.additionalDetails).not.toBeDefined(); - }); - it("should handle not being able to instantiate the handler", async () => { // Allocate the command processor const processor: CommandProcessor = new CommandProcessor({ @@ -843,15 +805,6 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - // Nothing to do - } - }; - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -897,15 +850,6 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - // Nothing to do - } - }; - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -948,15 +892,6 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - // Nothing to do - } - }; - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1008,15 +943,6 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - // Nothing to do - } - }; - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1050,15 +976,6 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - // Nothing to do - } - }; - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1100,15 +1017,6 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - // Nothing to do - } - }; - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1150,15 +1058,6 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - // Nothing to do - } - }; - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1200,15 +1099,6 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - // Nothing to do - } - }; - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1253,15 +1143,6 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - // Nothing to do - } - }; - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1301,15 +1182,6 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - // Nothing to do - } - }; - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1342,15 +1214,6 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - // Nothing to do - } - }; - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1484,15 +1347,6 @@ describe("Command Processor", () => { config: ImperativeConfig.instance.config }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - return; - } - }; - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1595,15 +1449,6 @@ describe("Command Processor", () => { config: ImperativeConfig.instance.config }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - return; - } - }; - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1667,19 +1512,8 @@ describe("Command Processor", () => { config: ImperativeConfig.instance.config }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - return; - } - }; - }); - // return the "fake" args object with values from profile - CliUtils.getOptValueFromProfiles = jest.fn((cmdProfiles, profileDef, allOpts) => { - return {}; - }); + CliUtils.getOptValuesFromConfig = jest.fn().mockReturnValue({}); const parms: any = { arguments: { @@ -1767,15 +1601,6 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - // Nothing to do - } - }; - }); - jest.spyOn(process, "chdir"); const mockConfigReload = jest.fn(); jest.spyOn(ImperativeConfig, "instance", "get").mockReturnValue({ @@ -1833,15 +1658,6 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - // Nothing to do - } - }; - }); - jest.spyOn(process, "chdir"); const mockConfigReload = jest.fn(); jest.spyOn(ImperativeConfig, "instance", "get").mockReturnValue({ @@ -1886,7 +1702,8 @@ describe("Command Processor", () => { helpGenerator: FAKE_HELP_GENERATOR, rootCommandName: SAMPLE_ROOT_COMMAND, commandLine: "", - promptPhrase: "dummydummy" + promptPhrase: "dummydummy", + config: ImperativeConfig.instance.config }); // Mock read stdin @@ -1894,21 +1711,8 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - return; - } - }; - }); - // return the "fake" args object with values from profile - CliUtils.getOptValueFromProfiles = jest.fn((cmdProfiles, profileDef, allOpts) => { - return { - color: "yellow" - }; - }); + CliUtils.getOptValuesFromConfig = jest.fn().mockReturnValue({ color: "yellow" }); const parms: any = { arguments: { @@ -1920,7 +1724,7 @@ describe("Command Processor", () => { }; const commandResponse: ICommandResponse = await processor.invoke(parms); - expect(CliUtils.getOptValueFromProfiles).toHaveBeenCalledTimes(1); + expect(CliUtils.getOptValuesFromConfig).toHaveBeenCalledTimes(1); expect(commandResponse.stdout.toString()).toMatchSnapshot(); expect(commandResponse).toBeDefined(); expect(commandResponse).toMatchSnapshot(); @@ -1942,19 +1746,8 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - return; - } - }; - }); - // return the "fake" args object with values from profile - CliUtils.getOptValueFromProfiles = jest.fn((cmdProfiles, profileDef, allOpts) => { - return {}; - }); + CliUtils.getOptValuesFromConfig = jest.fn().mockReturnValue({}); const parms: any = { arguments: { @@ -1979,7 +1772,8 @@ describe("Command Processor", () => { helpGenerator: FAKE_HELP_GENERATOR, rootCommandName: SAMPLE_ROOT_COMMAND, commandLine: "", - promptPhrase: "dummydummy" + promptPhrase: "dummydummy", + config: ImperativeConfig.instance.config }); // Mock read stdin @@ -1987,21 +1781,8 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - return; - } - }; - }); - // return the "fake" args object with values from profile - CliUtils.getOptValueFromProfiles = jest.fn((cmdProfiles, profileDef, allOpts) => { - return { - color: "yellow" - }; - }); + CliUtils.getOptValuesFromConfig = jest.fn().mockReturnValue({ color: "yellow" }); const parms: any = { arguments: { @@ -2013,7 +1794,7 @@ describe("Command Processor", () => { }; const commandResponse: ICommandResponse = await processor.invoke(parms); - expect(CliUtils.getOptValueFromProfiles).toHaveBeenCalledTimes(1); + expect(CliUtils.getOptValuesFromConfig).toHaveBeenCalledTimes(1); expect(commandResponse.stdout.toString()).toMatchSnapshot(); expect(commandResponse).toBeDefined(); expect(commandResponse).toMatchSnapshot(); @@ -2027,7 +1808,8 @@ describe("Command Processor", () => { helpGenerator: FAKE_HELP_GENERATOR, rootCommandName: SAMPLE_ROOT_COMMAND, commandLine: "", - promptPhrase: "dummydummy" + promptPhrase: "dummydummy", + config: ImperativeConfig.instance.config }); // Mock read stdin @@ -2035,21 +1817,8 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - return; - } - }; - }); - // return the "fake" args object with values from profile - CliUtils.getOptValueFromProfiles = jest.fn((cmdProfiles, profileDef, allOpts) => { - return { - color: "yellow" - }; - }); + CliUtils.getOptValuesFromConfig = jest.fn().mockReturnValue({ color: "yellow" }); const parms: any = { arguments: { @@ -2062,7 +1831,7 @@ describe("Command Processor", () => { }; const commandResponse: ICommandResponse = await processor.invoke(parms); - expect(CliUtils.getOptValueFromProfiles).toHaveBeenCalledTimes(1); + expect(CliUtils.getOptValuesFromConfig).toHaveBeenCalledTimes(1); expect(commandResponse.stdout.toString()).toMatchSnapshot(); expect(commandResponse).toBeDefined(); expect(commandResponse).toMatchSnapshot(); @@ -2076,7 +1845,8 @@ describe("Command Processor", () => { helpGenerator: FAKE_HELP_GENERATOR, rootCommandName: SAMPLE_ROOT_COMMAND, commandLine: "", - promptPhrase: "dummydummy" + promptPhrase: "dummydummy", + config: ImperativeConfig.instance.config }); // Mock read stdin @@ -2084,21 +1854,8 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - return; - } - }; - }); - // return the "fake" args object with values from profile - CliUtils.getOptValueFromProfiles = jest.fn((cmdProfiles, profileDef, allOpts) => { - return { - color: "yellow" - }; - }); + CliUtils.getOptValuesFromConfig = jest.fn().mockReturnValue({ color: "yellow" }); const parms: any = { arguments: { @@ -2111,7 +1868,7 @@ describe("Command Processor", () => { }; const commandResponse: ICommandResponse = await processor.invoke(parms); - expect(CliUtils.getOptValueFromProfiles).toHaveBeenCalledTimes(1); + expect(CliUtils.getOptValuesFromConfig).toHaveBeenCalledTimes(1); expect(commandResponse.stdout.toString()).toMatchSnapshot(); expect(commandResponse).toBeDefined(); expect(commandResponse).toMatchSnapshot(); @@ -2171,15 +1928,6 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - // Nothing to do - } - }; - }); - const parms: any = { arguments: { _: [], @@ -2215,15 +1963,6 @@ describe("Command Processor", () => { // Nothing to do }); - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - // Nothing to do - } - }; - }); - const parms: any = { arguments: { _: [], @@ -2419,22 +2158,22 @@ describe("Command Processor", () => { }); it("should find profile that matches name specified in arguments", async () => { - const commandPrepared = await (processor as any).prepare(null, { + const preparedArgs = await (processor as any).prepare(null, { "banana-profile": "ripe" }); - expect(commandPrepared.args.color).toBe("yellow"); + expect(preparedArgs.color).toBe("yellow"); }); it("should find profile with type prefix that matches name specified in arguments", async () => { - const commandPrepared = await (processor as any).prepare(null, { + const preparedArgs = await (processor as any).prepare(null, { "banana-profile": "old" }); - expect(commandPrepared.args.color).toBe("brown"); + expect(preparedArgs.color).toBe("brown"); }); it("should find default profile that matches type", async () => { - const commandPrepared = await (processor as any).prepare(null, {}); - expect(commandPrepared.args.color).toBe("green"); + const preparedArgs = await (processor as any).prepare(null, {}); + expect(preparedArgs.color).toBe("green"); }); }); }); diff --git a/packages/imperative/src/cmd/__tests__/profiles/CliProfileManager.unit.test.ts b/packages/imperative/src/cmd/__tests__/profiles/CliProfileManager.unit.test.ts index 8985e6b2a0..714dfc7d44 100644 --- a/packages/imperative/src/cmd/__tests__/profiles/CliProfileManager.unit.test.ts +++ b/packages/imperative/src/cmd/__tests__/profiles/CliProfileManager.unit.test.ts @@ -9,6 +9,8 @@ * */ +/* eslint-disable deprecation/deprecation */ + import { ImperativeError } from "../../../error"; import { TestLogger } from "../../../../__tests__/src/TestLogger"; import { APPLE_PROFILE_TYPE, ONLY_APPLE } from "./TestConstants"; diff --git a/packages/imperative/src/cmd/__tests__/profiles/CommandProfileLoader.unit.test.ts b/packages/imperative/src/cmd/__tests__/profiles/CommandProfileLoader.unit.test.ts index 0f5cea376b..a23e844942 100644 --- a/packages/imperative/src/cmd/__tests__/profiles/CommandProfileLoader.unit.test.ts +++ b/packages/imperative/src/cmd/__tests__/profiles/CommandProfileLoader.unit.test.ts @@ -9,6 +9,8 @@ * */ +/* eslint-disable deprecation/deprecation */ + import { CommandProfileLoader } from "../../src/profiles/CommandProfileLoader"; import { ICommandDefinition } from "../../src/doc/ICommandDefinition"; import { TestLogger } from "../../../../__tests__/src/TestLogger"; diff --git a/packages/imperative/src/cmd/__tests__/profiles/CommandProfiles.unit.test.ts b/packages/imperative/src/cmd/__tests__/profiles/CommandProfiles.unit.test.ts index 48352581fc..a8d2397c8a 100644 --- a/packages/imperative/src/cmd/__tests__/profiles/CommandProfiles.unit.test.ts +++ b/packages/imperative/src/cmd/__tests__/profiles/CommandProfiles.unit.test.ts @@ -9,6 +9,8 @@ * */ +/* eslint-disable deprecation/deprecation */ + import { IProfile, IProfileLoaded } from "../../../profiles"; import { CommandProfiles } from "../../src/profiles/CommandProfiles"; import { ImperativeError } from "../../../error"; diff --git a/packages/imperative/src/cmd/__tests__/profiles/profileHandlers/AddTwoNumbersHandler.ts b/packages/imperative/src/cmd/__tests__/profiles/profileHandlers/AddTwoNumbersHandler.ts deleted file mode 100644 index 0f3db4eef3..0000000000 --- a/packages/imperative/src/cmd/__tests__/profiles/profileHandlers/AddTwoNumbersHandler.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandHandler, IHandlerParameters } from "../../../"; - -export default class AddTwoNumbersHandler implements ICommandHandler { - public async process(params: IHandlerParameters): Promise { - const sum = params.arguments.a + params.arguments.b; - params.response.console.log("updated sum to: " + sum); - params.response.data.setObj({sum}); - } -} diff --git a/packages/imperative/src/cmd/__tests__/profiles/profileHandlers/DoNothingHandler.ts b/packages/imperative/src/cmd/__tests__/profiles/profileHandlers/DoNothingHandler.ts deleted file mode 100644 index ab19d2da81..0000000000 --- a/packages/imperative/src/cmd/__tests__/profiles/profileHandlers/DoNothingHandler.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandHandler, IHandlerParameters } from "../../../"; - -export default class DoNothingHandler implements ICommandHandler { - public async process(params: IHandlerParameters): Promise { - params.response.console.log("Doing nothing "); - params.response.data.setObj({}); - } -} diff --git a/packages/imperative/src/cmd/__tests__/profiles/profileHandlers/ThrowErrorHandler.ts b/packages/imperative/src/cmd/__tests__/profiles/profileHandlers/ThrowErrorHandler.ts deleted file mode 100644 index 021b5f32d2..0000000000 --- a/packages/imperative/src/cmd/__tests__/profiles/profileHandlers/ThrowErrorHandler.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandHandler, IHandlerParameters } from "../../../"; - -export default class ThrowErrorHandler implements ICommandHandler { - public async process(params: IHandlerParameters): Promise { - throw new Error("threw an error"); - } -} diff --git a/packages/imperative/src/cmd/src/CommandProcessor.ts b/packages/imperative/src/cmd/src/CommandProcessor.ts index 5adfe0ad0e..bdb78ee99d 100644 --- a/packages/imperative/src/cmd/src/CommandProcessor.ts +++ b/packages/imperative/src/cmd/src/CommandProcessor.ts @@ -17,11 +17,8 @@ import { ICommandHandler } from "./doc/handler/ICommandHandler"; import { couldNotInstantiateCommandHandler, unexpectedCommandError } from "../../messages"; import { SharedOptions } from "./utils/SharedOptions"; import { IImperativeError, ImperativeError } from "../../error"; -import { ProfileUtils } from "../../profiles"; import { SyntaxValidator } from "./syntax/SyntaxValidator"; -import { CommandProfileLoader } from "./profiles/CommandProfileLoader"; import { IHelpGenerator } from "./help/doc/IHelpGenerator"; -import { ICommandPrepared } from "./doc/response/response/ICommandPrepared"; import { CommandResponse } from "./response/CommandResponse"; import { ICommandResponse } from "./doc/response/response/ICommandResponse"; import { Logger } from "../../logger"; @@ -40,7 +37,6 @@ import { Constants } from "../../constants"; import { ICommandArguments } from "./doc/args/ICommandArguments"; import { CliUtils } from "../../utilities/src/CliUtils"; import { WebHelpManager } from "./help/WebHelpManager"; -import { ICommandProfile } from "./doc/profiles/definition/ICommandProfile"; import { Config } from "../../config/src/Config"; import { ConfigUtils } from "../../config/src/ConfigUtils"; import { ConfigConstants } from "../../config/src/ConfigConstants"; @@ -409,7 +405,7 @@ export class CommandProcessor { prepareResponse.succeeded(); // Prepare for command processing - load profiles, stdin, etc. - let prepared: ICommandPrepared; + let preparedArgs: ICommandArguments; try { // Build the response object, base args object, and the entire array of options for this command // Assume that the command succeed, it will be marked otherwise under the appropriate failure conditions @@ -442,7 +438,7 @@ export class CommandProcessor { } this.log.info(`Preparing (loading profiles, reading stdin, etc.) execution of "${this.definition.name}" command...`); - prepared = await this.prepare(prepareResponse, params.arguments); + preparedArgs = await this.prepare(prepareResponse, params.arguments); } catch (prepareErr) { // Indicate that the command has failed @@ -475,7 +471,7 @@ export class CommandProcessor { } // Recreate the response object with the update params from prepare. - params.arguments = prepared.args; + params.arguments = preparedArgs; const response = this.constructResponseObject(params); response.succeeded(); @@ -488,36 +484,36 @@ export class CommandProcessor { // convert if positional is an array designated by "..." const positionalName = positional.name.replace("...", ""); // check if value provided - if (prepared.args[positionalName] != null) { + if (preparedArgs[positionalName] != null) { // string processing - if (typeof prepared.args[positionalName] === "string" && - prepared.args[positionalName].toUpperCase() === this.promptPhrase.toUpperCase()) { + if (typeof preparedArgs[positionalName] === "string" && + preparedArgs[positionalName].toUpperCase() === this.promptPhrase.toUpperCase()) { // prompt has been requested for a positional this.log.debug("Prompting for positional %s which was requested by passing the value %s", positionalName, this.promptPhrase); - prepared.args[positionalName] = + preparedArgs[positionalName] = await response.console.prompt(`"${positionalName}" Description: ` + `${positional.description}\nPlease enter "${positionalName}":`, { hideText: true, secToWait: 0 }); } // array processing else { - if (prepared.args[positionalName] != null && - Array.isArray(prepared.args[positionalName]) && - prepared.args[positionalName][0] != null && - typeof prepared.args[positionalName][0] === "string" && - prepared.args[positionalName][0].toUpperCase() === this.promptPhrase.toUpperCase()) { + if (preparedArgs[positionalName] != null && + Array.isArray(preparedArgs[positionalName]) && + preparedArgs[positionalName][0] != null && + typeof preparedArgs[positionalName][0] === "string" && + preparedArgs[positionalName][0].toUpperCase() === this.promptPhrase.toUpperCase()) { // prompt has been requested for a positional this.log.debug("Prompting for positional %s which was requested by passing the value %s", - prepared.args[positionalName][0], this.promptPhrase); - prepared.args[positionalName][0] = + preparedArgs[positionalName][0], this.promptPhrase); + preparedArgs[positionalName][0] = await response.console.prompt(`"${positionalName}" Description: ` + `${positional.description}\nPlease enter "${positionalName}":`, { hideText: true, secToWait: 0 }); // prompting enters as string but need to place it in array - const array = prepared.args[positionalName][0].split(" "); - prepared.args[positionalName] = array; + const array = preparedArgs[positionalName][0].split(" "); + preparedArgs[positionalName] = array; } } } @@ -527,48 +523,48 @@ export class CommandProcessor { if (this.definition.options != null && this.definition.options.length > 0) { for (const option of this.definition.options) { // check if value provided - if (prepared.args[option.name] != null) { + if (preparedArgs[option.name] != null) { // string processing - if (typeof prepared.args[option.name] === "string" && - prepared.args[option.name].toUpperCase() === this.promptPhrase.toUpperCase()) { + if (typeof preparedArgs[option.name] === "string" && + preparedArgs[option.name].toUpperCase() === this.promptPhrase.toUpperCase()) { // prompt has been requested for an --option this.log.debug("Prompting for option %s which was requested by passing the value %s", option.name, this.promptPhrase); - prepared.args[option.name] = + preparedArgs[option.name] = await response.console.prompt(`"${option.name}" Description: ` + `${option.description}\nPlease enter "${option.name}":`, { hideText: true, secToWait: 0 }); const camelCase = CliUtils.getOptionFormat(option.name).camelCase; - prepared.args[camelCase] = prepared.args[option.name]; + preparedArgs[camelCase] = preparedArgs[option.name]; if (option.aliases != null) { for (const alias of option.aliases) { // set each alias of the args object as well - prepared.args[alias] = prepared.args[option.name]; + preparedArgs[alias] = preparedArgs[option.name]; } } } // array processing else { - if (Array.isArray(prepared.args[option.name]) && - prepared.args[option.name][0] != null && - typeof prepared.args[option.name][0] === "string" && - prepared.args[option.name][0].toUpperCase() === this.promptPhrase.toUpperCase()) { + if (Array.isArray(preparedArgs[option.name]) && + preparedArgs[option.name][0] != null && + typeof preparedArgs[option.name][0] === "string" && + preparedArgs[option.name][0].toUpperCase() === this.promptPhrase.toUpperCase()) { // prompt has been requested for an --option this.log.debug("Prompting for option %s which was requested by passing the value %s", option.name, this.promptPhrase); - prepared.args[option.name][0] = + preparedArgs[option.name][0] = await response.console.prompt(`"${option.name}" Description: ` + `${option.description}\nPlease enter "${option.name}":`, { hideText: true, secToWait: 0 }); - const array = prepared.args[option.name][0].split(" "); - prepared.args[option.name] = array; + const array = preparedArgs[option.name][0].split(" "); + preparedArgs[option.name] = array; const camelCase = CliUtils.getOptionFormat(option.name).camelCase; - prepared.args[camelCase] = prepared.args[option.name]; + preparedArgs[camelCase] = preparedArgs[option.name]; if (option.aliases != null) { for (const alias of option.aliases) { // set each alias of the args object as well - prepared.args[alias] = prepared.args[option.name]; + preparedArgs[alias] = preparedArgs[option.name]; } } } @@ -595,7 +591,7 @@ export class CommandProcessor { // Validate that the syntax is correct for the command let validator: ICommandValidatorResponse; try { - validator = await this.validate(prepared.args, response); + validator = await this.validate(preparedArgs, response); } catch (e) { const errMsg: string = `Unexpected syntax validation error`; const errReason: string = errMsg + ": " + e.message; @@ -630,9 +626,8 @@ export class CommandProcessor { const handlerParms: IHandlerParameters = { response, - profiles: prepared.profiles, - arguments: prepared.args, - positionals: prepared.args._, + arguments: preparedArgs, + positionals: preparedArgs._, definition: this.definition, fullDefinition: this.fullDefinition, stdin: this.getStdinStream() @@ -696,16 +691,15 @@ export class CommandProcessor { try { await handler.process({ response: chainedResponse, - profiles: prepared.profiles, arguments: ChainedHandlerService.getArguments( this.mCommandRootName, this.definition.chainedHandlers, chainedHandlerIndex, chainedResponses, - prepared.args, + preparedArgs, this.log ), - positionals: prepared.args._, + positionals: preparedArgs._, definition: this.definition, fullDefinition: this.fullDefinition, stdin: this.getStdinStream(), @@ -882,9 +876,9 @@ export class CommandProcessor { * the command handler is invoked. * @param {CommandResponse} response: The response object for command messaging. * @param {yargs.Arguments} commandArguments: The arguments specified on the command line. - * @return {Promise}: Promise to fulfill when complete. + * @return {Promise}: Promise to fulfill when complete. */ - private async prepare(response: CommandResponse, commandArguments: Arguments): Promise { + private async prepare(response: CommandResponse, commandArguments: Arguments): Promise { // Construct the imperative arguments - replacement/wrapper for Yargs to insulate handlers against any // changes made to Yargs let args: ICommandArguments = CliUtils.buildBaseArgs(commandArguments); @@ -905,100 +899,11 @@ export class CommandProcessor { this.log.trace(`Reading stdin for "${this.definition.name}" command...`); await SharedOptions.readStdinIfRequested(commandArguments, response, this.definition.type); - // Build a list of all profile types - this will help us search the CLI - // options for profiles specified by the user - let allTypes: string[] = []; - if (this.definition.profile != null) { - if (this.definition.profile.required != null) - allTypes = allTypes.concat(this.definition.profile.required); - if (this.definition.profile.optional != null) - allTypes = allTypes.concat(this.definition.profile.optional); - } - // Build an object that contains all the options loaded from config - const fulfilled: string[] = []; - let fromCnfg: any = {}; if (this.mConfig != null) { - for (const profileType of allTypes) { - const opt = ProfileUtils.getProfileOptionAndAlias(profileType)[0]; - // If the config contains the requested profiles, then "remember" - // that this type has been fulfilled - so that we do NOT load from - // the traditional profile location - const profileTypePrefix = profileType + "_"; - let p: any = {}; - if (args[opt] != null && this.mConfig.api.profiles.exists(args[opt])) { - fulfilled.push(profileType); - p = this.mConfig.api.profiles.get(args[opt]); - } else if (args[opt] != null && !args[opt].startsWith(profileTypePrefix) && - this.mConfig.api.profiles.exists(profileTypePrefix + args[opt])) { - fulfilled.push(profileType); - p = this.mConfig.api.profiles.get(profileTypePrefix + args[opt]); - } else if (args[opt] == null && - this.mConfig.properties.defaults[profileType] != null && - this.mConfig.api.profiles.exists(this.mConfig.properties.defaults[profileType])) { - fulfilled.push(profileType); - p = this.mConfig.api.profiles.defaultGet(profileType); - } - fromCnfg = { ...p, ...fromCnfg }; - } - } - - // Convert each property extracted from the config to the correct yargs - // style cases for the command handler (kebab and camel) - allOpts.forEach((opt) => { - const cases = CliUtils.getOptionFormat(opt.name); - const profileKebab = fromCnfg[cases.kebabCase]; - const profileCamel = fromCnfg[cases.camelCase]; - - if ((profileCamel !== undefined || profileKebab !== undefined) && - (!Object.prototype.hasOwnProperty.call(args, cases.kebabCase) && - !Object.prototype.hasOwnProperty.call(args, cases.camelCase))) { - - // If both case properties are present in the profile, use the one that matches - // the option name explicitly - const value = profileKebab !== undefined && profileCamel !== undefined ? - opt.name === cases.kebabCase ? profileKebab : profileCamel : - profileKebab !== undefined ? profileKebab : profileCamel; - const keys = CliUtils.setOptionValue(opt.name, - "aliases" in opt ? opt.aliases : [], - value - ); - fromCnfg = { ...fromCnfg, ...keys }; - } - }); - - // Merge the arguments from the config into the CLI args - this.log.trace(`Arguments extracted from the config:\n${inspect(fromCnfg)}`); - args = CliUtils.mergeArguments(fromCnfg, args); - - // Load all profiles for the command - this.log.trace(`Loading profiles for "${this.definition.name}" command. ` + - `Profile definitions: ${inspect(this.definition.profile, { depth: null })}`); - - const profiles = await CommandProfileLoader.loader({ - commandDefinition: this.definition - }).loadProfiles(args); - this.log.trace(`Profiles loaded for "${this.definition.name}" command:\n${inspect(profiles, { depth: null })}`); - - // If we have profiles listed on the command definition (the would be loaded already) - // we can extract values from them for options arguments - if (this.definition.profile != null) { - - // "fake out" the cli util to only populate options for profiles - // that have not been fulfilled by the config - const p: ICommandProfile = { - required: [], - optional: [], - suppressOptions: this.definition.profile.suppressOptions - }; - - if (this.definition.profile.required) - p.required = this.definition.profile.required.filter(type => fulfilled.indexOf(type) < 0); - if (this.definition.profile.optional) - p.optional = this.definition.profile.optional.filter(type => fulfilled.indexOf(type) < 0); - - const profArgs = CliUtils.getOptValueFromProfiles(profiles, p, allOpts); - this.log.trace(`Arguments extract from the profile:\n${inspect(profArgs)}`); + // Merge the arguments from the config into the CLI args + const profArgs = CliUtils.getOptValuesFromConfig(this.mConfig, this.definition, args, allOpts); + this.log.trace(`Arguments extracted from the config:\n${inspect(profArgs)}`); args = CliUtils.mergeArguments(profArgs, args); } @@ -1020,7 +925,7 @@ export class CommandProcessor { // Log for debugging this.log.trace(`Full argument object constructed:\n${inspect(args)}`); - return { profiles, args }; + return args; } /** diff --git a/packages/imperative/src/cmd/src/doc/handler/IHandlerParameters.ts b/packages/imperative/src/cmd/src/doc/handler/IHandlerParameters.ts index 247b68bcde..d2c960091f 100644 --- a/packages/imperative/src/cmd/src/doc/handler/IHandlerParameters.ts +++ b/packages/imperative/src/cmd/src/doc/handler/IHandlerParameters.ts @@ -11,7 +11,6 @@ import * as stream from "stream"; import { ICommandDefinition } from "../ICommandDefinition"; -import { CommandProfiles } from "../../profiles/CommandProfiles"; import { IHandlerResponseApi } from "../../doc/response/api/handler/IHandlerResponseApi"; import { ICommandArguments } from "../args/ICommandArguments"; @@ -52,15 +51,6 @@ export interface IHandlerParameters { */ positionals: (string | number)[]; - /** - * The set of profiles loaded for this command handler - the map is built with the key being the type and it - * returns the set of profiles loaded of that type. Multiple profiles can be loaded of the same type - depending - * on the request and the 0th entry is the first loaded. - * @type {Map} - * @memberof IHandlerParameters - */ - profiles: CommandProfiles; - /** * The command definition node that defines the command being issued. * @type {ICommandDefinition} diff --git a/packages/imperative/src/cmd/src/doc/response/response/ICommandPrepared.ts b/packages/imperative/src/cmd/src/doc/response/response/ICommandPrepared.ts deleted file mode 100644 index 636e0fbc58..0000000000 --- a/packages/imperative/src/cmd/src/doc/response/response/ICommandPrepared.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { CommandProfiles } from "../../../../src/profiles/CommandProfiles"; -import { ICommandArguments } from "../../../../src/doc/args/ICommandArguments"; -/** - * Command Processor prepare response. - * @export - * @interface ICommandPrepared - */ -export interface ICommandPrepared { - /** - * The profile map object for all profiles loaded for commands. - * @type {CommandProfiles} - * @memberof ICommandPrepared - */ - profiles: CommandProfiles; - /** - * Imperative arguments object. Starts with arguments passed parsed by - * Yargs as a base and fills in the rest from ENV/profile/defaults. - * Eventually passed to handlers. - * @type {ICommandArguments} - */ - args: ICommandArguments; -} diff --git a/packages/imperative/src/cmd/src/profiles/CliProfileManager.ts b/packages/imperative/src/cmd/src/profiles/CliProfileManager.ts index f71896074e..0989f2435c 100644 --- a/packages/imperative/src/cmd/src/profiles/CliProfileManager.ts +++ b/packages/imperative/src/cmd/src/profiles/CliProfileManager.ts @@ -27,6 +27,7 @@ import { * * The Profile Manager no longer reads V1 profile from disk. It only processes profile information from a * command's definition. The Config class now handles reading profiles from disk stored in a zowe.config.json file. + * @deprecated Use the `V1ProfileRead` class if you still need to read V1 profiles */ export class CliProfileManager { /** diff --git a/packages/imperative/src/cmd/src/profiles/CommandProfileLoader.ts b/packages/imperative/src/cmd/src/profiles/CommandProfileLoader.ts index 516b688a9f..2db7b75422 100644 --- a/packages/imperative/src/cmd/src/profiles/CommandProfileLoader.ts +++ b/packages/imperative/src/cmd/src/profiles/CommandProfileLoader.ts @@ -24,6 +24,7 @@ import { ImperativeExpect } from "../../../expect"; * command handlers usage). * @internal * @class CommandProfileLoader + * @deprecated Use the `V1ProfileRead` class if you still need to read V1 profiles */ export class CommandProfileLoader { /** @@ -34,6 +35,7 @@ export class CommandProfileLoader { * @memberof CommandProfileLoader */ public static loader(parms: ICommandProfileLoaderParms) { + // eslint-disable-next-line deprecation/deprecation return new CommandProfileLoader(parms.commandDefinition, parms.logger || Logger.getImperativeLogger()); } @@ -76,6 +78,7 @@ export class CommandProfileLoader { * Imperative error * @memberof CommandProfileLoader */ + // eslint-disable-next-line deprecation/deprecation public async loadProfiles(commandArguments: Arguments): Promise { // Validate parms ImperativeExpect.toNotBeNullOrUndefined(commandArguments, `Could not load profiles. No command arguments supplied.`); @@ -89,6 +92,7 @@ export class CommandProfileLoader { const profileMetaMap: Map = new Map(); // We no longer read V1 profile files, so just return empty maps + // eslint-disable-next-line deprecation/deprecation return new CommandProfiles(profileMap, profileMetaMap); } diff --git a/packages/imperative/src/cmd/src/profiles/CommandProfiles.ts b/packages/imperative/src/cmd/src/profiles/CommandProfiles.ts index 919d384350..e57a267d41 100644 --- a/packages/imperative/src/cmd/src/profiles/CommandProfiles.ts +++ b/packages/imperative/src/cmd/src/profiles/CommandProfiles.ts @@ -17,6 +17,7 @@ import { ImperativeExpect } from "../../../expect"; * Profiles map created by the command profile loader and passed to the handler via parameters. Handlers can * retrieve loaded profiles from the map via the profile type. * @class CommandProfiles + * @deprecated Use the `V1ProfileRead` class if you still need to read V1 profiles */ export class CommandProfiles { /** diff --git a/packages/imperative/src/imperative/__tests__/handlers/DefaultRootCommandHandler.unit.test.ts b/packages/imperative/src/imperative/__tests__/handlers/DefaultRootCommandHandler.unit.test.ts index f9f931687d..f61dbf32f5 100644 --- a/packages/imperative/src/imperative/__tests__/handlers/DefaultRootCommandHandler.unit.test.ts +++ b/packages/imperative/src/imperative/__tests__/handlers/DefaultRootCommandHandler.unit.test.ts @@ -116,7 +116,6 @@ describe("Default Root Command Handler", () => { arguments: {_: [], $0: ""}, definition: prepared.children?.[0].children?.[0] as any, fullDefinition: prepared, - profiles: undefined as any, positionals: [], stdin: process.stdin }); @@ -136,7 +135,6 @@ describe("Default Root Command Handler", () => { arguments: {_: [], $0: "", availableCommands: true}, definition: MULTIPLE_GROUPS, fullDefinition: MULTIPLE_GROUPS, - profiles: undefined as any, positionals: [], stdin: process.stdin }); @@ -159,7 +157,6 @@ describe("Default Root Command Handler", () => { arguments: {_: [], $0: "", version: true}, definition: MULTIPLE_GROUPS.children?.[0].children?.[0] as any, fullDefinition: MULTIPLE_GROUPS, - profiles: undefined as any, positionals: [], stdin: process.stdin }); diff --git a/packages/imperative/src/imperative/src/api/ImperativeApi.ts b/packages/imperative/src/imperative/src/api/ImperativeApi.ts index 358cbec56a..3fb75a82d9 100644 --- a/packages/imperative/src/imperative/src/api/ImperativeApi.ts +++ b/packages/imperative/src/imperative/src/api/ImperativeApi.ts @@ -12,7 +12,6 @@ import { IImperativeConfig } from "../doc/IImperativeConfig"; import { IImperativeApi } from "./doc/IImperativeApi"; import { Logger } from "../../../logger"; -import { CliProfileManager } from "../../../cmd"; export class ImperativeApi { /** @@ -63,18 +62,4 @@ export class ImperativeApi { public addAdditionalLogger(name: string, logger: Logger): void { this.mCustomLoggerMap[name] = logger; } - - /** - * Return an instance of a profile manager for a given profile type - * See ProfileManager.ts for more details - * @internal - */ - public profileManager(type: string): CliProfileManager { - return new CliProfileManager({ - type, - typeConfigurations: this.mConfig.profiles, - logger: this.imperativeLogger, - productDisplayName: this.mConfig.productDisplayName - }); - } } diff --git a/packages/imperative/src/utilities/__tests__/CliUtils.unit.test.ts b/packages/imperative/src/utilities/__tests__/CliUtils.unit.test.ts index ea94d6435c..b53c83c35c 100644 --- a/packages/imperative/src/utilities/__tests__/CliUtils.unit.test.ts +++ b/packages/imperative/src/utilities/__tests__/CliUtils.unit.test.ts @@ -294,6 +294,7 @@ describe("CliUtils", () => { let error; try { const args = CliUtils.getOptValueFromProfiles( + // eslint-disable-next-line deprecation/deprecation new CommandProfiles(new Map()), { required: ["banana"] }, FAKE_OPTS); @@ -307,6 +308,7 @@ describe("CliUtils", () => { it("should return nothing if a profile was optional and not loaded", () => { const args = CliUtils.getOptValueFromProfiles( + // eslint-disable-next-line deprecation/deprecation new CommandProfiles(new Map()), { optional: ["banana"] }, FAKE_OPTS); @@ -317,6 +319,7 @@ describe("CliUtils", () => { const map = new Map(); map.set("banana", [{ type: "banana", name: "fakebanana", nohyphen: "specified in profile" }]); const args = CliUtils.getOptValueFromProfiles( + // eslint-disable-next-line deprecation/deprecation new CommandProfiles(map), { optional: ["banana"] }, FAKE_OPTS); @@ -332,6 +335,7 @@ describe("CliUtils", () => { "could-be-either": "should not be me" }]); const args = CliUtils.getOptValueFromProfiles( + // eslint-disable-next-line deprecation/deprecation new CommandProfiles(map), { optional: ["banana"] }, FAKE_OPTS); @@ -347,6 +351,7 @@ describe("CliUtils", () => { "fake-string-opt": "should be me" }]); const args = CliUtils.getOptValueFromProfiles( + // eslint-disable-next-line deprecation/deprecation new CommandProfiles(map), { optional: ["banana"] }, FAKE_OPTS); @@ -361,6 +366,7 @@ describe("CliUtils", () => { "could-be-either": "should be me" }]); const args = CliUtils.getOptValueFromProfiles( + // eslint-disable-next-line deprecation/deprecation new CommandProfiles(map), { optional: ["banana"] }, FAKE_OPTS); @@ -375,6 +381,7 @@ describe("CliUtils", () => { fakeStringOpt: "should be me" }]); const args = CliUtils.getOptValueFromProfiles( + // eslint-disable-next-line deprecation/deprecation new CommandProfiles(map), { optional: ["banana"] }, FAKE_OPTS); @@ -389,6 +396,7 @@ describe("CliUtils", () => { withAlias: "should have 'w' on args object too" }]); const args = CliUtils.getOptValueFromProfiles( + // eslint-disable-next-line deprecation/deprecation new CommandProfiles(map), { optional: ["banana"] }, FAKE_OPTS); @@ -403,6 +411,7 @@ describe("CliUtils", () => { username: "fake" }]); const args = CliUtils.getOptValueFromProfiles( + // eslint-disable-next-line deprecation/deprecation new CommandProfiles(map), { optional: ["banana"] }, FAKE_OPTS); diff --git a/packages/imperative/src/utilities/src/CliUtils.ts b/packages/imperative/src/utilities/src/CliUtils.ts index 8b2612f7da..460d025750 100644 --- a/packages/imperative/src/utilities/src/CliUtils.ts +++ b/packages/imperative/src/utilities/src/CliUtils.ts @@ -18,10 +18,13 @@ import { CommandProfiles, ICommandOptionDefinition, ICommandPositionalDefinition ICommandProfile, IHandlerParameters } from "../../cmd"; import { ICommandArguments } from "../../cmd/src/doc/args/ICommandArguments"; -import { IProfile } from "../../profiles"; +import { IProfile } from "../../profiles/src/doc/definition/IProfile"; +import { ProfileUtils } from "../../profiles/src/utils/ProfileUtils"; import { IPromptOptions } from "../../cmd/src/doc/response/api/handler/IPromptOptions"; import { read } from "read"; import { ICommandDefinition } from "../../cmd"; +import { Config } from "../../config"; + /** * Cli Utils contains a set of static methods/helpers that are CLI related (forming options, censoring args, etc.) * @export @@ -117,6 +120,7 @@ export class CliUtils { * * @memberof CliUtils */ + // eslint-disable-next-line deprecation/deprecation public static getOptValueFromProfiles(profiles: CommandProfiles, definitions: ICommandProfile, options: Array): any { let args: any = {}; @@ -185,6 +189,82 @@ export class CliUtils { return args; } + /** + * Searches properties in team configuration and attempts to match the option names supplied with profile keys. + * @param {Config} config - Team config API + * @param {ICommandDefinition} definition - Definition of invoked command + * @param {ICommandArguments} args - Arguments from command line and environment + * @param {(Array)} allOpts - the full set of command options + * for the command being processed + * + * @returns {*} + * + * @memberof CliUtils + */ + public static getOptValuesFromConfig(config: Config, definition: ICommandDefinition, args: ICommandArguments, + allOpts: Array): any { + // Build a list of all profile types - this will help us search the CLI + // options for profiles specified by the user + let allTypes: string[] = []; + if (definition.profile != null) { + if (definition.profile.required != null) + allTypes = allTypes.concat(definition.profile.required); + if (definition.profile.optional != null) + allTypes = allTypes.concat(definition.profile.optional); + } + + // Build an object that contains all the options loaded from config + const fulfilled: string[] = []; + let fromCnfg: any = {}; + for (const profileType of allTypes) { + const opt = ProfileUtils.getProfileOptionAndAlias(profileType)[0]; + // If the config contains the requested profiles, then "remember" + // that this type has been fulfilled - so that we do NOT load from + // the traditional profile location + const profileTypePrefix = profileType + "_"; + let p: any = {}; + if (args[opt] != null && config.api.profiles.exists(args[opt])) { + fulfilled.push(profileType); + p = config.api.profiles.get(args[opt]); + } else if (args[opt] != null && !args[opt].startsWith(profileTypePrefix) && + config.api.profiles.exists(profileTypePrefix + args[opt])) { + fulfilled.push(profileType); + p = config.api.profiles.get(profileTypePrefix + args[opt]); + } else if (args[opt] == null && + config.properties.defaults[profileType] != null && + config.api.profiles.exists(config.properties.defaults[profileType])) { + fulfilled.push(profileType); + p = config.api.profiles.defaultGet(profileType); + } + fromCnfg = { ...p, ...fromCnfg }; + } + + // Convert each property extracted from the config to the correct yargs + // style cases for the command handler (kebab and camel) + allOpts.forEach((opt) => { + const cases = CliUtils.getOptionFormat(opt.name); + const profileKebab = fromCnfg[cases.kebabCase]; + const profileCamel = fromCnfg[cases.camelCase]; + + if ((profileCamel !== undefined || profileKebab !== undefined) && + (!Object.prototype.hasOwnProperty.call(args, cases.kebabCase) && + !Object.prototype.hasOwnProperty.call(args, cases.camelCase))) { + + // If both case properties are present in the profile, use the one that matches + // the option name explicitly + const value = profileKebab !== undefined && profileCamel !== undefined ? + opt.name === cases.kebabCase ? profileKebab : profileCamel : + profileKebab !== undefined ? profileKebab : profileCamel; + const keys = CliUtils.setOptionValue(opt.name, + "aliases" in opt ? opt.aliases : [], + value + ); + fromCnfg = { ...fromCnfg, ...keys }; + } + }); + return fromCnfg; + } + /** * Using Object.assign(), merges objects in the order they appear in call. Object.assign() copies and overwrites * existing properties in the target object, meaning property precedence is least to most (left to right). diff --git a/packages/zosuss/__tests__/__unit__/SshBaseHandler.unit.test.ts b/packages/zosuss/__tests__/__unit__/SshBaseHandler.unit.test.ts index 5e9365250a..3f8ee619f4 100644 --- a/packages/zosuss/__tests__/__unit__/SshBaseHandler.unit.test.ts +++ b/packages/zosuss/__tests__/__unit__/SshBaseHandler.unit.test.ts @@ -9,7 +9,7 @@ * */ -import { IHandlerParameters, IProfile, CommandProfiles, ConnectionPropsForSessCfg } from "@zowe/imperative"; +import { IHandlerParameters, ConnectionPropsForSessCfg } from "@zowe/imperative"; import { mockHandlerParameters } from "@zowe/cli-test-utils"; import { join, normalize } from "path"; import { Shell } from "../../src/Shell"; @@ -45,73 +45,28 @@ const UNIT_TEST_SSH_PROF_OPTS_PRIVATE_KEY_WITH_PASSPHRASE_NO_USER = { keyPassPhrase: "dummyPassPhrase123" }; - -// A mocked profile map with ssh profile -const UNIT_TEST_PROFILE_MAP = new Map(); -UNIT_TEST_PROFILE_MAP.set( - "ssh", [{ - name: "ssh", - type: "ssh", - ...UNIT_TEST_SSH_PROF_OPTS - }] -); -const UNIT_TEST_PROFILES_SSH = new CommandProfiles(UNIT_TEST_PROFILE_MAP); - -const UNIT_TEST_PROFILE_MAP_PRIVATE_KEY = new Map(); -UNIT_TEST_PROFILE_MAP_PRIVATE_KEY.set( - "ssh", [{ - name: "ssh", - type: "ssh", - ...UNIT_TEST_SSH_PROF_OPTS_PRIVATE_KEY - }] -); -const UNIT_TEST_PROFILE_MAP_PRIVATE_KEY_WITH_PASSPHRASE = new Map(); -UNIT_TEST_PROFILE_MAP_PRIVATE_KEY_WITH_PASSPHRASE.set( - "ssh", [{ - name: "ssh", - type: "ssh", - ...UNIT_TEST_SSH_PROF_OPTS_PRIVATE_KEY_WITH_PASSPHRASE - }] -); -const UNIT_TEST_PROFILE_MAP_PRIVATE_KEY_WITH_PASSPHRASE_NO_USER = new Map(); -UNIT_TEST_PROFILE_MAP_PRIVATE_KEY_WITH_PASSPHRASE.set( - "ssh", [{ - name: "ssh", - type: "ssh", - ...UNIT_TEST_SSH_PROF_OPTS_PRIVATE_KEY_WITH_PASSPHRASE_NO_USER - }] -); - -const UNIT_TEST_PROFILES_SSH_PRIVATE_KEY = new CommandProfiles(UNIT_TEST_PROFILE_MAP_PRIVATE_KEY); -const UNIT_TEST_PROFILES_SSH_PRIVATE_KEY_WITH_PASSPHRASE = new CommandProfiles(UNIT_TEST_PROFILE_MAP_PRIVATE_KEY_WITH_PASSPHRASE); -const UNIT_TEST_PROFILES_SSH_PRIVATE_KEY_WITH_PASSPHRASE_NO_USER = new CommandProfiles(UNIT_TEST_PROFILE_MAP_PRIVATE_KEY_WITH_PASSPHRASE_NO_USER); - // Mocked parameters for the unit tests const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_SSH_PROF_OPTS, positionals: ["zos-uss", "issue", "ssh"], - definition: {} as any, - profiles: UNIT_TEST_PROFILES_SSH + definition: {} as any }); const DEFAULT_PARAMETERS_PRIVATE_KEY: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_SSH_PROF_OPTS_PRIVATE_KEY, positionals: ["zos-uss", "issue", "ssh"], - definition: {} as any, - profiles: UNIT_TEST_PROFILES_SSH_PRIVATE_KEY + definition: {} as any }); const DEFAULT_PARAMETERS_KEY_PASSPHRASE: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_SSH_PROF_OPTS_PRIVATE_KEY_WITH_PASSPHRASE, positionals: ["zos-uss", "issue", "ssh"], - definition: {} as any, - profiles: UNIT_TEST_PROFILES_SSH_PRIVATE_KEY_WITH_PASSPHRASE, + definition: {} as any }); const DEFAULT_PARAMETERS_KEY_PASSPHRASE_NO_USER: IHandlerParameters = mockHandlerParameters({ arguments: UNIT_TEST_SSH_PROF_OPTS_PRIVATE_KEY_WITH_PASSPHRASE_NO_USER, positionals: ["zos-uss", "issue", "ssh"], - definition: {} as any, - profiles: UNIT_TEST_PROFILES_SSH_PRIVATE_KEY_WITH_PASSPHRASE_NO_USER, + definition: {} as any }); class myHandler extends SshBaseHandler { From 29776af0dbbd5ea52868d444e1ed775b1a0c12b1 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Thu, 22 Aug 2024 15:51:40 -0400 Subject: [PATCH 2/7] Remove V1 profiles from integration tests Signed-off-by: Timothy Johnson --- .../Cmd.cli.root.integration.test.ts.snap | 4 +- packages/imperative/__tests__/src/TestUtil.ts | 8 +- .../with_bin_package/ProfileBinExampleCLI.ts | 2 +- .../ProfileBinExampleConfiguration.ts | 30 ++- .../ExampleDefinitions.integration.test.ts} | 4 +- .../ExampleLogging.integration.test.ts} | 4 +- .../HelpCommands.integration.test.ts} | 44 ++-- .../handlers/LogMessagesHandler.ts | 4 +- .../with_bin_package/tsconfig.json | 3 + .../with_profiles/ProfileExampleCLI.ts | 11 +- .../ProfileExampleConfiguration.ts | 217 ------------------ .../WithProfiles.integration.test.ts | 21 -- ...atedProfileCommands.integration.subtest.ts | 38 --- .../ExampleProfiles.integration.subtest.ts | 23 -- .../many-field-profile_meta.yaml | 40 ---- .../autoGenProfiles/profile-a/first.yaml | 2 - .../autoGenProfiles/profile-a/good.yaml | 2 - .../profile-a/profile-a_meta.yaml | 35 --- .../autoGenProfiles/profile-a/second.yaml | 2 - .../autoGenProfiles/profile-b/first.yaml | 1 - .../profile-b/profile-b_meta.yaml | 19 -- .../autoGenProfiles/profile-b/second.yaml | 1 - .../profile-c/profile-c_meta.yaml | 19 -- .../profile-with-dependency/big_profile.yaml | 5 - .../profile-with-dependency_meta.yaml | 25 -- .../definitions/a/ADefinition.ts | 34 --- .../definitions/b/BDefinition.ts | 33 --- .../definitions/c/CDefinition.ts | 33 --- .../definitions/d/DDefinition.ts | 33 --- .../definitions/d/DoNotIncludeMe.ts | 33 --- .../handlers/LogMessagesHandler.ts | 27 --- .../handlers/OptionalProfileCHandler.ts | 20 -- .../handlers/UseDependentProfileHandler.ts | 23 -- .../handlers/UseProfileAHandler.ts | 21 -- .../handlers/UseProfileBHandler.ts | 22 -- .../example_clis/with_profiles/package.json | 29 --- .../plans/ManyFieldValidationPlan.ts | 44 ---- .../profileHandlers/AddTwoNumbersHandler.ts | 20 -- .../__tests__/CommandProcessor.unit.test.ts | 20 +- .../src/imperative/src/api/ImperativeApi.ts | 16 ++ .../doc/config/IProfileTypeConfiguration.ts | 1 + .../src/validation/api/ProfileValidator.ts | 1 + 42 files changed, 100 insertions(+), 874 deletions(-) mode change 100644 => 100755 packages/imperative/__tests__/src/example_clis/with_bin_package/ProfileBinExampleCLI.ts rename packages/imperative/__tests__/src/example_clis/{with_profiles/__integration__/ExampleDefinitions.integration.subtest.ts => with_bin_package/__integration__/ExampleDefinitions.integration.test.ts} (94%) rename packages/imperative/__tests__/src/example_clis/{with_profiles/__integration__/ExampleLogging.integration.subtest.ts => with_bin_package/__integration__/ExampleLogging.integration.test.ts} (96%) rename packages/imperative/__tests__/src/{packages/cmd/__integration__/HelpCommands.integration.subtest.ts => example_clis/with_bin_package/__integration__/HelpCommands.integration.test.ts} (51%) create mode 100644 packages/imperative/__tests__/src/example_clis/with_bin_package/tsconfig.json mode change 100644 => 100755 packages/imperative/__tests__/src/example_clis/with_profiles/ProfileExampleCLI.ts delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/ProfileExampleConfiguration.ts delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/WithProfiles.integration.test.ts delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/AutoGeneratedProfileCommands.integration.subtest.ts delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/ExampleProfiles.integration.subtest.ts delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/many-field-profile/many-field-profile_meta.yaml delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-a/first.yaml delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-a/good.yaml delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-a/profile-a_meta.yaml delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-a/second.yaml delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-b/first.yaml delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-b/profile-b_meta.yaml delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-b/second.yaml delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-c/profile-c_meta.yaml delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-with-dependency/big_profile.yaml delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-with-dependency/profile-with-dependency_meta.yaml delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/definitions/a/ADefinition.ts delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/definitions/b/BDefinition.ts delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/definitions/c/CDefinition.ts delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/definitions/d/DDefinition.ts delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/definitions/d/DoNotIncludeMe.ts delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/handlers/LogMessagesHandler.ts delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/handlers/OptionalProfileCHandler.ts delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseDependentProfileHandler.ts delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseProfileAHandler.ts delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseProfileBHandler.ts delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/package.json delete mode 100644 packages/imperative/__tests__/src/example_clis/with_profiles/plans/ManyFieldValidationPlan.ts delete mode 100644 packages/imperative/__tests__/src/packages/cmd/profileHandlers/AddTwoNumbersHandler.ts diff --git a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/root/__snapshots__/Cmd.cli.root.integration.test.ts.snap b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/root/__snapshots__/Cmd.cli.root.integration.test.ts.snap index 0a4eb0e99b..669c13bad7 100644 --- a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/root/__snapshots__/Cmd.cli.root.integration.test.ts.snap +++ b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/root/__snapshots__/Cmd.cli.root.integration.test.ts.snap @@ -26,7 +26,6 @@ exports[`cmd-cli should display the help 1`] = ` invoke Invoke handlers to test promise reject/fulfill nested Test a complex structure profile Validate profile mapping - read Read some profiles respond Invoke handlers that will produce messages validate Validate syntax checking @@ -81,7 +80,6 @@ exports[`cmd-cli should display the help 1`] = ` invoke Invoke handlers to test promise reject/fulfill nested Test a complex structure profile Validate profile mapping - read Read some profiles respond Invoke handlers that will produce messages validate Validate syntax checking @@ -116,7 +114,7 @@ exports[`cmd-cli should display the help 1`] = ` \\"success\\": true, \\"exitCode\\": 0, \\"message\\": \\"\\", - \\"stdout\\": \\"\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n A test CLI for the 'cmd' imperative package\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n cmd-cli \\\\n\\\\n Where is one of the following:\\\\n\\\\n GROUPS\\\\n ------\\\\n\\\\n auth Connect to token-based authentication services\\\\n auto-format Invoke handlers to test auto-format \\\\n chained chained handler test commands \\\\n gen-help Commands to test help generator \\\\n invalid Invalid definitions \\\\n invoke Invoke handlers to test promise reject/fulfill\\\\n nested Test a complex structure \\\\n profile Validate profile mapping \\\\n read Read some profiles \\\\n respond Invoke handlers that will produce messages \\\\n validate Validate syntax checking \\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --version | -V (boolean)\\\\n\\\\n Display the current version of Cmd Package CLI\\\\n\\\\n --available-commands | --ac (boolean)\\\\n\\\\n Displays a list of available commands\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n\\", + \\"stdout\\": \\"\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n A test CLI for the 'cmd' imperative package\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n cmd-cli \\\\n\\\\n Where is one of the following:\\\\n\\\\n GROUPS\\\\n ------\\\\n\\\\n auth Connect to token-based authentication services\\\\n auto-format Invoke handlers to test auto-format \\\\n chained chained handler test commands \\\\n gen-help Commands to test help generator \\\\n invalid Invalid definitions \\\\n invoke Invoke handlers to test promise reject/fulfill\\\\n nested Test a complex structure \\\\n profile Validate profile mapping \\\\n respond Invoke handlers that will produce messages \\\\n validate Validate syntax checking \\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --version | -V (boolean)\\\\n\\\\n Display the current version of Cmd Package CLI\\\\n\\\\n --available-commands | --ac (boolean)\\\\n\\\\n Displays a list of available commands\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n\\", \\"stderr\\": \\"\\", \\"data\\": {} }" diff --git a/packages/imperative/__tests__/src/TestUtil.ts b/packages/imperative/__tests__/src/TestUtil.ts index 93e0ceab01..1bb7373060 100644 --- a/packages/imperative/__tests__/src/TestUtil.ts +++ b/packages/imperative/__tests__/src/TestUtil.ts @@ -170,10 +170,14 @@ export function executeTestCLICommand(cliBinModule: string, testContext: any, ar execDir?: string, pipeContent?: string | Buffer, env: { [key: string]: string } = process.env): SpawnSyncReturns { const testLogger = TestLogger.getTestLogger(); - const nodeCommand = "node"; + const isLocalFile = fs.existsSync(cliBinModule); + const nodeCommand = isLocalFile ? "node" : "npx"; // run the command with ts-node/register - const starterArguments = ["--require", "ts-node/register", cliBinModule]; + const starterArguments = isLocalFile ? ["--require", "ts-node/register", cliBinModule] : [cliBinModule]; args = starterArguments.concat(args); + if (!isLocalFile) { + execDir ??= nodePath.dirname(expect.getState().testPath); + } const commandExecutionMessage = "Executing " + nodeCommand + " " + args.join(" "); diff --git a/packages/imperative/__tests__/src/example_clis/with_bin_package/ProfileBinExampleCLI.ts b/packages/imperative/__tests__/src/example_clis/with_bin_package/ProfileBinExampleCLI.ts old mode 100644 new mode 100755 index c142ccd093..cedeaa80b0 --- a/packages/imperative/__tests__/src/example_clis/with_bin_package/ProfileBinExampleCLI.ts +++ b/packages/imperative/__tests__/src/example_clis/with_bin_package/ProfileBinExampleCLI.ts @@ -1,3 +1,4 @@ +#!/usr/bin/env ts-node /* * This program and the accompanying materials are made available under the terms of the * Eclipse Public License v2.0 which accompanies this distribution, and is available at @@ -16,4 +17,3 @@ Imperative.init({configurationModule: __dirname + "/ProfileBinExampleConfigurati }).catch((error) => { process.stderr.write(`An error occurred parsing or initing: ${error.message}`); }); - diff --git a/packages/imperative/__tests__/src/example_clis/with_bin_package/ProfileBinExampleConfiguration.ts b/packages/imperative/__tests__/src/example_clis/with_bin_package/ProfileBinExampleConfiguration.ts index e8a7a20675..86520ee8f7 100644 --- a/packages/imperative/__tests__/src/example_clis/with_bin_package/ProfileBinExampleConfiguration.ts +++ b/packages/imperative/__tests__/src/example_clis/with_bin_package/ProfileBinExampleConfiguration.ts @@ -11,8 +11,32 @@ import { IImperativeConfig } from "../../../../src/imperative"; -const binConfig: IImperativeConfig = { - commandModuleGlobs: ["definitions/*/*Definition.ts"], +const config: IImperativeConfig = { + definitions: [ + { + name: "log", + description: "Log example messages", + type: "group", + children: [ + { + name: "messages", + description: "Log example messages", + type: "command", + handler: __dirname + "/handlers/LogMessagesHandler", + options: [ + { + name: "level", + allowableValues: {values: ["trace", "debug", "info", "warn", "error", "fatal"]}, + type: "string", + description: "The level to log messages at.", + required: true + } + ] + } + ] + } + ], + commandModuleGlobs: ["../with_bin_package/definitions/*/*Definition.ts"], rootCommandDescription: "Sample command line interface", defaultHome: __dirname + "/../../../__results__/.examplewithprofiles", // defaultHome: createUniqueTestDataDir(), @@ -40,4 +64,4 @@ const binConfig: IImperativeConfig = { }] }; -module.exports = binConfig; +module.exports = config; diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/ExampleDefinitions.integration.subtest.ts b/packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/ExampleDefinitions.integration.test.ts similarity index 94% rename from packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/ExampleDefinitions.integration.subtest.ts rename to packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/ExampleDefinitions.integration.test.ts index de7af85799..3b651f9a24 100644 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/ExampleDefinitions.integration.subtest.ts +++ b/packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/ExampleDefinitions.integration.test.ts @@ -15,8 +15,8 @@ import * as T from "../../../TestUtil"; describe("We should provide the ability to define commands through Javascript objects passed through the config " + "or globs that match modules locally, " + "tested through an example CLI", function () { - const cliBin = __dirname + "/../ProfileExampleCLI.ts"; - const config: IImperativeConfig = require(__dirname + "/../ProfileExampleConfiguration"); + const cliBin = __dirname + "/../ProfileBinExampleCLI.ts"; + const config: IImperativeConfig = require(__dirname + "/../ProfileBinExampleConfiguration"); it("All commands defined through module globs should be accurately defined, " + "and a definition module in the same directory that does not ", diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/ExampleLogging.integration.subtest.ts b/packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/ExampleLogging.integration.test.ts similarity index 96% rename from packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/ExampleLogging.integration.subtest.ts rename to packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/ExampleLogging.integration.test.ts index fbfc1d2804..8e3508a54a 100644 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/ExampleLogging.integration.subtest.ts +++ b/packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/ExampleLogging.integration.test.ts @@ -15,8 +15,8 @@ import { IImperativeConfig } from "../../../../../src/imperative"; describe("We should provide the ability to create, manage, and use profiles, " + "tested through an example CLI", function () { - const cliBin = __dirname + "/../ProfileExampleCLI.ts"; - const config: IImperativeConfig = require(__dirname + "/../ProfileExampleConfiguration"); + const cliBin = __dirname + "/../ProfileBinExampleCLI.ts"; + const config: IImperativeConfig = require(__dirname + "/../ProfileBinExampleConfiguration"); const logFile = path.join(config.defaultHome as string, "logs", config.name + ".log"); afterEach(function () { diff --git a/packages/imperative/__tests__/src/packages/cmd/__integration__/HelpCommands.integration.subtest.ts b/packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/HelpCommands.integration.test.ts similarity index 51% rename from packages/imperative/__tests__/src/packages/cmd/__integration__/HelpCommands.integration.subtest.ts rename to packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/HelpCommands.integration.test.ts index 19139af974..d062798e23 100644 --- a/packages/imperative/__tests__/src/packages/cmd/__integration__/HelpCommands.integration.subtest.ts +++ b/packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/HelpCommands.integration.test.ts @@ -9,12 +9,14 @@ * */ +import * as fs from "fs"; import * as T from "../../../TestUtil"; import { IImperativeConfig } from "../../../../../src/imperative/index"; describe("Imperative help should be available for a range of definitions", function () { - const withBinPackageCliBin = __dirname + "/../../../example_clis/with_bin_package/ProfileBinExampleCLI"; - const profileCliBin = __dirname + "/../../../example_clis/with_profiles/ProfileExampleCLI"; + const cliWithBin = Object.keys(require(__dirname + "/../package.json").bin)[0]; + const cliWithoutBin = __dirname + "/../../with_profiles/ProfileExampleCLI.ts"; + const config: IImperativeConfig = require(__dirname + "/../ProfileBinExampleConfiguration"); /** * Clean up the home directory before and after each test. */ @@ -22,39 +24,41 @@ describe("Imperative help should be available for a range of definitions", funct T.rimraf(T.TEST_HOME); }); afterEach(function () { - T.rimraf(T.TEST_HOME); }); - const config: IImperativeConfig = require(__dirname + "/../../../example_clis/with_profiles/ProfileExampleConfiguration"); - const binConfig: IImperativeConfig = require(__dirname + "/../../../example_clis/with_bin_package/ProfileBinExampleConfiguration"); - - it("We should be able to get --help for our example CLI - no bin specified in package", function () { - T.findExpectedOutputInCommand(profileCliBin, ["--help"], + it("We should be able to get --help for our example CLI - without bin script", function () { + T.findExpectedOutputInCommand(cliWithoutBin, ["--help"], [config.productDisplayName, "log"], "stdout", true, - this, T.CMD_TYPE.INTERACTIVE); - T.findExpectedOutputInCommand(profileCliBin, ["log", "--help"], + this, T.CMD_TYPE.INTERACTIVE, undefined, undefined, { + IMPERATIVE_CALLER_LOCATION: T.TEST_HOME + }); + T.findExpectedOutputInCommand(cliWithoutBin, ["log", "--help"], ["ProfileExampleCLI.ts", "Log example messages", "messages"], "stdout", true, - this, T.CMD_TYPE.INTERACTIVE); - T.findExpectedOutputInCommand(profileCliBin, ["log", "messages", "--help"], + this, T.CMD_TYPE.INTERACTIVE, undefined, undefined, { + IMPERATIVE_CALLER_LOCATION: T.TEST_HOME + }); + T.findExpectedOutputInCommand(cliWithoutBin, ["log", "messages", "--help"], ["ProfileExampleCLI.ts", "Log example messages", "messages", "level"], "stdout", true, - this, T.CMD_TYPE.INTERACTIVE); + this, T.CMD_TYPE.INTERACTIVE, undefined, undefined, { + IMPERATIVE_CALLER_LOCATION: T.TEST_HOME + }); }); it("should display --version in the root help", function () { - T.findExpectedOutputInCommand(withBinPackageCliBin, ["--help"], - [binConfig.productDisplayName, "--version"], "stdout", true, + T.findExpectedOutputInCommand(cliWithBin, ["--help"], + [config.productDisplayName, "--version"], "stdout", true, this, T.CMD_TYPE.INTERACTIVE); }); - it("We should be able to get --help for our example CLI - with bin in package", function () { - T.findExpectedOutputInCommand(withBinPackageCliBin, ["--help"], - [binConfig.productDisplayName, "ape", "bat", "cat"], "stdout", true, + it("We should be able to get --help for our example CLI - with bin script", function () { + T.findExpectedOutputInCommand(cliWithBin, ["--help"], + [config.productDisplayName, "ape", "bat", "cat"], "stdout", true, this, T.CMD_TYPE.INTERACTIVE); - T.findExpectedOutputInCommand(withBinPackageCliBin, ["ape", "--help"], + T.findExpectedOutputInCommand(cliWithBin, ["ape", "--help"], ["sample-with-bin", "An ape eats grapes"], "stdout", true, this, T.CMD_TYPE.INTERACTIVE); - T.findExpectedOutputInCommand(withBinPackageCliBin, ["ape", "grape", "--help"], + T.findExpectedOutputInCommand(cliWithBin, ["ape", "grape", "--help"], ["sample-with-bin", "--grape-color", "the color of the grapes eaten by the ape"], "stdout", true, this, T.CMD_TYPE.INTERACTIVE); }); diff --git a/packages/imperative/__tests__/src/example_clis/with_bin_package/handlers/LogMessagesHandler.ts b/packages/imperative/__tests__/src/example_clis/with_bin_package/handlers/LogMessagesHandler.ts index 08fef83eec..8c3647b681 100644 --- a/packages/imperative/__tests__/src/example_clis/with_bin_package/handlers/LogMessagesHandler.ts +++ b/packages/imperative/__tests__/src/example_clis/with_bin_package/handlers/LogMessagesHandler.ts @@ -13,7 +13,7 @@ import { ICommandHandler, IHandlerParameters } from "../../../../../src/cmd"; import { Imperative } from "../../../../../src/imperative"; -class ProduceLogMessagesHandler implements ICommandHandler { +export default class ProduceLogMessagesHandler implements ICommandHandler { public async process(params: IHandlerParameters): Promise { Imperative.api.appLogger.level = params.arguments.level; Imperative.api.appLogger.trace("This is a trace message"); @@ -25,5 +25,3 @@ class ProduceLogMessagesHandler implements ICommandHandler { params.response.console.log("Log messages were written"); } } - -module.exports = ProduceLogMessagesHandler; diff --git a/packages/imperative/__tests__/src/example_clis/with_bin_package/tsconfig.json b/packages/imperative/__tests__/src/example_clis/with_bin_package/tsconfig.json new file mode 100644 index 0000000000..64498cb3a3 --- /dev/null +++ b/packages/imperative/__tests__/src/example_clis/with_bin_package/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../../tsconfig.json" +} \ No newline at end of file diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/ProfileExampleCLI.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/ProfileExampleCLI.ts old mode 100644 new mode 100755 index 8ca0edeb9c..7aff87c698 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/ProfileExampleCLI.ts +++ b/packages/imperative/__tests__/src/example_clis/with_profiles/ProfileExampleCLI.ts @@ -11,10 +11,9 @@ import { Imperative } from "../../../../src/imperative"; - -process.on("unhandledRejection", (err) => { - process.stderr.write("Err: " + err + "\n"); +// Reuse "with_bin_package" configuration without bin script +Imperative.init({configurationModule: __dirname + "/../with_bin_package/ProfileBinExampleConfiguration.ts"}).then(() => { + Imperative.parse(); +}).catch((error) => { + process.stderr.write(`An error occurred parsing or initing: ${error.message}`); }); - -Imperative.init({configurationModule: __dirname + "/ProfileExampleConfiguration.ts"}).then(() => Imperative.parse()); -// Imperative.parse(); diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/ProfileExampleConfiguration.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/ProfileExampleConfiguration.ts deleted file mode 100644 index 3fe9563ca5..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/ProfileExampleConfiguration.ts +++ /dev/null @@ -1,217 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { IImperativeConfig } from "../../../../src/imperative"; - -const config: IImperativeConfig = { - definitions: [ - { - name: "log", - description: "Log example messages", - type: "group", - children: [ - { - name: "messages", - description: "Log example messages", - type: "command", - handler: __dirname + "/handlers/LogMessagesHandler", - options: [ - { - name: "level", - allowableValues: {values: ["trace", "debug", "info", "warn", "error", "fatal"]}, - type: "string", - description: "The level to log messages at.", - required: true - } - ] - } - ] - }, - { - name: "use-profile-a", - description: "Use a profile of type A", - type: "command", - profile: { - required: ["profile-a"] - }, - handler: __dirname + "/handlers/UseProfileAHandler" - }, - { - name: "use-profile-b", - description: "Use a profile of type B", - type: "command", - profile: { - required: ["profile-b"] - }, - handler: __dirname + "/handlers/UseProfileBHandler" - }, - { - name: "optional-profile-c", - description: "Use a profile of type C", - type: "command", - profile: { - optional: ["profile-c"] - }, - handler: __dirname + "/handlers/OptionalProfileCHandler" - }, - { - name: "use-dependent-profile", - description: "Use a profile of type profile-with-dependency", - type: "command", - profile: { - required: ["profile-with-dependency"] - }, - handler: __dirname + "/handlers/UseDependentProfileHandler" - } - ], - commandModuleGlobs: ["definitions/*/*Definition.ts"], - rootCommandDescription: "Sample command line interface", - defaultHome: __dirname + "/../../../__results__/.examplewithprofiles", - // defaultHome: createUniqueTestDataDir(), - productDisplayName: "Test CLI with Profiles", - name: "example_with_profiles", - profiles: [ - { - type: "profile-a", - schema: { - type: "object", - title: "Example profile type A", - description: "Example profile type A", - properties: { - animal: { - optionDefinition: { - description: "The animal", - type: "string", - name: "animal", aliases: ["a"], - required: true - }, - type: "string", - }, - numberWithDefault: { - optionDefinition: { - defaultValue: 8080, - name: "number-with-default", - type: "number", - description: "A number field with default value", - }, - type: "number" - } - }, - required: ["animal", "numberWithDefault"] - } - }, - { - type: "profile-b", - schema: { - type: "object", - title: "Example profile type B", - description: "Example profile type B", - properties: { - bumblebee: { - optionDefinition: { - description: "The bumblebee", - type: "string", - name: "bumblebee", aliases: ["b"], - required: true - }, - type: "string", - }, - }, - required: ["bumblebee"] - }, - }, - { - type: "profile-c", - schema: { - type: "object", - title: "Example profile type C", - description: "Example profile type C", - properties: { - animal: { - optionDefinition: { - description: "The animal", - type: "string", - name: "animal", aliases: ["a"], - required: true - }, - type: "string", - }, - }, - required: ["animal"] - }, - }, - { - type: "profile-with-dependency", - schema: { - type: "object", - title: "Example profile with dependent profiles", - description: "Example profile type with dependent profiles", - properties: { - ghost: { - optionDefinition: { - description: "The ghost", - type: "string", - name: "ghost", aliases: ["g"], - required: true - }, - type: "string", - }, - }, - required: ["ghost", "dependencies"] - }, - dependencies: [{ - description: "The profile-a profile to use as a dependency.", - type: "profile-a", - required: true - }] - }, - { - type: "many-field-profile", - validationPlanModule: __dirname + "/plans/ManyFieldValidationPlan", - schema: { - type: "object", - title: "Example profile with multiple fields", - description: "Example profile type with multiple fields", - properties: { - tea: { - optionDefinition: { - description: "The tea", - type: "string", - name: "tea", aliases: ["t"], - required: true - }, - type: "string", - }, - soda: { - optionDefinition: { - description: "The soda", - type: "string", - name: "soda", aliases: ["s"], - required: true - }, - type: "string", - }, - water: { - optionDefinition: { - description: "The water", - type: "string", - name: "water", aliases: ["w"], - required: true - }, - type: "string", - }, - }, - required: ["tea", "soda", "water"] - }, - }] -}; - -export = config; diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/WithProfiles.integration.test.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/WithProfiles.integration.test.ts deleted file mode 100644 index 0de0e5180c..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/WithProfiles.integration.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -// The test order is important - some tests depend on other tests not running first - do not change it -/* eslint-disable max-len */ - -describe("Imperative With Profiles Tests", () => { - require("./__integration__/AutoGeneratedProfileCommands.integration.subtest"); - require("./__integration__/ExampleDefinitions.integration.subtest"); - require("./__integration__/ExampleLogging.integration.subtest"); - require("./__integration__/ExampleProfiles.integration.subtest"); - require("../../packages/cmd/__integration__/HelpCommands.integration.subtest"); -}); diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/AutoGeneratedProfileCommands.integration.subtest.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/AutoGeneratedProfileCommands.integration.subtest.ts deleted file mode 100644 index b2772f5a17..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/AutoGeneratedProfileCommands.integration.subtest.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import * as T from "../../../TestUtil"; - -describe("We should provide auto-generated profile commands for convenience, " + - "so that Imperative-based CLIs can let users manage configuration profiles", () => { - const cliBin = __dirname + "/../ProfileExampleCLI.ts"; - - it("should fail to load a V1 dependent profile", () => { - const result = T.executeTestCLICommand(cliBin, this, ["use-dependent-profile"]); - - /* Since we no longer read V1 profiles from disk, such an operation will always return an error. - Note that Zowe client code no longer attempts to do such an operation. - */ - expect(result.stderr).toContain( - 'Profile of type "profile-with-dependency" does not exist ' + - 'within the loaded profiles for the command and it is marked as required' - ); - expect(result.status).toBe(1); - }); - - it("should not fail a command where the profile is listed as optional and not specified", () => { - // Optional profiles shouldn't cause a handler or other failure - const output = T.findExpectedOutputInCommand(cliBin, ["optional-profile-c"], // second profile should be used - ["Profile Cs loaded: undefined"], - "stdout", true, this, T.CMD_TYPE.JSON, {ignoreCase: true}); - expect(output.stderr).toEqual(""); - }); -}); diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/ExampleProfiles.integration.subtest.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/ExampleProfiles.integration.subtest.ts deleted file mode 100644 index 25bdc3b950..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/ExampleProfiles.integration.subtest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import * as T from "../../../TestUtil"; -import { IImperativeConfig } from "../../../../../src/imperative"; - -describe("We should provide the ability access profiles from an example CLI definition", function () { - - const config: IImperativeConfig = require(__dirname + "/../ProfileExampleConfiguration"); - it("We should be able to get --help for our example CLI", function () { - T.findExpectedOutputInCommand(__dirname + "/../ProfileExampleCLI", ["--help"], - [config.productDisplayName, "log"], "stdout", true, - this, T.CMD_TYPE.INTERACTIVE); - }); -}); diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/many-field-profile/many-field-profile_meta.yaml b/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/many-field-profile/many-field-profile_meta.yaml deleted file mode 100644 index 2eacfe0579..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/many-field-profile/many-field-profile_meta.yaml +++ /dev/null @@ -1,40 +0,0 @@ -defaultProfile: null -configuration: - type: many-field-profile - validationPlanModule: /home/stduser/repos/zowe-cli/packages/imperative/__tests__/src/example_clis/with_profiles/plans/ManyFieldValidationPlan - schema: - type: object - title: 'Example profile with multiple fields' - description: 'Example profile type with multiple fields' - properties: - tea: - optionDefinition: - description: 'The tea' - type: string - name: tea - aliases: - - t - required: true - type: string - soda: - optionDefinition: - description: 'The soda' - type: string - name: soda - aliases: - - s - required: true - type: string - water: - optionDefinition: - description: 'The water' - type: string - name: water - aliases: - - w - required: true - type: string - required: - - tea - - soda - - water diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-a/first.yaml b/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-a/first.yaml deleted file mode 100644 index 80f1e54e7c..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-a/first.yaml +++ /dev/null @@ -1,2 +0,0 @@ -animal: doggy -numberWithDefault: 8080 diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-a/good.yaml b/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-a/good.yaml deleted file mode 100644 index 80f1e54e7c..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-a/good.yaml +++ /dev/null @@ -1,2 +0,0 @@ -animal: doggy -numberWithDefault: 8080 diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-a/profile-a_meta.yaml b/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-a/profile-a_meta.yaml deleted file mode 100644 index 3186d43175..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-a/profile-a_meta.yaml +++ /dev/null @@ -1,35 +0,0 @@ -defaultProfile: good -configuration: - type: profile-a - schema: - type: object - title: 'Example profile type A' - description: 'Example profile type A' - properties: - animal: - optionDefinition: - description: 'The animal' - type: string - name: animal - aliases: - - a - required: true - type: string - numberWithDefault: - optionDefinition: - defaultValue: 8080 - name: number-with-default - type: number - description: 'A number field with default value' - type: number - required: - - animal - - numberWithDefault - createProfileExamples: - - - options: '--animal doggy' - description: 'Create a profile-a profile with a doggy as the animal' - updateProfileExamples: - - - options: '--animal froggy' - description: 'Update a profile-a profile to use froggy as the animal' diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-a/second.yaml b/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-a/second.yaml deleted file mode 100644 index 9b70f0f916..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-a/second.yaml +++ /dev/null @@ -1,2 +0,0 @@ -animal: sloth -numberWithDefault: 8080 diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-b/first.yaml b/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-b/first.yaml deleted file mode 100644 index 2add236402..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-b/first.yaml +++ /dev/null @@ -1 +0,0 @@ -bumblebee: dumbledore diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-b/profile-b_meta.yaml b/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-b/profile-b_meta.yaml deleted file mode 100644 index 0606ccecb9..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-b/profile-b_meta.yaml +++ /dev/null @@ -1,19 +0,0 @@ -defaultProfile: null -configuration: - type: profile-b - schema: - type: object - title: 'Example profile type B' - description: 'Example profile type B' - properties: - bumblebee: - optionDefinition: - description: 'The bumblebee' - type: string - name: bumblebee - aliases: - - b - required: true - type: string - required: - - bumblebee diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-b/second.yaml b/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-b/second.yaml deleted file mode 100644 index 90ad5c49d9..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-b/second.yaml +++ /dev/null @@ -1 +0,0 @@ -bumblebee: seinfeld diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-c/profile-c_meta.yaml b/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-c/profile-c_meta.yaml deleted file mode 100644 index 2192f53d30..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-c/profile-c_meta.yaml +++ /dev/null @@ -1,19 +0,0 @@ -defaultProfile: null -configuration: - type: profile-c - schema: - type: object - title: 'Example profile type C' - description: 'Example profile type C' - properties: - animal: - optionDefinition: - description: 'The animal' - type: string - name: animal - aliases: - - a - required: true - type: string - required: - - animal diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-with-dependency/big_profile.yaml b/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-with-dependency/big_profile.yaml deleted file mode 100644 index 2b11630ebd..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-with-dependency/big_profile.yaml +++ /dev/null @@ -1,5 +0,0 @@ -ghost: lenore -dependencies: - - - type: profile-a - name: good diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-with-dependency/profile-with-dependency_meta.yaml b/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-with-dependency/profile-with-dependency_meta.yaml deleted file mode 100644 index 296d066641..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/__integration__/__resources__/autoGenProfiles/profile-with-dependency/profile-with-dependency_meta.yaml +++ /dev/null @@ -1,25 +0,0 @@ -defaultProfile: big_profile -configuration: - type: profile-with-dependency - schema: - type: object - title: 'Example profile with dependent profiles' - description: 'Example profile type with dependent profiles' - properties: - ghost: - optionDefinition: - description: 'The ghost' - type: string - name: ghost - aliases: - - g - required: true - type: string - required: - - ghost - - dependencies - dependencies: - - - description: 'The profile-a profile to use as a dependency.' - type: profile-a - required: true diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/definitions/a/ADefinition.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/definitions/a/ADefinition.ts deleted file mode 100644 index 7aa077568e..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/definitions/a/ADefinition.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandDefinition } from "../../../../../../src/cmd"; - -const definition: ICommandDefinition = { - name: "ape", - type: "group", - description: "Ape commands", - children: [ - { - name: "grape", - type: "command", - description: "An ape eats grapes", - options: [ - { - name: "grape-color", - type: "string", - description: "the color of the grapes eaten by the ape" - } - ] - } - ] -}; - -module.exports = definition; diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/definitions/b/BDefinition.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/definitions/b/BDefinition.ts deleted file mode 100644 index ba5dd4b3f3..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/definitions/b/BDefinition.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandDefinition } from "../../../../../../src/cmd"; - -const definition: ICommandDefinition = { - name: "bat", - type: "group", - description: "Bat commands", - children: [ - { - name: "rat", - type: "command", - description: "A bat eats rats", - options: [ - { - name: "rat-color", - type: "string", - description: "the color of the rat eaten by the bat" - } - ] - } - ] -}; -module.exports = definition; diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/definitions/c/CDefinition.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/definitions/c/CDefinition.ts deleted file mode 100644 index d0aee7aafc..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/definitions/c/CDefinition.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandDefinition } from "../../../../../../src/cmd"; - -const definition: ICommandDefinition = { - name: "cat", - type: "group", - description: "Cat commands", - children: [ - { - name: "splat", - type: "command", - description: "A cat eats splats", - options: [ - { - name: "splat-color", - type: "string", - description: "the color of the splat eaten by the cat" - } - ] - } - ] -}; -module.exports = definition; diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/definitions/d/DDefinition.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/definitions/d/DDefinition.ts deleted file mode 100644 index 2a7f746fac..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/definitions/d/DDefinition.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandDefinition } from "../../../../../../src/cmd"; - -const definition: ICommandDefinition = { - name: "dog", - type: "group", - description: "Dog commands", - children: [ - { - name: "log", - type: "command", - description: "A dog eats logs", - options: [ - { - name: "log-color", - type: "string", - description: "the color of the log eaten by the dog" - } - ] - } - ] -}; -module.exports = definition; diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/definitions/d/DoNotIncludeMe.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/definitions/d/DoNotIncludeMe.ts deleted file mode 100644 index bea26ce1c2..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/definitions/d/DoNotIncludeMe.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandDefinition } from "../../../../../../src/cmd"; - -const definition: ICommandDefinition = { - name: "do-not-include-this", - type: "group", - description: "These commands should not match the glob and thus should not be defined", - children: [ - { - name: "or-this", - type: "command", - description: "Don't include this either", - options: [ - { - name: "this-color", - type: "string", - description: "the color of the this that you shouldn't include" - } - ] - } - ] -}; -module.exports = definition; diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/LogMessagesHandler.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/LogMessagesHandler.ts deleted file mode 100644 index 8c3647b681..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/LogMessagesHandler.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandHandler, IHandlerParameters } from "../../../../../src/cmd"; -import { Imperative } from "../../../../../src/imperative"; - - -export default class ProduceLogMessagesHandler implements ICommandHandler { - public async process(params: IHandlerParameters): Promise { - Imperative.api.appLogger.level = params.arguments.level; - Imperative.api.appLogger.trace("This is a trace message"); - Imperative.api.appLogger.debug("This is a debug message"); - Imperative.api.appLogger.info("This is an info message"); - Imperative.api.appLogger.warn("This is a warn message"); - Imperative.api.appLogger.error("This is an error message"); - Imperative.api.appLogger.fatal("This is a fatal message"); - params.response.console.log("Log messages were written"); - } -} diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/OptionalProfileCHandler.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/OptionalProfileCHandler.ts deleted file mode 100644 index 6122fd06a4..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/OptionalProfileCHandler.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandHandler, IHandlerParameters } from "../../../../../src/cmd"; - -export default class OptionalProfileCHandler implements ICommandHandler { - public async process(params: IHandlerParameters) { - // eslint-disable-next-line deprecation/deprecation - const profile = params.profiles.get("profile-c", false); - params.response.console.log(`Profile Cs loaded: ${profile}`); - } -} diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseDependentProfileHandler.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseDependentProfileHandler.ts deleted file mode 100644 index 94722840a3..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseDependentProfileHandler.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandHandler, IHandlerParameters } from "../../../../../src/cmd"; - -export default class UseDependentProfile implements ICommandHandler { - public async process(params: IHandlerParameters) { - // eslint-disable-next-line deprecation/deprecation - const dependencyProfile = params.profiles.get("profile-a"); - params.response.console.log("Loaded profile dependency of type profile-a"); - // eslint-disable-next-line deprecation/deprecation - const mainProfile = params.profiles.get("profile-with-dependency"); - params.response.console.log("Loaded main profile of type profile-with-dependency"); - } -} diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseProfileAHandler.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseProfileAHandler.ts deleted file mode 100644 index 1745880c01..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseProfileAHandler.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandHandler, IHandlerParameters } from "../../../../../src/cmd"; - -export default class UseProfileAHandler implements ICommandHandler { - public async process(params: IHandlerParameters) { - // eslint-disable-next-line deprecation/deprecation - const profile = params.profiles.get("profile-a"); - params.response.console.log("Loaded profile {{name}} of type {{type}}", - {name: profile.name, type: profile.type}); - } -} diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseProfileBHandler.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseProfileBHandler.ts deleted file mode 100644 index 246abae3c1..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseProfileBHandler.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandHandler, IHandlerParameters } from "../../../../../src/cmd"; - -export default class UseProfileAHandler implements ICommandHandler { - public async process(params: IHandlerParameters): Promise { - // eslint-disable-next-line deprecation/deprecation - const profile = params.profiles.get("profile-b"); - params.response.console.log("Loaded profile {{name}} of type {{type}}", - {name: profile.name, type: profile.type}); - } -} - diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/package.json b/packages/imperative/__tests__/src/example_clis/with_profiles/package.json deleted file mode 100644 index feedaf6726..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "profile-example-cli", - "version": "0.0.0", - "description": "Test Imperative CLI with Profiles", - "license": "EPL 2.0", - "repository": "", - "author": { - "name": "", - "email": "", - "url": "" - }, - "keywords": [ - "" - ], - "files": [ - "lib" - ], - "main": "lib/index.js", - "typings": "lib/index.d.ts", - "scripts": { - }, - "dependencies": { - }, - "devDependencies": { - }, - "engines": { - "node": ">=6.0.0" - } -} diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/plans/ManyFieldValidationPlan.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/plans/ManyFieldValidationPlan.ts deleted file mode 100644 index 8e8b8d9d74..0000000000 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/plans/ManyFieldValidationPlan.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { IProfileValidationPlan, IProfileValidationTask } from "../../../../../src/profiles"; -import { IProfileValidationTaskResult } from "../../../../../src/profiles/src/validation/doc/IProfileValidationTaskResult"; - -export = class ManyFieldValidationPlan implements IProfileValidationPlan { - - public get tasks(): IProfileValidationTask[] { - return [ - { - description: "Tea should be earl_grey", - name: "Tea color", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - let result: IProfileValidationTaskResult; - if (profile.tea == null || profile.tea !== "earl_grey") { - result = { - outcome: "Failed", - resultDescription: "Tea was not earl_grey" - }; - } else { - result = { - outcome: "OK", - resultDescription: "Tea was earl_grey" - }; - } - done(result); - } - } - ]; - } - - public get failureSuggestions(): string { - return "Get earl grey tea"; - } -}; diff --git a/packages/imperative/__tests__/src/packages/cmd/profileHandlers/AddTwoNumbersHandler.ts b/packages/imperative/__tests__/src/packages/cmd/profileHandlers/AddTwoNumbersHandler.ts deleted file mode 100644 index 117d409014..0000000000 --- a/packages/imperative/__tests__/src/packages/cmd/profileHandlers/AddTwoNumbersHandler.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ICommandHandler, IHandlerParameters } from "../../../../../src/cmd"; - -export default class AddTwoNumbersHandler implements ICommandHandler { - public async process(params: IHandlerParameters): Promise { - const sum = params.arguments.a + params.arguments.b; - params.response.console.log("updated sum to: " + sum); - params.response.data.setObj({sum}); - } -} diff --git a/packages/imperative/src/cmd/__tests__/CommandProcessor.unit.test.ts b/packages/imperative/src/cmd/__tests__/CommandProcessor.unit.test.ts index a333af0ebf..76d56a8b4f 100644 --- a/packages/imperative/src/cmd/__tests__/CommandProcessor.unit.test.ts +++ b/packages/imperative/src/cmd/__tests__/CommandProcessor.unit.test.ts @@ -1513,7 +1513,7 @@ describe("Command Processor", () => { }); // return the "fake" args object with values from profile - CliUtils.getOptValuesFromConfig = jest.fn().mockReturnValue({}); + jest.spyOn(CliUtils, "getOptValuesFromConfig").mockReturnValueOnce({}); const parms: any = { arguments: { @@ -1712,7 +1712,7 @@ describe("Command Processor", () => { }); // return the "fake" args object with values from profile - CliUtils.getOptValuesFromConfig = jest.fn().mockReturnValue({ color: "yellow" }); + const getOptValuesSpy = jest.spyOn(CliUtils, "getOptValuesFromConfig").mockReturnValueOnce({ color: "yellow" }); const parms: any = { arguments: { @@ -1724,7 +1724,7 @@ describe("Command Processor", () => { }; const commandResponse: ICommandResponse = await processor.invoke(parms); - expect(CliUtils.getOptValuesFromConfig).toHaveBeenCalledTimes(1); + expect(getOptValuesSpy).toHaveBeenCalledTimes(1); expect(commandResponse.stdout.toString()).toMatchSnapshot(); expect(commandResponse).toBeDefined(); expect(commandResponse).toMatchSnapshot(); @@ -1747,7 +1747,7 @@ describe("Command Processor", () => { }); // return the "fake" args object with values from profile - CliUtils.getOptValuesFromConfig = jest.fn().mockReturnValue({}); + jest.spyOn(CliUtils, "getOptValuesFromConfig").mockReturnValueOnce({}); const parms: any = { arguments: { @@ -1782,7 +1782,7 @@ describe("Command Processor", () => { }); // return the "fake" args object with values from profile - CliUtils.getOptValuesFromConfig = jest.fn().mockReturnValue({ color: "yellow" }); + const getOptValuesSpy = jest.spyOn(CliUtils, "getOptValuesFromConfig").mockReturnValueOnce({ color: "yellow" }); const parms: any = { arguments: { @@ -1794,7 +1794,7 @@ describe("Command Processor", () => { }; const commandResponse: ICommandResponse = await processor.invoke(parms); - expect(CliUtils.getOptValuesFromConfig).toHaveBeenCalledTimes(1); + expect(getOptValuesSpy).toHaveBeenCalledTimes(1); expect(commandResponse.stdout.toString()).toMatchSnapshot(); expect(commandResponse).toBeDefined(); expect(commandResponse).toMatchSnapshot(); @@ -1818,7 +1818,7 @@ describe("Command Processor", () => { }); // return the "fake" args object with values from profile - CliUtils.getOptValuesFromConfig = jest.fn().mockReturnValue({ color: "yellow" }); + const getOptValuesSpy = jest.spyOn(CliUtils, "getOptValuesFromConfig").mockReturnValueOnce({ color: "yellow" }); const parms: any = { arguments: { @@ -1831,7 +1831,7 @@ describe("Command Processor", () => { }; const commandResponse: ICommandResponse = await processor.invoke(parms); - expect(CliUtils.getOptValuesFromConfig).toHaveBeenCalledTimes(1); + expect(getOptValuesSpy).toHaveBeenCalledTimes(1); expect(commandResponse.stdout.toString()).toMatchSnapshot(); expect(commandResponse).toBeDefined(); expect(commandResponse).toMatchSnapshot(); @@ -1855,7 +1855,7 @@ describe("Command Processor", () => { }); // return the "fake" args object with values from profile - CliUtils.getOptValuesFromConfig = jest.fn().mockReturnValue({ color: "yellow" }); + const getOptValuesSpy = jest.spyOn(CliUtils, "getOptValuesFromConfig").mockReturnValueOnce({ color: "yellow" }); const parms: any = { arguments: { @@ -1868,7 +1868,7 @@ describe("Command Processor", () => { }; const commandResponse: ICommandResponse = await processor.invoke(parms); - expect(CliUtils.getOptValuesFromConfig).toHaveBeenCalledTimes(1); + expect(getOptValuesSpy).toHaveBeenCalledTimes(1); expect(commandResponse.stdout.toString()).toMatchSnapshot(); expect(commandResponse).toBeDefined(); expect(commandResponse).toMatchSnapshot(); diff --git a/packages/imperative/src/imperative/src/api/ImperativeApi.ts b/packages/imperative/src/imperative/src/api/ImperativeApi.ts index 3fb75a82d9..8350358884 100644 --- a/packages/imperative/src/imperative/src/api/ImperativeApi.ts +++ b/packages/imperative/src/imperative/src/api/ImperativeApi.ts @@ -12,6 +12,7 @@ import { IImperativeConfig } from "../doc/IImperativeConfig"; import { IImperativeApi } from "./doc/IImperativeApi"; import { Logger } from "../../../logger"; +import { CliProfileManager } from "../../../cmd"; export class ImperativeApi { /** @@ -62,4 +63,19 @@ export class ImperativeApi { public addAdditionalLogger(name: string, logger: Logger): void { this.mCustomLoggerMap[name] = logger; } + + /** + * Return an instance of a profile manager for a given profile type + * See ProfileManager.ts for more details + * @internal + * @deprecated Use the `V1ProfileRead` class if you still need to read V1 profiles + */ + public profileManager(type: string): CliProfileManager { + return new CliProfileManager({ + type, + typeConfigurations: this.mConfig.profiles, + logger: this.imperativeLogger, + productDisplayName: this.mConfig.productDisplayName + }); + } } diff --git a/packages/imperative/src/profiles/src/doc/config/IProfileTypeConfiguration.ts b/packages/imperative/src/profiles/src/doc/config/IProfileTypeConfiguration.ts index af454d6ee4..94d389de23 100644 --- a/packages/imperative/src/profiles/src/doc/config/IProfileTypeConfiguration.ts +++ b/packages/imperative/src/profiles/src/doc/config/IProfileTypeConfiguration.ts @@ -46,6 +46,7 @@ export interface IProfileTypeConfiguration { * * @type {IProfileDependency[]} * @memberof IProfileTypeConfiguration + * @deprecated */ dependencies?: IProfileDependency[]; /** diff --git a/packages/imperative/src/profiles/src/validation/api/ProfileValidator.ts b/packages/imperative/src/profiles/src/validation/api/ProfileValidator.ts index 39dd1caa19..7d6dd08166 100644 --- a/packages/imperative/src/profiles/src/validation/api/ProfileValidator.ts +++ b/packages/imperative/src/profiles/src/validation/api/ProfileValidator.ts @@ -29,6 +29,7 @@ import { CliUtils } from "../../../../utilities/src/CliUtils"; * API for going through the full validation test for a Zowe CLI profile * and producing validation report * @internal + * @deprecated */ export class ProfileValidator { From c37e3b01b8b88872623e89cf005937766ac8b71d Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Thu, 22 Aug 2024 15:53:56 -0400 Subject: [PATCH 3/7] Fix lint errors Signed-off-by: Timothy Johnson --- .../__integration__/HelpCommands.integration.test.ts | 1 - packages/imperative/src/cmd/src/profiles/CliProfileManager.ts | 3 +++ packages/imperative/src/imperative/src/api/ImperativeApi.ts | 2 ++ .../src/validation/__tests__/ProfileValidation.unit.test.ts | 1 + .../src/profiles/src/validation/api/ProfileValidator.ts | 2 +- 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/HelpCommands.integration.test.ts b/packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/HelpCommands.integration.test.ts index d062798e23..bc9bd15454 100644 --- a/packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/HelpCommands.integration.test.ts +++ b/packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/HelpCommands.integration.test.ts @@ -9,7 +9,6 @@ * */ -import * as fs from "fs"; import * as T from "../../../TestUtil"; import { IImperativeConfig } from "../../../../../src/imperative/index"; diff --git a/packages/imperative/src/cmd/src/profiles/CliProfileManager.ts b/packages/imperative/src/cmd/src/profiles/CliProfileManager.ts index 0989f2435c..82c97f0c94 100644 --- a/packages/imperative/src/cmd/src/profiles/CliProfileManager.ts +++ b/packages/imperative/src/cmd/src/profiles/CliProfileManager.ts @@ -177,10 +177,13 @@ export class CliProfileManager { ImperativeExpect.keysToBeDefined(typeConfiguration, ["schema"], `The profile type configuration document for ` + `"${typeConfiguration.type}" does NOT contain a schema.`); this.validateSchema(typeConfiguration.schema, typeConfiguration.type); + // eslint-disable-next-line deprecation/deprecation if (!(typeConfiguration.dependencies == null)) { + // eslint-disable-next-line deprecation/deprecation ImperativeExpect.toBeAnArray(typeConfiguration.dependencies, `The profile type configuration for "${typeConfiguration.type}" contains a "dependencies" property, ` + `but it is not an array (ill-formed)`); + // eslint-disable-next-line deprecation/deprecation for (const dep of typeConfiguration.dependencies) { ImperativeExpect.keysToBeDefinedAndNonBlank(dep, ["type"], "A dependency specified for the " + "profile definitions did not contain a type."); diff --git a/packages/imperative/src/imperative/src/api/ImperativeApi.ts b/packages/imperative/src/imperative/src/api/ImperativeApi.ts index 8350358884..3f9e3b49a4 100644 --- a/packages/imperative/src/imperative/src/api/ImperativeApi.ts +++ b/packages/imperative/src/imperative/src/api/ImperativeApi.ts @@ -70,7 +70,9 @@ export class ImperativeApi { * @internal * @deprecated Use the `V1ProfileRead` class if you still need to read V1 profiles */ + // eslint-disable-next-line deprecation/deprecation public profileManager(type: string): CliProfileManager { + // eslint-disable-next-line deprecation/deprecation return new CliProfileManager({ type, typeConfigurations: this.mConfig.profiles, diff --git a/packages/imperative/src/profiles/src/validation/__tests__/ProfileValidation.unit.test.ts b/packages/imperative/src/profiles/src/validation/__tests__/ProfileValidation.unit.test.ts index 8b74413713..f5744c9a65 100644 --- a/packages/imperative/src/profiles/src/validation/__tests__/ProfileValidation.unit.test.ts +++ b/packages/imperative/src/profiles/src/validation/__tests__/ProfileValidation.unit.test.ts @@ -8,6 +8,7 @@ * Copyright Contributors to the Zowe Project. * */ +/* eslint-disable deprecation/deprecation */ import { inspect } from "util"; import { TestLogger } from "../../../../../__tests__/src/TestLogger"; diff --git a/packages/imperative/src/profiles/src/validation/api/ProfileValidator.ts b/packages/imperative/src/profiles/src/validation/api/ProfileValidator.ts index 7d6dd08166..d363596ac7 100644 --- a/packages/imperative/src/profiles/src/validation/api/ProfileValidator.ts +++ b/packages/imperative/src/profiles/src/validation/api/ProfileValidator.ts @@ -29,7 +29,7 @@ import { CliUtils } from "../../../../utilities/src/CliUtils"; * API for going through the full validation test for a Zowe CLI profile * and producing validation report * @internal - * @deprecated + * @deprecated Use the `V1ProfileRead` class if you still need to read V1 profiles */ export class ProfileValidator { From cad2e864ef9a7914adb73392546ef566884dc963 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Thu, 22 Aug 2024 17:49:09 -0400 Subject: [PATCH 4/7] Restore help commands test to old location Signed-off-by: Timothy Johnson --- packages/imperative/__tests__/src/TestUtil.ts | 15 ++++++++----- .../HelpCommands.integration.test.ts | 22 +++++++------------ 2 files changed, 17 insertions(+), 20 deletions(-) rename packages/imperative/__tests__/src/{example_clis/with_bin_package => packages/cmd}/__integration__/HelpCommands.integration.test.ts (72%) diff --git a/packages/imperative/__tests__/src/TestUtil.ts b/packages/imperative/__tests__/src/TestUtil.ts index 1bb7373060..1f2693f558 100644 --- a/packages/imperative/__tests__/src/TestUtil.ts +++ b/packages/imperative/__tests__/src/TestUtil.ts @@ -170,13 +170,16 @@ export function executeTestCLICommand(cliBinModule: string, testContext: any, ar execDir?: string, pipeContent?: string | Buffer, env: { [key: string]: string } = process.env): SpawnSyncReturns { const testLogger = TestLogger.getTestLogger(); - const isLocalFile = fs.existsSync(cliBinModule); + const isLocalFile = fs.existsSync(cliBinModule) && fs.statSync(cliBinModule).isFile(); const nodeCommand = isLocalFile ? "node" : "npx"; - // run the command with ts-node/register - const starterArguments = isLocalFile ? ["--require", "ts-node/register", cliBinModule] : [cliBinModule]; - args = starterArguments.concat(args); - if (!isLocalFile) { - execDir ??= nodePath.dirname(expect.getState().testPath); + if (isLocalFile) { + // run the command with ts-node/register if local file specified + const starterArguments = ["--require", "ts-node/register", cliBinModule]; + args = starterArguments.concat(args); + } else { + // run the command with package bin script if directory specified + args.unshift(Object.keys(require(cliBinModule + "/package.json").bin).pop()); + execDir ??= cliBinModule; } const commandExecutionMessage = "Executing " + nodeCommand + " " + args.join(" "); diff --git a/packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/HelpCommands.integration.test.ts b/packages/imperative/__tests__/src/packages/cmd/__integration__/HelpCommands.integration.test.ts similarity index 72% rename from packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/HelpCommands.integration.test.ts rename to packages/imperative/__tests__/src/packages/cmd/__integration__/HelpCommands.integration.test.ts index bc9bd15454..4ea5996a96 100644 --- a/packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/HelpCommands.integration.test.ts +++ b/packages/imperative/__tests__/src/packages/cmd/__integration__/HelpCommands.integration.test.ts @@ -13,9 +13,9 @@ import * as T from "../../../TestUtil"; import { IImperativeConfig } from "../../../../../src/imperative/index"; describe("Imperative help should be available for a range of definitions", function () { - const cliWithBin = Object.keys(require(__dirname + "/../package.json").bin)[0]; - const cliWithoutBin = __dirname + "/../../with_profiles/ProfileExampleCLI.ts"; - const config: IImperativeConfig = require(__dirname + "/../ProfileBinExampleConfiguration"); + const cliWithBin = __dirname + "/../../../example_clis/with_bin_package"; + const cliWithoutBin = __dirname + "/../../../example_clis/with_profiles/ProfileExampleCLI.ts"; + const config: IImperativeConfig = require(__dirname + "/../../../example_clis/with_bin_package/ProfileBinExampleConfiguration"); /** * Clean up the home directory before and after each test. */ @@ -26,22 +26,16 @@ describe("Imperative help should be available for a range of definitions", funct T.rimraf(T.TEST_HOME); }); - it("We should be able to get --help for our example CLI - without bin script", function () { + it("We should be able to get --help for our example CLI - no bin specified in package", function () { T.findExpectedOutputInCommand(cliWithoutBin, ["--help"], [config.productDisplayName, "log"], "stdout", true, - this, T.CMD_TYPE.INTERACTIVE, undefined, undefined, { - IMPERATIVE_CALLER_LOCATION: T.TEST_HOME - }); + this, T.CMD_TYPE.INTERACTIVE); T.findExpectedOutputInCommand(cliWithoutBin, ["log", "--help"], ["ProfileExampleCLI.ts", "Log example messages", "messages"], "stdout", true, - this, T.CMD_TYPE.INTERACTIVE, undefined, undefined, { - IMPERATIVE_CALLER_LOCATION: T.TEST_HOME - }); + this, T.CMD_TYPE.INTERACTIVE); T.findExpectedOutputInCommand(cliWithoutBin, ["log", "messages", "--help"], ["ProfileExampleCLI.ts", "Log example messages", "messages", "level"], "stdout", true, - this, T.CMD_TYPE.INTERACTIVE, undefined, undefined, { - IMPERATIVE_CALLER_LOCATION: T.TEST_HOME - }); + this, T.CMD_TYPE.INTERACTIVE); }); it("should display --version in the root help", function () { @@ -50,7 +44,7 @@ describe("Imperative help should be available for a range of definitions", funct this, T.CMD_TYPE.INTERACTIVE); }); - it("We should be able to get --help for our example CLI - with bin script", function () { + it("We should be able to get --help for our example CLI - with bin in package", function () { T.findExpectedOutputInCommand(cliWithBin, ["--help"], [config.productDisplayName, "ape", "bat", "cat"], "stdout", true, this, T.CMD_TYPE.INTERACTIVE); From 96723b654fef6d5e5dc9a39452b87a0582079816 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Thu, 22 Aug 2024 18:49:26 -0400 Subject: [PATCH 5/7] Add prompting unit tests and deprecate more V1 stuff Signed-off-by: Timothy Johnson --- .../__tests__/CommandProcessor.unit.test.ts | 215 ++++++++++-------- .../doc/config/IProfileTypeConfiguration.ts | 3 +- 2 files changed, 117 insertions(+), 101 deletions(-) diff --git a/packages/imperative/src/cmd/__tests__/CommandProcessor.unit.test.ts b/packages/imperative/src/cmd/__tests__/CommandProcessor.unit.test.ts index 76d56a8b4f..b48f3c2d23 100644 --- a/packages/imperative/src/cmd/__tests__/CommandProcessor.unit.test.ts +++ b/packages/imperative/src/cmd/__tests__/CommandProcessor.unit.test.ts @@ -192,6 +192,11 @@ const FAKE_HELP_GENERATOR: IHelpGenerator = { const ENV_VAR_PREFIX: string = "UNIT_TEST"; describe("Command Processor", () => { + beforeEach(() => { + // Mock read stdin + jest.spyOn(SharedOptions, "readStdinIfRequested").mockResolvedValueOnce(false); + }); + // Restore everything after each test afterEach(() => { process.stdout.write = ORIGINAL_STDOUT_WRITE; @@ -800,11 +805,6 @@ describe("Command Processor", () => { promptPhrase: "dummydummy" }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -845,11 +845,6 @@ describe("Command Processor", () => { promptPhrase: "dummydummy" }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -887,11 +882,6 @@ describe("Command Processor", () => { promptPhrase: "dummydummy" }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -938,11 +928,6 @@ describe("Command Processor", () => { promptPhrase: "dummydummy" }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -971,11 +956,6 @@ describe("Command Processor", () => { promptPhrase: "dummydummy" }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1012,11 +992,6 @@ describe("Command Processor", () => { promptPhrase: "dummydummy" }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1053,11 +1028,6 @@ describe("Command Processor", () => { promptPhrase: "dummydummy" }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1094,11 +1064,6 @@ describe("Command Processor", () => { promptPhrase: "dummydummy" }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1138,11 +1103,6 @@ describe("Command Processor", () => { promptPhrase: "dummydummy" }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1177,11 +1137,6 @@ describe("Command Processor", () => { promptPhrase: "dummydummy" }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1209,11 +1164,6 @@ describe("Command Processor", () => { promptPhrase: "dummydummy" }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - const parms: any = { arguments: { _: ["check", "for", "banana"], @@ -1596,11 +1546,6 @@ describe("Command Processor", () => { } }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - jest.spyOn(process, "chdir"); const mockConfigReload = jest.fn(); jest.spyOn(ImperativeConfig, "instance", "get").mockReturnValue({ @@ -1653,11 +1598,6 @@ describe("Command Processor", () => { } }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - jest.spyOn(process, "chdir"); const mockConfigReload = jest.fn(); jest.spyOn(ImperativeConfig, "instance", "get").mockReturnValue({ @@ -1706,11 +1646,6 @@ describe("Command Processor", () => { config: ImperativeConfig.instance.config }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - // return the "fake" args object with values from profile const getOptValuesSpy = jest.spyOn(CliUtils, "getOptValuesFromConfig").mockReturnValueOnce({ color: "yellow" }); @@ -1741,11 +1676,6 @@ describe("Command Processor", () => { promptPhrase: "dummydummy" }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - // return the "fake" args object with values from profile jest.spyOn(CliUtils, "getOptValuesFromConfig").mockReturnValueOnce({}); @@ -1776,11 +1706,6 @@ describe("Command Processor", () => { config: ImperativeConfig.instance.config }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - // return the "fake" args object with values from profile const getOptValuesSpy = jest.spyOn(CliUtils, "getOptValuesFromConfig").mockReturnValueOnce({ color: "yellow" }); @@ -1812,11 +1737,6 @@ describe("Command Processor", () => { config: ImperativeConfig.instance.config }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - // return the "fake" args object with values from profile const getOptValuesSpy = jest.spyOn(CliUtils, "getOptValuesFromConfig").mockReturnValueOnce({ color: "yellow" }); @@ -1849,11 +1769,6 @@ describe("Command Processor", () => { config: ImperativeConfig.instance.config }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - // return the "fake" args object with values from profile const getOptValuesSpy = jest.spyOn(CliUtils, "getOptValuesFromConfig").mockReturnValueOnce({ color: "yellow" }); @@ -1923,11 +1838,6 @@ describe("Command Processor", () => { promptPhrase: "dummydummy" }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - const parms: any = { arguments: { _: [], @@ -1958,11 +1868,6 @@ describe("Command Processor", () => { promptPhrase: "dummydummy" }); - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - const parms: any = { arguments: { _: [], @@ -2176,4 +2081,114 @@ describe("Command Processor", () => { expect(preparedArgs.color).toBe("green"); }); }); + + describe("prompting", () => { + const invokeParms: any = { + arguments: { + _: ["check", "for", "banana"], + $0: "", + valid: true + }, + silent: true + }; + function buildProcessor(definition: ICommandDefinition): CommandProcessor { + return new CommandProcessor({ + envVariablePrefix: ENV_VAR_PREFIX, + fullDefinition: SAMPLE_CMD_WITH_OPTS_AND_PROF, + definition, + helpGenerator: FAKE_HELP_GENERATOR, + rootCommandName: SAMPLE_ROOT_COMMAND, + commandLine: "", + promptPhrase: "please" + }); + } + + it("should prompt for missing positional with string type", async () => { + // Allocate the command processor + const processor = buildProcessor(SAMPLE_COMMAND_REAL_HANDLER_WITH_POS_OPT); + + const promptMock = jest.fn().mockResolvedValue("yellow"); + jest.spyOn(CommandResponse.prototype, "console", "get").mockReturnValueOnce({ + prompt: promptMock + } as any); + + invokeParms.arguments.color = "please"; + const commandResponse: ICommandResponse = await processor.invoke(invokeParms); + expect(commandResponse).toBeDefined(); + expect(promptMock).toHaveBeenCalledTimes(1); + expect(promptMock.mock.calls[0][0]).toContain(`Please enter "color"`); + expect(invokeParms.arguments.color).toBe("yellow"); + }); + + it("should prompt for missing positional with array type", async () => { + // Allocate the command processor + const processor = buildProcessor({ + ...SAMPLE_COMMAND_REAL_HANDLER_WITH_POS_OPT, + positionals: [ + { + name: "color", + type: "array", + description: "The banana colors.", + required: true + } + ], + }); + + const promptMock = jest.fn().mockResolvedValue("yellow brown"); + jest.spyOn(CommandResponse.prototype, "console", "get").mockReturnValueOnce({ + prompt: promptMock + } as any); + + invokeParms.arguments.color = ["please"]; + const commandResponse: ICommandResponse = await processor.invoke(invokeParms); + expect(commandResponse).toBeDefined(); + expect(promptMock).toHaveBeenCalledTimes(1); + expect(promptMock.mock.calls[0][0]).toContain(`Please enter "color"`); + expect(invokeParms.arguments.color).toEqual(["yellow", "brown"]); + }); + + it("should prompt for missing option with string type", async () => { + // Allocate the command processor + const processor = buildProcessor(SAMPLE_COMMAND_REAL_HANDLER_WITH_OPT); + + const promptMock = jest.fn().mockResolvedValue("yellow"); + jest.spyOn(CommandResponse.prototype, "console", "get").mockReturnValueOnce({ + prompt: promptMock + } as any); + + invokeParms.arguments.color = "please"; + const commandResponse: ICommandResponse = await processor.invoke(invokeParms); + expect(commandResponse).toBeDefined(); + expect(promptMock).toHaveBeenCalledTimes(1); + expect(promptMock.mock.calls[0][0]).toContain(`Please enter "color"`); + expect(invokeParms.arguments.color).toBe("yellow"); + }); + + it("should prompt for missing option with array type", async () => { + // Allocate the command processor + const processor = buildProcessor({ + ...SAMPLE_COMMAND_REAL_HANDLER_WITH_OPT, + options: [ + { + name: "color", + type: "array", + description: "The banana colors.", + required: true + } + ], + }); + + const promptMock = jest.fn().mockResolvedValue("yellow brown"); + jest.spyOn(CommandResponse.prototype, "console", "get").mockReturnValueOnce({ + prompt: promptMock + } as any); + + invokeParms.arguments.color = ["please"]; + const commandResponse: ICommandResponse = await processor.invoke(invokeParms); + expect(commandResponse).toBeDefined(); + expect(promptMock).toHaveBeenCalledTimes(1); + expect(promptMock.mock.calls[0][0]).toContain(`Please enter "color"`); + expect(invokeParms.arguments.color).toEqual(["yellow", "brown"]); + }); + }); }); diff --git a/packages/imperative/src/profiles/src/doc/config/IProfileTypeConfiguration.ts b/packages/imperative/src/profiles/src/doc/config/IProfileTypeConfiguration.ts index 94d389de23..a4777ba354 100644 --- a/packages/imperative/src/profiles/src/doc/config/IProfileTypeConfiguration.ts +++ b/packages/imperative/src/profiles/src/doc/config/IProfileTypeConfiguration.ts @@ -46,7 +46,7 @@ export interface IProfileTypeConfiguration { * * @type {IProfileDependency[]} * @memberof IProfileTypeConfiguration - * @deprecated + * @deprecated Only applies to V1 profiles. For team config, use nested profiles instead. */ dependencies?: IProfileDependency[]; /** @@ -56,6 +56,7 @@ export interface IProfileTypeConfiguration { * * @type {string} * @memberof IProfileTypeConfiguration + * @deprecated Only applies to V1 profiles. For team config, validate with JSON schema instead. */ validationPlanModule?: string; } From 48fa3dacbdb3d77ce8c0670534617bbb15a6ccc5 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Fri, 23 Aug 2024 08:09:18 -0400 Subject: [PATCH 6/7] Fix code smells and update changelog Signed-off-by: Timothy Johnson --- .../__packages__/cli-test-utils/CHANGELOG.md | 4 + packages/imperative/CHANGELOG.md | 11 +++ .../ExampleDefinitions.integration.test.ts | 2 - .../src/cmd/src/CommandProcessor.ts | 76 +++++++++---------- .../__tests__/ProfileValidation.unit.test.ts | 1 + .../utilities/__tests__/CliUtils.unit.test.ts | 9 +++ .../imperative/src/utilities/src/CliUtils.ts | 15 ++-- 7 files changed, 67 insertions(+), 51 deletions(-) diff --git a/__tests__/__packages__/cli-test-utils/CHANGELOG.md b/__tests__/__packages__/cli-test-utils/CHANGELOG.md index 552e7898f5..d50a15e407 100644 --- a/__tests__/__packages__/cli-test-utils/CHANGELOG.md +++ b/__tests__/__packages__/cli-test-utils/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Zowe CLI test utils package will be documented in this file. +## Recent Changes + +- BugFix: Removed obsolete V1 `profiles` property from the parameters object returned by `mockHandlerParameters` method. + ## `8.0.0-next.202408131445` - Update: See `7.28.3` for details diff --git a/packages/imperative/CHANGELOG.md b/packages/imperative/CHANGELOG.md index 4d862a2abc..58e7ead1da 100644 --- a/packages/imperative/CHANGELOG.md +++ b/packages/imperative/CHANGELOG.md @@ -2,6 +2,17 @@ All notable changes to the Imperative package will be documented in this file. +## Recent Changes + +- LTS Breaking: [#2231](https://github.com/zowe/zowe-cli/issues/2231) + - Removed the obsolete V1 `profiles` property from `IHandlerParameters` interface + - Deprecated the following obsolete V1 profile interfaces: + - `IProfileTypeConfiguration.dependencies` - For team config, use nested profiles instead + - `IProfileTypeConfiguration.validationPlanModule` - For team config, validate with JSON schema instead + - Deprecated the following obsolete V1 profile classes/functions: + - `CliUtils.getOptValueFromProfiles` - Use `getOptValuesFromConfig` instead to load from team config + - `CommandProfiles` - Use the `V1ProfileRead` class if you still need to read V1 profiles + ## `8.0.0-next.202408191401` - Update: See `5.26.3` and `5.27.0` for details diff --git a/packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/ExampleDefinitions.integration.test.ts b/packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/ExampleDefinitions.integration.test.ts index 3b651f9a24..98a734a3aa 100644 --- a/packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/ExampleDefinitions.integration.test.ts +++ b/packages/imperative/__tests__/src/example_clis/with_bin_package/__integration__/ExampleDefinitions.integration.test.ts @@ -9,14 +9,12 @@ * */ -import { IImperativeConfig } from "../../../../../src/imperative"; import * as T from "../../../TestUtil"; describe("We should provide the ability to define commands through Javascript objects passed through the config " + "or globs that match modules locally, " + "tested through an example CLI", function () { const cliBin = __dirname + "/../ProfileBinExampleCLI.ts"; - const config: IImperativeConfig = require(__dirname + "/../ProfileBinExampleConfiguration"); it("All commands defined through module globs should be accurately defined, " + "and a definition module in the same directory that does not ", diff --git a/packages/imperative/src/cmd/src/CommandProcessor.ts b/packages/imperative/src/cmd/src/CommandProcessor.ts index bdb78ee99d..5ff82ff5eb 100644 --- a/packages/imperative/src/cmd/src/CommandProcessor.ts +++ b/packages/imperative/src/cmd/src/CommandProcessor.ts @@ -497,24 +497,22 @@ export class CommandProcessor { { hideText: true, secToWait: 0 }); } // array processing - else { - if (preparedArgs[positionalName] != null && - Array.isArray(preparedArgs[positionalName]) && - preparedArgs[positionalName][0] != null && - typeof preparedArgs[positionalName][0] === "string" && - preparedArgs[positionalName][0].toUpperCase() === this.promptPhrase.toUpperCase()) { - // prompt has been requested for a positional - this.log.debug("Prompting for positional %s which was requested by passing the value %s", - preparedArgs[positionalName][0], this.promptPhrase); - preparedArgs[positionalName][0] = - await response.console.prompt(`"${positionalName}" Description: ` + - `${positional.description}\nPlease enter "${positionalName}":`, - { hideText: true, secToWait: 0 }); - // prompting enters as string but need to place it in array - - const array = preparedArgs[positionalName][0].split(" "); - preparedArgs[positionalName] = array; - } + else if (preparedArgs[positionalName] != null && + Array.isArray(preparedArgs[positionalName]) && + preparedArgs[positionalName][0] != null && + typeof preparedArgs[positionalName][0] === "string" && + preparedArgs[positionalName][0].toUpperCase() === this.promptPhrase.toUpperCase()) { + // prompt has been requested for a positional + this.log.debug("Prompting for positional %s which was requested by passing the value %s", + preparedArgs[positionalName][0], this.promptPhrase); + preparedArgs[positionalName][0] = + await response.console.prompt(`"${positionalName}" Description: ` + + `${positional.description}\nPlease enter "${positionalName}":`, + { hideText: true, secToWait: 0 }); + // prompting enters as string but need to place it in array + + const array = preparedArgs[positionalName][0].split(" "); + preparedArgs[positionalName] = array; } } } @@ -544,28 +542,26 @@ export class CommandProcessor { } } // array processing - else { - if (Array.isArray(preparedArgs[option.name]) && - preparedArgs[option.name][0] != null && - typeof preparedArgs[option.name][0] === "string" && - preparedArgs[option.name][0].toUpperCase() === this.promptPhrase.toUpperCase()) { - // prompt has been requested for an --option - this.log.debug("Prompting for option %s which was requested by passing the value %s", - option.name, this.promptPhrase); - preparedArgs[option.name][0] = - await response.console.prompt(`"${option.name}" Description: ` + - `${option.description}\nPlease enter "${option.name}":`, - { hideText: true, secToWait: 0 }); - - const array = preparedArgs[option.name][0].split(" "); - preparedArgs[option.name] = array; - const camelCase = CliUtils.getOptionFormat(option.name).camelCase; - preparedArgs[camelCase] = preparedArgs[option.name]; - if (option.aliases != null) { - for (const alias of option.aliases) { - // set each alias of the args object as well - preparedArgs[alias] = preparedArgs[option.name]; - } + else if (Array.isArray(preparedArgs[option.name]) && + preparedArgs[option.name][0] != null && + typeof preparedArgs[option.name][0] === "string" && + preparedArgs[option.name][0].toUpperCase() === this.promptPhrase.toUpperCase()) { + // prompt has been requested for an --option + this.log.debug("Prompting for option %s which was requested by passing the value %s", + option.name, this.promptPhrase); + preparedArgs[option.name][0] = + await response.console.prompt(`"${option.name}" Description: ` + + `${option.description}\nPlease enter "${option.name}":`, + { hideText: true, secToWait: 0 }); + + const array = preparedArgs[option.name][0].split(" "); + preparedArgs[option.name] = array; + const camelCase = CliUtils.getOptionFormat(option.name).camelCase; + preparedArgs[camelCase] = preparedArgs[option.name]; + if (option.aliases != null) { + for (const alias of option.aliases) { + // set each alias of the args object as well + preparedArgs[alias] = preparedArgs[option.name]; } } } diff --git a/packages/imperative/src/profiles/src/validation/__tests__/ProfileValidation.unit.test.ts b/packages/imperative/src/profiles/src/validation/__tests__/ProfileValidation.unit.test.ts index f5744c9a65..a36defb065 100644 --- a/packages/imperative/src/profiles/src/validation/__tests__/ProfileValidation.unit.test.ts +++ b/packages/imperative/src/profiles/src/validation/__tests__/ProfileValidation.unit.test.ts @@ -8,6 +8,7 @@ * Copyright Contributors to the Zowe Project. * */ + /* eslint-disable deprecation/deprecation */ import { inspect } from "util"; diff --git a/packages/imperative/src/utilities/__tests__/CliUtils.unit.test.ts b/packages/imperative/src/utilities/__tests__/CliUtils.unit.test.ts index b53c83c35c..cf92150b13 100644 --- a/packages/imperative/src/utilities/__tests__/CliUtils.unit.test.ts +++ b/packages/imperative/src/utilities/__tests__/CliUtils.unit.test.ts @@ -293,6 +293,7 @@ describe("CliUtils", () => { it("should throw an imperative error if a required profile is not present", () => { let error; try { + // eslint-disable-next-line deprecation/deprecation const args = CliUtils.getOptValueFromProfiles( // eslint-disable-next-line deprecation/deprecation new CommandProfiles(new Map()), @@ -307,6 +308,7 @@ describe("CliUtils", () => { }); it("should return nothing if a profile was optional and not loaded", () => { + // eslint-disable-next-line deprecation/deprecation const args = CliUtils.getOptValueFromProfiles( // eslint-disable-next-line deprecation/deprecation new CommandProfiles(new Map()), @@ -318,6 +320,7 @@ describe("CliUtils", () => { it("should return args (from definitions with no hyphen in name) extracted from loaded profile", () => { const map = new Map(); map.set("banana", [{ type: "banana", name: "fakebanana", nohyphen: "specified in profile" }]); + // eslint-disable-next-line deprecation/deprecation const args = CliUtils.getOptValueFromProfiles( // eslint-disable-next-line deprecation/deprecation new CommandProfiles(map), @@ -334,6 +337,7 @@ describe("CliUtils", () => { "couldBeEither": "should be me", "could-be-either": "should not be me" }]); + // eslint-disable-next-line deprecation/deprecation const args = CliUtils.getOptValueFromProfiles( // eslint-disable-next-line deprecation/deprecation new CommandProfiles(map), @@ -350,6 +354,7 @@ describe("CliUtils", () => { "fakeStringOpt": "should not be me", "fake-string-opt": "should be me" }]); + // eslint-disable-next-line deprecation/deprecation const args = CliUtils.getOptValueFromProfiles( // eslint-disable-next-line deprecation/deprecation new CommandProfiles(map), @@ -365,6 +370,7 @@ describe("CliUtils", () => { "name": "fakebanana", "could-be-either": "should be me" }]); + // eslint-disable-next-line deprecation/deprecation const args = CliUtils.getOptValueFromProfiles( // eslint-disable-next-line deprecation/deprecation new CommandProfiles(map), @@ -380,6 +386,7 @@ describe("CliUtils", () => { name: "fakebanana", fakeStringOpt: "should be me" }]); + // eslint-disable-next-line deprecation/deprecation const args = CliUtils.getOptValueFromProfiles( // eslint-disable-next-line deprecation/deprecation new CommandProfiles(map), @@ -395,6 +402,7 @@ describe("CliUtils", () => { name: "fakebanana", withAlias: "should have 'w' on args object too" }]); + // eslint-disable-next-line deprecation/deprecation const args = CliUtils.getOptValueFromProfiles( // eslint-disable-next-line deprecation/deprecation new CommandProfiles(map), @@ -410,6 +418,7 @@ describe("CliUtils", () => { name: "fakebanana", username: "fake" }]); + // eslint-disable-next-line deprecation/deprecation const args = CliUtils.getOptValueFromProfiles( // eslint-disable-next-line deprecation/deprecation new CommandProfiles(map), diff --git a/packages/imperative/src/utilities/src/CliUtils.ts b/packages/imperative/src/utilities/src/CliUtils.ts index 460d025750..115548af5e 100644 --- a/packages/imperative/src/utilities/src/CliUtils.ts +++ b/packages/imperative/src/utilities/src/CliUtils.ts @@ -108,6 +108,8 @@ export class CliUtils { /** * Accepts the full set of loaded profiles and attempts to match the option names supplied with profile keys. * + * @deprecated Use `getOptValuesFromConfig` instead to load from team config + * * @param {Map} profiles - the map of type to loaded profiles. The key is the profile type * and the value is an array of profiles loaded for that type. * @@ -214,7 +216,6 @@ export class CliUtils { } // Build an object that contains all the options loaded from config - const fulfilled: string[] = []; let fromCnfg: any = {}; for (const profileType of allTypes) { const opt = ProfileUtils.getProfileOptionAndAlias(profileType)[0]; @@ -224,16 +225,13 @@ export class CliUtils { const profileTypePrefix = profileType + "_"; let p: any = {}; if (args[opt] != null && config.api.profiles.exists(args[opt])) { - fulfilled.push(profileType); p = config.api.profiles.get(args[opt]); } else if (args[opt] != null && !args[opt].startsWith(profileTypePrefix) && config.api.profiles.exists(profileTypePrefix + args[opt])) { - fulfilled.push(profileType); p = config.api.profiles.get(profileTypePrefix + args[opt]); } else if (args[opt] == null && config.properties.defaults[profileType] != null && config.api.profiles.exists(config.properties.defaults[profileType])) { - fulfilled.push(profileType); p = config.api.profiles.defaultGet(profileType); } fromCnfg = { ...p, ...fromCnfg }; @@ -247,14 +245,13 @@ export class CliUtils { const profileCamel = fromCnfg[cases.camelCase]; if ((profileCamel !== undefined || profileKebab !== undefined) && - (!Object.prototype.hasOwnProperty.call(args, cases.kebabCase) && - !Object.prototype.hasOwnProperty.call(args, cases.camelCase))) { + (!Object.hasOwn(args, cases.kebabCase) && !Object.hasOwn(args, cases.camelCase))) { // If both case properties are present in the profile, use the one that matches // the option name explicitly - const value = profileKebab !== undefined && profileCamel !== undefined ? - opt.name === cases.kebabCase ? profileKebab : profileCamel : - profileKebab !== undefined ? profileKebab : profileCamel; + const shouldUseKebab = profileKebab !== undefined && profileCamel !== undefined ? + opt.name === cases.kebabCase : profileKebab !== undefined; + const value = shouldUseKebab ? profileKebab : profileCamel; const keys = CliUtils.setOptionValue(opt.name, "aliases" in opt ? opt.aliases : [], value From 25ee4da4a255efbcccedc354648550e822bfba14 Mon Sep 17 00:00:00 2001 From: zowe-robot Date: Tue, 27 Aug 2024 13:30:29 +0000 Subject: [PATCH 7/7] Bump version to 8.0.0-next.202408271330 [ci skip] Signed-off-by: zowe-robot --- .../__packages__/cli-test-utils/CHANGELOG.md | 2 +- .../__packages__/cli-test-utils/package.json | 4 +- lerna.json | 2 +- npm-shrinkwrap.json | 122 +++++++++--------- packages/cli/package.json | 28 ++-- packages/core/package.json | 6 +- packages/imperative/CHANGELOG.md | 2 +- packages/imperative/package.json | 4 +- packages/provisioning/package.json | 8 +- packages/secrets/package.json | 2 +- packages/workflows/package.json | 10 +- packages/zosconsole/package.json | 8 +- packages/zosfiles/package.json | 10 +- packages/zosjobs/package.json | 10 +- packages/zoslogs/package.json | 8 +- packages/zosmf/package.json | 8 +- packages/zostso/package.json | 10 +- packages/zosuss/package.json | 6 +- 18 files changed, 125 insertions(+), 125 deletions(-) diff --git a/__tests__/__packages__/cli-test-utils/CHANGELOG.md b/__tests__/__packages__/cli-test-utils/CHANGELOG.md index d50a15e407..baec97cf76 100644 --- a/__tests__/__packages__/cli-test-utils/CHANGELOG.md +++ b/__tests__/__packages__/cli-test-utils/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to the Zowe CLI test utils package will be documented in this file. -## Recent Changes +## `8.0.0-next.202408271330` - BugFix: Removed obsolete V1 `profiles` property from the parameters object returned by `mockHandlerParameters` method. diff --git a/__tests__/__packages__/cli-test-utils/package.json b/__tests__/__packages__/cli-test-utils/package.json index 8363c55f51..5d4cab14a7 100644 --- a/__tests__/__packages__/cli-test-utils/package.json +++ b/__tests__/__packages__/cli-test-utils/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/cli-test-utils", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "description": "Test utilities package for Zowe CLI plug-ins", "author": "Zowe", "license": "EPL-2.0", @@ -43,7 +43,7 @@ "devDependencies": { "@types/js-yaml": "^4.0.9", "@types/uuid": "^10.0.0", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/imperative": "8.0.0-next.202408271330" }, "peerDependencies": { "@zowe/imperative": "^8.0.0-next" diff --git a/lerna.json b/lerna.json index 3e5f67613d..415822a4f4 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "command": { "publish": { "ignoreChanges": [ diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 0d484ccf50..0c90e33f11 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -52,7 +52,7 @@ }, "__tests__/__packages__/cli-test-utils": { "name": "@zowe/cli-test-utils", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "license": "EPL-2.0", "dependencies": { "find-up": "^5.0.0", @@ -63,7 +63,7 @@ "devDependencies": { "@types/js-yaml": "^4.0.9", "@types/uuid": "^10.0.0", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/imperative": "8.0.0-next.202408271330" }, "peerDependencies": { "@zowe/imperative": "^8.0.0-next" @@ -16365,21 +16365,21 @@ }, "packages/cli": { "name": "@zowe/cli", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "hasInstallScript": true, "license": "EPL-2.0", "dependencies": { - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543", - "@zowe/provisioning-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/zos-console-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/zos-jobs-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/zos-logs-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/zos-tso-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/zos-workflows-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/zosmf-for-zowe-sdk": "8.0.0-next.202408261543", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330", + "@zowe/provisioning-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/zos-console-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/zos-jobs-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/zos-logs-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/zos-tso-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/zos-workflows-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/zosmf-for-zowe-sdk": "8.0.0-next.202408271330", "find-process": "1.4.7", "lodash": "4.17.21", "minimatch": "9.0.5", @@ -16392,7 +16392,7 @@ "@types/diff": "^5.0.9", "@types/lodash": "^4.17.6", "@types/tar": "^6.1.11", - "@zowe/cli-test-utils": "8.0.0-next.202408261543", + "@zowe/cli-test-utils": "8.0.0-next.202408271330", "comment-json": "^4.2.3", "strip-ansi": "^6.0.1", "which": "^4.0.0" @@ -16401,7 +16401,7 @@ "node": ">=18.12.0" }, "optionalDependencies": { - "@zowe/secrets-for-zowe-sdk": "8.0.0-next.202408261543" + "@zowe/secrets-for-zowe-sdk": "8.0.0-next.202408271330" } }, "packages/cli/node_modules/brace-expansion": { @@ -16448,15 +16448,15 @@ }, "packages/core": { "name": "@zowe/core-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "license": "EPL-2.0", "dependencies": { "comment-json": "~4.2.3", "string-width": "^4.2.3" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "engines": { "node": ">=18.12.0" @@ -16467,7 +16467,7 @@ }, "packages/imperative": { "name": "@zowe/imperative", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "license": "EPL-2.0", "dependencies": { "@types/yargs": "^17.0.32", @@ -16520,7 +16520,7 @@ "@types/pacote": "^11.1.8", "@types/progress": "^2.0.7", "@types/stack-trace": "^0.0.33", - "@zowe/secrets-for-zowe-sdk": "8.0.0-next.202408261543", + "@zowe/secrets-for-zowe-sdk": "8.0.0-next.202408271330", "concurrently": "^8.0.0", "cowsay": "^1.6.0", "deep-diff": "^1.0.0", @@ -16661,16 +16661,16 @@ }, "packages/provisioning": { "name": "@zowe/provisioning-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "license": "EPL-2.0", "dependencies": { "js-yaml": "^4.1.0" }, "devDependencies": { "@types/js-yaml": "^4.0.9", - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "engines": { "node": ">=18.12.0" @@ -16682,7 +16682,7 @@ }, "packages/secrets": { "name": "@zowe/secrets-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "hasInstallScript": true, "license": "EPL-2.0", "devDependencies": { @@ -16695,15 +16695,15 @@ }, "packages/workflows": { "name": "@zowe/zos-workflows-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "license": "EPL-2.0", "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408261543" + "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408271330" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "engines": { "node": ">=18.12.0" @@ -16715,12 +16715,12 @@ }, "packages/zosconsole": { "name": "@zowe/zos-console-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "license": "EPL-2.0", "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "engines": { "node": ">=18.12.0" @@ -16732,16 +16732,16 @@ }, "packages/zosfiles": { "name": "@zowe/zos-files-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "license": "EPL-2.0", "dependencies": { "minimatch": "^9.0.5" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543", - "@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330", + "@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202408271330" }, "engines": { "node": ">=18.12.0" @@ -16773,15 +16773,15 @@ }, "packages/zosjobs": { "name": "@zowe/zos-jobs-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "license": "EPL-2.0", "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408261543" + "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408271330" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "engines": { "node": ">=18.12.0" @@ -16793,12 +16793,12 @@ }, "packages/zoslogs": { "name": "@zowe/zos-logs-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "license": "EPL-2.0", "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "engines": { "node": ">=18.12.0" @@ -16810,12 +16810,12 @@ }, "packages/zosmf": { "name": "@zowe/zosmf-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "license": "EPL-2.0", "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "engines": { "node": ">=18.12.0" @@ -16827,15 +16827,15 @@ }, "packages/zostso": { "name": "@zowe/zos-tso-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "license": "EPL-2.0", "dependencies": { - "@zowe/zosmf-for-zowe-sdk": "8.0.0-next.202408261543" + "@zowe/zosmf-for-zowe-sdk": "8.0.0-next.202408271330" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "engines": { "node": ">=18.12.0" @@ -16847,15 +16847,15 @@ }, "packages/zosuss": { "name": "@zowe/zos-uss-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "license": "EPL-2.0", "dependencies": { "ssh2": "^1.15.0" }, "devDependencies": { "@types/ssh2": "^1.11.19", - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "engines": { "node": ">=18.12.0" diff --git a/packages/cli/package.json b/packages/cli/package.json index 54d85535dd..d4d842218c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/cli", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "zoweVersion": "v3.0.0-prerelease", "description": "Zowe CLI is a command line interface (CLI) that provides a simple and streamlined way to interact with IBM z/OS.", "author": "Zowe", @@ -58,17 +58,17 @@ "preshrinkwrap": "node ../../scripts/rewriteShrinkwrap.js" }, "dependencies": { - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543", - "@zowe/provisioning-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/zos-console-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/zos-jobs-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/zos-logs-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/zos-tso-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/zos-workflows-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/zosmf-for-zowe-sdk": "8.0.0-next.202408261543", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330", + "@zowe/provisioning-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/zos-console-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/zos-jobs-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/zos-logs-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/zos-tso-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/zos-workflows-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/zosmf-for-zowe-sdk": "8.0.0-next.202408271330", "find-process": "1.4.7", "lodash": "4.17.21", "minimatch": "9.0.5", @@ -78,13 +78,13 @@ "@types/diff": "^5.0.9", "@types/lodash": "^4.17.6", "@types/tar": "^6.1.11", - "@zowe/cli-test-utils": "8.0.0-next.202408261543", + "@zowe/cli-test-utils": "8.0.0-next.202408271330", "comment-json": "^4.2.3", "strip-ansi": "^6.0.1", "which": "^4.0.0" }, "optionalDependencies": { - "@zowe/secrets-for-zowe-sdk": "8.0.0-next.202408261543" + "@zowe/secrets-for-zowe-sdk": "8.0.0-next.202408271330" }, "engines": { "node": ">=18.12.0" diff --git a/packages/core/package.json b/packages/core/package.json index 53e9d868d0..bce2840be6 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/core-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "description": "Core libraries shared by Zowe SDK packages", "author": "Zowe", "license": "EPL-2.0", @@ -49,8 +49,8 @@ "string-width": "^4.2.3" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "peerDependencies": { "@zowe/imperative": "^8.0.0-next" diff --git a/packages/imperative/CHANGELOG.md b/packages/imperative/CHANGELOG.md index 0204ab62f4..6b10c766c1 100644 --- a/packages/imperative/CHANGELOG.md +++ b/packages/imperative/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to the Imperative package will be documented in this file. -## Recent Changes +## `8.0.0-next.202408271330` - LTS Breaking: [#2231](https://github.com/zowe/zowe-cli/issues/2231) - Removed the obsolete V1 `profiles` property from `IHandlerParameters` interface diff --git a/packages/imperative/package.json b/packages/imperative/package.json index 6aac843275..dad7f36ad3 100644 --- a/packages/imperative/package.json +++ b/packages/imperative/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/imperative", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "description": "framework for building configurable CLIs", "author": "Zowe", "license": "EPL-2.0", @@ -95,7 +95,7 @@ "@types/pacote": "^11.1.8", "@types/progress": "^2.0.7", "@types/stack-trace": "^0.0.33", - "@zowe/secrets-for-zowe-sdk": "8.0.0-next.202408261543", + "@zowe/secrets-for-zowe-sdk": "8.0.0-next.202408271330", "concurrently": "^8.0.0", "cowsay": "^1.6.0", "deep-diff": "^1.0.0", diff --git a/packages/provisioning/package.json b/packages/provisioning/package.json index cca4e1b5e9..9b0d1ec793 100644 --- a/packages/provisioning/package.json +++ b/packages/provisioning/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/provisioning-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "description": "Zowe SDK to interact with the z/OS provisioning APIs", "author": "Zowe", "license": "EPL-2.0", @@ -49,9 +49,9 @@ }, "devDependencies": { "@types/js-yaml": "^4.0.9", - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0-next", diff --git a/packages/secrets/package.json b/packages/secrets/package.json index 4cf2cde288..2c19496383 100644 --- a/packages/secrets/package.json +++ b/packages/secrets/package.json @@ -3,7 +3,7 @@ "description": "Credential management facilities for Imperative, Zowe CLI, and extenders.", "repository": "https://github.com/zowe/zowe-cli.git", "author": "Zowe", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "homepage": "https://github.com/zowe/zowe-cli/tree/master/packages/secrets#readme", "bugs": { "url": "https://github.com/zowe/zowe-cli/issues" diff --git a/packages/workflows/package.json b/packages/workflows/package.json index efd53faea2..470ea2ff14 100644 --- a/packages/workflows/package.json +++ b/packages/workflows/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-workflows-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "description": "Zowe SDK to interact with the z/OS workflows APIs", "author": "Zowe", "license": "EPL-2.0", @@ -45,12 +45,12 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408261543" + "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408271330" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0-next", diff --git a/packages/zosconsole/package.json b/packages/zosconsole/package.json index 4753c599a6..7df35d2a55 100644 --- a/packages/zosconsole/package.json +++ b/packages/zosconsole/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-console-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "description": "Zowe SDK to interact with the z/OS console", "author": "Zowe", "license": "EPL-2.0", @@ -45,9 +45,9 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0-next", diff --git a/packages/zosfiles/package.json b/packages/zosfiles/package.json index 691ae84976..b92d684360 100644 --- a/packages/zosfiles/package.json +++ b/packages/zosfiles/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-files-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "description": "Zowe SDK to interact with files and data sets on z/OS", "author": "Zowe", "license": "EPL-2.0", @@ -49,10 +49,10 @@ "minimatch": "^9.0.5" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543", - "@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330", + "@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202408271330" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0-next", diff --git a/packages/zosjobs/package.json b/packages/zosjobs/package.json index 66e6b378a7..77bb62055d 100644 --- a/packages/zosjobs/package.json +++ b/packages/zosjobs/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-jobs-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "description": "Zowe SDK to interact with jobs on z/OS", "author": "Zowe", "license": "EPL-2.0", @@ -46,12 +46,12 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408261543" + "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408271330" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0-next", diff --git a/packages/zoslogs/package.json b/packages/zoslogs/package.json index 19dc00e7ed..60c39014c3 100644 --- a/packages/zoslogs/package.json +++ b/packages/zoslogs/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-logs-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "description": "Zowe SDK to interact with the z/OS logs", "author": "Zowe", "license": "EPL-2.0", @@ -45,9 +45,9 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0-next", diff --git a/packages/zosmf/package.json b/packages/zosmf/package.json index 4ff6f46fb0..9bfb60253f 100644 --- a/packages/zosmf/package.json +++ b/packages/zosmf/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zosmf-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "description": "Zowe SDK to interact with the z/OS Management Facility", "author": "Zowe", "license": "EPL-2.0", @@ -44,9 +44,9 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0-next", diff --git a/packages/zostso/package.json b/packages/zostso/package.json index 5d4b778e98..1e31fa5d82 100644 --- a/packages/zostso/package.json +++ b/packages/zostso/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-tso-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "description": "Zowe SDK to interact with TSO on z/OS", "author": "Zowe", "license": "EPL-2.0", @@ -45,12 +45,12 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "dependencies": { - "@zowe/zosmf-for-zowe-sdk": "8.0.0-next.202408261543" + "@zowe/zosmf-for-zowe-sdk": "8.0.0-next.202408271330" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0-next", diff --git a/packages/zosuss/package.json b/packages/zosuss/package.json index bfddc27559..1aa904d690 100644 --- a/packages/zosuss/package.json +++ b/packages/zosuss/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-uss-for-zowe-sdk", - "version": "8.0.0-next.202408261543", + "version": "8.0.0-next.202408271330", "description": "Zowe SDK to interact with USS on z/OS", "author": "Zowe", "license": "EPL-2.0", @@ -49,8 +49,8 @@ }, "devDependencies": { "@types/ssh2": "^1.11.19", - "@zowe/cli-test-utils": "8.0.0-next.202408261543", - "@zowe/imperative": "8.0.0-next.202408261543" + "@zowe/cli-test-utils": "8.0.0-next.202408271330", + "@zowe/imperative": "8.0.0-next.202408271330" }, "peerDependencies": { "@zowe/imperative": "^8.0.0-next"