diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index 0a33ff26d3b..5e79d7bed44 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -236,7 +236,7 @@ export function createApiFactory( }; // namespace: env - const env: typeof vscode.env = Object.freeze({ + const env: typeof vscode.env = { get machineId() { return initData.telemetryInfo.machineId; }, get sessionId() { return initData.telemetryInfo.sessionId; }, get language() { return initData.environment.appLanguage; }, @@ -257,7 +257,11 @@ export function createApiFactory( openExternal(uri: URI) { return extHostWindow.openUri(uri, { allowTunneling: !!initData.remoteAuthority }); } - }); + }; + if (!initData.environment.extensionTestsLocationURI) { + // allow to patch env-function when running tests + Object.freeze(env); + } // namespace: extensions const extensions: typeof vscode.extensions = {