mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-23 17:08:10 +00:00
fix(test): restore live media harness entrypoint
This commit is contained in:
@@ -1,20 +1,8 @@
|
||||
#!/usr/bin/env -S node --import tsx
|
||||
// Test Live Media script supports OpenClaw repository automation.
|
||||
|
||||
import type { ChildProcess } from "node:child_process";
|
||||
import { createRequire } from "node:module";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { formatErrorMessage } from "../src/infra/errors.ts";
|
||||
type SpawnPnpmRunner = (params: {
|
||||
pnpmArgs: string[];
|
||||
stdio: "inherit";
|
||||
env: NodeJS.ProcessEnv;
|
||||
}) => ChildProcess;
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const { spawnPnpmRunner: _spawnPnpmRunner } = require("./pnpm-runner.mjs") as {
|
||||
spawnPnpmRunner: SpawnPnpmRunner;
|
||||
};
|
||||
import { spawnPnpmRunner as _spawnPnpmRunner } from "./pnpm-runner.mjs";
|
||||
|
||||
export type MediaSuiteId = "image" | "music" | "video";
|
||||
|
||||
@@ -114,7 +102,7 @@ function formatProviderList(providers: Iterable<string>): string {
|
||||
return [...providers].toSorted().join(", ");
|
||||
}
|
||||
|
||||
function spawnLivePnpm(params: { pnpmArgs: string[]; env: NodeJS.ProcessEnv }): ChildProcess {
|
||||
function spawnLivePnpm(params: { pnpmArgs: string[]; env: NodeJS.ProcessEnv }) {
|
||||
return _spawnPnpmRunner({
|
||||
pnpmArgs: params.pnpmArgs,
|
||||
stdio: "inherit",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Test Live Media tests cover test live media script behavior.
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
MEDIA_SUITES,
|
||||
@@ -8,6 +9,22 @@ import {
|
||||
} from "../../scripts/test-live-media.ts";
|
||||
|
||||
describe("scripts/test-live-media", () => {
|
||||
it("prints help through the real node --import tsx entrypoint", () => {
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
["--import", "tsx", "scripts/test-live-media.ts", "--help"],
|
||||
{
|
||||
cwd: process.cwd(),
|
||||
encoding: "utf8",
|
||||
},
|
||||
);
|
||||
|
||||
expect(result.status).toBe(0);
|
||||
expect(result.stdout).toContain("Media live harness");
|
||||
expect(result.stdout).toContain("pnpm test:live:media");
|
||||
expect(result.stderr).toBe("");
|
||||
});
|
||||
|
||||
it("rejects unknown global providers for the selected suites", () => {
|
||||
expect(() =>
|
||||
parseArgs(["image", "--providers", "definitely-not-a-provider", "--all-providers"]),
|
||||
|
||||
Reference in New Issue
Block a user