@theia/task 1.67.0-next.56 → 1.67.0-next.59

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.
Files changed (229) hide show
  1. package/lib/browser/index.d.ts +7 -0
  2. package/lib/browser/index.d.ts.map +1 -0
  3. package/lib/browser/index.js +25 -0
  4. package/lib/browser/index.js.map +1 -0
  5. package/lib/browser/process/process-task-contribution.d.ts +7 -0
  6. package/lib/browser/process/process-task-contribution.d.ts.map +1 -0
  7. package/lib/browser/process/process-task-contribution.js +36 -0
  8. package/lib/browser/process/process-task-contribution.js.map +1 -0
  9. package/lib/browser/process/process-task-frontend-module.d.ts +3 -0
  10. package/lib/browser/process/process-task-frontend-module.d.ts.map +1 -0
  11. package/lib/browser/process/process-task-frontend-module.js +28 -0
  12. package/lib/browser/process/process-task-frontend-module.js.map +1 -0
  13. package/lib/browser/process/process-task-resolver.d.ts +18 -0
  14. package/lib/browser/process/process-task-resolver.d.ts.map +1 -0
  15. package/lib/browser/process/process-task-resolver.js +94 -0
  16. package/lib/browser/process/process-task-resolver.js.map +1 -0
  17. package/lib/browser/provided-task-configurations.d.ts +44 -0
  18. package/lib/browser/provided-task-configurations.d.ts.map +1 -0
  19. package/lib/browser/provided-task-configurations.js +206 -0
  20. package/lib/browser/provided-task-configurations.js.map +1 -0
  21. package/lib/browser/provided-task-configurations.spec.d.ts +2 -0
  22. package/lib/browser/provided-task-configurations.spec.d.ts.map +1 -0
  23. package/lib/browser/provided-task-configurations.spec.js +44 -0
  24. package/lib/browser/provided-task-configurations.spec.js.map +1 -0
  25. package/lib/browser/quick-open-task.d.ts +146 -0
  26. package/lib/browser/quick-open-task.d.ts.map +1 -0
  27. package/lib/browser/quick-open-task.js +757 -0
  28. package/lib/browser/quick-open-task.js.map +1 -0
  29. package/lib/browser/task-configuration-manager.d.ts +63 -0
  30. package/lib/browser/task-configuration-manager.d.ts.map +1 -0
  31. package/lib/browser/task-configuration-manager.js +243 -0
  32. package/lib/browser/task-configuration-manager.js.map +1 -0
  33. package/lib/browser/task-configuration-model.d.ts +34 -0
  34. package/lib/browser/task-configuration-model.d.ts.map +1 -0
  35. package/lib/browser/task-configuration-model.js +83 -0
  36. package/lib/browser/task-configuration-model.js.map +1 -0
  37. package/lib/browser/task-configurations.d.ts +128 -0
  38. package/lib/browser/task-configurations.d.ts.map +1 -0
  39. package/lib/browser/task-configurations.js +479 -0
  40. package/lib/browser/task-configurations.js.map +1 -0
  41. package/lib/browser/task-context-key-service.d.ts +18 -0
  42. package/lib/browser/task-context-key-service.d.ts.map +1 -0
  43. package/lib/browser/task-context-key-service.js +72 -0
  44. package/lib/browser/task-context-key-service.js.map +1 -0
  45. package/lib/browser/task-contribution.d.ts +183 -0
  46. package/lib/browser/task-contribution.d.ts.map +1 -0
  47. package/lib/browser/task-contribution.js +199 -0
  48. package/lib/browser/task-contribution.js.map +1 -0
  49. package/lib/browser/task-definition-registry.d.ts +39 -0
  50. package/lib/browser/task-definition-registry.d.ts.map +1 -0
  51. package/lib/browser/task-definition-registry.js +130 -0
  52. package/lib/browser/task-definition-registry.js.map +1 -0
  53. package/lib/browser/task-definition-registry.spec.d.ts +2 -0
  54. package/lib/browser/task-definition-registry.spec.d.ts.map +1 -0
  55. package/lib/browser/task-definition-registry.spec.js +171 -0
  56. package/lib/browser/task-definition-registry.spec.js.map +1 -0
  57. package/lib/browser/task-frontend-contribution.d.ts +57 -0
  58. package/lib/browser/task-frontend-contribution.d.ts.map +1 -0
  59. package/lib/browser/task-frontend-contribution.js +351 -0
  60. package/lib/browser/task-frontend-contribution.js.map +1 -0
  61. package/lib/browser/task-frontend-module.d.ts +6 -0
  62. package/lib/browser/task-frontend-module.d.ts.map +1 -0
  63. package/lib/browser/task-frontend-module.js +82 -0
  64. package/lib/browser/task-frontend-module.js.map +1 -0
  65. package/lib/browser/task-name-resolver.d.ts +14 -0
  66. package/lib/browser/task-name-resolver.d.ts.map +1 -0
  67. package/lib/browser/task-name-resolver.js +60 -0
  68. package/lib/browser/task-name-resolver.js.map +1 -0
  69. package/lib/browser/task-node.d.ts +10 -0
  70. package/lib/browser/task-node.d.ts.map +1 -0
  71. package/lib/browser/task-node.js +18 -0
  72. package/lib/browser/task-node.js.map +1 -0
  73. package/lib/browser/task-problem-matcher-registry.d.ts +41 -0
  74. package/lib/browser/task-problem-matcher-registry.d.ts.map +1 -0
  75. package/lib/browser/task-problem-matcher-registry.js +302 -0
  76. package/lib/browser/task-problem-matcher-registry.js.map +1 -0
  77. package/lib/browser/task-problem-pattern-registry.d.ts +24 -0
  78. package/lib/browser/task-problem-pattern-registry.d.ts.map +1 -0
  79. package/lib/browser/task-problem-pattern-registry.js +203 -0
  80. package/lib/browser/task-problem-pattern-registry.js.map +1 -0
  81. package/lib/browser/task-schema-updater.d.ts +58 -0
  82. package/lib/browser/task-schema-updater.d.ts.map +1 -0
  83. package/lib/browser/task-schema-updater.js +676 -0
  84. package/lib/browser/task-schema-updater.js.map +1 -0
  85. package/lib/browser/task-service.d.ts +282 -0
  86. package/lib/browser/task-service.d.ts.map +1 -0
  87. package/lib/browser/task-service.js +1116 -0
  88. package/lib/browser/task-service.js.map +1 -0
  89. package/lib/browser/task-source-resolver.d.ts +10 -0
  90. package/lib/browser/task-source-resolver.d.ts.map +1 -0
  91. package/lib/browser/task-source-resolver.js +44 -0
  92. package/lib/browser/task-source-resolver.js.map +1 -0
  93. package/lib/browser/task-templates.d.ts +14 -0
  94. package/lib/browser/task-templates.d.ts.map +1 -0
  95. package/lib/browser/task-templates.js +158 -0
  96. package/lib/browser/task-templates.js.map +1 -0
  97. package/lib/browser/task-terminal-widget-manager.d.ts +45 -0
  98. package/lib/browser/task-terminal-widget-manager.d.ts.map +1 -0
  99. package/lib/browser/task-terminal-widget-manager.js +222 -0
  100. package/lib/browser/task-terminal-widget-manager.js.map +1 -0
  101. package/lib/browser/tasks-monaco-contribution.d.ts +2 -0
  102. package/lib/browser/tasks-monaco-contribution.d.ts.map +1 -0
  103. package/lib/browser/tasks-monaco-contribution.js +28 -0
  104. package/lib/browser/tasks-monaco-contribution.js.map +1 -0
  105. package/lib/common/index.d.ts +5 -0
  106. package/lib/common/index.d.ts.map +1 -0
  107. package/lib/common/index.js +23 -0
  108. package/lib/common/index.js.map +1 -0
  109. package/lib/common/problem-matcher-protocol.d.ts +125 -0
  110. package/lib/common/problem-matcher-protocol.d.ts.map +1 -0
  111. package/lib/common/problem-matcher-protocol.js +133 -0
  112. package/lib/common/problem-matcher-protocol.js.map +1 -0
  113. package/lib/common/process/task-protocol.d.ts +69 -0
  114. package/lib/common/process/task-protocol.d.ts.map +1 -0
  115. package/lib/common/process/task-protocol.js +34 -0
  116. package/lib/common/process/task-protocol.js.map +1 -0
  117. package/lib/common/task-common-module.d.ts +8 -0
  118. package/lib/common/task-common-module.d.ts.map +1 -0
  119. package/lib/common/task-common-module.js +29 -0
  120. package/lib/common/task-common-module.js.map +1 -0
  121. package/lib/common/task-preferences.d.ts +6 -0
  122. package/lib/common/task-preferences.d.ts.map +1 -0
  123. package/lib/common/task-preferences.js +41 -0
  124. package/lib/common/task-preferences.js.map +1 -0
  125. package/lib/common/task-protocol.d.ts +194 -0
  126. package/lib/common/task-protocol.d.ts.map +1 -0
  127. package/lib/common/task-protocol.js +138 -0
  128. package/lib/common/task-protocol.js.map +1 -0
  129. package/lib/common/task-util.d.ts +23 -0
  130. package/lib/common/task-util.d.ts.map +1 -0
  131. package/lib/common/task-util.js +47 -0
  132. package/lib/common/task-util.js.map +1 -0
  133. package/lib/common/task-watcher.d.ts +18 -0
  134. package/lib/common/task-watcher.d.ts.map +1 -0
  135. package/lib/common/task-watcher.js +82 -0
  136. package/lib/common/task-watcher.js.map +1 -0
  137. package/lib/node/custom/custom-task-runner-backend-module.d.ts +3 -0
  138. package/lib/node/custom/custom-task-runner-backend-module.d.ts.map +1 -0
  139. package/lib/node/custom/custom-task-runner-backend-module.js +37 -0
  140. package/lib/node/custom/custom-task-runner-backend-module.js.map +1 -0
  141. package/lib/node/custom/custom-task-runner-contribution.d.ts +7 -0
  142. package/lib/node/custom/custom-task-runner-contribution.d.ts.map +1 -0
  143. package/lib/node/custom/custom-task-runner-contribution.js +35 -0
  144. package/lib/node/custom/custom-task-runner-contribution.js.map +1 -0
  145. package/lib/node/custom/custom-task-runner.d.ts +16 -0
  146. package/lib/node/custom/custom-task-runner.d.ts.map +1 -0
  147. package/lib/node/custom/custom-task-runner.js +62 -0
  148. package/lib/node/custom/custom-task-runner.js.map +1 -0
  149. package/lib/node/custom/custom-task.d.ts +21 -0
  150. package/lib/node/custom/custom-task.d.ts.map +1 -0
  151. package/lib/node/custom/custom-task.js +68 -0
  152. package/lib/node/custom/custom-task.js.map +1 -0
  153. package/lib/node/index.d.ts +4 -0
  154. package/lib/node/index.d.ts.map +1 -0
  155. package/lib/node/index.js +22 -0
  156. package/lib/node/index.js.map +1 -0
  157. package/lib/node/process/process-task-runner-backend-module.d.ts +3 -0
  158. package/lib/node/process/process-task-runner-backend-module.d.ts.map +1 -0
  159. package/lib/node/process/process-task-runner-backend-module.js +37 -0
  160. package/lib/node/process/process-task-runner-backend-module.js.map +1 -0
  161. package/lib/node/process/process-task-runner-contribution.d.ts +7 -0
  162. package/lib/node/process/process-task-runner-contribution.d.ts.map +1 -0
  163. package/lib/node/process/process-task-runner-contribution.js +36 -0
  164. package/lib/node/process/process-task-runner-contribution.js.map +1 -0
  165. package/lib/node/process/process-task-runner.d.ts +61 -0
  166. package/lib/node/process/process-task-runner.d.ts.map +1 -0
  167. package/lib/node/process/process-task-runner.js +348 -0
  168. package/lib/node/process/process-task-runner.js.map +1 -0
  169. package/lib/node/process/process-task.d.ts +27 -0
  170. package/lib/node/process/process-task.d.ts.map +1 -0
  171. package/lib/node/process/process-task.js +125 -0
  172. package/lib/node/process/process-task.js.map +1 -0
  173. package/lib/node/process/process-task.spec.d.ts +2 -0
  174. package/lib/node/process/process-task.spec.d.ts.map +1 -0
  175. package/lib/node/process/process-task.spec.js +30 -0
  176. package/lib/node/process/process-task.spec.js.map +1 -0
  177. package/lib/node/task-abstract-line-matcher.d.ts +50 -0
  178. package/lib/node/task-abstract-line-matcher.d.ts.map +1 -0
  179. package/lib/node/task-abstract-line-matcher.js +274 -0
  180. package/lib/node/task-abstract-line-matcher.js.map +1 -0
  181. package/lib/node/task-backend-application-contribution.d.ts +9 -0
  182. package/lib/node/task-backend-application-contribution.d.ts.map +1 -0
  183. package/lib/node/task-backend-application-contribution.js +41 -0
  184. package/lib/node/task-backend-application-contribution.js.map +1 -0
  185. package/lib/node/task-backend-module.d.ts +4 -0
  186. package/lib/node/task-backend-module.d.ts.map +1 -0
  187. package/lib/node/task-backend-module.js +53 -0
  188. package/lib/node/task-backend-module.js.map +1 -0
  189. package/lib/node/task-line-matchers.d.ts +28 -0
  190. package/lib/node/task-line-matchers.d.ts.map +1 -0
  191. package/lib/node/task-line-matchers.js +122 -0
  192. package/lib/node/task-line-matchers.js.map +1 -0
  193. package/lib/node/task-manager.d.ts +56 -0
  194. package/lib/node/task-manager.d.ts.map +1 -0
  195. package/lib/node/task-manager.js +125 -0
  196. package/lib/node/task-manager.js.map +1 -0
  197. package/lib/node/task-problem-collector.d.ts +11 -0
  198. package/lib/node/task-problem-collector.d.ts.map +1 -0
  199. package/lib/node/task-problem-collector.js +58 -0
  200. package/lib/node/task-problem-collector.js.map +1 -0
  201. package/lib/node/task-problem-collector.spec.d.ts +2 -0
  202. package/lib/node/task-problem-collector.spec.d.ts.map +1 -0
  203. package/lib/node/task-problem-collector.spec.js +311 -0
  204. package/lib/node/task-problem-collector.spec.js.map +1 -0
  205. package/lib/node/task-runner-protocol.d.ts +17 -0
  206. package/lib/node/task-runner-protocol.d.ts.map +1 -0
  207. package/lib/node/task-runner-protocol.js +20 -0
  208. package/lib/node/task-runner-protocol.js.map +1 -0
  209. package/lib/node/task-runner.d.ts +51 -0
  210. package/lib/node/task-runner.d.ts.map +1 -0
  211. package/lib/node/task-runner.js +90 -0
  212. package/lib/node/task-runner.js.map +1 -0
  213. package/lib/node/task-server.d.ts +40 -0
  214. package/lib/node/task-server.d.ts.map +1 -0
  215. package/lib/node/task-server.js +232 -0
  216. package/lib/node/task-server.js.map +1 -0
  217. package/lib/node/task-server.slow-spec.d.ts +2 -0
  218. package/lib/node/task-server.slow-spec.d.ts.map +1 -0
  219. package/lib/node/task-server.slow-spec.js +395 -0
  220. package/lib/node/task-server.slow-spec.js.map +1 -0
  221. package/lib/node/task.d.ts +51 -0
  222. package/lib/node/task.d.ts.map +1 -0
  223. package/lib/node/task.js +73 -0
  224. package/lib/node/task.js.map +1 -0
  225. package/lib/node/test/task-test-container.d.ts +3 -0
  226. package/lib/node/test/task-test-container.d.ts.map +1 -0
  227. package/lib/node/test/task-test-container.js +59 -0
  228. package/lib/node/test/task-test-container.js.map +1 -0
  229. package/package.json +12 -12
@@ -0,0 +1,395 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2017-2019 Ericsson and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ // tslint:disable-next-line:no-implicit-dependencies
19
+ require("reflect-metadata");
20
+ const task_test_container_1 = require("./test/task-test-container");
21
+ const backend_application_1 = require("@theia/core/lib/node/backend-application");
22
+ const common_1 = require("../common");
23
+ const os_1 = require("@theia/core/lib/common/os");
24
+ const node_1 = require("@theia/core/lib/node");
25
+ const terminal_protocol_1 = require("@theia/terminal/lib/common/terminal-protocol");
26
+ const test_web_socket_channel_1 = require("@theia/core/lib/node/messaging/test/test-web-socket-channel");
27
+ const chai_1 = require("chai");
28
+ const buffering_stream_1 = require("@theia/terminal/lib/node/buffering-stream");
29
+ const backend_application_config_provider_1 = require("@theia/core/lib/node/backend-application-config-provider");
30
+ // test scripts that we bundle with tasks
31
+ const commandShortRunning = './task';
32
+ const commandShortRunningOsx = './task-osx';
33
+ const commandShortRunningWindows = '.\\task.bat';
34
+ const commandLongRunning = './task-long-running';
35
+ const commandLongRunningOsx = './task-long-running-osx';
36
+ const commandLongRunningWindows = '.\\task-long-running.bat';
37
+ const bogusCommand = 'thisisnotavalidcommand';
38
+ const commandUnixNoop = 'true';
39
+ const commandWindowsNoop = 'rundll32.exe';
40
+ /** Expects argv to be ['a', 'b', 'c'] */
41
+ const script0 = './test-arguments-0.js';
42
+ /** Expects argv to be ['a', 'b', ' c'] */
43
+ const script1 = './test-arguments-1.js';
44
+ /** Expects argv to be ['a', 'b', 'c"'] */
45
+ const script2 = './test-arguments-2.js';
46
+ // we use test-resources subfolder ('<theia>/packages/task/test-resources/'),
47
+ // as workspace root, for these tests
48
+ const wsRootUri = node_1.FileUri.create(__dirname).resolve('../../test-resources');
49
+ const wsRoot = node_1.FileUri.fsPath(wsRootUri);
50
+ describe('Task server / back-end', function () {
51
+ this.timeout(20000);
52
+ let backend;
53
+ let server;
54
+ let taskServer;
55
+ let taskWatcher;
56
+ this.beforeAll(() => {
57
+ backend_application_config_provider_1.BackendApplicationConfigProvider.set({});
58
+ });
59
+ beforeEach(async () => {
60
+ delete process.env['THEIA_TASK_TEST_DEBUG'];
61
+ const testContainer = (0, task_test_container_1.createTaskTestContainer)();
62
+ taskWatcher = testContainer.get(common_1.TaskWatcher);
63
+ taskServer = testContainer.get(common_1.TaskServer);
64
+ taskServer.setClient(taskWatcher.getTaskClient());
65
+ backend = testContainer.get(backend_application_1.BackendApplication);
66
+ server = await backend.start(3000, 'localhost');
67
+ });
68
+ afterEach(async () => {
69
+ const _backend = backend;
70
+ const _server = server;
71
+ backend = undefined;
72
+ taskServer = undefined;
73
+ taskWatcher = undefined;
74
+ server = undefined;
75
+ _backend['onStop']();
76
+ _server.close();
77
+ });
78
+ it('task running in terminal - expected data is received from the terminal ws server', async function () {
79
+ const someString = 'someSingleWordString';
80
+ // create task using terminal process
81
+ const command = os_1.isWindows ? commandShortRunningWindows : (os_1.isOSX ? commandShortRunningOsx : commandShortRunning);
82
+ const taskInfo = await taskServer.run(createProcessTaskConfig('shell', `${command} ${someString}`), wsRoot);
83
+ const terminalId = taskInfo.terminalId;
84
+ const messagesToWaitFor = 10;
85
+ const messages = [];
86
+ // check output of task on terminal is what we expect
87
+ const expected = `${os_1.isOSX ? 'tasking osx' : 'tasking'}... ${someString}`;
88
+ // hook-up to terminal's ws and confirm that it outputs expected tasks' output
89
+ await new Promise((resolve, reject) => {
90
+ const setup = new test_web_socket_channel_1.TestWebSocketChannelSetup({ server, path: `${terminal_protocol_1.terminalsPath}/${terminalId}` });
91
+ const stringBuffer = new buffering_stream_1.StringBufferingStream();
92
+ setup.connectionProvider.listen(`${terminal_protocol_1.terminalsPath}/${terminalId}`, (path, channel) => {
93
+ channel.onMessage(e => stringBuffer.push(e().readString()));
94
+ channel.onError(reject);
95
+ channel.onClose(() => reject(new Error('Channel has been closed')));
96
+ }, false);
97
+ stringBuffer.onData(currentMessage => {
98
+ // Instead of waiting for one message from the terminal, we wait for several ones as the very first message can be something unexpected.
99
+ // For instance: `nvm is not compatible with the \"PREFIX\" environment variable: currently set to \"/usr/local\"\r\n`
100
+ messages.unshift(currentMessage);
101
+ if (currentMessage.includes(expected)) {
102
+ resolve();
103
+ }
104
+ else if (messages.length >= messagesToWaitFor) {
105
+ reject(new Error(`expected sub-string not found in terminal output. Expected: "${expected}" vs Actual messages: ${JSON.stringify(messages)}`));
106
+ }
107
+ });
108
+ });
109
+ });
110
+ it('task using raw process - task server success response shall not contain a terminal id', async function () {
111
+ const someString = 'someSingleWordString';
112
+ const command = os_1.isWindows ? commandShortRunningWindows : (os_1.isOSX ? commandShortRunningOsx : commandShortRunning);
113
+ const executable = node_1.FileUri.fsPath(wsRootUri.resolve(command));
114
+ // create task using raw process
115
+ const taskInfo = await taskServer.run(createProcessTaskConfig('process', executable, [someString]), wsRoot);
116
+ await new Promise((resolve, reject) => {
117
+ const toDispose = taskWatcher.onTaskExit((event) => {
118
+ if (event.taskId === taskInfo.taskId && event.code === 0) {
119
+ if (typeof taskInfo.terminalId === 'number') {
120
+ resolve();
121
+ }
122
+ else {
123
+ reject(new Error(`terminal id was expected to be a number, got: ${typeof taskInfo.terminalId}`));
124
+ }
125
+ toDispose.dispose();
126
+ }
127
+ });
128
+ });
129
+ });
130
+ it('task is executed successfully with cwd as a file URI', async function () {
131
+ const command = os_1.isWindows ? commandShortRunningWindows : (os_1.isOSX ? commandShortRunningOsx : commandShortRunning);
132
+ const config = createProcessTaskConfig('shell', command, undefined, node_1.FileUri.create(wsRoot).toString());
133
+ const taskInfo = await taskServer.run(config, wsRoot);
134
+ await checkSuccessfulProcessExit(taskInfo, taskWatcher);
135
+ });
136
+ it('task is executed successfully using terminal process', async function () {
137
+ const command = os_1.isWindows ? commandShortRunningWindows : (os_1.isOSX ? commandShortRunningOsx : commandShortRunning);
138
+ const taskInfo = await taskServer.run(createProcessTaskConfig('shell', command, undefined), wsRoot);
139
+ await checkSuccessfulProcessExit(taskInfo, taskWatcher);
140
+ });
141
+ it('task is executed successfully using raw process', async function () {
142
+ const command = os_1.isWindows ? commandShortRunningWindows : (os_1.isOSX ? commandShortRunningOsx : commandShortRunning);
143
+ const executable = node_1.FileUri.fsPath(wsRootUri.resolve(command));
144
+ const taskInfo = await taskServer.run(createProcessTaskConfig('process', executable, []));
145
+ await checkSuccessfulProcessExit(taskInfo, taskWatcher);
146
+ });
147
+ it('task without a specific runner is executed successfully using as a process', async function () {
148
+ const command = os_1.isWindows ? commandWindowsNoop : commandUnixNoop;
149
+ // there's no runner registered for the 'npm' task type
150
+ const taskConfig = createTaskConfig('npm', command, []);
151
+ const taskInfo = await taskServer.run(taskConfig, wsRoot);
152
+ await checkSuccessfulProcessExit(taskInfo, taskWatcher);
153
+ });
154
+ it('task can successfully execute command found in system path using a terminal process', async function () {
155
+ const command = os_1.isWindows ? commandWindowsNoop : commandUnixNoop;
156
+ const opts = createProcessTaskConfig('shell', command, []);
157
+ const taskInfo = await taskServer.run(opts, wsRoot);
158
+ await checkSuccessfulProcessExit(taskInfo, taskWatcher);
159
+ });
160
+ it('task can successfully execute command found in system path using a raw process', async function () {
161
+ const command = os_1.isWindows ? commandWindowsNoop : commandUnixNoop;
162
+ const taskInfo = await taskServer.run(createProcessTaskConfig('process', command, []), wsRoot);
163
+ await checkSuccessfulProcessExit(taskInfo, taskWatcher);
164
+ });
165
+ it('task using type "shell" can be killed', async function () {
166
+ const taskInfo = await taskServer.run(createTaskConfigTaskLongRunning('shell'), wsRoot);
167
+ const exitStatusPromise = getExitStatus(taskInfo, taskWatcher);
168
+ taskServer.kill(taskInfo.taskId);
169
+ const exitStatus = await exitStatusPromise;
170
+ // node-pty reports different things on Linux/macOS vs Windows when
171
+ // killing a process. This is not ideal, but that's how things are
172
+ // currently. Ideally, its behavior should be aligned as much as
173
+ // possible on what node's child_process module does.
174
+ if (os_1.isWindows) {
175
+ // On Windows, node-pty just reports an exit code of 0.
176
+ // expect(exitStatus).equals(1); // this does not work reliably: locally, the exit code from node-pty is 0, whereas in CI it is 1
177
+ }
178
+ else {
179
+ // On Linux/macOS, node-pty sends SIGHUP by default, for some reason.
180
+ (0, chai_1.expect)(exitStatus).equals('SIGHUP');
181
+ }
182
+ });
183
+ it('task using type "process" can be killed', async function () {
184
+ const taskInfo = await taskServer.run(createTaskConfigTaskLongRunning('process'), wsRoot);
185
+ const exitStatusPromise = getExitStatus(taskInfo, taskWatcher);
186
+ taskServer.kill(taskInfo.taskId);
187
+ const exitStatus = await exitStatusPromise;
188
+ // node-pty reports different things on Linux/macOS vs Windows when
189
+ // killing a process. This is not ideal, but that's how things are
190
+ // currently. Ideally, its behavior should be aligned as much as
191
+ // possible on what node's child_process module does.
192
+ if (os_1.isWindows) {
193
+ // On Windows, node-pty just reports an exit code of 1.
194
+ // expect(exitStatus).equals(1); // this does not work reliably: locally, the exit code from node-pty is 0, whereas in CI it is 1
195
+ }
196
+ else {
197
+ // On Linux/macOS, node-pty sends SIGHUP by default, for some reason.
198
+ (0, chai_1.expect)(exitStatus).equals('SIGHUP');
199
+ }
200
+ });
201
+ /**
202
+ * TODO: Figure out how to debug a process that correctly starts but exits with a return code > 0
203
+ */
204
+ it('task using terminal process can handle command that does not exist', async function () {
205
+ const taskInfo = await taskServer.run(createProcessTaskConfig2('shell', bogusCommand, []), wsRoot);
206
+ const code = await new Promise((resolve, reject) => {
207
+ taskWatcher.onTaskExit((event) => {
208
+ if (event.taskId !== taskInfo.taskId || event.code === undefined) {
209
+ reject(new Error(JSON.stringify(event)));
210
+ }
211
+ else {
212
+ resolve(event.code);
213
+ }
214
+ });
215
+ });
216
+ // node-pty reports different things on Linux/macOS vs Windows when
217
+ // killing a process. This is not ideal, but that's how things are
218
+ // currently. Ideally, its behavior should be aligned as much as
219
+ // possible on what node's child_process module does.
220
+ if (os_1.isWindows) {
221
+ (0, chai_1.expect)(code).equals(1);
222
+ }
223
+ else {
224
+ (0, chai_1.expect)(code).equals(127);
225
+ }
226
+ });
227
+ it('getTasks(ctx) returns tasks according to created context', async function () {
228
+ const context1 = 'aContext';
229
+ const context2 = 'anotherContext';
230
+ // create some tasks: 4 for context1, 2 for context2
231
+ const task1 = await taskServer.run(createTaskConfigTaskLongRunning('shell'), context1);
232
+ const task2 = await taskServer.run(createTaskConfigTaskLongRunning('process'), context2);
233
+ const task3 = await taskServer.run(createTaskConfigTaskLongRunning('shell'), context1);
234
+ const task4 = await taskServer.run(createTaskConfigTaskLongRunning('process'), context2);
235
+ const task5 = await taskServer.run(createTaskConfigTaskLongRunning('shell'), context1);
236
+ const task6 = await taskServer.run(createTaskConfigTaskLongRunning('process'), context1);
237
+ const runningTasksCtx1 = await taskServer.getTasks(context1); // should return 4 tasks
238
+ const runningTasksCtx2 = await taskServer.getTasks(context2); // should return 2 tasks
239
+ const runningTasksAll = await taskServer.getTasks(); // should return 6 tasks
240
+ if (runningTasksCtx1.length !== 4) {
241
+ throw new Error(`Error: unexpected number of running tasks for context 1: expected: 4, actual: ${runningTasksCtx1.length}`);
242
+ }
243
+ if (runningTasksCtx2.length !== 2) {
244
+ throw new Error(`Error: unexpected number of running tasks for context 2: expected: 2, actual: ${runningTasksCtx1.length}`);
245
+ }
246
+ if (runningTasksAll.length !== 6) {
247
+ throw new Error(`Error: unexpected total number of running tasks for all contexts: expected: 6, actual: ${runningTasksCtx1.length}`);
248
+ }
249
+ // cleanup
250
+ await taskServer.kill(task1.taskId);
251
+ await taskServer.kill(task2.taskId);
252
+ await taskServer.kill(task3.taskId);
253
+ await taskServer.kill(task4.taskId);
254
+ await taskServer.kill(task5.taskId);
255
+ await taskServer.kill(task6.taskId);
256
+ });
257
+ it('creating and killing a bunch of tasks works as expected', async function () {
258
+ // const command = isWindows ? command_absolute_path_long_running_windows : command_absolute_path_long_running;
259
+ const numTasks = 20;
260
+ const taskInfo = [];
261
+ // create a mix of terminal and raw processes
262
+ for (let i = 0; i < numTasks; i++) {
263
+ if (i % 2 === 0) {
264
+ taskInfo.push(await taskServer.run(createTaskConfigTaskLongRunning('shell')));
265
+ }
266
+ else {
267
+ taskInfo.push(await taskServer.run(createTaskConfigTaskLongRunning('process')));
268
+ }
269
+ }
270
+ const numRunningTasksAfterCreated = await taskServer.getTasks();
271
+ for (let i = 0; i < taskInfo.length; i++) {
272
+ await taskServer.kill(taskInfo[i].taskId);
273
+ }
274
+ const numRunningTasksAfterKilled = await taskServer.getTasks();
275
+ if (numRunningTasksAfterCreated.length !== numTasks) {
276
+ throw new Error(`Error: unexpected number of running tasks: expected: ${numTasks}, actual: ${numRunningTasksAfterCreated.length}`);
277
+ }
278
+ if (numRunningTasksAfterKilled.length !== 0) {
279
+ throw new Error(`Error: remaining running tasks, after all killed: expected: 0, actual: ${numRunningTasksAfterKilled.length}`);
280
+ }
281
+ });
282
+ it('shell task should execute the command as a whole if not arguments are specified', async function () {
283
+ const taskInfo = await taskServer.run(createProcessTaskConfig2('shell', `node ${script0} debug-hint:0a a b c`));
284
+ const exitStatus = await getExitStatus(taskInfo, taskWatcher);
285
+ (0, chai_1.expect)(exitStatus).eq(0);
286
+ });
287
+ it('shell task should fail if user defines a full command line and arguments', async function () {
288
+ const taskInfo = await taskServer.run(createProcessTaskConfig2('shell', `node ${script0} debug-hint:0b a b c`, []));
289
+ const exitStatus = await getExitStatus(taskInfo, taskWatcher);
290
+ (0, chai_1.expect)(exitStatus).not.eq(0);
291
+ });
292
+ it('shell task should be able to exec using simple arguments', async function () {
293
+ const taskInfo = await taskServer.run(createProcessTaskConfig2('shell', 'node', [script0, 'debug-hint:0c', 'a', 'b', 'c']));
294
+ const exitStatus = await getExitStatus(taskInfo, taskWatcher);
295
+ (0, chai_1.expect)(exitStatus).eq(0);
296
+ });
297
+ it('shell task should be able to run using arguments containing whitespace', async function () {
298
+ const taskInfo = await taskServer.run(createProcessTaskConfig2('shell', 'node', [script1, 'debug-hint:1', 'a', 'b', ' c']));
299
+ const exitStatus = await getExitStatus(taskInfo, taskWatcher);
300
+ (0, chai_1.expect)(exitStatus).eq(0);
301
+ });
302
+ it('shell task will fail if user specify problematic arguments', async function () {
303
+ const taskInfo = await taskServer.run(createProcessTaskConfig2('shell', 'node', [script2, 'debug-hint:2a', 'a', 'b', 'c"']));
304
+ const exitStatus = await getExitStatus(taskInfo, taskWatcher);
305
+ (0, chai_1.expect)(exitStatus).not.eq(0);
306
+ });
307
+ it('shell task should be able to run using arguments specifying which quoting method to use', async function () {
308
+ const taskInfo = await taskServer.run(createProcessTaskConfig2('shell', 'node', [script2, 'debug-hint:2b', 'a', 'b', { value: 'c"', quoting: 'escape' }]));
309
+ const exitStatus = await getExitStatus(taskInfo, taskWatcher);
310
+ (0, chai_1.expect)(exitStatus).eq(0);
311
+ });
312
+ it('shell task should be able to run using arguments with forbidden characters but no whitespace', async function () {
313
+ const taskInfo = await taskServer.run(createProcessTaskConfig2('shell', 'node', ['-e', 'setTimeout(console.log,1000,1+2)']));
314
+ const exitStatus = await getExitStatus(taskInfo, taskWatcher);
315
+ (0, chai_1.expect)(exitStatus).eq(0);
316
+ });
317
+ });
318
+ function createTaskConfig(taskType, command, args) {
319
+ const options = {
320
+ label: 'test task',
321
+ type: taskType,
322
+ _source: '/source/folder',
323
+ _scope: '/source/folder',
324
+ command,
325
+ args,
326
+ options: { cwd: wsRoot }
327
+ };
328
+ return options;
329
+ }
330
+ function createProcessTaskConfig(processType, command, args, cwd = wsRoot) {
331
+ return {
332
+ label: 'test task',
333
+ type: processType,
334
+ _source: '/source/folder',
335
+ _scope: '/source/folder',
336
+ command,
337
+ args,
338
+ options: { cwd },
339
+ };
340
+ }
341
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
342
+ function createProcessTaskConfig2(processType, command, args) {
343
+ return {
344
+ label: 'test task',
345
+ type: processType,
346
+ command,
347
+ args,
348
+ options: { cwd: wsRoot },
349
+ };
350
+ }
351
+ function createTaskConfigTaskLongRunning(processType) {
352
+ return {
353
+ label: '[Task] long running test task (~300s)',
354
+ type: processType,
355
+ _source: '/source/folder',
356
+ _scope: '/source/folder',
357
+ options: { cwd: wsRoot },
358
+ command: commandLongRunning,
359
+ windows: {
360
+ command: node_1.FileUri.fsPath(wsRootUri.resolve(commandLongRunningWindows)),
361
+ options: { cwd: wsRoot }
362
+ },
363
+ osx: {
364
+ command: node_1.FileUri.fsPath(wsRootUri.resolve(commandLongRunningOsx))
365
+ }
366
+ };
367
+ }
368
+ function checkSuccessfulProcessExit(taskInfo, taskWatcher) {
369
+ return new Promise((resolve, reject) => {
370
+ const toDispose = taskWatcher.onTaskExit((event) => {
371
+ if (event.taskId === taskInfo.taskId && event.code === 0) {
372
+ toDispose.dispose();
373
+ resolve();
374
+ }
375
+ });
376
+ });
377
+ }
378
+ function getExitStatus(taskInfo, taskWatcher) {
379
+ return new Promise((resolve, reject) => {
380
+ taskWatcher.onTaskExit((event) => {
381
+ if (event.taskId === taskInfo.taskId) {
382
+ if (typeof event.signal === 'string') {
383
+ resolve(event.signal);
384
+ }
385
+ else if (typeof event.code === 'number') {
386
+ resolve(event.code);
387
+ }
388
+ else {
389
+ reject(new Error('no code nor signal'));
390
+ }
391
+ }
392
+ });
393
+ });
394
+ }
395
+ //# sourceMappingURL=task-server.slow-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-server.slow-spec.js","sourceRoot":"","sources":["../../src/node/task-server.slow-spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,oDAAoD;AACpD,4BAA0B;AAC1B,oEAAqE;AACrE,kFAA8E;AAC9E,sCAAkG;AAIlG,kDAA6D;AAC7D,+CAA+C;AAC/C,oFAA6E;AAC7E,yGAAwG;AACxG,+BAA8B;AAE9B,gFAAkF;AAClF,kHAA4G;AAE5G,yCAAyC;AACzC,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AACrC,MAAM,sBAAsB,GAAG,YAAY,CAAC;AAC5C,MAAM,0BAA0B,GAAG,aAAa,CAAC;AAEjD,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AACjD,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AACxD,MAAM,yBAAyB,GAAG,0BAA0B,CAAC;AAE7D,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAE9C,MAAM,eAAe,GAAG,MAAM,CAAC;AAC/B,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAE1C,yCAAyC;AACzC,MAAM,O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Emitter, Event, MaybePromise } from '@theia/core/lib/common/';
2
+ import { TaskInfo, TaskExitedEvent, TaskConfiguration, TaskOutputEvent, ManagedTask, ManagedTaskManager } from '../common/task-protocol';
3
+ /**
4
+ * Represents the options used for running a task.
5
+ */
6
+ export interface TaskOptions {
7
+ /** The task label */
8
+ label: string;
9
+ /** The task configuration which should be executed */
10
+ config: TaskConfiguration;
11
+ /** The optional execution context */
12
+ context?: string;
13
+ }
14
+ /**
15
+ * A {@link Task} represents the execution state of a `TaskConfiguration`.
16
+ * Implementing classes have to call the {@link Task#fireOutputLine} function
17
+ * whenever a new output occurs during the execution.
18
+ */
19
+ export declare abstract class Task implements Disposable, ManagedTask {
20
+ protected readonly taskManager: ManagedTaskManager<Task>;
21
+ protected readonly logger: ILogger;
22
+ protected readonly options: TaskOptions;
23
+ protected taskId: number;
24
+ protected readonly toDispose: DisposableCollection;
25
+ readonly exitEmitter: Emitter<TaskExitedEvent>;
26
+ readonly outputEmitter: Emitter<TaskOutputEvent>;
27
+ constructor(taskManager: ManagedTaskManager<Task>, logger: ILogger, options: TaskOptions);
28
+ /**
29
+ * Terminate this task.
30
+ *
31
+ * @returns a promise that resolves once the task has been properly terminated.
32
+ */
33
+ abstract kill(): Promise<void>;
34
+ get onExit(): Event<TaskExitedEvent>;
35
+ get onOutput(): Event<TaskOutputEvent>;
36
+ /** Has to be called when a task has concluded its execution. */
37
+ protected fireTaskExited(event: TaskExitedEvent): void;
38
+ protected fireOutputLine(event: TaskOutputEvent): void;
39
+ /**
40
+ * Retrieves the runtime information about this task.
41
+ * The runtime information computation may happen asynchronous.
42
+ *
43
+ * @returns (a promise of) the runtime information as `TaskInfo`.
44
+ */
45
+ abstract getRuntimeInfo(): MaybePromise<TaskInfo>;
46
+ get id(): number;
47
+ get context(): string | undefined;
48
+ get label(): string;
49
+ dispose(): void;
50
+ }
51
+ //# sourceMappingURL=task.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task.d.ts","sourceRoot":"","sources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AAG,IAAI;IAItD,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;IAGtD;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,IAAI,YAAY,CAAC,QAAQ,CAAC;IAEjD,IAAI,EAAE,IAAI,MAAM,CAEf;IAED,IAAI,OAAO,IAAI,MAAM,GAAG,SAAS,CAEhC;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,OAAO,IAAI,IAAI;CAGlB"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2017 Ericsson and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.Task = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const common_1 = require("@theia/core/lib/common/");
22
+ /**
23
+ * A {@link Task} represents the execution state of a `TaskConfiguration`.
24
+ * Implementing classes have to call the {@link Task#fireOutputLine} function
25
+ * whenever a new output occurs during the execution.
26
+ */
27
+ let Task = class Task {
28
+ constructor(taskManager, logger, options) {
29
+ this.taskManager = taskManager;
30
+ this.logger = logger;
31
+ this.options = options;
32
+ this.toDispose = new common_1.DisposableCollection();
33
+ this.taskId = this.taskManager.register(this, this.options.context);
34
+ this.exitEmitter = new common_1.Emitter();
35
+ this.outputEmitter = new common_1.Emitter();
36
+ this.toDispose.push(this.exitEmitter);
37
+ this.toDispose.push(this.outputEmitter);
38
+ }
39
+ get onExit() {
40
+ return this.exitEmitter.event;
41
+ }
42
+ get onOutput() {
43
+ return this.outputEmitter.event;
44
+ }
45
+ /** Has to be called when a task has concluded its execution. */
46
+ fireTaskExited(event) {
47
+ this.exitEmitter.fire(event);
48
+ }
49
+ fireOutputLine(event) {
50
+ this.outputEmitter.fire(event);
51
+ }
52
+ get id() {
53
+ return this.taskId;
54
+ }
55
+ get context() {
56
+ return this.options.context;
57
+ }
58
+ get label() {
59
+ return this.options.label;
60
+ }
61
+ dispose() {
62
+ this.toDispose.dispose();
63
+ }
64
+ };
65
+ exports.Task = Task;
66
+ exports.Task = Task = tslib_1.__decorate([
67
+ (0, inversify_1.injectable)(),
68
+ tslib_1.__param(0, (0, inversify_1.unmanaged)()),
69
+ tslib_1.__param(1, (0, inversify_1.unmanaged)()),
70
+ tslib_1.__param(2, (0, inversify_1.unmanaged)()),
71
+ tslib_1.__metadata("design:paramtypes", [Object, Object, Object])
72
+ ], Task);
73
+ //# sourceMappingURL=task.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task.js","sourceRoot":"","sources":["../../src/node/task.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAAqE;AACrE,oDAAkH;AAclH;;;;GAIG;AAEI,IAAe,IAAI,GAAnB,MAAe,IAAI;IAOtB,YACiB,WAAwD,EACxD,MAAkC,EAClC,OAAuC;QAFpB,gBAAW,GAAX,WAAW,CAA0B;QACrC,WAAM,GAAN,MAAM,CAAS;QACf,YAAO,GAAP,OAAO,CAAa;QAPrC,cAAS,GAAyB,IAAI,6BAAoB,EAAE,CAAC;QAS5E,IAAI,CAAC,M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,0 +1,3 @@
1
+ import { Container } from '@theia/core/shared/inversify';
2
+ export declare function createTaskTestContainer(): Container;
3
+ //# sourceMappingURL=task-test-container.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-test-container.d.ts","sourceRoot":"","sources":["../../../src/node/test/task-test-container.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAazD,wBAAgB,uBAAuB,IAAI,SAAS,CAsBnD"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createTaskTestContainer = void 0;
4
+ // *****************************************************************************
5
+ // Copyright (C) 2017 Ericsson and others.
6
+ //
7
+ // This program and the accompanying materials are made available under the
8
+ // terms of the Eclipse Public License v. 2.0 which is available at
9
+ // http://www.eclipse.org/legal/epl-2.0.
10
+ //
11
+ // This Source Code may also be made available under the following Secondary
12
+ // Licenses when the conditions for such availability set forth in the Eclipse
13
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
14
+ // with the GNU Classpath Exception which is available at
15
+ // https://www.gnu.org/software/classpath/license.html.
16
+ //
17
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
18
+ // *****************************************************************************
19
+ const inversify_1 = require("@theia/core/shared/inversify");
20
+ const logger_backend_module_1 = require("@theia/core/lib/node/logger-backend-module");
21
+ const backend_application_module_1 = require("@theia/core/lib/node/backend-application-module");
22
+ const process_backend_module_1 = require("@theia/process/lib/node/process-backend-module");
23
+ const terminal_backend_module_1 = require("@theia/terminal/lib/node/terminal-backend-module");
24
+ const task_backend_module_1 = require("../task-backend-module");
25
+ const filesystem_backend_module_1 = require("@theia/filesystem/lib/node/filesystem-backend-module");
26
+ const workspace_backend_module_1 = require("@theia/workspace/lib/node/workspace-backend-module");
27
+ const messaging_backend_module_1 = require("@theia/core/lib/node/messaging/messaging-backend-module");
28
+ const application_package_1 = require("@theia/core/shared/@theia/application-package");
29
+ const node_1 = require("@theia/process/lib/node");
30
+ const process_utils_1 = require("@theia/core/lib/node/process-utils");
31
+ function createTaskTestContainer() {
32
+ const testContainer = new inversify_1.Container();
33
+ testContainer.load(backend_application_module_1.backendApplicationModule);
34
+ testContainer.rebind(application_package_1.ApplicationPackage).toConstantValue({});
35
+ (0, logger_backend_module_1.bindLogger)(testContainer.bind.bind(testContainer));
36
+ testContainer.load(messaging_backend_module_1.messagingBackendModule);
37
+ testContainer.load(process_backend_module_1.default);
38
+ testContainer.load(task_backend_module_1.default);
39
+ testContainer.load(filesystem_backend_module_1.default);
40
+ testContainer.load(workspace_backend_module_1.default);
41
+ testContainer.load(terminal_backend_module_1.default);
42
+ // Make it easier to debug processes.
43
+ testContainer.rebind(node_1.TerminalProcess).to(TestTerminalProcess);
44
+ testContainer.rebind(process_utils_1.ProcessUtils).toConstantValue(new class extends process_utils_1.ProcessUtils {
45
+ terminateProcessTree() { } // don't actually kill the tree, it breaks the tests.
46
+ });
47
+ return testContainer;
48
+ }
49
+ exports.createTaskTestContainer = createTaskTestContainer;
50
+ class TestTerminalProcess extends node_1.TerminalProcess {
51
+ emitOnStarted() {
52
+ if (process.env['THEIA_TASK_TEST_DEBUG']) {
53
+ console.log(`START ${this.id} ${JSON.stringify([this.executable, this.options.commandLine, ...this.arguments])}`);
54
+ this.outputStream.on('data', data => console.debug(`${this.id} OUTPUT: ${data.toString().trim()}`));
55
+ }
56
+ super.emitOnStarted();
57
+ }
58
+ }
59
+ //# sourceMappingURL=task-test-container.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-test-container.js","sourceRoot":"","sources":["../../../src/node/test/task-test-container.ts"],"names":[],"mappings":";;;AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AAC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