Skip to content

Conversation

@Robdel12
Copy link
Contributor

@Robdel12 Robdel12 commented Jan 5, 2026

Summary

  • Add static HTML report generation for vizzly tdd run that creates a self-contained report at .vizzly/report/index.html
  • Use SSR with React's renderToString for true static HTML output (no JavaScript required to view)
  • Add --no-open flag to skip auto-opening the report in browser
  • Add --keep-server flag to use interactive live dashboard instead of static report
  • Clean up dead SPA static mode code that was never fully implemented
  • Use native <details>/<summary> HTML elements for expand/collapse functionality
image

This should address #159

Technical Details

SSR Architecture:

  • New Vite SSR build config (vite.ssr.config.js) outputs Node-compatible ES module
  • Hook-free React component (static-report-view.jsx) for SSR compatibility
  • SSR entry point uses renderToString from react-dom/server
  • CSS inlined in <style> tag, images copied to report/images/ folder

Report UI:

  • Dark theme with amber brand accent
  • Grouped by status: Visual Changes → New → Passed (collapsed by default)
  • Side-by-side baseline vs current comparison when expanded
  • Diff image shown separately below
  • Summary bar with test counts and status

Cleanup:

  • Removed isStaticMode() function from API client
  • Removed unused useStaticMode() hook
  • Removed static mode handling from TDD queries and SSE hooks
  • Removed mock data from dev index.html

Test plan

  • Run vizzly tdd run "npm run test:reporter" and verify static report opens
  • Verify report works offline when opened as file:// URL
  • Verify images load correctly in the static report
  • Test --no-open flag skips browser opening
  • Test --keep-server flag shows live dashboard instead
  • Verify build passes with npm run build
  • Verify existing tests pass with npm test

Generates a self-contained HTML report after `vizzly tdd run` completes,
allowing offline viewing of visual test results without a running server.

**New features:**
- Static report generated at `.vizzly/report/index.html`
- SSR-rendered HTML with inlined CSS (no JavaScript required)
- Images copied to `report/images/` for offline access
- Report auto-opens in browser after tests complete
- `--no-open` flag to skip browser opening
- `--keep-server` flag for interactive mode (live dashboard)

**Technical approach:**
- Uses React's `renderToString` for true SSR
- Separate Vite SSR build config for Node-compatible output
- Hook-free React component for SSR compatibility
- Native `<details>/<summary>` for expand/collapse without JS

**Cleanup:**
- Removed dead SPA static mode code from React app
- Removed unused `isStaticMode()` and `useStaticMode()` hook
- Simplified TDD queries and SSE hooks
@claude

This comment was marked as resolved.

Security:
- Add URL validation to openBrowser() to prevent command injection
- Only allow http://, https://, and file:// URL schemes

Tests:
- Add unit tests for static-report-generator.js
- Add unit tests for browser.js URL validation

Fixes:
- Restore null guards in screenshot-list.jsx handlers
- Add comment about race condition assumption in CLI
@blacksmith-sh

This comment has been minimized.

Now that SSR-based static report generation works properly, we don't
need the `--keep-server` workaround. This was tech debt from when
static reports weren't working.

Simplifies the tdd run flow: tests run, report generates, browser opens.
@Robdel12 Robdel12 merged commit ca3c2a0 into main Jan 5, 2026
24 checks passed
@Robdel12 Robdel12 deleted the feat/static-report-generation branch January 5, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants