test: harden plugin env-scoped fixtures

This commit is contained in:
Peter Steinberger
2026-03-13 03:01:03 +00:00
parent 08da1b47ba
commit 21fa50f564
5 changed files with 12 additions and 1 deletions

View File

@@ -41,7 +41,10 @@ describe("config plugin validation", () => {
const suiteEnv = () =>
({
...process.env,
HOME: suiteHome,
OPENCLAW_HOME: undefined,
OPENCLAW_STATE_DIR: path.join(suiteHome, ".openclaw"),
CLAWDBOT_STATE_DIR: undefined,
OPENCLAW_PLUGIN_MANIFEST_CACHE_MS: "10000",
}) satisfies NodeJS.ProcessEnv;

View File

@@ -214,6 +214,7 @@ describe("applyPluginAutoEnable", () => {
},
env: {
...process.env,
OPENCLAW_HOME: undefined,
OPENCLAW_STATE_DIR: stateDir,
CLAWDBOT_STATE_DIR: undefined,
OPENCLAW_BUNDLED_PLUGINS_DIR: "/nonexistent/bundled/plugins",
@@ -439,6 +440,7 @@ describe("applyPluginAutoEnable", () => {
config: makeApnChannelConfig(),
env: {
...process.env,
OPENCLAW_HOME: undefined,
OPENCLAW_STATE_DIR: stateDir,
CLAWDBOT_STATE_DIR: undefined,
OPENCLAW_BUNDLED_PLUGINS_DIR: "/nonexistent/bundled/plugins",

View File

@@ -16,9 +16,9 @@ function makeTempDir() {
function buildDiscoveryEnv(stateDir: string): NodeJS.ProcessEnv {
return {
...process.env,
OPENCLAW_STATE_DIR: stateDir,
CLAWDBOT_STATE_DIR: undefined,
OPENCLAW_HOME: undefined,
OPENCLAW_BUNDLED_PLUGINS_DIR: "/nonexistent/bundled/plugins",
};
}

View File

@@ -540,6 +540,7 @@ describe("loadOpenClawPlugins", () => {
env: {
...process.env,
HOME: homeA,
OPENCLAW_HOME: undefined,
OPENCLAW_STATE_DIR: stateDir,
OPENCLAW_BUNDLED_PLUGINS_DIR: bundledDir,
},
@@ -549,6 +550,7 @@ describe("loadOpenClawPlugins", () => {
env: {
...process.env,
HOME: homeB,
OPENCLAW_HOME: undefined,
OPENCLAW_STATE_DIR: stateDir,
OPENCLAW_BUNDLED_PLUGINS_DIR: bundledDir,
},
@@ -679,6 +681,7 @@ describe("loadOpenClawPlugins", () => {
env: {
...process.env,
HOME: homeDir,
OPENCLAW_HOME: undefined,
OPENCLAW_BUNDLED_PLUGINS_DIR: override,
},
config: {
@@ -1814,6 +1817,7 @@ describe("loadOpenClawPlugins", () => {
cwd: process.cwd(),
env: {
...process.env,
OPENCLAW_HOME: undefined,
OPENCLAW_BUNDLED_PLUGINS_DIR: "/nonexistent/bundled/plugins",
},
encoding: "utf-8",

View File

@@ -346,6 +346,7 @@ describe("loadPluginManifestRegistry", () => {
env: {
...process.env,
HOME: homeA,
OPENCLAW_HOME: undefined,
OPENCLAW_STATE_DIR: path.join(homeA, ".state"),
},
});
@@ -355,6 +356,7 @@ describe("loadPluginManifestRegistry", () => {
env: {
...process.env,
HOME: homeB,
OPENCLAW_HOME: undefined,
OPENCLAW_STATE_DIR: path.join(homeB, ".state"),
},
});