From 6eb5e4483de50fc2099c4a6b61bf74c71a453e37 Mon Sep 17 00:00:00 2001 From: David Snelling Date: Thu, 3 Sep 2026 09:38:26 -0700 Subject: [PATCH] test(hygiene): close the brain typeAware.bench.test.ts creates Excluded from the correctness gate (tests/performance/**, run only via npm run test:perf) but still leaked: brainMemory was created in a beforeEach with no matching afterEach. --- tests/performance/typeAware.bench.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/performance/typeAware.bench.test.ts b/tests/performance/typeAware.bench.test.ts index 72d96fe5..b1153662 100644 --- a/tests/performance/typeAware.bench.test.ts +++ b/tests/performance/typeAware.bench.test.ts @@ -17,7 +17,7 @@ * - Note limitations and edge cases */ -import { describe, it, expect, beforeEach } from 'vitest' +import { describe, it, expect, beforeEach, afterEach } from 'vitest' import { Brainy } from '../../src/brainy.js' import { TypeAwareStorageAdapter } from '../../src/storage/adapters/typeAwareStorageAdapter.js' import { FileSystemStorage } from '../../src/storage/adapters/fileSystemStorage.js' @@ -67,6 +67,10 @@ describe('TypeAware Performance Benchmarks', () => { } }) + afterEach(async () => { + await brainMemory.close() + }) + it('should measure type-based query performance', async () => { // MEASURED: Query for one type (200 entities) const start = performance.now()