From bd416b0190fcd486eddfc7b26c47bc816fa0cdb5 Mon Sep 17 00:00:00 2001 From: KernelDeimos <7225168+KernelDeimos@users.noreply.github.com> Date: Mon, 12 Jan 2026 18:42:04 -0500 Subject: [PATCH] test: ensure `kv` global is always available This is comitted separately from the commit for AppService.comp.test.js that will follow because it interacts with all other test cases. It did not cause any issue based on what I observed, but I'm still wrapping it in a separate commit in case we need to revert or change it later. --- src/backend/vitest.config.ts | 2 +- src/backend/vitest.setup.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 src/backend/vitest.setup.js diff --git a/src/backend/vitest.config.ts b/src/backend/vitest.config.ts index 0a2b29318..628a4f957 100644 --- a/src/backend/vitest.config.ts +++ b/src/backend/vitest.config.ts @@ -5,7 +5,7 @@ import { defineConfig } from 'vitest/config'; export default defineConfig(({ mode }) => ({ test: { globals: true, - setupFiles: [], + setupFiles: ['./vitest.setup.js'], coverage: { provider: 'v8', reporter: ['text', 'json', 'json-summary', 'html', 'lcov'], diff --git a/src/backend/vitest.setup.js b/src/backend/vitest.setup.js new file mode 100644 index 000000000..233c04177 --- /dev/null +++ b/src/backend/vitest.setup.js @@ -0,0 +1,5 @@ +// Vitest setup file - runs before all test files +// Initializes globalThis.kv which is required by PermissionService and other services + +import { kv } from './src/util/kvSingleton'; +globalThis.kv = kv;