Improve error message when attempting toFile/GIF without magick

This commit is contained in:
Lovell Fuller
2021-02-08 11:46:13 +00:00
parent 0dc325daa4
commit 7017af303d
2 changed files with 26 additions and 21 deletions

View File

@@ -63,12 +63,17 @@ describe('GIF input', () => {
);
if (!sharp.format.magick.output.buffer) {
it('GIF output should fail due to missing ImageMagick', () => {
it('GIF buffer output should fail due to missing ImageMagick', () => {
assert.throws(
() => {
sharp().gif();
},
/The gif operation requires libvips to have been installed with support for ImageMagick/
() => sharp().gif(),
/GIF output requires libvips with support for ImageMagick/
);
});
it('GIF file output should fail due to missing ImageMagick', () => {
assert.rejects(
async () => await sharp().toFile('test.gif'),
/GIF output requires libvips with support for ImageMagick/
);
});
}