mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Linter: apply all recommended biome settings
Enforces previously-skipped useArrowFunction check
This commit is contained in:
@@ -9,12 +9,12 @@ const assert = require('node:assert');
|
||||
const sharp = require('../../');
|
||||
const fixtures = require('../fixtures');
|
||||
|
||||
describe('Negate', function () {
|
||||
it('negate (jpeg)', function (_t, done) {
|
||||
describe('Negate', () => {
|
||||
it('negate (jpeg)', (_t, done) => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.negate()
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -23,11 +23,11 @@ describe('Negate', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('negate (png)', function (_t, done) {
|
||||
it('negate (png)', (_t, done) => {
|
||||
sharp(fixtures.inputPng)
|
||||
.resize(320, 240)
|
||||
.negate()
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('png', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -36,11 +36,11 @@ describe('Negate', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('negate (png, trans)', function (_t, done) {
|
||||
it('negate (png, trans)', (_t, done) => {
|
||||
sharp(fixtures.inputPngWithTransparency)
|
||||
.resize(320, 240)
|
||||
.negate()
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('png', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -49,11 +49,11 @@ describe('Negate', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('negate (png, alpha)', function (_t, done) {
|
||||
it('negate (png, alpha)', (_t, done) => {
|
||||
sharp(fixtures.inputPngWithGreyAlpha)
|
||||
.resize(320, 240)
|
||||
.negate()
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('png', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -62,11 +62,11 @@ describe('Negate', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('negate (webp)', function (_t, done) {
|
||||
it('negate (webp)', (_t, done) => {
|
||||
sharp(fixtures.inputWebP)
|
||||
.resize(320, 240)
|
||||
.negate()
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('webp', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -75,11 +75,11 @@ describe('Negate', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('negate (webp, trans)', function (_t, done) {
|
||||
it('negate (webp, trans)', (_t, done) => {
|
||||
sharp(fixtures.inputWebPWithTransparency)
|
||||
.resize(320, 240)
|
||||
.negate()
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('webp', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -88,11 +88,11 @@ describe('Negate', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('negate (true)', function (_t, done) {
|
||||
it('negate (true)', (_t, done) => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.negate(true)
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -101,22 +101,22 @@ describe('Negate', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('negate (false)', function (_t, done) {
|
||||
it('negate (false)', (_t, done) => {
|
||||
const output = fixtures.path('output.unmodified-by-negate.png');
|
||||
sharp(fixtures.inputJpgWithLowContrast)
|
||||
.negate(false)
|
||||
.toFile(output, function (err) {
|
||||
.toFile(output, (err) => {
|
||||
if (err) throw err;
|
||||
fixtures.assertMaxColourDistance(output, fixtures.inputJpgWithLowContrast, 0);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('negate ({alpha: true})', function (_t, done) {
|
||||
it('negate ({alpha: true})', (_t, done) => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.negate({ alpha: true })
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -125,11 +125,11 @@ describe('Negate', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('negate non-alpha channels (png)', function (_t, done) {
|
||||
it('negate non-alpha channels (png)', (_t, done) => {
|
||||
sharp(fixtures.inputPng)
|
||||
.resize(320, 240)
|
||||
.negate({ alpha: false })
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('png', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -138,11 +138,11 @@ describe('Negate', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('negate non-alpha channels (png, trans)', function (_t, done) {
|
||||
it('negate non-alpha channels (png, trans)', (_t, done) => {
|
||||
sharp(fixtures.inputPngWithTransparency)
|
||||
.resize(320, 240)
|
||||
.negate({ alpha: false })
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('png', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -151,11 +151,11 @@ describe('Negate', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('negate non-alpha channels (png, alpha)', function (_t, done) {
|
||||
it('negate non-alpha channels (png, alpha)', (_t, done) => {
|
||||
sharp(fixtures.inputPngWithGreyAlpha)
|
||||
.resize(320, 240)
|
||||
.negate({ alpha: false })
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('png', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -164,11 +164,11 @@ describe('Negate', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('negate non-alpha channels (webp)', function (_t, done) {
|
||||
it('negate non-alpha channels (webp)', (_t, done) => {
|
||||
sharp(fixtures.inputWebP)
|
||||
.resize(320, 240)
|
||||
.negate({ alpha: false })
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('webp', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -177,11 +177,11 @@ describe('Negate', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('negate non-alpha channels (webp, trans)', function (_t, done) {
|
||||
it('negate non-alpha channels (webp, trans)', (_t, done) => {
|
||||
sharp(fixtures.inputWebPWithTransparency)
|
||||
.resize(320, 240)
|
||||
.negate({ alpha: false })
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('webp', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -206,8 +206,8 @@ describe('Negate', function () {
|
||||
assert.deepStrictEqual({ r, g, b }, { r: 245, g: 235, b: 225 });
|
||||
});
|
||||
|
||||
it('invalid alpha value', function () {
|
||||
assert.throws(function () {
|
||||
it('invalid alpha value', () => {
|
||||
assert.throws(() => {
|
||||
sharp(fixtures.inputWebPWithTransparency).negate({ alpha: 'non-bool' });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user