@theia/api-tests 1.34.2 → 1.34.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/scm.spec.js CHANGED
@@ -1,173 +1,173 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2020 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- // @ts-check
18
- describe('SCM', function () {
19
-
20
- const { assert } = chai;
21
-
22
- const Uri = require('@theia/core/lib/common/uri');
23
- const { ApplicationShell } = require('@theia/core/lib/browser/shell/application-shell');
24
- const { ContextKeyService } = require('@theia/core/lib/browser/context-key-service');
25
- const { ScmContribution } = require('@theia/scm/lib/browser/scm-contribution');
26
- const { ScmService } = require('@theia/scm/lib/browser/scm-service');
27
- const { ScmWidget } = require('@theia/scm/lib/browser/scm-widget');
28
-
29
- /** @type {import('inversify').Container} */
30
- const container = window['theia'].container;
31
- const contextKeyService = container.get(ContextKeyService);
32
- const scmContribution = container.get(ScmContribution);
33
- const shell = container.get(ApplicationShell);
34
- const service = container.get(ScmService);
35
-
36
- /** @type {ScmWidget} */
37
- let scmWidget;
38
-
39
- /** @type {ScmService} */
40
- let scmService;
41
-
42
- beforeEach(async () => {
43
- await shell.leftPanelHandler.collapse();
44
- scmWidget = await scmContribution.openView({ activate: true, reveal: true });
45
- scmService = service;
46
- });
47
-
48
- afterEach(() => {
49
- // @ts-ignore
50
- scmWidget = undefined;
51
- // @ts-ignore
52
- scmService = undefined;
53
- });
54
-
55
- describe('scm-view', () => {
56
-
57
- it('the view should open and activate successfully', () => {
58
- assert.notEqual(scmWidget, undefined);
59
- assert.strictEqual(scmWidget, shell.activeWidget);
60
- });
61
-
62
- describe('\'ScmTreeWidget\'', () => {
63
-
64
- it('the view should display the resource tree when a repository is present', () => {
65
- assert.isTrue(scmWidget.resourceWidget.isVisible);
66
- });
67
-
68
- it('the view should not display the resource tree when no repository is present', () => {
69
-
70
- // Store the current selected repository so it can be restored.
71
- const cachedSelectedRepository = scmService.selectedRepository;
72
-
73
- scmService.selectedRepository = undefined;
74
- assert.isFalse(scmWidget.resourceWidget.isVisible);
75
-
76
- // Restore the selected repository.
77
- scmService.selectedRepository = cachedSelectedRepository;
78
- });
79
-
80
- });
81
-
82
- describe('\'ScmNoRepositoryWidget\'', () => {
83
-
84
- it('should not be visible when a repository is present', () => {
85
- assert.isFalse(scmWidget.noRepositoryWidget.isVisible);
86
- });
87
-
88
- it('should be visible when no repository is present', () => {
89
-
90
- // Store the current selected repository so it can be restored.
91
- const cachedSelectedRepository = scmService.selectedRepository;
92
-
93
- scmService.selectedRepository = undefined;
94
- assert.isTrue(scmWidget.noRepositoryWidget.isVisible);
95
-
96
- // Restore the selected repository.
97
- scmService.selectedRepository = cachedSelectedRepository;
98
- });
99
-
100
- });
101
- });
102
-
103
- describe('scm-service', () => {
104
-
105
- it('should successfully return the list of repositories', () => {
106
- const repositories = scmService.repositories;
107
- assert.isTrue(repositories.length > 0);
108
- });
109
-
110
- it('should include the selected repository in the list of repositories', () => {
111
- const repositories = scmService.repositories;
112
- const selectedRepository = scmService.selectedRepository;
113
- assert.isTrue(repositories.length === 1);
114
- assert.strictEqual(repositories[0], selectedRepository);
115
- });
116
-
117
- it('should successfully return the selected repository', () => {
118
- assert.notEqual(scmService.selectedRepository, undefined);
119
- });
120
-
121
- it('should successfully find the repository', () => {
122
- const selectedRepository = scmService.selectedRepository;
123
- if (selectedRepository) {
124
- const rootUri = selectedRepository.provider.rootUri;
125
- const foundRepository = scmService.findRepository(new Uri.default(rootUri));
126
- assert.notEqual(foundRepository, undefined);
127
- }
128
- });
129
-
130
- it('should not find a repository for an unknown uri', () => {
131
- const mockUri = new Uri.default('foobar/foo/bar');
132
- const repo = scmService.findRepository(mockUri);
133
- assert.strictEqual(repo, undefined);
134
- });
135
-
136
- it('should successfully return the list of statusbar commands', () => {
137
- assert.isTrue(scmService.statusBarCommands.length > 0);
138
- });
139
-
140
- });
141
-
142
- describe('scm-provider', () => {
143
-
144
- it('should successfully return the last commit', async () => {
145
- const selectedRepository = scmService.selectedRepository;
146
- if (selectedRepository) {
147
- const amendSupport = selectedRepository.provider.amendSupport;
148
- if (amendSupport) {
149
- const commit = await amendSupport.getLastCommit();
150
- assert.notEqual(commit, undefined);
151
- }
152
- }
153
- });
154
-
155
- });
156
-
157
- describe('scm-contribution', () => {
158
-
159
- describe('scmFocus context-key', () => {
160
-
161
- it('should return \'true\' when the view is focused', () => {
162
- assert.isTrue(contextKeyService.match('scmFocus'));
163
- });
164
-
165
- it('should return \'false\' when the view is not focused', async () => {
166
- await scmContribution.closeView();
167
- assert.isFalse(contextKeyService.match('scmFocus'));
168
- });
169
-
170
- });
171
- });
172
-
173
- });
1
+ // *****************************************************************************
2
+ // Copyright (C) 2020 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ // @ts-check
18
+ describe('SCM', function () {
19
+
20
+ const { assert } = chai;
21
+
22
+ const Uri = require('@theia/core/lib/common/uri');
23
+ const { ApplicationShell } = require('@theia/core/lib/browser/shell/application-shell');
24
+ const { ContextKeyService } = require('@theia/core/lib/browser/context-key-service');
25
+ const { ScmContribution } = require('@theia/scm/lib/browser/scm-contribution');
26
+ const { ScmService } = require('@theia/scm/lib/browser/scm-service');
27
+ const { ScmWidget } = require('@theia/scm/lib/browser/scm-widget');
28
+
29
+ /** @type {import('inversify').Container} */
30
+ const container = window['theia'].container;
31
+ const contextKeyService = container.get(ContextKeyService);
32
+ const scmContribution = container.get(ScmContribution);
33
+ const shell = container.get(ApplicationShell);
34
+ const service = container.get(ScmService);
35
+
36
+ /** @type {ScmWidget} */
37
+ let scmWidget;
38
+
39
+ /** @type {ScmService} */
40
+ let scmService;
41
+
42
+ beforeEach(async () => {
43
+ await shell.leftPanelHandler.collapse();
44
+ scmWidget = await scmContribution.openView({ activate: true, reveal: true });
45
+ scmService = service;
46
+ });
47
+
48
+ afterEach(() => {
49
+ // @ts-ignore
50
+ scmWidget = undefined;
51
+ // @ts-ignore
52
+ scmService = undefined;
53
+ });
54
+
55
+ describe('scm-view', () => {
56
+
57
+ it('the view should open and activate successfully', () => {
58
+ assert.notEqual(scmWidget, undefined);
59
+ assert.strictEqual(scmWidget, shell.activeWidget);
60
+ });
61
+
62
+ describe('\'ScmTreeWidget\'', () => {
63
+
64
+ it('the view should display the resource tree when a repository is present', () => {
65
+ assert.isTrue(scmWidget.resourceWidget.isVisible);
66
+ });
67
+
68
+ it('the view should not display the resource tree when no repository is present', () => {
69
+
70
+ // Store the current selected repository so it can be restored.
71
+ const cachedSelectedRepository = scmService.selectedRepository;
72
+
73
+ scmService.selectedRepository = undefined;
74
+ assert.isFalse(scmWidget.resourceWidget.isVisible);
75
+
76
+ // Restore the selected repository.
77
+ scmService.selectedRepository = cachedSelectedRepository;
78
+ });
79
+
80
+ });
81
+
82
+ describe('\'ScmNoRepositoryWidget\'', () => {
83
+
84
+ it('should not be visible when a repository is present', () => {
85
+ assert.isFalse(scmWidget.noRepositoryWidget.isVisible);
86
+ });
87
+
88
+ it('should be visible when no repository is present', () => {
89
+
90
+ // Store the current selected repository so it can be restored.
91
+ const cachedSelectedRepository = scmService.selectedRepository;
92
+
93
+ scmService.selectedRepository = undefined;
94
+ assert.isTrue(scmWidget.noRepositoryWidget.isVisible);
95
+
96
+ // Restore the selected repository.
97
+ scmService.selectedRepository = cachedSelectedRepository;
98
+ });
99
+
100
+ });
101
+ });
102
+
103
+ describe('scm-service', () => {
104
+
105
+ it('should successfully return the list of repositories', () => {
106
+ const repositories = scmService.repositories;
107
+ assert.isTrue(repositories.length > 0);
108
+ });
109
+
110
+ it('should include the selected repository in the list of repositories', () => {
111
+ const repositories = scmService.repositories;
112
+ const selectedRepository = scmService.selectedRepository;
113
+ assert.isTrue(repositories.length === 1);
114
+ assert.strictEqual(repositories[0], selectedRepository);
115
+ });
116
+
117
+ it('should successfully return the selected repository', () => {
118
+ assert.notEqual(scmService.selectedRepository, undefined);
119
+ });
120
+
121
+ it('should successfully find the repository', () => {
122
+ const selectedRepository = scmService.selectedRepository;
123
+ if (selectedRepository) {
124
+ const rootUri = selectedRepository.provider.rootUri;
125
+ const foundRepository = scmService.findRepository(new Uri.default(rootUri));
126
+ assert.notEqual(foundRepository, undefined);
127
+ }
128
+ });
129
+
130
+ it('should not find a repository for an unknown uri', () => {
131
+ const mockUri = new Uri.default('foobar/foo/bar');
132
+ const repo = scmService.findRepository(mockUri);
133
+ assert.strictEqual(repo, undefined);
134
+ });
135
+
136
+ it('should successfully return the list of statusbar commands', () => {
137
+ assert.isTrue(scmService.statusBarCommands.length > 0);
138
+ });
139
+
140
+ });
141
+
142
+ describe('scm-provider', () => {
143
+
144
+ it('should successfully return the last commit', async () => {
145
+ const selectedRepository = scmService.selectedRepository;
146
+ if (selectedRepository) {
147
+ const amendSupport = selectedRepository.provider.amendSupport;
148
+ if (amendSupport) {
149
+ const commit = await amendSupport.getLastCommit();
150
+ assert.notEqual(commit, undefined);
151
+ }
152
+ }
153
+ });
154
+
155
+ });
156
+
157
+ describe('scm-contribution', () => {
158
+
159
+ describe('scmFocus context-key', () => {
160
+
161
+ it('should return \'true\' when the view is focused', () => {
162
+ assert.isTrue(contextKeyService.match('scmFocus'));
163
+ });
164
+
165
+ it('should return \'false\' when the view is not focused', async () => {
166
+ await scmContribution.closeView();
167
+ assert.isFalse(contextKeyService.match('scmFocus'));
168
+ });
169
+
170
+ });
171
+ });
172
+
173
+ });
package/src/shell.spec.js CHANGED
@@ -1,41 +1,41 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2017 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- // @ts-check
18
- describe('Shell', function () {
19
-
20
- const { assert } = chai;
21
-
22
- const { ApplicationShell } = require('@theia/core/lib/browser/shell/application-shell');
23
- const { StatusBarImpl } = require('@theia/core/lib/browser/status-bar');
24
-
25
- const container = window.theia.container;
26
- const shell = container.get(ApplicationShell);
27
- const statusBar = container.get(StatusBarImpl);
28
-
29
- it('should be shown', () => {
30
- assert.isTrue(shell.isAttached && shell.isVisible);
31
- });
32
-
33
- it('should show the main content panel', () => {
34
- assert.isTrue(shell.mainPanel.isAttached && shell.mainPanel.isVisible);
35
- });
36
-
37
- it('should show the status bar', () => {
38
- assert.isTrue(statusBar.isAttached && statusBar.isVisible);
39
- });
40
-
41
- });
1
+ // *****************************************************************************
2
+ // Copyright (C) 2017 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ // @ts-check
18
+ describe('Shell', function () {
19
+
20
+ const { assert } = chai;
21
+
22
+ const { ApplicationShell } = require('@theia/core/lib/browser/shell/application-shell');
23
+ const { StatusBarImpl } = require('@theia/core/lib/browser/status-bar');
24
+
25
+ const container = window.theia.container;
26
+ const shell = container.get(ApplicationShell);
27
+ const statusBar = container.get(StatusBarImpl);
28
+
29
+ it('should be shown', () => {
30
+ assert.isTrue(shell.isAttached && shell.isVisible);
31
+ });
32
+
33
+ it('should show the main content panel', () => {
34
+ assert.isTrue(shell.mainPanel.isAttached && shell.mainPanel.isVisible);
35
+ });
36
+
37
+ it('should show the status bar', () => {
38
+ assert.isTrue(statusBar.isAttached && statusBar.isVisible);
39
+ });
40
+
41
+ });
@@ -1,112 +1,112 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2021 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- // @ts-check
18
-
19
- describe('The Task Configuration Manager', function () {
20
- this.timeout(5000);
21
-
22
- const { assert } = chai;
23
-
24
- const { WorkspaceService } = require('@theia/workspace/lib/browser/workspace-service');
25
- const { TaskScope, TaskConfigurationScope } = require('@theia/task/lib/common/task-protocol');
26
- const { TaskConfigurationManager } = require('@theia/task/lib/browser/task-configuration-manager');
27
- const container = window.theia.container;
28
- const workspaceService = container.get(WorkspaceService);
29
- const taskConfigurationManager = container.get(TaskConfigurationManager);
30
-
31
- const baseWorkspaceURI = workspaceService.tryGetRoots()[0].resource;
32
- const baseWorkspaceRoot = baseWorkspaceURI.toString();
33
-
34
- const basicTaskConfig = {
35
- label: 'task',
36
- type: 'shell',
37
- command: 'top',
38
- };
39
-
40
- /** @type {Set<TaskConfigurationScope>} */
41
- const scopesToClear = new Set();
42
-
43
- describe('in a single-root workspace', () => {
44
- beforeEach(() => clearTasks());
45
- after(() => clearTasks());
46
-
47
- setAndRetrieveTasks(() => TaskScope.Global, 'user');
48
- setAndRetrieveTasks(() => TaskScope.Workspace, 'workspace');
49
- setAndRetrieveTasks(() => baseWorkspaceRoot, 'folder');
50
- });
51
-
52
- async function clearTasks() {
53
- await Promise.all(Array.from(scopesToClear, async scope => {
54
- if (!!scope || scope === 0) {
55
- await taskConfigurationManager.setTaskConfigurations(scope, []);
56
- }
57
- }));
58
- scopesToClear.clear();
59
- }
60
-
61
- /**
62
- * @param {() => TaskConfigurationScope} scopeGenerator a function to allow lazy evaluation of the second workspace root.
63
- * @param {string} scopeLabel
64
- * @param {boolean} only
65
- */
66
- function setAndRetrieveTasks(scopeGenerator, scopeLabel, only = false) {
67
- const testFunction = only ? it.only : it;
68
- testFunction(`successfully handles ${scopeLabel} scope`, async () => {
69
- const scope = scopeGenerator();
70
- scopesToClear.add(scope);
71
- const initialTasks = taskConfigurationManager.getTasks(scope);
72
- assert.deepEqual(initialTasks, []);
73
- await taskConfigurationManager.setTaskConfigurations(scope, [basicTaskConfig]);
74
- const newTasks = taskConfigurationManager.getTasks(scope);
75
- assert.deepEqual(newTasks, [basicTaskConfig]);
76
- });
77
- }
78
-
79
- /* UNCOMMENT TO RUN MULTI-ROOT TESTS */
80
- // const { FileService } = require('@theia/filesystem/lib/browser/file-service');
81
- // const { EnvVariablesServer } = require('@theia/core/lib/common/env-variables');
82
- // const URI = require('@theia/core/lib/common/uri').default;
83
-
84
- // const fileService = container.get(FileService);
85
- // /** @type {EnvVariablesServer} */
86
- // const envVariables = container.get(EnvVariablesServer);
87
-
88
- // describe('in a multi-root workspace', () => {
89
- // let secondWorkspaceRoot = '';
90
- // before(async () => {
91
- // const configLocation = await envVariables.getConfigDirUri();
92
- // const secondWorkspaceRootURI = new URI(configLocation).parent.resolve(`test-root-${Date.now()}`);
93
- // secondWorkspaceRoot = secondWorkspaceRootURI.toString();
94
- // await fileService.createFolder(secondWorkspaceRootURI);
95
- // /** @type {Promise<void>} */
96
- // const waitForEvent = new Promise(resolve => {
97
- // const listener = taskConfigurationManager.onDidChangeTaskConfig(() => {
98
- // listener.dispose();
99
- // resolve();
100
- // });
101
- // });
102
- // workspaceService.addRoot(secondWorkspaceRootURI);
103
- // return waitForEvent;
104
- // });
105
- // beforeEach(() => clearTasks());
106
- // after(() => clearTasks());
107
- // setAndRetrieveTasks(() => TaskScope.Global, 'user');
108
- // setAndRetrieveTasks(() => TaskScope.Workspace, 'workspace');
109
- // setAndRetrieveTasks(() => baseWorkspaceRoot, 'folder (1)');
110
- // setAndRetrieveTasks(() => secondWorkspaceRoot, 'folder (2)');
111
- // });
112
- });
1
+ // *****************************************************************************
2
+ // Copyright (C) 2021 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ // @ts-check
18
+
19
+ describe('The Task Configuration Manager', function () {
20
+ this.timeout(5000);
21
+
22
+ const { assert } = chai;
23
+
24
+ const { WorkspaceService } = require('@theia/workspace/lib/browser/workspace-service');
25
+ const { TaskScope, TaskConfigurationScope } = require('@theia/task/lib/common/task-protocol');
26
+ const { TaskConfigurationManager } = require('@theia/task/lib/browser/task-configuration-manager');
27
+ const container = window.theia.container;
28
+ const workspaceService = container.get(WorkspaceService);
29
+ const taskConfigurationManager = container.get(TaskConfigurationManager);
30
+
31
+ const baseWorkspaceURI = workspaceService.tryGetRoots()[0].resource;
32
+ const baseWorkspaceRoot = baseWorkspaceURI.toString();
33
+
34
+ const basicTaskConfig = {
35
+ label: 'task',
36
+ type: 'shell',
37
+ command: 'top',
38
+ };
39
+
40
+ /** @type {Set<TaskConfigurationScope>} */
41
+ const scopesToClear = new Set();
42
+
43
+ describe('in a single-root workspace', () => {
44
+ beforeEach(() => clearTasks());
45
+ after(() => clearTasks());
46
+
47
+ setAndRetrieveTasks(() => TaskScope.Global, 'user');
48
+ setAndRetrieveTasks(() => TaskScope.Workspace, 'workspace');
49
+ setAndRetrieveTasks(() => baseWorkspaceRoot, 'folder');
50
+ });
51
+
52
+ async function clearTasks() {
53
+ await Promise.all(Array.from(scopesToClear, async scope => {
54
+ if (!!scope || scope === 0) {
55
+ await taskConfigurationManager.setTaskConfigurations(scope, []);
56
+ }
57
+ }));
58
+ scopesToClear.clear();
59
+ }
60
+
61
+ /**
62
+ * @param {() => TaskConfigurationScope} scopeGenerator a function to allow lazy evaluation of the second workspace root.
63
+ * @param {string} scopeLabel
64
+ * @param {boolean} only
65
+ */
66
+ function setAndRetrieveTasks(scopeGenerator, scopeLabel, only = false) {
67
+ const testFunction = only ? it.only : it;
68
+ testFunction(`successfully handles ${scopeLabel} scope`, async () => {
69
+ const scope = scopeGenerator();
70
+ scopesToClear.add(scope);
71
+ const initialTasks = taskConfigurationManager.getTasks(scope);
72
+ assert.deepEqual(initialTasks, []);
73
+ await taskConfigurationManager.setTaskConfigurations(scope, [basicTaskConfig]);
74
+ const newTasks = taskConfigurationManager.getTasks(scope);
75
+ assert.deepEqual(newTasks, [basicTaskConfig]);
76
+ });
77
+ }
78
+
79
+ /* UNCOMMENT TO RUN MULTI-ROOT TESTS */
80
+ // const { FileService } = require('@theia/filesystem/lib/browser/file-service');
81
+ // const { EnvVariablesServer } = require('@theia/core/lib/common/env-variables');
82
+ // const URI = require('@theia/core/lib/common/uri').default;
83
+
84
+ // const fileService = container.get(FileService);
85
+ // /** @type {EnvVariablesServer} */
86
+ // const envVariables = container.get(EnvVariablesServer);
87
+
88
+ // describe('in a multi-root workspace', () => {
89
+ // let secondWorkspaceRoot = '';
90
+ // before(async () => {
91
+ // const configLocation = await envVariables.getConfigDirUri();
92
+ // const secondWorkspaceRootURI = new URI(configLocation).parent.resolve(`test-root-${Date.now()}`);
93
+ // secondWorkspaceRoot = secondWorkspaceRootURI.toString();
94
+ // await fileService.createFolder(secondWorkspaceRootURI);
95
+ // /** @type {Promise<void>} */
96
+ // const waitForEvent = new Promise(resolve => {
97
+ // const listener = taskConfigurationManager.onDidChangeTaskConfig(() => {
98
+ // listener.dispose();
99
+ // resolve();
100
+ // });
101
+ // });
102
+ // workspaceService.addRoot(secondWorkspaceRootURI);
103
+ // return waitForEvent;
104
+ // });
105
+ // beforeEach(() => clearTasks());
106
+ // after(() => clearTasks());
107
+ // setAndRetrieveTasks(() => TaskScope.Global, 'user');
108
+ // setAndRetrieveTasks(() => TaskScope.Workspace, 'workspace');
109
+ // setAndRetrieveTasks(() => baseWorkspaceRoot, 'folder (1)');
110
+ // setAndRetrieveTasks(() => secondWorkspaceRoot, 'folder (2)');
111
+ // });
112
+ });