Tests: ensure truncated PNG test handles possible race

This commit is contained in:
Lovell Fuller 2022-09-04 10:28:24 +01:00
parent f5109560d6
commit 9a54a034e1

View File

@ -23,7 +23,7 @@ describe('failOn', () => {
let isWarningEmitted = false;
sharp(fixtures.inputPngTruncated, { failOn: 'none' })
.on('warning', function (warning) {
assert.ok(warning.includes('not enough data') || warning.includes('end of stream'));
assert.ok(['read gave 2 warnings', 'not enough data', 'end of stream'].includes(warning));
isWarningEmitted = true;
})
.resize(32, 24)