mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:00:42 +00:00
test: auto-discover vitest suites
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { runTelegramQaLive } from "../../extensions/qa-lab/src/live-transports/telegram/telegram-live.runtime.ts";
|
||||
|
||||
function parseBoolean(value: string | undefined) {
|
||||
const normalized = value?.trim().toLowerCase();
|
||||
@@ -27,10 +26,6 @@ function resolveCredentialRole(env: NodeJS.ProcessEnv) {
|
||||
return env.OPENCLAW_NPM_TELEGRAM_CREDENTIAL_ROLE ?? env.OPENCLAW_QA_CREDENTIAL_ROLE;
|
||||
}
|
||||
|
||||
function formatErrorMessage(error: unknown) {
|
||||
return error instanceof Error ? error.message : String(error);
|
||||
}
|
||||
|
||||
async function resolveTrustedOpenClawCommand(rawCommand: string) {
|
||||
if (!path.isAbsolute(rawCommand)) {
|
||||
throw new Error("OPENCLAW_NPM_TELEGRAM_SUT_COMMAND must be an absolute path.");
|
||||
@@ -56,6 +51,8 @@ async function resolveTrustedOpenClawCommand(rawCommand: string) {
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const { runTelegramQaLive } =
|
||||
await import("../../extensions/qa-lab/src/live-transports/telegram/telegram-live.runtime.ts");
|
||||
const rawSutOpenClawCommand = process.env.OPENCLAW_NPM_TELEGRAM_SUT_COMMAND?.trim();
|
||||
if (!rawSutOpenClawCommand) {
|
||||
throw new Error("Missing OPENCLAW_NPM_TELEGRAM_SUT_COMMAND.");
|
||||
@@ -92,9 +89,20 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
async function formatRunnerErrorMessage(error: unknown) {
|
||||
try {
|
||||
const { formatErrorMessage } = await import("../../dist/infra/errors.js");
|
||||
return formatErrorMessage(error);
|
||||
} catch {
|
||||
return error instanceof Error ? error.message : String(error);
|
||||
}
|
||||
}
|
||||
|
||||
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
||||
main().catch((error) => {
|
||||
process.stderr.write(`npm telegram live e2e failed: ${formatErrorMessage(error)}\n`);
|
||||
main().catch(async (error) => {
|
||||
process.stderr.write(
|
||||
`npm telegram live e2e failed: ${await formatRunnerErrorMessage(error)}\n`,
|
||||
);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user