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:
@@ -10,13 +10,13 @@ const fs = require('node:fs');
|
||||
const sharp = require('../../');
|
||||
const fixtures = require('../fixtures');
|
||||
|
||||
describe('Image channel insertion', function () {
|
||||
it('Grayscale to RGB, buffer', function (_t, done) {
|
||||
describe('Image channel insertion', () => {
|
||||
it('Grayscale to RGB, buffer', (_t, done) => {
|
||||
sharp(fixtures.inputPng) // gray -> red
|
||||
.resize(320, 240)
|
||||
.joinChannel(fixtures.inputPngTestJoinChannel) // new green channel
|
||||
.joinChannel(fixtures.inputPngStripesH) // new blue channel
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(320, info.width);
|
||||
assert.strictEqual(240, info.height);
|
||||
@@ -25,12 +25,12 @@ describe('Image channel insertion', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('Grayscale to RGB, file', function (_t, done) {
|
||||
it('Grayscale to RGB, file', (_t, done) => {
|
||||
sharp(fixtures.inputPng) // gray -> red
|
||||
.resize(320, 240)
|
||||
.joinChannel(fs.readFileSync(fixtures.inputPngTestJoinChannel)) // new green channel
|
||||
.joinChannel(fs.readFileSync(fixtures.inputPngStripesH)) // new blue channel
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(320, info.width);
|
||||
assert.strictEqual(240, info.height);
|
||||
@@ -39,7 +39,7 @@ describe('Image channel insertion', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('Grayscale to RGBA, buffer', function (_t, done) {
|
||||
it('Grayscale to RGBA, buffer', (_t, done) => {
|
||||
sharp(fixtures.inputPng) // gray -> red
|
||||
.resize(320, 240)
|
||||
.joinChannel([
|
||||
@@ -48,7 +48,7 @@ describe('Image channel insertion', function () {
|
||||
fixtures.inputPngStripesV
|
||||
]) // new green + blue + alpha channel
|
||||
.toColourspace(sharp.colourspace.srgb)
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(320, info.width);
|
||||
assert.strictEqual(240, info.height);
|
||||
@@ -57,7 +57,7 @@ describe('Image channel insertion', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('Grayscale to RGBA, file', function (_t, done) {
|
||||
it('Grayscale to RGBA, file', (_t, done) => {
|
||||
sharp(fixtures.inputPng) // gray -> red
|
||||
.resize(320, 240)
|
||||
.joinChannel([
|
||||
@@ -66,7 +66,7 @@ describe('Image channel insertion', function () {
|
||||
fs.readFileSync(fixtures.inputPngStripesV) // new alpha channel
|
||||
])
|
||||
.toColourspace('srgb')
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(320, info.width);
|
||||
assert.strictEqual(240, info.height);
|
||||
@@ -75,7 +75,7 @@ describe('Image channel insertion', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('Grayscale to CMYK, buffers', function (_t, done) {
|
||||
it('Grayscale to CMYK, buffers', (_t, done) => {
|
||||
sharp(fixtures.inputPng) // gray -> magenta
|
||||
.resize(320, 240)
|
||||
.joinChannel([
|
||||
@@ -85,7 +85,7 @@ describe('Image channel insertion', function () {
|
||||
])
|
||||
.toColorspace('cmyk')
|
||||
.toFormat('jpeg')
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(320, info.width);
|
||||
assert.strictEqual(240, info.height);
|
||||
@@ -94,12 +94,12 @@ describe('Image channel insertion', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('Join raw buffers to RGB', function (_t, done) {
|
||||
it('Join raw buffers to RGB', (_t, done) => {
|
||||
Promise.all([
|
||||
sharp(fixtures.inputPngTestJoinChannel).toColourspace('b-w').raw().toBuffer(),
|
||||
sharp(fixtures.inputPngStripesH).toColourspace('b-w').raw().toBuffer()
|
||||
])
|
||||
.then(function (buffers) {
|
||||
.then((buffers) => {
|
||||
sharp(fixtures.inputPng)
|
||||
.resize(320, 240)
|
||||
.joinChannel(buffers, {
|
||||
@@ -109,7 +109,7 @@ describe('Image channel insertion', function () {
|
||||
channels: 1
|
||||
}
|
||||
})
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(320, info.width);
|
||||
assert.strictEqual(240, info.height);
|
||||
@@ -117,12 +117,12 @@ describe('Image channel insertion', function () {
|
||||
fixtures.assertSimilar(fixtures.expected('joinChannel-rgb.jpg'), data, done);
|
||||
});
|
||||
})
|
||||
.catch(function (err) {
|
||||
.catch((err) => {
|
||||
throw err;
|
||||
});
|
||||
});
|
||||
|
||||
it('Grayscale to RGBA, files, two arrays', function (_t, done) {
|
||||
it('Grayscale to RGBA, files, two arrays', (_t, done) => {
|
||||
sharp(fixtures.inputPng) // gray -> red
|
||||
.resize(320, 240)
|
||||
.joinChannel([fs.readFileSync(fixtures.inputPngTestJoinChannel)]) // new green channel
|
||||
@@ -131,7 +131,7 @@ describe('Image channel insertion', function () {
|
||||
fs.readFileSync(fixtures.inputPngStripesV) // new alpha channel
|
||||
])
|
||||
.toColourspace('srgb')
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(320, info.width);
|
||||
assert.strictEqual(240, info.height);
|
||||
@@ -140,20 +140,20 @@ describe('Image channel insertion', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('Invalid raw buffer description', function () {
|
||||
assert.throws(function () {
|
||||
it('Invalid raw buffer description', () => {
|
||||
assert.throws(() => {
|
||||
sharp().joinChannel(fs.readFileSync(fixtures.inputPng), { raw: {} });
|
||||
});
|
||||
});
|
||||
|
||||
it('Invalid input', function () {
|
||||
assert.throws(function () {
|
||||
it('Invalid input', () => {
|
||||
assert.throws(() => {
|
||||
sharp(fixtures.inputJpg).joinChannel(1);
|
||||
});
|
||||
});
|
||||
|
||||
it('No arguments', function () {
|
||||
assert.throws(function () {
|
||||
it('No arguments', () => {
|
||||
assert.throws(() => {
|
||||
sharp(fixtures.inputJpg).joinChannel();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user