mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 11:34:46 +00:00
fix: restore ci gates on main
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import path from "node:path";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { clearRuntimeConfigSnapshot, setRuntimeConfigSnapshot } from "../config/config.js";
|
||||
import {
|
||||
@@ -15,20 +16,32 @@ import {
|
||||
} from "./test-helpers/temp-plugin-extension-fixtures.js";
|
||||
|
||||
const originalBundledPluginsDir = process.env.OPENCLAW_BUNDLED_PLUGINS_DIR;
|
||||
const originalDisableBundledPlugins = process.env.OPENCLAW_DISABLE_BUNDLED_PLUGINS;
|
||||
const tempDirs: string[] = [];
|
||||
|
||||
function createTempDir(): string {
|
||||
return createTempPluginDir(tempDirs, "openclaw-codex-ext-");
|
||||
}
|
||||
|
||||
function createBundledTempDir(): string {
|
||||
delete process.env.OPENCLAW_DISABLE_BUNDLED_PLUGINS;
|
||||
return createTempPluginDir(tempDirs, "openclaw-codex-ext-", {
|
||||
parentDir: path.join(process.cwd(), "dist-runtime", "extensions"),
|
||||
});
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
clearRuntimeConfigSnapshot();
|
||||
cleanupTempPluginTestEnvironment(tempDirs, originalBundledPluginsDir);
|
||||
cleanupTempPluginTestEnvironment(
|
||||
tempDirs,
|
||||
originalBundledPluginsDir,
|
||||
originalDisableBundledPlugins,
|
||||
);
|
||||
});
|
||||
|
||||
describe("agent tool result middleware", () => {
|
||||
it("includes plugin-registered middleware and restores it from cache", async () => {
|
||||
const tmp = createTempDir();
|
||||
const tmp = createBundledTempDir();
|
||||
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = tmp;
|
||||
|
||||
writeTempPlugin({
|
||||
@@ -81,7 +94,7 @@ describe("agent tool result middleware", () => {
|
||||
});
|
||||
|
||||
it("rejects middleware when the manifest omits the runtime contract", () => {
|
||||
const tmp = createTempDir();
|
||||
const tmp = createBundledTempDir();
|
||||
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = tmp;
|
||||
|
||||
writeTempPlugin({
|
||||
@@ -158,7 +171,7 @@ describe("agent tool result middleware", () => {
|
||||
});
|
||||
|
||||
it("merges runtimes when a plugin registers the same middleware function twice", () => {
|
||||
const tmp = createTempDir();
|
||||
const tmp = createBundledTempDir();
|
||||
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = tmp;
|
||||
|
||||
writeTempPlugin({
|
||||
@@ -194,7 +207,7 @@ export default { id: "tool-result-middleware", register(api) {
|
||||
});
|
||||
|
||||
it("lazily loads bundled middleware owners from manifest contracts", async () => {
|
||||
const tmp = createTempDir();
|
||||
const tmp = createBundledTempDir();
|
||||
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = tmp;
|
||||
|
||||
writeTempPlugin({
|
||||
@@ -246,7 +259,7 @@ export default { id: "tool-result-middleware", register(api) {
|
||||
|
||||
describe("Codex app-server extension factories", () => {
|
||||
it("includes plugin-registered Codex app-server extension factories and restores them from cache", async () => {
|
||||
const tmp = createTempDir();
|
||||
const tmp = createBundledTempDir();
|
||||
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = tmp;
|
||||
|
||||
writeTempPlugin({
|
||||
@@ -337,7 +350,7 @@ describe("Codex app-server extension factories", () => {
|
||||
});
|
||||
|
||||
it("rejects bundled plugins that omit the Codex app-server extension contract", () => {
|
||||
const tmp = createTempDir();
|
||||
const tmp = createBundledTempDir();
|
||||
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = tmp;
|
||||
|
||||
writeTempPlugin({
|
||||
@@ -373,7 +386,7 @@ describe("Codex app-server extension factories", () => {
|
||||
});
|
||||
|
||||
it("rejects non-function Codex app-server extension factories from bundled plugins", () => {
|
||||
const tmp = createTempDir();
|
||||
const tmp = createBundledTempDir();
|
||||
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = tmp;
|
||||
|
||||
writeTempPlugin({
|
||||
|
||||
Reference in New Issue
Block a user