Skip to content

Commit 5b93361

Browse files
fix unit test timout
1 parent 1fbac96 commit 5b93361

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

apps/sim/lib/copilot/vfs/file-reader.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
3135
describe('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(/^image\/(jpeg|webp|png)$/)
93-
})
97+
}, SHARP_TEST_TIMEOUT_MS)
9498
})

0 commit comments

Comments
 (0)