mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +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:
@@ -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('../../');
|
||||
@@ -18,7 +19,7 @@ const assertNormalized = function (data) {
|
||||
};
|
||||
|
||||
describe('Normalization', function () {
|
||||
it('spreads rgb image values between 0 and 255', function (done) {
|
||||
it('spreads rgb image values between 0 and 255', function (_t, done) {
|
||||
sharp(fixtures.inputJpgWithLowContrast)
|
||||
.normalise()
|
||||
.raw()
|
||||
@@ -29,7 +30,7 @@ describe('Normalization', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('spreads grayscaled image values between 0 and 255', function (done) {
|
||||
it('spreads grayscaled image values between 0 and 255', function (_t, done) {
|
||||
sharp(fixtures.inputJpgWithLowContrast)
|
||||
.greyscale()
|
||||
.normalize()
|
||||
@@ -41,7 +42,7 @@ describe('Normalization', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('stretches greyscale images with alpha channel', function (done) {
|
||||
it('stretches greyscale images with alpha channel', function (_t, done) {
|
||||
sharp(fixtures.inputPngWithGreyAlpha)
|
||||
.normalise()
|
||||
.raw()
|
||||
@@ -52,7 +53,7 @@ describe('Normalization', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('keeps an existing alpha channel', function (done) {
|
||||
it('keeps an existing alpha channel', function (_t, done) {
|
||||
sharp(fixtures.inputPngWithTransparency)
|
||||
.resize(8, 8)
|
||||
.normalize()
|
||||
@@ -68,7 +69,7 @@ describe('Normalization', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('keeps the alpha channel of greyscale images intact', function (done) {
|
||||
it('keeps the alpha channel of greyscale images intact', function (_t, done) {
|
||||
sharp(fixtures.inputPngWithGreyAlpha)
|
||||
.resize(8, 8)
|
||||
.normalise()
|
||||
@@ -84,7 +85,7 @@ describe('Normalization', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('does not alter images with only one color', function (done) {
|
||||
it('does not alter images with only one color', function (_t, done) {
|
||||
const output = fixtures.path('output.unmodified-png-with-one-color.png');
|
||||
sharp(fixtures.inputPngWithOneColor)
|
||||
.normalize()
|
||||
@@ -95,7 +96,7 @@ describe('Normalization', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('works with 16-bit RGBA images', function (done) {
|
||||
it('works with 16-bit RGBA images', function (_t, done) {
|
||||
sharp(fixtures.inputPngWithTransparency16bit)
|
||||
.normalise()
|
||||
.raw()
|
||||
@@ -106,7 +107,7 @@ describe('Normalization', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle luminance range', function (done) {
|
||||
it('should handle luminance range', function (_t, done) {
|
||||
sharp(fixtures.inputJpgWithLowContrast)
|
||||
.normalise({ lower: 10, upper: 70 })
|
||||
.raw()
|
||||
|
||||
Reference in New Issue
Block a user