Migrate from mocha to Node.js native test runner

Includes coverage reports when using Node.js 22 onwards
This commit is contained in:
Lovell Fuller
2025-09-21 11:04:55 +01:00
parent c446d743a2
commit f2978651f0
70 changed files with 583 additions and 541 deletions

View File

@@ -1,6 +1,7 @@
// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
const { describe, it } = require('node:test');
const assert = require('node:assert');
const sharp = require('../../');
@@ -8,7 +9,7 @@ const inRange = require('../../lib/is').inRange;
const fixtures = require('../fixtures');
describe('Trim borders', function () {
it('Skip shrink-on-load', function (done) {
it('Skip shrink-on-load', function (_t, done) {
const expected = fixtures.expected('alpha-layer-2-trim-resize.jpg');
sharp(fixtures.inputJpgOverlayLayer2)
.trim()
@@ -41,7 +42,7 @@ describe('Trim borders', function () {
})
);
it('16-bit PNG with alpha channel', function (done) {
it('16-bit PNG with alpha channel', function (_t, done) {
sharp(fixtures.inputPngWithTransparency16bit)
.resize(32, 32)
.trim({
@@ -60,7 +61,7 @@ describe('Trim borders', function () {
});
});
it('Attempt to trim 2x2 pixel image fails', function (done) {
it('Attempt to trim 2x2 pixel image fails', function (_t, done) {
sharp({
create: {
width: 2,
@@ -78,7 +79,7 @@ describe('Trim borders', function () {
assert.strictEqual('Image to trim must be at least 3x3 pixels', err.message);
done();
})
.catch(done);
.catch(_t, done);
});
it('Should rotate before trim', () =>