Skip to content

Commit 1a1b76f

Browse files
committed
Check for undefined specifically in task execution test
Part of microsoft#100361
1 parent 2b2f5b2 commit 1a1b76f

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,17 @@ import { window, tasks, Disposable, TaskDefinition, Task, EventEmitter, CustomEx
144144
let taskExecution: TaskExecution | undefined;
145145

146146
disposables.push(tasks.onDidStartTaskProcess(e => {
147-
if (e.execution !== taskExecution) {
147+
if (taskExecution === undefined) {
148+
reject('taskExecution is still undefined when process started.');
149+
} else if (e.execution !== taskExecution) {
148150
reject('Unexpected task execution value in start process.');
149151
}
150152
}));
151153

152154
disposables.push(tasks.onDidEndTaskProcess(e => {
153-
if (e.execution === taskExecution) {
155+
if (taskExecution === undefined) {
156+
reject('taskExecution is still undefined when process ended.');
157+
} else if (e.execution === taskExecution) {
154158
resolve();
155159
} else {
156160
reject('Unexpected task execution value in end process.');
@@ -167,15 +171,19 @@ import { window, tasks, Disposable, TaskDefinition, Task, EventEmitter, CustomEx
167171
let taskExecution: TaskExecution | undefined;
168172

169173
disposables.push(tasks.onDidStartTaskProcess(e => {
170-
if (e.execution === taskExecution) {
174+
if (taskExecution === undefined) {
175+
reject('taskExecution is still undefined when process started.');
176+
} else if (e.execution === taskExecution) {
171177
resolve();
172178
} else {
173179
reject('Unexpected task execution value in start process.');
174180
}
175181
}));
176182

177183
disposables.push(tasks.onDidEndTaskProcess(e => {
178-
if (e.execution !== taskExecution) {
184+
if (taskExecution === undefined) {
185+
reject('taskExecution is still undefined when process ended.');
186+
} else if (e.execution !== taskExecution) {
179187
reject('Unexpected task execution value in end process.');
180188
}
181189
}));

0 commit comments

Comments
 (0)