




















@@ -50,6 +50,21 @@ function expectShellSuccess(result: ReturnType<typeof spawnSync>) {
5050expect(result.status, result.stderr || result.stdout || result.error?.message).toBe(0);
5151}
525253+function writePackageFixture(packagePath: string): void {
54+const root = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-e2e-package-"));
55+try {
56+const packageDir = path.join(root, "package");
57+fs.mkdirSync(packageDir);
58+fs.writeFileSync(
59+path.join(packageDir, "package.json"),
60+JSON.stringify({ name: "openclaw-e2e-fixture", version: "0.0.0" }),
61+);
62+execFileSync("tar", ["-czf", packagePath, "-C", root, "package"]);
63+} finally {
64+fs.rmSync(root, { force: true, recursive: true });
65+}
66+}
67+5368describe("scripts/lib/openclaw-e2e-instance.sh", () => {
5469it("sources decoded test-state scripts", () => {
5570const result = runHelper(base64('export OPENCLAW_E2E_INSTANCE_TEST="ok"\n'));
@@ -81,7 +96,7 @@ describe("scripts/lib/openclaw-e2e-instance.sh", () => {
8196const npmArgsPath = path.join(tempDir, "npm-args.txt");
8297const logPath = path.join(tempDir, "install.log");
8398const packagePath = path.join(tempDir, "openclaw.tgz");
84-fs.writeFileSync(packagePath, "");
99+writePackageFixture(packagePath);
85100fs.writeFileSync(
86101path.join(tempDir, "timeout"),
87102[
@@ -145,7 +160,7 @@ describe("scripts/lib/openclaw-e2e-instance.sh", () => {
145160const npmArgsPath = path.join(tempDir, "npm-args.txt");
146161const logPath = path.join(tempDir, "install.log");
147162const packagePath = path.join(tempDir, "openclaw.tgz");
148-fs.writeFileSync(packagePath, "");
163+writePackageFixture(packagePath);
149164fs.writeFileSync(
150165path.join(tempDir, "timeout"),
151166[
@@ -208,7 +223,7 @@ describe("scripts/lib/openclaw-e2e-instance.sh", () => {
208223const npmArgsPath = path.join(tempDir, "npm-args.txt");
209224const logPath = path.join(tempDir, "install.log");
210225const packagePath = path.join(tempDir, "openclaw.tgz");
211-fs.writeFileSync(packagePath, "");
226+writePackageFixture(packagePath);
212227fs.writeFileSync(
213228path.join(tempDir, "gtimeout"),
214229[
@@ -271,7 +286,7 @@ describe("scripts/lib/openclaw-e2e-instance.sh", () => {
271286const logPath = path.join(tempDir, "install.log");
272287const packagePath = path.join(tempDir, "openclaw.tgz");
273288const nodeBinDir = path.dirname(process.execPath);
274-fs.writeFileSync(packagePath, "");
289+writePackageFixture(packagePath);
275290fs.writeFileSync(
276291path.join(tempDir, "npm"),
277292["#!/bin/sh", "set -eu", 'printf "%s\\n" "$*" >"$OPENCLAW_TEST_NPM_ARGS"', ""].join("\n"),
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。