From f43a56fa5464605be32ff38208098094b07f3b62 Mon Sep 17 00:00:00 2001 From: kartik-mem0 Date: Mon, 20 Apr 2026 17:58:12 +0530 Subject: [PATCH] refactor: update global test setup/teardown to load SDK version and import MemoryClient dynamically --- mem0-ts/src/client/tests/integration/global-setup.ts | 5 ++++- mem0-ts/src/client/tests/integration/global-teardown.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mem0-ts/src/client/tests/integration/global-setup.ts b/mem0-ts/src/client/tests/integration/global-setup.ts index 7adae5831..66a46c371 100644 --- a/mem0-ts/src/client/tests/integration/global-setup.ts +++ b/mem0-ts/src/client/tests/integration/global-setup.ts @@ -4,12 +4,15 @@ * Runs a full project cleanup before any integration test starts, * then waits 10 seconds for the async cleanup to propagate. */ -import { MemoryClient } from "../../mem0"; export default async function globalSetup() { + const pkg = require("../../../../package.json"); + (globalThis as any).__MEM0_SDK_VERSION__ = pkg.version; + const apiKey = process.env.MEM0_API_KEY; if (!apiKey) return; // skip if no key — tests will be skipped too + const { MemoryClient } = await import("../../mem0"); const client = new MemoryClient({ apiKey }); await client.ping(); diff --git a/mem0-ts/src/client/tests/integration/global-teardown.ts b/mem0-ts/src/client/tests/integration/global-teardown.ts index 56815d556..6d3572c15 100644 --- a/mem0-ts/src/client/tests/integration/global-teardown.ts +++ b/mem0-ts/src/client/tests/integration/global-teardown.ts @@ -4,12 +4,15 @@ * Runs a full project cleanup after all integration tests complete * so no test data is left behind. */ -import { MemoryClient } from "../../mem0"; export default async function globalTeardown() { + const pkg = require("../../../../package.json"); + (globalThis as any).__MEM0_SDK_VERSION__ = pkg.version; + const apiKey = process.env.MEM0_API_KEY; if (!apiKey) return; + const { MemoryClient } = await import("../../mem0"); const client = new MemoryClient({ apiKey }); await client.ping();