This commit is contained in:
Horldsence
2026-09-11 17:24:29 +08:00
parent 2bc4c7ed82
commit b15db59ac3
9 changed files with 683 additions and 12 deletions
+25
View File
@@ -0,0 +1,25 @@
"""回放器播放器的 JS 逻辑回归:用 DOM 桩跑发布的 app.js/replay.js 原文。
曾回归出两类"加载即冻结"bug(applyEvents 参数遮蔽模块级状态、switch 段缺
at 导致 robot.x TypeError),当时只有 Python 层测试、JS 层零覆盖——本文件
补上该防线:有 node 环境则执行 referee/tests/js/replay_harness.cjs,
无 node 环境跳过(回放器为纯前端功能,Python 测试仅覆盖静态资源存在性)。
"""
import os
import shutil
import subprocess
from pathlib import Path
import pytest
REPO = Path(__file__).resolve().parents[2]
HARNESS = REPO / "referee" / "tests" / "js" / "replay_harness.cjs"
@pytest.mark.skipif(shutil.which("node") is None, reason="需要 node 环境运行 JS 桩测试")
def test_replay_player_logic():
result = subprocess.run(["node", str(HARNESS)], capture_output=True, text=True,
env={**os.environ, "REPO": str(REPO)}, timeout=60)
assert result.returncode == 0, f"回放器逻辑测试失败:\n{result.stdout}\n{result.stderr}"
assert "ALL PASS" in result.stdout