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,20 +1,21 @@
|
||||
// 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('../../');
|
||||
const fixtures = require('../fixtures');
|
||||
|
||||
describe('Colour space conversion', function () {
|
||||
it('To greyscale', function (done) {
|
||||
it('To greyscale', function (_t, done) {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.greyscale()
|
||||
.toFile(fixtures.path('output.greyscale-gamma-0.0.jpg'), done);
|
||||
});
|
||||
|
||||
it('To greyscale with gamma correction', function (done) {
|
||||
it('To greyscale with gamma correction', function (_t, done) {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.gamma()
|
||||
@@ -22,14 +23,14 @@ describe('Colour space conversion', function () {
|
||||
.toFile(fixtures.path('output.greyscale-gamma-2.2.jpg'), done);
|
||||
});
|
||||
|
||||
it('Not to greyscale', function (done) {
|
||||
it('Not to greyscale', function (_t, done) {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.greyscale(false)
|
||||
.toFile(fixtures.path('output.greyscale-not.jpg'), done);
|
||||
});
|
||||
|
||||
it('Greyscale with single channel output', function (done) {
|
||||
it('Greyscale with single channel output', function (_t, done) {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.greyscale()
|
||||
@@ -53,7 +54,7 @@ describe('Colour space conversion', function () {
|
||||
assert.strictEqual(format, 'webp');
|
||||
});
|
||||
|
||||
it('From CMYK to sRGB', function (done) {
|
||||
it('From CMYK to sRGB', function (_t, done) {
|
||||
sharp(fixtures.inputJpgWithCmykProfile)
|
||||
.resize(320)
|
||||
.toBuffer(function (err, data, info) {
|
||||
@@ -65,7 +66,7 @@ describe('Colour space conversion', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('From CMYK to sRGB with white background, not yellow', function (done) {
|
||||
it('From CMYK to sRGB with white background, not yellow', function (_t, done) {
|
||||
sharp(fixtures.inputJpgWithCmykProfile)
|
||||
.resize(320, 240, {
|
||||
fit: sharp.fit.contain,
|
||||
@@ -80,7 +81,7 @@ describe('Colour space conversion', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('From profile-less CMYK to sRGB', function (done) {
|
||||
it('From profile-less CMYK to sRGB', function (_t, done) {
|
||||
sharp(fixtures.inputJpgWithCmykNoProfile)
|
||||
.resize(320)
|
||||
.toBuffer(function (err, data, info) {
|
||||
@@ -120,7 +121,7 @@ describe('Colour space conversion', function () {
|
||||
);
|
||||
});
|
||||
|
||||
it('CMYK profile to CMYK profile with negate', (done) => {
|
||||
it('CMYK profile to CMYK profile with negate', (_t, done) => {
|
||||
sharp(fixtures.inputTiffFogra)
|
||||
.resize(320, 240)
|
||||
.toColourspace('cmyk')
|
||||
@@ -141,7 +142,7 @@ describe('Colour space conversion', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('From sRGB with RGB16 pipeline, resize with gamma, to sRGB', function (done) {
|
||||
it('From sRGB with RGB16 pipeline, resize with gamma, to sRGB', function (_t, done) {
|
||||
sharp(fixtures.inputPngGradients)
|
||||
.pipelineColourspace('rgb16')
|
||||
.resize(320)
|
||||
|
||||
Reference in New Issue
Block a user