Check for undefined specifically in task execution test

Part of #100361
This commit is contained in:
Alex Ross
2020-06-17 11:41:28 +02:00
parent 2b2f5b2f07
commit 1a1b76f0ee

View File

@@ -144,13 +144,17 @@ import { window, tasks, Disposable, TaskDefinition, Task, EventEmitter, CustomEx
let taskExecution: TaskExecution | undefined;
disposables.push(tasks.onDidStartTaskProcess(e => {
if (e.execution !== taskExecution) {
if (taskExecution === undefined) {
reject('taskExecution is still undefined when process started.');
} else if (e.execution !== taskExecution) {
reject('Unexpected task execution value in start process.');
}
}));
disposables.push(tasks.onDidEndTaskProcess(e => {
if (e.execution === taskExecution) {
if (taskExecution === undefined) {
reject('taskExecution is still undefined when process ended.');
} else if (e.execution === taskExecution) {
resolve();
} else {
reject('Unexpected task execution value in end process.');
@@ -167,7 +171,9 @@ import { window, tasks, Disposable, TaskDefinition, Task, EventEmitter, CustomEx
let taskExecution: TaskExecution | undefined;
disposables.push(tasks.onDidStartTaskProcess(e => {
if (e.execution === taskExecution) {
if (taskExecution === undefined) {
reject('taskExecution is still undefined when process started.');
} else if (e.execution === taskExecution) {
resolve();
} else {
reject('Unexpected task execution value in start process.');
@@ -175,7 +181,9 @@ import { window, tasks, Disposable, TaskDefinition, Task, EventEmitter, CustomEx
}));
disposables.push(tasks.onDidEndTaskProcess(e => {
if (e.execution !== taskExecution) {
if (taskExecution === undefined) {
reject('taskExecution is still undefined when process ended.');
} else if (e.execution !== taskExecution) {
reject('Unexpected task execution value in end process.');
}
}));