Skip to content

Commit

Permalink
Merge pull request #2516 from zowe/port/2.11.2
Browse files Browse the repository at this point in the history
Port 2.11.1 & 2.11.2 updates to main
  • Loading branch information
JillieBeanSim authored Oct 19, 2023
2 parents e22ff96 + 6bf9886 commit 7664664
Show file tree
Hide file tree
Showing 37 changed files with 1,862 additions and 1,744 deletions.
12 changes: 12 additions & 0 deletions packages/eslint-plugin-zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ All notable changes to the "eslint-plugin-zowe-explorer" package will be documen

### Bug fixes

## `2.11.2`

### New features and enhancements

### Bug fixes

## `2.11.1`

### New features and enhancements

### Bug fixes

## `2.11.0`

### New features and enhancements
Expand Down
12 changes: 8 additions & 4 deletions packages/zowe-explorer-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t

### Bug fixes

## `2.11.2`

### Bug fixes

- Bundle Zowe Secrets for issues seen by extenders that use the ProfilesCache for profile management. [#2512](https://github.com/zowe/vscode-extension-for-zowe/issues/2512)

## `2.11.1`

## `2.11.0`

### New features and enhancements
Expand All @@ -35,10 +43,6 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t

## `2.9.2`

### New features and enhancements

### Bug fixes

## `2.9.1`

### New features and enhancements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function createGlobalMocks() {
showWarningMessage: jest.fn(),
createOutputChannel: jest.fn(),
createQuickPick: jest.fn(),
createTreeView: jest.fn(),
createTreeView: jest.fn().mockReturnValue({ onDidCollapseElement: jest.fn() }),
createWebviewPanel: jest.fn(),
withProgress: jest.fn(),
showTextDocument: jest.fn(),
Expand Down
8 changes: 5 additions & 3 deletions packages/zowe-explorer-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"lib"
],
"devDependencies": {
"@types/semver": "^7.5.0"
"@types/semver": "^7.5.0",
"copyfiles": "^2.4.1"
},
"dependencies": {
"@types/vscode": "^1.53.2",
Expand All @@ -23,7 +24,7 @@
"semver": "^7.5.3"
},
"scripts": {
"build": "yarn check-cli && yarn clean && tsc -p ./ && yarn license",
"build": "yarn check-cli && yarn copy-secrets && yarn clean && tsc -p ./ && yarn license",
"test:unit": "jest \".*__tests__.*\\.unit\\.test\\.ts\" --coverage",
"test": "yarn test:unit",
"lint": "concurrently -n \"_eslint_,prettier\" \"eslint .\" \"prettier --check .\"",
Expand All @@ -33,7 +34,8 @@
"clean": "rimraf lib",
"fresh-clone": "yarn clean && rimraf node_modules",
"license": "node ../../scripts/updateLicenses.js",
"package": "yarn build && npm pack && node ../../scripts/mv-pack.js zowe-zowe-explorer-api tgz"
"package": "yarn build && npm pack && node ../../scripts/mv-pack.js zowe-zowe-explorer-api tgz",
"copy-secrets": "copyfiles -f ../../node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/*.node ./prebuilds"
},
"jest": {
"moduleFileExtensions": [
Expand Down
12 changes: 8 additions & 4 deletions packages/zowe-explorer-ftp-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ All notable changes to the "zowe-explorer-ftp-extension" extension will be docum

- Fixed ECONNRESET error when trying to upload or create an empty data set member. [#2350](https://github.com/zowe/vscode-extension-for-zowe/issues/2350)

## `2.11.2`

### Bug fixes

- Update Zowe Explorer API dependency to pick up latest fixes for Zowe Secrets. [#2512](https://github.com/zowe/vscode-extension-for-zowe/issues/2512)

## `2.11.1`

## `2.11.0`

### Bug fixes
Expand All @@ -27,10 +35,6 @@ All notable changes to the "zowe-explorer-ftp-extension" extension will be docum

## `2.9.2`

### New features and enhancements

### Bug fixes

## `2.9.1`

### Bug fixes
Expand Down
16 changes: 16 additions & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- Fixed submitting local JCL using command pallet option `Zowe Explorer: Submit JCL` by adding a check for chosen profile returned to continue the action. [#1625](https://github.com/zowe/vscode-extension-for-zowe/issues/1625)
- Fixed conflict resolution being skipped if local and remote file have different contents but are the same size. [#2496](https://github.com/zowe/vscode-extension-for-zowe/issues/2496)

## `2.11.2`

### Bug fixes

- Update Zowe Explorer API dependency to pick up latest fixes for Zowe Secrets. [#2512](https://github.com/zowe/vscode-extension-for-zowe/issues/2512)

## `2.11.1`

### Bug fixes

- Fixed issue where USS nodes were not removed from tree during deletion. [#2479](https://github.com/zowe/vscode-extension-for-zowe/issues/2479)
- Fixed issue where new USS nodes from a paste operation were not shown in tree until refreshed. [#2479](https://github.com/zowe/vscode-extension-for-zowe/issues/2479)
- Fixed issue where the "Delete Job" action showed a successful deletion message, even if the API returned an error.
- USS directories, PDS nodes, job nodes and session nodes now update with their respective "collapsed icon" when collapsed.
- Fixed bug where the list of datasets from a filter search was not re-sorted after a new data set was created in Zowe Explorer. [#2473](https://github.com/zowe/vscode-extension-for-zowe/issues/2473)

## `2.11.0`

### New features and enhancements
Expand Down
9 changes: 8 additions & 1 deletion packages/zowe-explorer/__mocks__/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,12 @@ export namespace extensions {
};
}
}

export interface TreeViewExpansionEvent<T> {
/**
* Element that is expanded or collapsed.
*/
readonly element: T;
}
export interface TreeView<T> {
/**
* An optional human-readable message that will be rendered in the view.
Expand Down Expand Up @@ -177,6 +182,8 @@ export interface TreeView<T> {
* **NOTE:** The {@link TreeDataProvider} that the `TreeView` {@link window.createTreeView is registered with} with must implement {@link TreeDataProvider.getParent getParent} method to access this API.
*/
reveal(element: T, options?: { select?: boolean; focus?: boolean; expand?: boolean | number }): Thenable<void>;

onDidCollapseElement: Event<TreeViewExpansionEvent<T>>;
}

export class FileDecoration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ async function createGlobalMocks() {
configurable: true,
});
Object.defineProperty(globals, "ISTHEIA", { get: () => false, configurable: true });
Object.defineProperty(vscode.window, "createTreeView", { value: jest.fn(), configurable: true });
Object.defineProperty(vscode.window, "createTreeView", {
value: jest.fn().mockReturnValue({ onDidCollapseElement: jest.fn() }),
configurable: true,
});
Object.defineProperty(vscode.workspace, "getConfiguration", {
value: newMocks.mockGetConfiguration,
configurable: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ describe("ZoweExplorerExtender unit tests", () => {
})
.mockReturnValue(newMocks.profiles),
});
Object.defineProperty(vscode.window, "createTreeView", { value: jest.fn(), configurable: true });
Object.defineProperty(vscode.window, "createTreeView", {
value: jest.fn().mockReturnValue({ onDidCollapseElement: jest.fn() }),
configurable: true,
});
Object.defineProperty(vscode.window, "showErrorMessage", {
value: newMocks.mockErrorMessage,
configurable: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async function createGlobalMocks() {
mockLoadNamedProfile: jest.fn(),
mockDefaultProfile: jest.fn(),
withProgress: jest.fn(),
createTreeView: jest.fn(),
createTreeView: jest.fn().mockReturnValue({ onDidCollapseElement: jest.fn() }),
mockAffects: jest.fn(),
mockEditSession: jest.fn(),
mockCheckCurrentProfile: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { ZoweLogger } from "../../../src/utils/LoggerUtils";

describe("ZoweSaveQueue - unit tests", () => {
const createGlobalMocks = () => {
jest.spyOn(Gui, "createTreeView").mockReturnValue({ onDidCollapseElement: jest.fn() } as any);
const globalMocks = {
errorMessageSpy: jest.spyOn(Gui, "errorMessage"),
markDocumentUnsavedSpy: jest.spyOn(workspaceUtils, "markDocumentUnsaved"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ function createGlobalMocks() {

globalMocks.mockProfileInstance = createInstanceOfProfile(globalMocks.testProfileLoaded);

Object.defineProperty(vscode.window, "createTreeView", { value: jest.fn(), configurable: true });
Object.defineProperty(vscode.window, "createTreeView", {
value: jest.fn().mockReturnValue({ onDidCollapseElement: jest.fn() }),
configurable: true,
});
Object.defineProperty(Gui, "showMessage", { value: jest.fn(), configurable: true });
Object.defineProperty(Gui, "setStatusBarMessage", { value: jest.fn().mockReturnValue({ dispose: jest.fn() }), configurable: true });
Object.defineProperty(vscode.window, "showTextDocument", { value: jest.fn(), configurable: true });
Expand Down Expand Up @@ -2697,6 +2700,8 @@ describe("Dataset Tree Unit Tests - Function initializeFavorites", () => {
});
});
describe("Dataset Tree Unit Tests - Sorting and Filtering operations", () => {
createGlobalMocks();
mocked(vscode.window.createTreeView).mockReturnValueOnce(createTreeView());
const tree = new DatasetTree();
const nodesForSuite = (): Record<string, IZoweDatasetTreeNode> => {
const session = new ZoweDatasetNode("testSession", vscode.TreeItemCollapsibleState.Collapsed, null, createISession());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async function createGlobalMocks() {
mockMoveSync: jest.fn(),
mockGetAllProfileNames: jest.fn(),
mockReveal: jest.fn(),
mockCreateTreeView: jest.fn(),
mockCreateTreeView: jest.fn().mockReturnValue({ onDidCollapseElement: jest.fn() }),
mockExecuteCommand: jest.fn(),
mockRegisterCommand: jest.fn(),
mockOnDidSaveTextDocument: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import * as vscode from "vscode";

describe("Checking icon generator's basics", () => {
const setGlobalMocks = () => {
const createTreeView = jest.fn();
const createTreeView = jest.fn().mockReturnValue({ onDidCollapseElement: jest.fn() });
const getConfiguration = jest.fn();

Object.defineProperty(vscode.window, "createTreeView", { value: createTreeView });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jest.mock("vscode");

describe("Checking message generator's basics", () => {
const setGlobalMocks = () => {
const createTreeView = jest.fn();
const createTreeView = jest.fn().mockReturnValue({ onDidCollapseElement: jest.fn() });
const getConfiguration = jest.fn();

Object.defineProperty(vscode.window, "createTreeView", { value: createTreeView });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async function createGlobalMocks() {
mockGetJob: jest.fn(),
mockRefresh: jest.fn(),
mockAffectsConfig: jest.fn(),
createTreeView: jest.fn(),
createTreeView: jest.fn().mockReturnValue({ onDidCollapseElement: jest.fn() }),
mockGetSpoolFiles: jest.fn(),
mockDeleteJobs: jest.fn(),
mockShowInputBox: jest.fn(),
Expand Down Expand Up @@ -85,7 +85,7 @@ async function createGlobalMocks() {
};
}),
};

jest.spyOn(Gui, "createTreeView").mockImplementation(globalMocks.createTreeView);
Object.defineProperty(ProfilesCache, "getConfigInstance", {
value: jest.fn(() => {
return {
Expand Down Expand Up @@ -173,7 +173,6 @@ async function createGlobalMocks() {
Object.defineProperty(ZoweLogger, "warn", { value: jest.fn(), configurable: true });
Object.defineProperty(ZoweLogger, "info", { value: jest.fn(), configurable: true });
Object.defineProperty(ZoweLogger, "trace", { value: jest.fn(), configurable: true });
globalMocks.createTreeView.mockReturnValue("testTreeView");
globalMocks.testSessionNode = createJobSessionNode(globalMocks.testSession, globalMocks.testProfile);
globalMocks.mockGetJob.mockReturnValue(globalMocks.testIJob);
globalMocks.mockGetJobsByOwnerAndPrefix.mockReturnValue([globalMocks.testIJob, globalMocks.testIJobComplete]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ async function createGlobalMocks() {
mockAffectsConfig: jest.fn(),
createTreeView: jest.fn(() => ({
reveal: jest.fn(),
onDidCollapseElement: jest.fn(),
})),
mockCreateSessCfgFromArgs: jest.fn(),
mockGetSpoolFiles: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { ZosJobsProvider } from "../../../src/job/ZosJobsProvider";
const activeTextEditorDocument = jest.fn();

function createGlobalMocks() {
jest.spyOn(Gui, "createTreeView").mockReturnValue({ onDidCollapseElement: jest.fn() } as any);
Object.defineProperty(vscode.workspace, "getConfiguration", {
value: jest.fn().mockImplementation(() => new Map([["zowe.jobs.confirmSubmission", false]])),
configurable: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ async function createGlobalMocks() {
}),
configurable: true,
});
Object.defineProperty(vscode.window, "createTreeView", { value: jest.fn(), configurable: true });
Object.defineProperty(vscode.window, "createTreeView", {
value: jest.fn().mockReturnValue({ onDidCollapseElement: jest.fn() }),
configurable: true,
});
Object.defineProperty(vscode.workspace, "getConfiguration", { value: jest.fn(), configurable: true });
Object.defineProperty(vscode.window, "showInformationMessage", { value: jest.fn(), configurable: true });
Object.defineProperty(vscode.window, "showInputBox", { value: jest.fn(), configurable: true });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { ZoweLogger } from "../../../src/utils/LoggerUtils";
function createGlobalMocks() {
const globalMocks = {
session: createISessionWithoutCredentials(),
createTreeView: jest.fn(),
createTreeView: jest.fn().mockReturnValue({ onDidCollapseElement: jest.fn() }),
mockLog: jest.fn(),
mockDebug: jest.fn(),
mockError: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async function createGlobalMocks() {
showInputBox: jest.fn(),
filters: jest.fn(),
getFilters: jest.fn(),
createTreeView: jest.fn(),
createTreeView: jest.fn().mockReturnValue({ onDidCollapseElement: jest.fn() }),
createQuickPick: jest.fn(),
getConfiguration: jest.fn(),
ZosmfSession: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ async function createGlobalMocks() {
configurable: true,
});
Object.defineProperty(vscode.window, "showInputBox", { value: globalMocks.showInputBox, configurable: true });
Object.defineProperty(vscode.window, "createTreeView", { value: jest.fn(), configurable: true });
Object.defineProperty(vscode.window, "createTreeView", {
value: jest.fn().mockReturnValue({ onDidCollapseElement: jest.fn() }),
configurable: true,
});
Object.defineProperty(zowe, "ZosmfSession", { value: globalMocks.ZosmfSession, configurable: true });
Object.defineProperty(globalMocks.ZosmfSession, "createSessCfgFromArgs", {
value: globalMocks.createSessCfgFromArgs,
Expand Down
16 changes: 12 additions & 4 deletions packages/zowe-explorer/__tests__/__unit__/uss/actions.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function createGlobalMocks() {
setStatusBarMessage: jest.fn().mockReturnValue({ dispose: jest.fn() }),
showWarningMessage: jest.fn(),
showErrorMessage: jest.fn(),
createTreeView: jest.fn(),
createTreeView: jest.fn().mockReturnValue({ onDidCollapseElement: jest.fn() }),
fileToUSSFile: jest.fn(),
Upload: jest.fn(),
isBinaryFileSync: jest.fn(),
Expand Down Expand Up @@ -891,9 +891,7 @@ describe("USS Action Unit Tests - copy file / directory", () => {
it("tests pasteUssFile executed successfully with selected nodes", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const parent = blockMocks.treeNodes.testUSSTree.getTreeView();
parent.selection = blockMocks.nodes[0];
await ussNodeActions.pasteUssFile(blockMocks.treeNodes.testUSSTree, undefined);
await ussNodeActions.pasteUssFile(blockMocks.treeNodes.testUSSTree, blockMocks.nodes[0]);
expect(sharedUtils.getSelectedNodeList(blockMocks.treeNodes.ussNode, blockMocks.treeNodes.ussNodes)).toEqual([blockMocks.treeNodes.ussNode]);
});
it("tests pasteUssFile executed successfully with one node", async () => {
Expand All @@ -905,6 +903,16 @@ describe("USS Action Unit Tests - copy file / directory", () => {
await ussNodeActions.pasteUssFile(blockMocks.treeNodes.testUSSTree, blockMocks.nodes[0]);
expect(sharedUtils.getSelectedNodeList(blockMocks.treeNodes.ussNode, blockMocks.treeNodes.ussNodes)).toEqual([blockMocks.treeNodes.ussNode]);
});
it("tests pasteUss returns early if APIs are not supported", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const testNode = blockMocks.nodes[0];
testNode.copyUssFile = testNode.pasteUssTree = null;
const infoMessageSpy = jest.spyOn(Gui, "infoMessage");
await ussNodeActions.pasteUss(blockMocks.treeNodes.testUSSTree, testNode);
expect(infoMessageSpy).toHaveBeenCalledWith("The paste operation is not supported for this node.");
infoMessageSpy.mockRestore();
});
});

describe("USS Action Unit Tests - function deleteUSSFilesPrompt", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ describe("SessionUtils removeSession Unit Tests", () => {
newMocks.datasetSessionNode = createDatasetSessionNode(newMocks.session, newMocks.imperativeProfile);
newMocks.testDatasetTree = createDatasetTree(newMocks.datasetSessionNode, newMocks.treeView);
newMocks.testDatasetTree.addFileHistory("[profile1]: TEST.NODE");
Object.defineProperty(vscode.window, "createTreeView", { value: jest.fn(), configurable: true });
Object.defineProperty(vscode.window, "createTreeView", {
value: jest.fn().mockReturnValue({ onDidCollapseElement: jest.fn() }),
configurable: true,
});
Object.defineProperty(vscode, "ConfigurationTarget", { value: jest.fn(), configurable: true });
newMocks.mockGetConfiguration.mockReturnValue(createPersistentConfig());
Object.defineProperty(vscode.workspace, "getConfiguration", {
Expand Down
Loading

0 comments on commit 7664664

Please sign in to comment.