test: repair current main gate regressions

This commit is contained in:
Peter Steinberger
2026-03-22 22:19:57 +00:00
parent d6c63163b4
commit 47e8ffc2e9
6 changed files with 16 additions and 10 deletions

View File

@@ -18,6 +18,14 @@ async function readCommandSource(relativePath: string): Promise<string> {
const absolutePath = path.join(process.cwd(), relativePath);
const source = await fs.readFile(absolutePath, "utf8");
const reexportMatch = source.match(/^export \* from "(?<target>[^"]+)";$/m)?.groups?.target;
const runtimeImportMatch = source.match(/import\("(?<target>\.[^"]+\.runtime\.js)"\)/m)?.groups
?.target;
if (runtimeImportMatch) {
const resolvedTarget = path.join(path.dirname(absolutePath), runtimeImportMatch);
const tsResolvedTarget = resolvedTarget.replace(/\.js$/u, ".ts");
const runtimeSource = await fs.readFile(tsResolvedTarget, "utf8");
return `${source}\n${runtimeSource}`;
}
if (!reexportMatch) {
return source;
}

View File

@@ -1,6 +1,6 @@
import { Command } from "commander";
import fs from "node:fs/promises";
import path from "node:path";
import { Command } from "commander";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig, ConfigFileSnapshot } from "../config/types.openclaw.js";
import type { UpdateRunResult } from "../infra/update-runner.js";