@@ -167,8 +167,8 @@ import { window, tasks, Disposable, TaskDefinition, Task, EventEmitter, CustomEx
167
167
commands . executeCommand ( 'workbench.action.tasks.runTask' , `${ taskType } : ${ taskName } ` ) ;
168
168
} ) ;
169
169
170
- test . skip ( 'Execution from onDidEndTaskProcess is equal to original' , ( ) => {
171
- return new Promise ( async ( resolve , reject ) => {
170
+ test ( 'Execution from onDidEndTaskProcess and onDidStartTaskProcess are equal to original' , ( ) => {
171
+ return new Promise ( async ( resolve ) => {
172
172
const task = new Task ( { type : 'testTask' } , TaskScope . Workspace , 'echo' , 'testTask' , new ShellExecution ( 'echo' , [ 'hello test' ] ) ) ;
173
173
let taskExecution : TaskExecution | undefined ;
174
174
const executeDoneEvent : EventEmitter < void > = new EventEmitter ( ) ;
@@ -178,61 +178,31 @@ import { window, tasks, Disposable, TaskDefinition, Task, EventEmitter, CustomEx
178
178
disposable . dispose ( ) ;
179
179
} ) ;
180
180
} ) ;
181
-
182
- disposables . push ( tasks . onDidStartTaskProcess ( async ( e ) => {
183
- await taskExecutionShouldBeSet ;
184
- if ( taskExecution === undefined ) {
185
- reject ( 'taskExecution is still undefined when process started.' ) ;
186
- } else if ( e . execution !== taskExecution ) {
187
- reject ( 'Unexpected task execution value in start process.' ) ;
188
- }
189
- } ) ) ;
190
-
191
- disposables . push ( tasks . onDidEndTaskProcess ( async ( e ) => {
192
- await taskExecutionShouldBeSet ;
193
- if ( taskExecution === undefined ) {
194
- reject ( 'taskExecution is still undefined when process ended.' ) ;
195
- } else if ( e . execution === taskExecution ) {
181
+ let count = 2 ;
182
+ const progressMade : EventEmitter < void > = new EventEmitter ( ) ;
183
+ let startSucceeded = false ;
184
+ let endSucceeded = false ;
185
+ disposables . push ( progressMade . event ( ( ) => {
186
+ count -- ;
187
+ if ( ( count === 0 ) && startSucceeded && endSucceeded ) {
196
188
resolve ( ) ;
197
- } else {
198
- reject ( 'Unexpected task execution value in end process.' ) ;
199
189
}
200
190
} ) ) ;
201
191
202
- taskExecution = await tasks . executeTask ( task ) ;
203
- executeDoneEvent . fire ( ) ;
204
- } ) ;
205
- } ) ;
206
-
207
- test . skip ( 'Execution from onDidStartTaskProcess is equal to original' , ( ) => {
208
- return new Promise ( async ( resolve , reject ) => {
209
- const task = new Task ( { type : 'testTask' } , TaskScope . Workspace , 'echo' , 'testTask' , new ShellExecution ( 'echo' , [ 'hello test' ] ) ) ;
210
- let taskExecution : TaskExecution | undefined ;
211
- const executeDoneEvent : EventEmitter < void > = new EventEmitter ( ) ;
212
- const taskExecutionShouldBeSet : Promise < void > = new Promise ( resolve => {
213
- const disposable = executeDoneEvent . event ( ( ) => {
214
- resolve ( ) ;
215
- disposable . dispose ( ) ;
216
- } ) ;
217
- } ) ;
218
192
219
193
disposables . push ( tasks . onDidStartTaskProcess ( async ( e ) => {
220
194
await taskExecutionShouldBeSet ;
221
- if ( taskExecution === undefined ) {
222
- reject ( 'taskExecution is still undefined when process started.' ) ;
223
- } else if ( e . execution === taskExecution ) {
224
- resolve ( ) ;
225
- } else {
226
- reject ( 'Unexpected task execution value in start process.' ) ;
195
+ if ( e . execution === taskExecution ) {
196
+ startSucceeded = true ;
197
+ progressMade . fire ( ) ;
227
198
}
228
199
} ) ) ;
229
200
230
201
disposables . push ( tasks . onDidEndTaskProcess ( async ( e ) => {
231
202
await taskExecutionShouldBeSet ;
232
- if ( taskExecution === undefined ) {
233
- reject ( 'taskExecution is still undefined when process ended.' ) ;
234
- } else if ( e . execution !== taskExecution ) {
235
- reject ( 'Unexpected task execution value in end process.' ) ;
203
+ if ( e . execution === taskExecution ) {
204
+ endSucceeded = true ;
205
+ progressMade . fire ( ) ;
236
206
}
237
207
} ) ) ;
238
208
0 commit comments