mirror of
https://github.com/lovell/sharp.git
synced 2025-07-08 18:20:13 +02:00
Tests: convert mocha hooks (#3450)
This commit is contained in:
parent
5740f4545e
commit
ac0dc10bd5
@ -2,5 +2,6 @@
|
|||||||
"parallel": true,
|
"parallel": true,
|
||||||
"slow": 1000,
|
"slow": 1000,
|
||||||
"timeout": 30000,
|
"timeout": 30000,
|
||||||
|
"require": "./test/beforeEach.js",
|
||||||
"spec": "./test/unit/*.js"
|
"spec": "./test/unit/*.js"
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const detectLibc = require('detect-libc');
|
const detectLibc = require('detect-libc');
|
||||||
const sharp = require('../../');
|
const sharp = require('../');
|
||||||
|
|
||||||
const libcFamily = detectLibc.familySync();
|
const libcFamily = detectLibc.familySync();
|
||||||
const usingCache = !(process.env.G_DEBUG || libcFamily === detectLibc.MUSL);
|
const usingCache = !(process.env.G_DEBUG || libcFamily === detectLibc.MUSL);
|
||||||
@ -9,14 +9,16 @@ const usingSimd = !(process.env.G_DEBUG || process.env.VIPS_NOVECTOR);
|
|||||||
const concurrency = process.env.VIPS_CONCURRENCY ||
|
const concurrency = process.env.VIPS_CONCURRENCY ||
|
||||||
(libcFamily === detectLibc.MUSL || process.arch === 'arm' ? 1 : undefined);
|
(libcFamily === detectLibc.MUSL || process.arch === 'arm' ? 1 : undefined);
|
||||||
|
|
||||||
beforeEach(function () {
|
exports.mochaHooks = {
|
||||||
sharp.cache(usingCache);
|
beforeEach () {
|
||||||
sharp.simd(usingSimd);
|
sharp.cache(usingCache);
|
||||||
sharp.concurrency(concurrency);
|
sharp.simd(usingSimd);
|
||||||
});
|
sharp.concurrency(concurrency);
|
||||||
|
},
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach () {
|
||||||
if (global.gc) {
|
if (global.gc) {
|
||||||
global.gc();
|
global.gc();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
Loading…
x
Reference in New Issue
Block a user