From 7f588ea5794af8ebaabe8fb79415bfa1cbf064cd Mon Sep 17 00:00:00 2001 From: "burrito.space" Date: Thu, 21 May 2026 19:27:07 +0200 Subject: [PATCH] fix(tests): correct stale projectRoot path in entity unit tests apps/desktop/main/entities.test.ts and entity-frecency.test.ts computed projectRoot as resolve(__dirname, '..', '..', '..') from __dirname = apps/desktop/dist/main/, which resolves to apps/. The dynamic import then looked for apps/features/entities/extractors/ regex.js -- a path that does not exist. Correct location is apps/desktop/features/entities/extractors/regex.js. Drop one .. so projectRoot resolves to apps/desktop/ and the dynamic imports resolve to the real files. Pre-fix: ERR_MODULE_NOT_FOUND aborts yarn test:unit early; the two files together host ~320 it() calls, all blocked. Post-fix: yarn test:unit runs the full ~1850 main-process unit tests. --- apps/desktop/main/entities.test.ts | 2 +- apps/desktop/main/entity-frecency.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/desktop/main/entities.test.ts b/apps/desktop/main/entities.test.ts index 3bc0f6b7..14f92a75 100644 --- a/apps/desktop/main/entities.test.ts +++ b/apps/desktop/main/entities.test.ts @@ -15,7 +15,7 @@ import { resolve, dirname } from 'path'; import { fileURLToPath } from 'url'; const __dirname = dirname(fileURLToPath(import.meta.url)); -const projectRoot = resolve(__dirname, '..', '..', '..'); +const projectRoot = resolve(__dirname, '..', '..'); const extensionsDir = resolve(projectRoot, 'features', 'entities'); // Module references loaded in before() diff --git a/apps/desktop/main/entity-frecency.test.ts b/apps/desktop/main/entity-frecency.test.ts index dd3171b8..daa486ac 100644 --- a/apps/desktop/main/entity-frecency.test.ts +++ b/apps/desktop/main/entity-frecency.test.ts @@ -16,7 +16,7 @@ import { resolve, dirname } from 'path'; import { fileURLToPath } from 'url'; const __dirname = dirname(fileURLToPath(import.meta.url)); -const projectRoot = resolve(__dirname, '..', '..', '..'); +const projectRoot = resolve(__dirname, '..', '..'); // Module references loaded in before() let calculateFrecency: (frequency: number, lastUsed: number) => number; -- 2.51.2