🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(ci): print the failing assertion, not just the filename, on a ratchet failure (#3208)
Mr. Makb02d9369351f
diff --git a/scripts/__tests__/ci-test-ratchet.test.mjs b/scripts/__tests__/ci-test-ratchet.test.mjsindex 5af1eb4395..3c9211f9f1 100644--- a/scripts/__tests__/ci-test-ratchet.test.mjs+++ b/scripts/__tests__/ci-test-ratchet.test.mjs@@ -1,5 +1,5 @@import { describe, expect, it } from 'vitest';-import { evaluateTestReport } from '../ci-test-ratchet.mjs';+import { evaluateTestReport, formatUnexpectedFailures } from '../ci-test-ratchet.mjs';const root = '/repo';@@ -40,3 +40,55 @@ describe('CI test failure ratchet (#3030)', () => {expect(evaluateTestReport({}, [], root).ok).toBe(false);});});++describe('unexpected-failure output (#3208)', () => {+ const report = {+ testResults: [+ {+ name: '/repo/pkg/__tests__/scores.test.ts',+ status: 'failed',+ assertionResults: [+ { status: 'passed', fullName: 'suite passes', failureMessages: [] },+ {+ status: 'failed',+ fullName: 'suite preserves standard fallback on import failure',+ failureMessages: ['AssertionError: expected [ …(5) ] to deeply equal [ …(4) ]\n at scores.test.ts:117:28'],+ },+ ],+ },+ { name: '/repo/pkg/__tests__/aborted.test.ts', status: 'failed', message: 'No test suite found in file\nsecond line' },+ ],+ };++ it('names the failing assertion and its first message line, not just the file', () => {+ expect(formatUnexpectedFailures(report, ['pkg/__tests__/scores.test.ts'], root)).toEqual([+ ' + pkg/__tests__/scores.test.ts',+ ' ✗ suite preserves standard fallback on import failure',+ ' AssertionError: expected [ …(5) ] to deeply equal [ …(4) ]',+ ]);+ });++ it('reports a file-level abort, which has a message and no assertions', () => {+ expect(formatUnexpectedFailures(report, ['pkg/__tests__/aborted.test.ts'], root)).toEqual([+ ' + pkg/__tests__/aborted.test.ts',+ ' No test suite found in file',+ ]);+ });++ it('still prints the filename when the report carries no detail for it', () => {+ expect(formatUnexpectedFailures(report, ['pkg/__tests__/absent.test.ts'], root))+ .toEqual([' + pkg/__tests__/absent.test.ts']);+ expect(formatUnexpectedFailures({}, ['a.test.ts'], root)).toEqual([' + a.test.ts']);+ });++ it('falls back to title when the reporter omits fullName', () => {+ const titleOnly = {+ testResults: [{+ name: '/repo/a.test.ts',+ assertionResults: [{ status: 'failed', title: 'bare title', failureMessages: [] }],+ }],+ };+ expect(formatUnexpectedFailures(titleOnly, ['a.test.ts'], root))+ .toEqual([' + a.test.ts', ' ✗ bare title']);+ });+});diff --git a/scripts/ci-test-ratchet.mjs b/scripts/ci-test-ratchet.mjsindex aa81481ea0..c2f8c7943c 100644--- a/scripts/ci-test-ratchet.mjs+++ b/scripts/ci-test-ratchet.mjs@@ -50,6 +50,38 @@ export function evaluateTestReport(report, baselineEntries, repoRoot = REPO_ROOT};}+/**+ * Render each unexpected failure with the assertion that caused it (#3208).+ *+ * The report is written with --outputFile, so nothing vitest prints reaches+ * the job log, and a rerun replaces the artifact — which leaves the filename+ * as the only surviving record of an attempt. The failure messages are+ * already in the report this process parsed, so putting them in the log+ * costs nothing and survives the rerun, because logs are per-attempt.+ *+ * Every field is optional by design: a file-level abort ("No test suite+ * found") has `message` and no assertions, and a report from another+ * reporter version may carry neither.+ */+export function formatUnexpectedFailures(report, unexpected, repoRoot = REPO_ROOT) {+ const lines = [];+ for (const name of unexpected) {+ lines.push(` + ${name}`);+ const file = (report?.testResults ?? []).find(+ (result) => typeof result?.name === 'string' && normalizeTestPath(result.name, repoRoot) === name,+ );+ const firstLine = (text) => String(text).split('\n')[0].trim();+ if (file?.message) lines.push(` ${firstLine(file.message)}`);+ for (const assertion of file?.assertionResults ?? []) {+ if (assertion?.status !== 'failed') continue;+ lines.push(` ✗ ${assertion.fullName || assertion.title || '(unnamed test)'}`);+ const [message] = assertion.failureMessages ?? [];+ if (message) lines.push(` ${firstLine(message)}`);+ }+ }+ return lines;+}+function parseArgs(argv) {const args = { report: '', baseline: resolve(REPO_ROOT, 'scripts/ci-test-baseline.txt'), run: true };for (let i = 0; i < argv.length; i += 1) {@@ -106,7 +138,7 @@ function main() {if (!result.ok) {console.error(`CI test ratchet: FAILED — ${result.unexpected?.length ?? 0} unexpected failing file(s)`);- for (const name of result.unexpected ?? []) console.error(` + ${name}`);+ for (const line of formatUnexpectedFailures(report, result.unexpected ?? [])) console.error(line);if (result.error) console.error(` ${result.error}`);process.exit(1);}