fix(test): trust bundled plugin fixtures explicitly

This commit is contained in:
Vincent Koc
2026-04-28 11:57:50 -07:00
parent 0311e172e0
commit b014462690

View File

@@ -33,6 +33,7 @@ export function mkdirSafe(dir: string) {
const fixtureRoot = mkdtempSafe(path.join(os.tmpdir(), "openclaw-plugin-"));
let tempDirIndex = 0;
const prevBundledDir = process.env.OPENCLAW_BUNDLED_PLUGINS_DIR;
const prevDisableBundledPlugins = process.env.OPENCLAW_DISABLE_BUNDLED_PLUGINS;
const prevPluginStageDir = process.env.OPENCLAW_PLUGIN_STAGE_DIR;
export const EMPTY_PLUGIN_SCHEMA = {
@@ -105,7 +106,8 @@ export function writePlugin(params: {
}
export function useNoBundledPlugins() {
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = "/nonexistent/bundled/plugins";
process.env.OPENCLAW_DISABLE_BUNDLED_PLUGINS = "1";
delete process.env.OPENCLAW_BUNDLED_PLUGINS_DIR;
}
export function loadBundleFixture(params: {
@@ -148,6 +150,11 @@ export function resetPluginLoaderTestStateForTest() {
} else {
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = prevBundledDir;
}
if (prevDisableBundledPlugins === undefined) {
delete process.env.OPENCLAW_DISABLE_BUNDLED_PLUGINS;
} else {
process.env.OPENCLAW_DISABLE_BUNDLED_PLUGINS = prevDisableBundledPlugins;
}
if (prevPluginStageDir === undefined) {
delete process.env.OPENCLAW_PLUGIN_STAGE_DIR;
} else {
@@ -161,4 +168,9 @@ export function cleanupPluginLoaderFixturesForTest() {
} catch {
// ignore cleanup failures in tests
}
if (prevDisableBundledPlugins === undefined) {
delete process.env.OPENCLAW_DISABLE_BUNDLED_PLUGINS;
} else {
process.env.OPENCLAW_DISABLE_BUNDLED_PLUGINS = prevDisableBundledPlugins;
}
}