Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions archon-ui-main/src/components/ui/TestResultDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const TestSummaryCard: React.FC<TestSummaryCardProps> = ({ results, isLoading })
);
}

if (!results) {
if (!results || !results.summary) {
return (
<div className="bg-white dark:bg-gray-800 rounded-lg p-6 border border-gray-200 dark:border-gray-700 shadow-sm">
<div className="flex flex-col items-center justify-center py-8 text-center">
Expand Down Expand Up @@ -381,9 +381,9 @@ export const TestResultDashboard: React.FC<TestResultDashboardProps> = ({
)}

{/* Main content */}
<div className={`grid gap-6 ${compact ? 'grid-cols-1' : 'grid-cols-1 xl:grid-cols-2'}`}>
<div className={`grid gap-6 ${compact ? 'grid-cols-1' : 'grid-cols-1'}`}>
{/* Test Summary */}
<div>
<div className="flex-1">
<TestSummaryCard results={results} isLoading={loading && !results} />
</div>

Expand Down
51 changes: 21 additions & 30 deletions archon-ui-main/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,43 +145,34 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
mkdirSync(testResultsDir, { recursive: true });
}

const testProcess = exec('npm run test:coverage:stream', {
const testProcess = exec('npx vitest run --coverage --reporter=verbose --reporter=json', {
cwd: process.cwd(),
env: {
...process.env,
FORCE_COLOR: '1',
env: {
...process.env,
FORCE_COLOR: '1',
CI: 'true',
NODE_ENV: 'test'
} // Enable color output and CI mode for cleaner output
NODE_ENV: 'test',
}
});

testProcess.stdout?.on('data', (data) => {
const text = data.toString();
// Split by newlines but preserve empty lines for better formatting
const lines = text.split('\n');

lines.forEach((line: string) => {
// Strip ANSI escape codes to get clean text
const cleanLine = line.replace(/\\x1b\[[0-9;]*m/g, '');
const handleStream = (stream: any, res: any) => {
stream.on('data', (data: any) => {
const text = data.toString();
const lines = text.split('\n');

// Send all lines for verbose reporter output
res.write(`data: ${JSON.stringify({ type: 'output', message: cleanLine, timestamp: new Date().toISOString() })}\n\n`);
});

// Flush the response to ensure immediate delivery
if (res.flushHeaders) {
res.flushHeaders();
}
});
lines.forEach((line: string) => {
const cleanLine = line.replace(/\x1b\[[0-9;]*m/g, '');
res.write(`data: ${JSON.stringify({ type: 'output', message: cleanLine, timestamp: new Date().toISOString() })}\n\n`);
});

testProcess.stderr?.on('data', (data) => {
const lines = data.toString().split('\n').filter((line: string) => line.trim());
lines.forEach((line: string) => {
// Strip ANSI escape codes
const cleanLine = line.replace(/\\x1b\[[0-9;]*m/g, '');
res.write(`data: ${JSON.stringify({ type: 'output', message: cleanLine, timestamp: new Date().toISOString() })}\n\n`);
if (res.flushHeaders) {
res.flushHeaders();
}
});
});
};

handleStream(testProcess.stdout, res);
handleStream(testProcess.stderr, res);

testProcess.on('close', (code) => {
res.write(`data: ${JSON.stringify({
Expand Down