Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

ci: run the agent-voice recipe's vitest unit suite (D10)

garrytanea58b5746e50
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index ebc11eeeea..cce1bd0a0d 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -226,6 +226,10 @@ jobs:
run: |
bun run check:bash32
bun test --timeout 60000 test/scripts/check-bash32.test.ts
+ # recipes/agent-voice's vitest unit suite (109 tests) ran in no workflow;
+ # pinned vitest + ws into a temp prefix, ~10s.
+ - name: agent-voice recipe unit tests (vitest)
+ run: bun run test:agent-voice
serial-tests:
if: ${{ github.event_name != 'workflow_dispatch' || inputs.native_only != true }}
diff --git a/package.json b/package.json
index c6bd615407..7151cc9d00 100644
--- a/package.json
+++ b/package.json
@@ -82,6 +82,7 @@
"check:pglite-embedded": "bash scripts/check-pglite-embedded.sh",
"check:newlines": "bash scripts/check-trailing-newline.sh",
"test:compile-smoke": "bun test test/binary-self-update-compiled.serial.test.ts",
+ "test:agent-voice": "bash scripts/test-agent-voice.sh",
"test:e2e": "bash scripts/run-e2e.sh",
"test:slow": "bash scripts/run-slow-tests.sh",
"test:scale": "bun scripts/scale/run.ts",
diff --git a/scripts/test-agent-voice.sh b/scripts/test-agent-voice.sh
new file mode 100755
index 0000000000..ed6f178d14
--- /dev/null
+++ b/scripts/test-agent-voice.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+# Runs the agent-voice recipe's vitest unit suite (recipes/agent-voice/tests/unit).
+#
+# The recipe is copied into an operator's host agent repo and is not a gbrain
+# runtime dependency, so its tests run under node + vitest, not bun test, and
+# no gbrain lane collected them. This installs exact pins of the two packages
+# the unit tests load (vitest, ws) into a temporary prefix, links it as the
+# recipe's node_modules for the run, and removes both afterwards. The e2e
+# voice tests (puppeteer + a live server) and the paid evals stay manual.
+#
+# Run: bun run test:agent-voice (CI: test.yml verify job)
+# Needs: node + npm on PATH and registry access for the pinned install.
+set -euo pipefail
+
+VITEST_VERSION=4.1.4
+WS_VERSION=8.18.3
+
+ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
+RECIPE="$ROOT/recipes/agent-voice"
+if [ -e "$RECIPE/node_modules" ] && [ ! -L "$RECIPE/node_modules" ]; then
+ echo "agent-voice: $RECIPE/node_modules already exists and is not this script's link." >&2
+ echo "Why: the run links a pinned temporary install there and would shadow or clobber your install." >&2
+ echo "Fix: rm -rf recipes/agent-voice/node_modules && bun run test:agent-voice" >&2
+ exit 2
+fi
+
+PREFIX="$(mktemp -d "${TMPDIR:-/tmp}/gbrain-agent-voice.XXXXXX")"
+cleanup() { rm -f "$RECIPE/node_modules"; rm -rf "$PREFIX"; }
+trap cleanup EXIT
+
+npm install --prefix "$PREFIX" --no-audit --no-fund --ignore-scripts --loglevel=error \
+ "vitest@$VITEST_VERSION" "ws@$WS_VERSION" >/dev/null
+ln -sfn "$PREFIX/node_modules" "$RECIPE/node_modules"
+cd "$RECIPE"
+"$PREFIX/node_modules/.bin/vitest" run tests/unit