Skip to content

Commit fd782a8

Browse files
committed
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
1 parent f424458 commit fd782a8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/memory/__tests__/knowledge-graph.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ describe('KnowledgeGraphManager', () => {
146146
});
147147

148148
it('should throw error for non-existent entity', async () => {
149-
await expect(
150-
manager.addObservations([
149+
await expect(async () => {
150+
await manager.addObservations([
151151
{ entityName: 'NonExistent', contents: ['some observation'] },
152-
])
153-
).rejects.toThrow('Entity with name NonExistent not found');
152+
]);
153+
}).rejects.toThrow('Entity with name NonExistent not found');
154154
});
155155
});
156156

0 commit comments

Comments
 (0)