Remove previously-deprecated properties from API

This commit is contained in:
Lovell Fuller
2025-12-29 13:04:27 +00:00
parent 937167933b
commit 1b2f79335d
13 changed files with 31 additions and 134 deletions

View File

@@ -54,23 +54,6 @@ describe('failOn', () => {
);
});
it('deprecated failOnError', () => {
assert.doesNotThrow(
() => sharp({ failOnError: true })
);
assert.doesNotThrow(
() => sharp({ failOnError: false })
);
assert.throws(
() => sharp({ failOnError: 'zoinks' }),
/Expected boolean for failOnError but received zoinks of type string/
);
assert.throws(
() => sharp({ failOnError: 1 }),
/Expected boolean for failOnError but received 1 of type number/
);
});
it('returns errors to callback for truncated JPEG', (_t, done) => {
sharp(fixtures.inputJpgTruncated, { failOn: 'truncated' }).toBuffer((err, data, info) => {
assert.ok(err.message.includes('VipsJpeg: premature end of'), err);

View File

@@ -154,7 +154,6 @@ describe('PNG', () => {
isProgressive: false,
isPalette: true,
bitsPerSample: 8,
paletteBitDepth: 8,
hasProfile: false,
hasAlpha: false
});
@@ -226,11 +225,10 @@ describe('PNG', () => {
.png({ colours: 2, palette: false })
.toBuffer();
const { channels, isPalette, bitsPerSample, paletteBitDepth, space } = await sharp(data).metadata();
const { channels, isPalette, bitsPerSample, space } = await sharp(data).metadata();
assert.strictEqual(channels, 1);
assert.strictEqual(isPalette, false);
assert.strictEqual(bitsPerSample, 1);
assert.strictEqual(paletteBitDepth, undefined);
assert.strictEqual(space, 'b-w');
});

View File

@@ -94,24 +94,6 @@ describe('Sharpen', () => {
});
});
it('invalid sigma', () => {
assert.throws(() => {
sharp(fixtures.inputJpg).sharpen(-1.5);
});
});
it('invalid flat', () => {
assert.throws(() => {
sharp(fixtures.inputJpg).sharpen(1, -1);
});
});
it('invalid jagged', () => {
assert.throws(() => {
sharp(fixtures.inputJpg).sharpen(1, 1, -1);
});
});
it('invalid options.sigma', () => assert.throws(
() => sharp().sharpen({ sigma: -1 }),
/Expected number between 0\.000001 and 10 for options\.sigma but received -1 of type number/
@@ -144,24 +126,23 @@ describe('Sharpen', () => {
it('sharpened image is larger than non-sharpened', (_t, done) => {
sharp(fixtures.inputJpg)
.resize(320, 240)
.sharpen(false)
.resize(32, 24)
.toBuffer((err, notSharpened, info) => {
if (err) throw err;
assert.strictEqual(true, notSharpened.length > 0);
assert.strictEqual('jpeg', info.format);
assert.strictEqual(320, info.width);
assert.strictEqual(240, info.height);
assert.strictEqual(32, info.width);
assert.strictEqual(24, info.height);
sharp(fixtures.inputJpg)
.resize(320, 240)
.sharpen(true)
.resize(32, 24)
.sharpen()
.toBuffer((err, sharpened, info) => {
if (err) throw err;
assert.strictEqual(true, sharpened.length > 0);
assert.strictEqual(true, sharpened.length > notSharpened.length);
assert.strictEqual('jpeg', info.format);
assert.strictEqual(320, info.width);
assert.strictEqual(240, info.height);
assert.strictEqual(32, info.width);
assert.strictEqual(24, info.height);
done();
});
});