Apply correct forced output when chaining #1528

This commit is contained in:
Lovell Fuller
2019-01-01 18:40:09 +00:00
parent 813831acf0
commit 30ca424942
3 changed files with 17 additions and 1 deletions

View File

@@ -1376,6 +1376,17 @@ describe('Input/output', function () {
});
});
it('Can force output format with output chaining', function () {
return sharp(fixtures.inputJpg)
.resize(320, 240)
.png({ force: true })
.jpeg({ force: false })
.toBuffer({ resolveWithObject: true })
.then(function (out) {
assert.strictEqual('png', out.info.format);
});
});
it('toFormat=JPEG takes precedence over WebP extension', function (done) {
sharp(fixtures.inputPng)
.jpeg()