Force V8 GC after each test during leak checks

This commit is contained in:
Lovell Fuller 2019-07-29 11:33:45 +01:00
parent ba4ce75377
commit 6b7ce8a605
2 changed files with 7 additions and 1 deletions

View File

@ -16,5 +16,5 @@ for test in ./test/unit/*.js; do
--show-leak-kinds=definite,indirect,possible \ --show-leak-kinds=definite,indirect,possible \
--num-callers=20 \ --num-callers=20 \
--trace-children=yes \ --trace-children=yes \
node node_modules/.bin/mocha --slow=60000 --timeout=120000 --file test/unit/beforeEach.js "$test"; node --expose-gc node_modules/.bin/mocha --slow=60000 --timeout=120000 --file test/unit/beforeEach.js "$test";
done done

View File

@ -12,3 +12,9 @@ beforeEach(function () {
sharp.simd(usingSimd); sharp.simd(usingSimd);
sharp.concurrency(concurrency); sharp.concurrency(concurrency);
}); });
afterEach(function () {
if (global.gc) {
global.gc();
}
});