0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-27 09:50:52 -05:00

improved error messages on tests

This commit is contained in:
liabru 2021-12-20 21:17:02 +00:00
parent 039212a56e
commit 9393ecb5b2

View file

@ -23,10 +23,14 @@ const runExample = options => {
let totalDuration = 0; let totalDuration = 0;
let overlapTotal = 0; let overlapTotal = 0;
let overlapCount = 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(); const startTime = process.hrtime();
totalMemory += process.memoryUsage().heapUsed; totalMemory += process.memoryUsage().heapUsed;
@ -48,6 +52,10 @@ const runExample = options => {
overlapCount += 1; overlapCount += 1;
} }
} }
}
} catch (err) {
err.message = `On example '${options.name}' update ${i}:\n\n ${err.message}`;
throw err;
} }
resetEnvironment(); resetEnvironment();