From e282cb2af50c38247dc8fb928e30dae05235d0ac Mon Sep 17 00:00:00 2001 From: Shakker Date: Fri, 5 Jun 2026 02:05:18 +0100 Subject: [PATCH] test: contain media roots state env --- src/media/local-roots.test.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/media/local-roots.test.ts b/src/media/local-roots.test.ts index 10520ab57cbf..c5fd253d2e78 100644 --- a/src/media/local-roots.test.ts +++ b/src/media/local-roots.test.ts @@ -1,7 +1,8 @@ // Local media root tests cover allowed root normalization and matching. import path from "node:path"; import { pathToFileURL } from "node:url"; -import { afterEach, describe, expect, it, vi } from "vitest"; +import { describe, expect, it } from "vitest"; +import { withEnv } from "../test-utils/env.js"; import { appendLocalMediaParentRoots, buildMediaLocalRoots, @@ -16,8 +17,7 @@ function normalizeHostPath(value: string): string { describe("local media roots", () => { function withStateDir(stateDir: string, run: () => T): T { - vi.stubEnv("OPENCLAW_STATE_DIR", stateDir); - return run(); + return withEnv({ OPENCLAW_STATE_DIR: stateDir }, run); } function expectNormalizedRootsContain( @@ -73,10 +73,6 @@ describe("local media roots", () => { } } - afterEach(() => { - vi.unstubAllEnvs(); - }); - it.each([ { name: "keeps temp, media cache, canvas, and workspace roots by default",