@@ -28,6 +28,10 @@ async function makeNoisePng(width: number, height: number): Promise<Buffer> {
2828 . toBuffer ( )
2929}
3030
31+ // Both tests do real sharp work (encode + metadata read) that can exceed the
32+ // default 10s timeout when CI runs them alongside thousands of other tests.
33+ const SHARP_TEST_TIMEOUT_MS = 30_000
34+
3135describe ( 'readFileRecord' , ( ) => {
3236 it ( 'returns small images as attachments without resize note' , async ( ) => {
3337 const sharp = ( await import ( 'sharp' ) ) . default
@@ -62,7 +66,7 @@ describe('readFileRecord', () => {
6266 expect ( result ?. attachment ?. source . media_type ) . toBe ( 'image/png' )
6367 expect ( result ?. content ) . not . toContain ( 'resized for vision' )
6468 expect ( Buffer . from ( result ?. attachment ?. source . data ?? '' , 'base64' ) ) . toEqual ( smallPng )
65- } )
69+ } , SHARP_TEST_TIMEOUT_MS )
6670
6771 it ( 'downscales oversized images into attachments that fit the read limit' , async ( ) => {
6872 const largePng = await makeNoisePng ( 1800 , 1800 )
@@ -90,5 +94,5 @@ describe('readFileRecord', () => {
9094 const decoded = Buffer . from ( result ?. attachment ?. source . data ?? '' , 'base64' )
9195 expect ( decoded . length ) . toBeLessThanOrEqual ( MAX_IMAGE_READ_BYTES )
9296 expect ( result ?. attachment ?. source . media_type ) . toMatch ( / ^ i m a g e \/ ( j p e g | w e b p | p n g ) $ / )
93- } )
97+ } , SHARP_TEST_TIMEOUT_MS )
9498} )
0 commit comments