Skip to content

Commit

Permalink
Merge pull request #1010 from zowe/theia-v1.1.0-update-fix
Browse files Browse the repository at this point in the history
Update environment check for Theia compatability
  • Loading branch information
zFernand0 authored Sep 11, 2020
2 parents 027db5e + 99dfe31 commit 9100ee3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions __tests__/__unit__/extension.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ async function createGlobalMocks() {
WorkspaceFolder: 3
};
}),
UIKindEnums: jest.fn().mockImplementation(() => {
return {
Desktop: 1,
Web: 2
};
}),
testSession: new imperative.Session({
user: "fake",
password: "fake",
Expand Down Expand Up @@ -227,6 +233,7 @@ async function createGlobalMocks() {
Object.defineProperty(globalMocks.mockImperativeConfig, "instance", { value: globalMocks.mockIcInstance, configurable: true });
Object.defineProperty(globalMocks.mockIcInstance, "cliHome", { get: globalMocks.mockCliHome });
Object.defineProperty(vscode.env, "appName", { value: globalMocks.appName, configurable: true });
Object.defineProperty(vscode, "UIKind", { value: globalMocks.UIKindEnums, configurable: true });
Object.defineProperty(Profiles, "createInstance", {
value: jest.fn(() => globalMocks.testProfileOps)
});
Expand Down Expand Up @@ -360,6 +367,7 @@ describe("Extension Unit Tests", () => {
const globalMocks = await createGlobalMocks();

Object.defineProperty(vscode.env, "appName", { value: "Eclipse Theia" });
Object.defineProperty(vscode.env, "uiKind", { value: vscode.UIKind.Web });
globalMocks.mockExistsSync.mockReset();
globalMocks.mockReaddirSync.mockReset();
globalMocks.mockExistsSync.mockReturnValueOnce(true);
Expand Down
6 changes: 4 additions & 2 deletions src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const ACTIVE_CONTEXT = CONTEXT_PREFIX + "Active";
export const UNVERIFIED_CONTEXT = CONTEXT_PREFIX + "Unverified";
export const ICON_STATE_OPEN = "open";
export const ICON_STATE_CLOSED = "closed";
export const THEIA = "Eclipse Theia";
export const VSCODE_APPNAME: string[] = ["Visual Studio Code", "VSCodium"];
export const ROOTPATH = path.join(__dirname, "..", "..");

/**
Expand All @@ -71,7 +71,9 @@ export enum PersistenceSchemaEnum {
export function defineGlobals(tempPath: string | undefined) {
// Set app name
const appName: string = vscode.env.appName;
if (appName && appName === this.THEIA) { this.ISTHEIA = true; }
if (appName && !this.VSCODE_APPNAME.includes(appName) && vscode.env.uiKind === vscode.UIKind.Web) {
this.ISTHEIA = true;
}

// Set temp path & folder paths
tempPath !== "" && tempPath !== undefined ?
Expand Down

0 comments on commit 9100ee3

Please sign in to comment.