- core 协议:Plugin 接口/注册器(重名拒绝/生命周期正序逆序/dispose幂等/错误隔离不连坐)+受控面 PluginContext(禁直透 littlejsengine)——前任agent核心设计17测绿收编(死于收尾的工具调用解析失败,续作字节级未碰) - _example 空插件样例五件全(克隆母本)+PLUGIN-TEMPLATE 六节规格+manifest schema+零依赖校验器(负例自检逮6违规) - scripts:esbuild锁参build/增量法size/test.sh遍历;browser-evidence harness纯计算口径冻结(FNV-1a/直方图/几何,CDP四函数=集成段占位) - 22/22 测全绿(RESULT.txt 留档);ESM JS+JSDoc+手写d.ts 零工具链纪律全程 - rc 状态:待 Gate0.1 受控面补丁(input/audio+per-plugin派生RNG+useContext守卫)后冻结 core-protocol-v0 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
35 lines
1.6 KiB
Bash
Executable File
35 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# scripts/test.sh — 遍历 core + 全插件,零依赖 node --test 跑全部单测(core-protocol-v0)
|
||
# owner:T1b-α lane-core | 运行:bash scripts/test.sh(在 game-runtime/ 下或任意路径,脚本自定位仓根)
|
||
#
|
||
# 纪律(执行版 §1):lane 阶段一切测试 = 本机零依赖 node --test;本脚本不装任何依赖、不跑 git。
|
||
# 收集对象:src/core/**/*.test.mjs|cjs + src/plugins/<*>/test/**/*.test.mjs|cjs。
|
||
# 退出码:全绿=0;任一失败=node --test 的非零码(CI/收口据此 gate)。
|
||
|
||
set -euo pipefail
|
||
|
||
# 自定位仓根(脚本在 game-runtime/scripts/ 下,根 = 上一级),保证任意 cwd 可跑。
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||
cd "${ROOT}"
|
||
|
||
echo "[test.sh] 仓根:${ROOT}"
|
||
echo "[test.sh] 收集测试文件(*.test.mjs / *.test.cjs)..."
|
||
|
||
# 收集 core 与插件测试文件(find 跨平台稳妥;排除 node_modules)。
|
||
# 用数组承载,避免文件名含空格出错。
|
||
mapfile -t TEST_FILES < <(find src -type f \( -name '*.test.mjs' -o -name '*.test.cjs' \) -not -path '*/node_modules/*' | sort)
|
||
|
||
if [ "${#TEST_FILES[@]}" -eq 0 ]; then
|
||
echo "[test.sh] 未发现任何测试文件,视为失败(避免空过假绿)。" >&2
|
||
exit 1
|
||
fi
|
||
|
||
echo "[test.sh] 共 ${#TEST_FILES[@]} 个测试文件:"
|
||
for f in "${TEST_FILES[@]}"; do echo " - ${f}"; done
|
||
echo "[test.sh] 开始 node --test ..."
|
||
echo
|
||
|
||
# 一次性把全部文件交给 node --test,得到合并的 TAP/汇总(pass/fail 总计一目了然)。
|
||
node --test "${TEST_FILES[@]}"
|