From 9393ecb5b2c22b91fc4fdc94dbffed9b7946d15c Mon Sep 17 00:00:00 2001 From: liabru Date: Mon, 20 Dec 2021 21:17:02 +0000 Subject: [PATCH] improved error messages on tests --- test/ExampleWorker.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/ExampleWorker.js b/test/ExampleWorker.js index 7b8b43d..0187069 100644 --- a/test/ExampleWorker.js +++ b/test/ExampleWorker.js @@ -23,10 +23,14 @@ const runExample = options => { let totalDuration = 0; let overlapTotal = 0; let overlapCount = 0; + let i; - global.gc(); + if (global.gc) { + global.gc(); + } - for (let i = 0; i < options.updates; i += 1) { + try { + for (i = 0; i < options.updates; i += 1) { const startTime = process.hrtime(); totalMemory += process.memoryUsage().heapUsed; @@ -48,6 +52,10 @@ const runExample = options => { overlapCount += 1; } } + } + } catch (err) { + err.message = `On example '${options.name}' update ${i}:\n\n ${err.message}`; + throw err; } resetEnvironment();