mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-24 16:32:29 +00:00
fix: unblock ci gates
This commit is contained in:
@@ -16,6 +16,23 @@ function makeTempDir() {
|
||||
|
||||
const mkdirSafe = mkdirSafeDir;
|
||||
|
||||
function normalizePathForAssertion(value: string | undefined): string | undefined {
|
||||
if (!value) {
|
||||
return value;
|
||||
}
|
||||
return value.replace(/\\/g, "/");
|
||||
}
|
||||
|
||||
function hasDiagnosticSourceSuffix(
|
||||
diagnostics: Array<{ source?: string }>,
|
||||
suffix: string,
|
||||
): boolean {
|
||||
const normalizedSuffix = normalizePathForAssertion(suffix);
|
||||
return diagnostics.some((entry) =>
|
||||
normalizePathForAssertion(entry.source)?.endsWith(normalizedSuffix ?? suffix),
|
||||
);
|
||||
}
|
||||
|
||||
function buildDiscoveryEnv(stateDir: string): NodeJS.ProcessEnv {
|
||||
return {
|
||||
OPENCLAW_STATE_DIR: stateDir,
|
||||
@@ -242,7 +259,9 @@ describe("discoverOpenClawPlugins", () => {
|
||||
expect(bundle?.format).toBe("bundle");
|
||||
expect(bundle?.bundleFormat).toBe("codex");
|
||||
expect(bundle?.source).toBe(bundleDir);
|
||||
expect(bundle?.rootDir).toBe(fs.realpathSync.native(bundleDir));
|
||||
expect(normalizePathForAssertion(bundle?.rootDir)).toBe(
|
||||
normalizePathForAssertion(fs.realpathSync(bundleDir)),
|
||||
);
|
||||
});
|
||||
|
||||
it("auto-detects manifestless Claude bundles from the default layout", async () => {
|
||||
@@ -296,9 +315,7 @@ describe("discoverOpenClawPlugins", () => {
|
||||
|
||||
expect(legacy).toBeDefined();
|
||||
expect(legacy?.format).toBe("openclaw");
|
||||
expect(
|
||||
result.diagnostics.some((entry) => entry.source?.endsWith(".claude-plugin/plugin.json")),
|
||||
).toBe(true);
|
||||
expect(hasDiagnosticSourceSuffix(result.diagnostics, ".claude-plugin/plugin.json")).toBe(true);
|
||||
});
|
||||
|
||||
it("falls back to legacy index discovery for configured paths with malformed bundle sidecars", async () => {
|
||||
@@ -317,9 +334,7 @@ describe("discoverOpenClawPlugins", () => {
|
||||
|
||||
expect(legacy).toBeDefined();
|
||||
expect(legacy?.format).toBe("openclaw");
|
||||
expect(
|
||||
result.diagnostics.some((entry) => entry.source?.endsWith(".codex-plugin/plugin.json")),
|
||||
).toBe(true);
|
||||
expect(hasDiagnosticSourceSuffix(result.diagnostics, ".codex-plugin/plugin.json")).toBe(true);
|
||||
});
|
||||
|
||||
it("blocks extension entries that escape package directory", async () => {
|
||||
|
||||
Reference in New Issue
Block a user