diff --git a/archon-ui-main/src/components/ui/TestResultDashboard.tsx b/archon-ui-main/src/components/ui/TestResultDashboard.tsx index cbac555b0c..abfb279925 100644 --- a/archon-ui-main/src/components/ui/TestResultDashboard.tsx +++ b/archon-ui-main/src/components/ui/TestResultDashboard.tsx @@ -72,7 +72,9 @@ const TestSummaryCard: React.FC = ({ results, isLoading }) ); } - if (!results || !results.summary) { + const summary = results?.summary; + + if (!summary) { return (
@@ -88,11 +90,18 @@ const TestSummaryCard: React.FC = ({ results, isLoading }) ); } - const { summary } = results; - const successRate = summary.total > 0 ? (summary.passed / summary.total) * 100 : 0; + const safeSummary = { + total: summary.total || 0, + passed: summary.passed || 0, + failed: summary.failed || 0, + skipped: summary.skipped || 0, + duration: summary.duration || 0, + }; + + const successRate = safeSummary.total > 0 ? (safeSummary.passed / safeSummary.total) * 100 : 0; const getHealthStatus = () => { - if (summary.failed === 0 && summary.passed > 0) return { text: 'All Tests Passing', color: 'text-green-600 dark:text-green-400', bg: 'bg-green-50 dark:bg-green-900/20' }; + if (safeSummary.failed === 0 && safeSummary.passed > 0) return { text: 'All Tests Passing', color: 'text-green-600 dark:text-green-400', bg: 'bg-green-50 dark:bg-green-900/20' }; if (successRate >= 80) return { text: 'Mostly Passing', color: 'text-yellow-600 dark:text-yellow-400', bg: 'bg-yellow-50 dark:bg-yellow-900/20' }; return { text: 'Tests Failing', color: 'text-red-600 dark:text-red-400', bg: 'bg-red-50 dark:bg-red-900/20' }; }; @@ -127,7 +136,7 @@ const TestSummaryCard: React.FC = ({ results, isLoading }) className="text-center p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg" >
- {summary.total} + {safeSummary.total}
Total Tests
@@ -140,7 +149,7 @@ const TestSummaryCard: React.FC = ({ results, isLoading }) >
- {summary.passed} + {safeSummary.passed}
Passed
@@ -153,7 +162,7 @@ const TestSummaryCard: React.FC = ({ results, isLoading }) >
- {summary.failed} + {safeSummary.failed}
Failed
@@ -166,7 +175,7 @@ const TestSummaryCard: React.FC = ({ results, isLoading }) >
- {summary.skipped} + {safeSummary.skipped}
Skipped
@@ -195,7 +204,7 @@ const TestSummaryCard: React.FC = ({ results, isLoading })
- Duration: {(summary.duration / 1000).toFixed(2)}s + Duration: {(safeSummary.duration / 1000).toFixed(2)}s
{results.timestamp && (
@@ -206,7 +215,7 @@ const TestSummaryCard: React.FC = ({ results, isLoading })
{/* Failed Tests Alert */} - {summary.failed > 0 && ( + {safeSummary.failed > 0 && ( = ({ results, isLoading })
- {summary.failed} test{summary.failed > 1 ? 's' : ''} failing - review errors below + {safeSummary.failed} test{safeSummary.failed > 1 ? 's' : ''} failing - review errors below
@@ -225,7 +234,10 @@ const TestSummaryCard: React.FC = ({ results, isLoading }) }; const FailedTestsList: React.FC<{ results: TestResults }> = ({ results }) => { - const failedSuites = results.suites.filter(suite => suite.failed > 0); + if (!results || !Array.isArray(results.suites) || !results.summary) { + return null; + } + const failedSuites = results.suites.filter(suite => suite && typeof suite.failed === 'number' && suite.failed > 0); if (failedSuites.length === 0) { return null; @@ -240,7 +252,7 @@ const FailedTestsList: React.FC<{ results: TestResults }> = ({ results }) => {

- Failed Tests ({results.summary.failed}) + Failed Tests ({results?.summary?.failed || 0})

@@ -400,7 +412,7 @@ export const TestResultDashboard: React.FC = ({
{/* Failed Tests */} - {results && results.summary.failed > 0 && ( + {results?.summary?.failed > 0 && results?.suites && ( )}
diff --git a/archon-ui-main/vite.config.ts b/archon-ui-main/vite.config.ts index 79909874c7..a7d1ae00dd 100644 --- a/archon-ui-main/vite.config.ts +++ b/archon-ui-main/vite.config.ts @@ -145,7 +145,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { mkdirSync(testResultsDir, { recursive: true }); } - const testProcess = exec('npx vitest run --coverage --reporter=verbose --reporter=json', { + const testProcess = exec('npx vitest run --coverage --reporter=dot --reporter=json', { cwd: process.cwd(), env: { ...process.env,