mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:50:43 +00:00
fix(test): trust bundled plugin fixtures explicitly
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user