Skip to content

Commit e0ec42e

Browse files
committed
fix(test): restore live media harness entrypoint
1 parent a971641 commit e0ec42e

2 files changed

Lines changed: 19 additions & 14 deletions

File tree

scripts/test-live-media.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
1-
#!/usr/bin/env -S node --import tsx
21
// Test Live Media script supports OpenClaw repository automation.
32

4-
import type { ChildProcess } from "node:child_process";
5-
import { createRequire } from "node:module";
63
import { pathToFileURL } from "node:url";
74
import { formatErrorMessage } from "../src/infra/errors.ts";
8-
type SpawnPnpmRunner = (params: {
9-
pnpmArgs: string[];
10-
stdio: "inherit";
11-
env: NodeJS.ProcessEnv;
12-
}) => ChildProcess;
13-
14-
const require = createRequire(import.meta.url);
15-
const { spawnPnpmRunner: _spawnPnpmRunner } = require("./pnpm-runner.mjs") as {
16-
spawnPnpmRunner: SpawnPnpmRunner;
17-
};
5+
import { spawnPnpmRunner as _spawnPnpmRunner } from "./pnpm-runner.mjs";
186

197
export type MediaSuiteId = "image" | "music" | "video";
208

@@ -114,7 +102,7 @@ function formatProviderList(providers: Iterable<string>): string {
114102
return [...providers].toSorted().join(", ");
115103
}
116104

117-
function spawnLivePnpm(params: { pnpmArgs: string[]; env: NodeJS.ProcessEnv }): ChildProcess {
105+
function spawnLivePnpm(params: { pnpmArgs: string[]; env: NodeJS.ProcessEnv }) {
118106
return _spawnPnpmRunner({
119107
pnpmArgs: params.pnpmArgs,
120108
stdio: "inherit",

test/scripts/test-live-media.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Test Live Media tests cover test live media script behavior.
2+
import { spawnSync } from "node:child_process";
23
import { describe, expect, it } from "vitest";
34
import {
45
MEDIA_SUITES,
@@ -8,6 +9,22 @@ import {
89
} from "../../scripts/test-live-media.ts";
910

1011
describe("scripts/test-live-media", () => {
12+
it("prints help through the real node --import tsx entrypoint", () => {
13+
const result = spawnSync(
14+
process.execPath,
15+
["--import", "tsx", "scripts/test-live-media.ts", "--help"],
16+
{
17+
cwd: process.cwd(),
18+
encoding: "utf8",
19+
},
20+
);
21+
22+
expect(result.status).toBe(0);
23+
expect(result.stdout).toContain("Media live harness");
24+
expect(result.stdout).toContain("pnpm test:live:media");
25+
expect(result.stderr).toBe("");
26+
});
27+
1128
it("rejects unknown global providers for the selected suites", () => {
1229
expect(() =>
1330
parseArgs(["image", "--providers", "definitely-not-a-provider", "--all-providers"]),

0 commit comments

Comments
 (0)