mirror of
https://github.com/linshenkx/prompt-optimizer.git
synced 2026-05-09 15:12:56 +08:00
- 实现 VCR 在启用真实 LLM 时默认使用 off 模式 - 实现动态数据库隔离以支持并行测试 - 修复 Pro 模式 session 持久化测试 - 移除 VCR fixtures 中的时间戳字段 - 改进测试隔离以防止路由状态泄漏 - 修正 smart-e2e 只检查实际调用 LLM API 的测试 fixture - 简化 smart-e2e 使用 auto 模式 - 重命名 analyze-prompt.spec.ts 为 route-initialization.spec.ts - 添加 session 持久化测试,验证下拉框选择刷新后丢失问题
35 lines
810 B
JavaScript
35 lines
810 B
JavaScript
#!/usr/bin/env node
|
||
/**
|
||
* 智能 E2E 测试运行器
|
||
*
|
||
* 使用 VCR auto 模式:每个测试独立检查自己的 fixture
|
||
* - fixture 存在 → 回放(快速)
|
||
* - fixture 不存在 → 录制(自动创建)
|
||
*
|
||
* 使用:
|
||
* node scripts/smart-e2e.js
|
||
*/
|
||
|
||
const { execSync } = require('child_process')
|
||
|
||
/**
|
||
* 主函数
|
||
*/
|
||
function main() {
|
||
console.log('\n🎬 使用 VCR auto 模式运行 E2E 测试')
|
||
console.log(' - 有 fixture 的测试:回放')
|
||
console.log(' - 无 fixture 的测试:录制\n')
|
||
|
||
try {
|
||
// 不设置 E2E_VCR_MODE,使用默认的 auto 模式
|
||
execSync('playwright test', {
|
||
stdio: 'inherit',
|
||
env: process.env // 继承现有环境变量,不覆盖 E2E_VCR_MODE
|
||
})
|
||
} catch (error) {
|
||
process.exit(error.status || 1)
|
||
}
|
||
}
|
||
|
||
main()
|