AgentSkillsCN

test

运行内存级 AOS 测试(legacynet 单元测试)。快速单元测试,无需启动服务器。适用于 AOS 脚本的测试,或在代码变更后进行测试。不适用于 HyperBEAM 集成测试——请改用 /test-hb。

SKILL.md
--- frontmatter
name: test
description: "Run in-memory AOS tests (legacynet units). Fast unit testing — no server needed. Use when testing AOS scripts or after code changes. Not for HyperBEAM integration tests — use /test-hb instead."
argument-hint: "[test-file]"
disable-model-invocation: true
allowed-tools: Bash, Read, Grep

Run in-memory AOS tests. For HyperBEAM integration tests, use /test-hb instead.

Examples

code
/test                          # run all tests
/test test/token.test.js       # run specific file

Steps

  1. Kill any stale beam.smp or HyperBEAM processes that may be lingering on ports 10000-10010:
bash
lsof -ti :10000-10010 | xargs -r kill -9 2>/dev/null || true
pkill -f beam.smp 2>/dev/null || true
  1. Run the tests:
bash
# Specific file (if argument provided)
yarn test $ARGUMENTS

# All tests (if no argument)
yarn test
  1. Report results:
    • Show pass/fail count
    • If failures, show the failing test names and error messages
    • Suggest fixes if the errors are obvious

Troubleshooting

Tests hang indefinitely

  • Likely cause: Send().receive() in Lua source — does NOT work on genesis-wasm
  • Fix: Replace with fire-and-forget Send() + separate handler
  • Also check for infinite loops in Lua state

"Cannot find module wao/test"

  • Run yarn install to ensure dependencies are installed
  • Check package.json has "wao" in dependencies

WASM memory error

  • Ensure --experimental-wasm-memory64 flag is in the test command
  • Node.js 20+ required