mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Ensure all Error objects contain a stack prop #3653
This commit is contained in:
@@ -690,11 +690,25 @@ describe('Image Stats', function () {
|
||||
it('File input with corrupt header fails gracefully', function (done) {
|
||||
sharp(fixtures.inputJpgWithCorruptHeader)
|
||||
.stats(function (err) {
|
||||
assert.strictEqual(true, !!err);
|
||||
assert(err.message.includes('Input file has corrupt header'));
|
||||
assert(err.stack.includes('at Sharp.stats'));
|
||||
assert(err.stack.includes(__filename));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('Stream input with corrupt header fails gracefully', function (done) {
|
||||
fs.createReadStream(fixtures.inputJpgWithCorruptHeader).pipe(
|
||||
sharp()
|
||||
.stats(function (err) {
|
||||
assert(err.message.includes('Input buffer has corrupt header'));
|
||||
assert(err.stack.includes('at Sharp.stats'));
|
||||
assert(err.stack.includes(__filename));
|
||||
done();
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('File input with corrupt header fails gracefully, Promise out', function () {
|
||||
return sharp(fixtures.inputJpgWithCorruptHeader)
|
||||
.stats().then(function (stats) {
|
||||
|
||||
Reference in New Issue
Block a user