Run one scenario, return an outcome vector { pass, vector, error }.
(scenario, cli)
| 112 | |
| 113 | /** Run one scenario, return an outcome vector { pass, vector, error }. */ |
| 114 | function runScenario(scenario, cli) { |
| 115 | let tmpDir = null; |
| 116 | try { |
| 117 | tmpDir = setupProjectState(scenario.state); |
| 118 | const exec = executeClaudeScenario(scenario, cli, tmpDir); |
| 119 | if (exec.timedOut) return { pass: null, vector: null, error: 'timed out' }; |
| 120 | if (exec.error && !exec.output) return { pass: null, vector: null, error: exec.error }; |
| 121 | const ar = runAssertions(scenario, exec.output); |
| 122 | return { |
| 123 | pass: ar.every(a => a.passed), |
| 124 | vector: ar.map(a => a.passed), |
| 125 | error: null, |
| 126 | }; |
| 127 | } catch (e) { |
| 128 | return { pass: null, vector: null, error: e.message }; |
| 129 | } finally { |
| 130 | if (tmpDir) { try { fs.rmSync(tmpDir, { recursive: true, force: true }); } catch { /* ignore */ } } |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | function vectorsEqual(a, b) { |
| 135 | if (!a || !b || a.length !== b.length) return false; |
no test coverage detected