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,12 +10,12 @@ const assert = require('node:assert');
|
||||
const sharp = require('../../');
|
||||
const fixtures = require('../fixtures');
|
||||
|
||||
describe('WebP', function () {
|
||||
it('WebP output', function (_t, done) {
|
||||
describe('WebP', () => {
|
||||
it('WebP output', (_t, done) => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.toFormat(sharp.format.webp)
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, data.length > 0);
|
||||
assert.strictEqual('webp', info.format);
|
||||
@@ -25,22 +25,22 @@ describe('WebP', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('Invalid WebP quality throws error', function () {
|
||||
assert.throws(function () {
|
||||
it('Invalid WebP quality throws error', () => {
|
||||
assert.throws(() => {
|
||||
sharp().webp({ quality: 101 });
|
||||
});
|
||||
});
|
||||
|
||||
it('Invalid WebP alpha quality throws error', function () {
|
||||
assert.throws(function () {
|
||||
it('Invalid WebP alpha quality throws error', () => {
|
||||
assert.throws(() => {
|
||||
sharp().webp({ alphaQuality: 101 });
|
||||
});
|
||||
});
|
||||
|
||||
it('should work for webp alpha quality', function (_t, done) {
|
||||
it('should work for webp alpha quality', (_t, done) => {
|
||||
sharp(fixtures.inputPngAlphaPremultiplicationSmall)
|
||||
.webp({ alphaQuality: 80, effort: 0 })
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, data.length > 0);
|
||||
assert.strictEqual('webp', info.format);
|
||||
@@ -48,10 +48,10 @@ describe('WebP', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('should work for webp lossless', function (_t, done) {
|
||||
it('should work for webp lossless', (_t, done) => {
|
||||
sharp(fixtures.inputPngAlphaPremultiplicationSmall)
|
||||
.webp({ lossless: true, effort: 0 })
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, data.length > 0);
|
||||
assert.strictEqual('webp', info.format);
|
||||
@@ -59,10 +59,10 @@ describe('WebP', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('should work for webp near-lossless', function (_t, done) {
|
||||
it('should work for webp near-lossless', (_t, done) => {
|
||||
sharp(fixtures.inputPngAlphaPremultiplicationSmall)
|
||||
.webp({ nearLossless: true, quality: 50, effort: 0 })
|
||||
.toBuffer(function (err50, data50, info50) {
|
||||
.toBuffer((err50, data50, info50) => {
|
||||
if (err50) throw err50;
|
||||
assert.strictEqual(true, data50.length > 0);
|
||||
assert.strictEqual('webp', info50.format);
|
||||
@@ -70,10 +70,10 @@ describe('WebP', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('should use near-lossless when both lossless and nearLossless are specified', function (_t, done) {
|
||||
it('should use near-lossless when both lossless and nearLossless are specified', (_t, done) => {
|
||||
sharp(fixtures.inputPngAlphaPremultiplicationSmall)
|
||||
.webp({ nearLossless: true, quality: 50, lossless: true, effort: 0 })
|
||||
.toBuffer(function (err50, data50, info50) {
|
||||
.toBuffer((err50, data50, info50) => {
|
||||
if (err50) throw err50;
|
||||
assert.strictEqual(true, data50.length > 0);
|
||||
assert.strictEqual('webp', info50.format);
|
||||
@@ -272,11 +272,11 @@ describe('WebP', function () {
|
||||
assert.deepStrictEqual(updated.delay, [120, 120, 90, 120, 120, 90, 120, 90, 30]);
|
||||
});
|
||||
|
||||
it('should work with streams when only animated is set', function (_t, done) {
|
||||
it('should work with streams when only animated is set', (_t, done) => {
|
||||
fs.createReadStream(fixtures.inputWebPAnimated)
|
||||
.pipe(sharp({ animated: true }))
|
||||
.webp({ lossless: true, effort: 0 })
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, data.length > 0);
|
||||
assert.strictEqual('webp', info.format);
|
||||
@@ -284,11 +284,11 @@ describe('WebP', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('should work with streams when only pages is set', function (_t, done) {
|
||||
it('should work with streams when only pages is set', (_t, done) => {
|
||||
fs.createReadStream(fixtures.inputWebPAnimated)
|
||||
.pipe(sharp({ pages: -1 }))
|
||||
.webp({ lossless: true, effort: 0 })
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, data.length > 0);
|
||||
assert.strictEqual('webp', info.format);
|
||||
|
||||
Reference in New Issue
Block a user