Improve thread-safety of error and warning message handling.

Ensures all message reading occurs before thread shutdown.
This commit is contained in:
Lovell Fuller
2026-01-20 22:23:13 +00:00
parent 66764b359b
commit af89127208
15 changed files with 71 additions and 66 deletions

View File

@@ -642,7 +642,7 @@ describe('Image metadata', () => {
});
it('keep existing ICC profile', async () => {
const data = await sharp(fixtures.inputJpgWithExif)
const data = await sharp(fixtures.inputJpgWithExif, { failOn: 'error' })
.keepIccProfile()
.toBuffer();
@@ -675,7 +675,7 @@ describe('Image metadata', () => {
});
it('keep existing ICC profile, avoid colour transform', async () => {
const [r, g, b] = await sharp(fixtures.inputPngWithProPhotoProfile)
const [r, g, b] = await sharp(fixtures.inputPngWithProPhotoProfile, { failOn: 'error' })
.keepIccProfile()
.raw()
.toBuffer();
@@ -721,7 +721,7 @@ describe('Image metadata', () => {
});
it('transform to invalid ICC profile emits warning', async () => {
const img = sharp({ create })
const img = sharp({ create, failOn: 'error' })
.png()
.withIccProfile(fixtures.path('invalid-illuminant.icc'));

View File

@@ -122,7 +122,6 @@ describe('TIFF', () => {
sharp(fixtures.inputTiff8BitDepth)
.toColourspace('b-w') // can only squash 1 band uchar images
.tiff({
bitdepth: 8,
compression: 'none',
predictor: 'none'
})
@@ -154,7 +153,7 @@ describe('TIFF', () => {
it('Invalid TIFF bitdepth value throws error', () => {
assert.throws(() => {
sharp().tiff({ bitdepth: 3 });
}, /Error: Expected 1, 2, 4 or 8 for bitdepth but received 3 of type number/);
}, /Error: Expected 1, 2 or 4 for bitdepth but received 3 of type number/);
});
it('TIFF setting xres and yres on file', () =>