「Expect」是一個開源工具,讓 AI Agent 在真實瀏覽器環境中對程式碼進行測試。其核心工作流為:掃描未提交的改動或分支差異,自動生成測試計畫,隨後針對實際執行的瀏覽器進行測試。這種方法直接整合了 Claude、Codex 或 Cursor 等現有工具的能力,無需額外的模型集成。
工作流程與使用方式
該工具支援多種運行模式:
- 透過 CLI 執行或作為 AI 代理技能使用
- 一行指令
npx -y expect-cli@latest init即可安裝並初始化 - 可選擇測試範圍:未提交變更、分支差異或特定改動
- 支援自然語言指令
-m參數自定義測試內容 - 允許跳過計畫審查直接執行(
-y參數)或重複使用已保存的測試流程
可視化與調試能力
測試失敗時,Expect 會生成「亮點片段」(highlight reel)影片,記錄每個發現的漏洞。這些影片不僅提供視覺化證據,更重要的是為其他 Agent 提供修復所需的具體上下文。這種設計讓修復過程能夠形成迴圈:測試失敗→檢視影片→提取修復資訊→重複執行。
技術棧與開放性
該專案採用 TypeScript 開發,在 GitHub 上完全開源。根據 npm 統計數據,已累積 432 個 stars 和 12 個 forks。專案使用 FSL-1.1-MIT 許可證,表明其在開源與商業使用間的平衡立場。開發者可透過 GitHub issue 追蹤回報漏洞,或直接提交 pull request 貢獻程式碼。
使用者隱私控制
工具內建遙測分析功能,但使用者可透過設定環境變數 NO_TELEMTRY=1 完全禁用分析事件追蹤,體現了對使用者隱私偏好的尊重。
Introducing Expect
— Aiden Bai (@aidenybai) March 25, 2026
Let agents test your code in a real browser
1. Run Claude Code / Codex to QA your app
2. Watch a video of every bug found
3. Fix and repeat until passing
Run as a CLI or agent skill. Fully open source pic.twitter.com/xHfZMIY97s
Run this in your terminal to try it out:
— Aiden Bai (@aidenybai) March 25, 2026
npx -y expect-cli@latest inithttps://t.co/zfHTmBSh0E
Expect generates a highlight reel for every test
— Aiden Bai (@aidenybai) March 25, 2026
If tests fail, it gives you context for another agent to fix
demo: https://t.co/m2rC87HYGs pic.twitter.com/me1GReyYlN
Expect uses your existing Claude Code, Codex, or Cursor under the hood!
— Aiden Bai (@aidenybai) March 25, 2026
Also available as a skill:
npx skills add https://t.co/uRQYRI5MP3 --skill expect-cli pic.twitter.com/WHuKDl61n4
