openpetswithchatandmcp/apps/desktop/scripts/run-tests.mjs
OpenPets Dev bb758e9d0f feat(desktop): add Text-to-Speech Phase 2 and update docs/registry
- Add configurable TTS providers: system OS voice, OpenAI TTS, ElevenLabs,
  Piper (local), and OpenAI-compatible (OpenRouter/LiteLLM/WaveSpeedAI/custom).
- Add secure TTS credential storage, endpoint presets, voice/model/speed UI,
  and test/stop controls in Settings.
- Wire TTS to pet/floating-chat renderer via openpets:tts-speak/audio/stop IPC.
- Respect quiet hours; validate cloud endpoints and returned audio buffers.
- Add plugin voice:speak bridge and tts-engine unit tests.
- Update FEATURES.md, FEATURES_OUR_CHANGES.md, README.md, README_OUR_CHANGES.md,
  PULL_REQUEST.md, FEATURE_REGISTRY.md, and add docs/pull-requests/PR_TTS_PHASE_2.md.
2026-06-16 18:40:52 +00:00

95 lines
3.1 KiB
JavaScript

#!/usr/bin/env node
/**
* Desktop test runner
* Runs preload checks, builds and runs behavior tests, contract tests, then remaining dist checks.
*/
import { spawn } from "node:child_process";
import { fileURLToPath } from "node:url";
import { dirname, join } from "node:path";
const __dirname = dirname(fileURLToPath(import.meta.url));
const rootDir = join(__dirname, "..");
const preloadChecks = ["control-center-preload.cjs", "pet-preload.cjs", "plugin-sdk-preload.cjs", "panel-preload.cjs"];
const behaviorTests = [
".test-dist/tests/lease-manager.test.js",
".test-dist/tests/default-pet-external-show.test.js",
".test-dist/tests/onboarding-state.test.js",
".test-dist/tests/update-version.test.js",
".test-dist/tests/reaction-animation-mapping.test.js",
".test-dist/tests/zip-safety.test.js",
".test-dist/tests/tts-engine.test.js",
".test-dist/tests/codex-pets.test.js",
".test-dist/tests/claude-memory.test.js",
".test-dist/tests/prompt-memory-extraction.test.js",
".test-dist/tests/knowledge-store.test.js",
".test-dist/tests/plugin-config.test.js",
".test-dist/tests/plugin-state.test.js",
".test-dist/tests/plugin-runtime.test.js",
".test-dist/tests/plugin-catalog-validation.test.js",
".test-dist/tests/plugin-package.test.js",
".test-dist/tests/plugin-service.test.js",
".test-dist/tests/plugin-ui-static.test.js",
".test-dist/tests/plugin-bridge-fuzz.test.js",
];
const contractTests = [
".test-dist/contracts/local-ipc-protocol.contract.js",
".test-dist/contracts/catalog-fixture.contract.js",
".test-dist/contracts/plugin-manifest.contract.js",
];
const distChecks = [
"dist/check-opencode-desktop-setup.js",
"dist/check-cursor-desktop.js",
"dist/check-packaging-contract.js",
];
function run(command, args = [], options = {}) {
return new Promise((resolve, reject) => {
const child = spawn(command, args, {
stdio: "inherit",
cwd: rootDir,
env: { ...process.env, OPENPETS_DESKTOP_ROOT: rootDir },
...options,
});
child.on("close", (code) => {
if (code !== 0) {
reject(new Error(`Command failed with exit code ${code}: ${command} ${args.join(" ")}`));
} else {
resolve();
}
});
child.on("error", reject);
});
}
async function main() {
// 1. Preload syntax checks
console.log("\n[1/5] Checking preload syntax...");
for (const preload of preloadChecks) await run("node", ["--check", preload]);
// 2. Build tests
console.log("\n[2/5] Building tests...");
await run("pnpm", ["test:build"]);
// 3. Run behavior tests
console.log("\n[3/5] Running behavior tests...");
for (const test of behaviorTests) await run("node", [test]);
// 4. Run contract tests
console.log("\n[4/5] Running contract tests...");
for (const test of contractTests) await run("node", [test]);
// 5. Run remaining dist checks
console.log("\n[5/5] Running dist checks...");
for (const check of distChecks) {
await run("node", [check]);
}
console.log("\n✓ All tests passed!");
}
main().catch((err) => {
console.error("\n✗ Test suite failed:", err.message);
process.exit(1);
});