Error the task waited for fails in tests

This commit is contained in:
Johannes Zellner
2022-09-19 18:20:27 +02:00
parent d2ea6b2002
commit 5184e017c9

View File

@@ -107,7 +107,10 @@ async function waitForTask(taskId) {
for (let i = 0; i < 10; i++) {
const result = await tasks.get(taskId);
expect(result).to.not.be(null);
if (!result.active) return;
if (!result.active) {
if (result.success) return result;
throw new Error(`Task ${taskId} failed: ${result.error.message} - ${result.error.stack}`);
}
await delay(2000);
console.log(`Waiting for task to ${taskId} finish`);
}