Skip to content

Commit 9393ecb

Browse files
committed
improved error messages on tests
1 parent 039212a commit 9393ecb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/ExampleWorker.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@ const runExample = options => {
2323
let totalDuration = 0;
2424
let overlapTotal = 0;
2525
let overlapCount = 0;
26+
let i;
2627

27-
global.gc();
28+
if (global.gc) {
29+
global.gc();
30+
}
2831

29-
for (let i = 0; i < options.updates; i += 1) {
32+
try {
33+
for (i = 0; i < options.updates; i += 1) {
3034
const startTime = process.hrtime();
3135
totalMemory += process.memoryUsage().heapUsed;
3236

@@ -48,6 +52,10 @@ const runExample = options => {
4852
overlapCount += 1;
4953
}
5054
}
55+
}
56+
} catch (err) {
57+
err.message = `On example '${options.name}' update ${i}:\n\n ${err.message}`;
58+
throw err;
5159
}
5260

5361
resetEnvironment();

0 commit comments

Comments
 (0)