From fd782a8921ee31b6a69472340c942fe4a4862b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yusufhan=20Sa=C3=A7ak?= Date: Fri, 10 Apr 2026 13:27:33 +0300 Subject: [PATCH] fix(memory): resolve Vitest false positive for expected rejection Wrap the addObservations call in an async closure before asserting with .rejects.toThrow(). This prevents Vitest's global unhandled rejection handler from capturing the expected error before the assertion can intercept it, eliminating the false-positive "Unhandled Errors" warning that was failing CI. Fixes #3073 --- src/memory/__tests__/knowledge-graph.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/memory/__tests__/knowledge-graph.test.ts b/src/memory/__tests__/knowledge-graph.test.ts index 236242413a..628ca567ee 100644 --- a/src/memory/__tests__/knowledge-graph.test.ts +++ b/src/memory/__tests__/knowledge-graph.test.ts @@ -146,11 +146,11 @@ describe('KnowledgeGraphManager', () => { }); it('should throw error for non-existent entity', async () => { - await expect( - manager.addObservations([ + await expect(async () => { + await manager.addObservations([ { entityName: 'NonExistent', contents: ['some observation'] }, - ]) - ).rejects.toThrow('Entity with name NonExistent not found'); + ]); + }).rejects.toThrow('Entity with name NonExistent not found'); }); });