mirror of
https://github.com/yuangyaa/openclaw.git
synced 2026-07-14 11:07:29 +08:00
skills: make sherpa-onnx-tts bin ESM-compatible
This commit is contained in:
committed by
Peter Steinberger
parent
a8fe8b6bf8
commit
738f5d4533
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
const fs = require("node:fs");
|
import fs from "node:fs";
|
||||||
const path = require("node:path");
|
import path from "node:path";
|
||||||
const { spawnSync } = require("node:child_process");
|
import { spawnSync } from "node:child_process";
|
||||||
|
|
||||||
function usage(message) {
|
function usage(message) {
|
||||||
if (message) {
|
if (message) {
|
||||||
|
|||||||
23
src/agents/skills.sherpa-onnx-tts-bin.test.ts
Normal file
23
src/agents/skills.sherpa-onnx-tts-bin.test.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { spawnSync } from "node:child_process";
|
||||||
|
import path from "node:path";
|
||||||
|
import { describe, expect, it } from "vitest";
|
||||||
|
|
||||||
|
describe("skills/sherpa-onnx-tts bin script", () => {
|
||||||
|
it("loads as ESM and falls through to usage output when env is missing", () => {
|
||||||
|
const scriptPath = path.resolve(
|
||||||
|
process.cwd(),
|
||||||
|
"skills",
|
||||||
|
"sherpa-onnx-tts",
|
||||||
|
"bin",
|
||||||
|
"sherpa-onnx-tts",
|
||||||
|
);
|
||||||
|
const result = spawnSync(process.execPath, [scriptPath], {
|
||||||
|
encoding: "utf8",
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(result.status).toBe(1);
|
||||||
|
expect(result.stderr).toContain("Missing runtime/model directory.");
|
||||||
|
expect(result.stderr).toContain("Usage: sherpa-onnx-tts");
|
||||||
|
expect(result.stderr).not.toContain("require is not defined in ES module scope");
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user