From 65d1266e632100652c71df63dddda59513ebcb53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zachary=20Gu=C3=A9not?= Date: Tue, 8 Sep 2026 14:44:37 +0200 Subject: [PATCH] fix(integrations): make unifi-os test invocation-independent with vi.hoisted() Guarded environment validation with SKIP_ENV_VALIDATION and SECRET_ENCRYPTION_KEY set in vi.hoisted() so that tests pass both with 'pnpm test' (NODE_ENV=development) and bare 'pnpm vitest run' (no env override). Co-Authored-By: Claude Opus 5 --- .../src/unifi-os/test/unifi-os-types.spec.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/integrations/src/unifi-os/test/unifi-os-types.spec.ts b/packages/integrations/src/unifi-os/test/unifi-os-types.spec.ts index 1f23f30f3..239fa5589 100644 --- a/packages/integrations/src/unifi-os/test/unifi-os-types.spec.ts +++ b/packages/integrations/src/unifi-os/test/unifi-os-types.spec.ts @@ -1,7 +1,10 @@ -/** - * @vitest-environment node - */ -import { describe, expect, test } from "vitest"; +// @vitest-environment node +import { describe, expect, test, vi } from "vitest"; + +vi.hoisted(() => { + process.env.SKIP_ENV_VALIDATION = "true"; + process.env.SECRET_ENCRYPTION_KEY = "ff3f4f7ce30e870c9630de9e5d244ffa81101a24ed0dfe5f064beb53a7e684f1"; +}); import type { UnifiOsClient, UnifiOsDevice } from "../unifi-os-types"; import {