mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 23:35:03 +01:00
Migrate from mocha to Node.js native test runner
Includes coverage reports when using Node.js 22 onwards
This commit is contained in:
@@ -15,6 +15,8 @@ const paths = [
|
||||
'@img/sharp-wasm32/sharp.node'
|
||||
];
|
||||
|
||||
/* node:coverage disable */
|
||||
|
||||
let path, sharp;
|
||||
const errors = [];
|
||||
for (path of paths) {
|
||||
@@ -22,12 +24,10 @@ for (path of paths) {
|
||||
sharp = require(path);
|
||||
break;
|
||||
} catch (err) {
|
||||
/* istanbul ignore next */
|
||||
errors.push(err);
|
||||
}
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
if (sharp && path.startsWith('@img/sharp-linux-x64') && !sharp._isUsingX64V2()) {
|
||||
const err = new Error('Prebuilt binaries for linux-x64 require v2 microarchitecture');
|
||||
err.code = 'Unsupported CPU';
|
||||
@@ -35,7 +35,6 @@ if (sharp && path.startsWith('@img/sharp-linux-x64') && !sharp._isUsingX64V2())
|
||||
sharp = null;
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
if (sharp) {
|
||||
module.exports = sharp;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user