|
6 | 6 | import { assert } from 'chai'; |
7 | 7 | import * as sinon from 'sinon'; |
8 | 8 | import * as TypeMoq from 'typemoq'; |
9 | | -import { Terminal } from 'vscode'; |
| 9 | +import { Terminal, Uri } from 'vscode'; |
10 | 10 | import { TerminalActivator } from '../../../../client/common/terminal/activator'; |
11 | 11 | import { |
12 | 12 | ITerminalActivationHandler, |
@@ -140,10 +140,13 @@ suite('Terminal Activator', () => { |
140 | 140 | suite('shouldEnvExtHandleActivation', () => { |
141 | 141 | let getExtensionStub: sinon.SinonStub; |
142 | 142 | let getConfigurationStub: sinon.SinonStub; |
| 143 | + let getWorkspaceFoldersStub: sinon.SinonStub; |
143 | 144 |
|
144 | 145 | setup(() => { |
145 | 146 | getExtensionStub = sinon.stub(extensionsApi, 'getExtension'); |
146 | 147 | getConfigurationStub = sinon.stub(workspaceApis, 'getConfiguration'); |
| 148 | + getWorkspaceFoldersStub = sinon.stub(workspaceApis, 'getWorkspaceFolders'); |
| 149 | + getWorkspaceFoldersStub.returns(undefined); |
147 | 150 | }); |
148 | 151 |
|
149 | 152 | teardown(() => { |
@@ -186,4 +189,21 @@ suite('shouldEnvExtHandleActivation', () => { |
186 | 189 | }); |
187 | 190 | assert.strictEqual(extapi.shouldEnvExtHandleActivation(), true); |
188 | 191 | }); |
| 192 | + |
| 193 | + test('Returns false when a workspace folder has workspaceFolderValue set to false', () => { |
| 194 | + getExtensionStub.returns({ id: extapi.ENVS_EXTENSION_ID }); |
| 195 | + const folderUri = Uri.parse('file:///workspace/folder1'); |
| 196 | + getWorkspaceFoldersStub.returns([{ uri: folderUri, name: 'folder1', index: 0 }]); |
| 197 | + getConfigurationStub.callsFake((_section: string, scope?: Uri) => { |
| 198 | + if (scope) { |
| 199 | + return { |
| 200 | + inspect: () => ({ workspaceFolderValue: false }), |
| 201 | + }; |
| 202 | + } |
| 203 | + return { |
| 204 | + inspect: () => ({ globalValue: undefined, workspaceValue: undefined }), |
| 205 | + }; |
| 206 | + }); |
| 207 | + assert.strictEqual(extapi.shouldEnvExtHandleActivation(), false); |
| 208 | + }); |
189 | 209 | }); |
0 commit comments