diff --git a/test/release-check.test.ts b/test/release-check.test.ts
index 9233ffd5da3a..add6ad72cb7c 100644
--- a/test/release-check.test.ts
+++ b/test/release-check.test.ts
@@ -42,6 +42,7 @@ import {
LOCAL_BUILD_METADATA_DIST_PATHS,
PACKAGE_DIST_INVENTORY_RELATIVE_PATH,
} from "../src/infra/package-dist-inventory.ts";
+import { withEnv } from "../src/test-utils/env.js";
function makeItem(shortVersion: string, sparkleVersion: string): string {
return `- ${shortVersion}${shortVersion}${sparkleVersion}
`;
@@ -52,24 +53,7 @@ function makePackResult(filename: string, unpackedSize: number) {
}
function withProcessEnv(env: Record, callback: () => T): T {
- const previous = new Map();
- for (const key of Object.keys(env)) {
- previous.set(key, process.env[key]);
- }
- for (const [key, value] of Object.entries(env)) {
- process.env[key] = value;
- }
- try {
- return callback();
- } finally {
- for (const [key, value] of previous) {
- if (value === undefined) {
- delete process.env[key];
- } else {
- process.env[key] = value;
- }
- }
- }
+ return withEnv(env, callback);
}
const requiredPluginSdkPackPaths = [...listPluginSdkDistArtifacts(), "dist/plugin-sdk/compat.js"];