From de6904cef842030155b9d9f81a8451c656d07f39 Mon Sep 17 00:00:00 2001 From: HuangWenjie Date: Thu, 7 May 2026 19:19:30 +0800 Subject: [PATCH] chore: drop test/global-setup.ts + test/vitest.d.ts Upstream removed these in commit 3f0c74fe (ladybugdb 0.16.0 upgrade). Commit 3f5d21c5 accidentally restored them during a rebase dance. --- gitnexus/test/global-setup.ts | 54 ----------------------------------- gitnexus/test/vitest.d.ts | 7 ----- 2 files changed, 61 deletions(-) delete mode 100644 gitnexus/test/global-setup.ts delete mode 100644 gitnexus/test/vitest.d.ts diff --git a/gitnexus/test/global-setup.ts b/gitnexus/test/global-setup.ts deleted file mode 100644 index f5760a1b1..000000000 --- a/gitnexus/test/global-setup.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Vitest globalSetup — runs once in the MAIN process before any forks. - * - * Creates a single shared LadybugDB with full schema so that forked test - * files only need to clear + reseed data instead of recreating the - * entire schema each time (~29 DDL queries per file eliminated). - * - * The dbPath is shared with test files via vitest's provide/inject API. - */ -import path from 'path'; -import lbug from '@ladybugdb/core'; -import type { GlobalSetupContext } from 'vitest/node'; -import { createTempDir } from './helpers/test-db.js'; -import { - NODE_SCHEMA_QUERIES, - REL_SCHEMA_QUERIES, - EMBEDDING_SCHEMA, -} from '../src/core/lbug/schema.js'; - -export default async function setup({ provide }: GlobalSetupContext) { - const tmpHandle = await createTempDir('gitnexus-shared-'); - const dbPath = path.join(tmpHandle.dbPath, 'lbug'); - - // Create DB with full schema - const db = new lbug.Database(dbPath); - const conn = new lbug.Connection(db); - - for (const q of NODE_SCHEMA_QUERIES) { - await conn.query(q); - } - for (const q of REL_SCHEMA_QUERIES) { - await conn.query(q); - } - await conn.query(EMBEDDING_SCHEMA); - - // Pre-install FTS extension so forks don't need to download it - try { - await conn.query('INSTALL fts'); - await conn.query('LOAD EXTENSION fts'); - } catch { - // FTS may already be installed system-wide — not fatal - } - - await conn.close(); - await db.close(); - - // Share the dbPath with all test files via inject('lbugDbPath') - provide('lbugDbPath', dbPath); - - // Teardown: remove temp directory after all tests complete - return async () => { - await tmpHandle.cleanup(); - }; -} diff --git a/gitnexus/test/vitest.d.ts b/gitnexus/test/vitest.d.ts deleted file mode 100644 index 63f658e6b..000000000 --- a/gitnexus/test/vitest.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import 'vitest'; - -declare module 'vitest' { - export interface ProvidedContext { - lbugDbPath: string; - } -}