Local Development
Vizzly’s TDD mode runs visual tests on your machine with a live dashboard. You see comparisons in real-time as tests run, accept or reject changes in the browser, and work without uploading anything to the cloud.
How it works
TDD mode starts a local server that captures screenshots from your tests and compares them against baseline images stored in .vizzly/baselines/. The dashboard at http://localhost:47392 shows you comparisons as they happen.
You have two workflows:
Background server - Start once, keep running:
npx vizzly tdd startnpm test -- --watchOne-off runs - Run tests, see results, exit:
npx vizzly tdd run "npm test"The background server is better for active development. The one-off approach works for quick checks or CI-like verification.
File structure
TDD mode creates a .vizzly/ directory in your project:
.vizzly/├── baselines/ # Reference images to compare against│ ├── metadata.json # Baseline source info (build ID, branch)│ └── *.png # Baseline screenshots├── current/ # Latest screenshots from your tests│ └── *.png├── diffs/ # Visual difference images (only for failures)│ └── *.png└── report-data.json # Comparison results for the dashboardAdd .vizzly/current/ and .vizzly/diffs/ to .gitignore. Commit .vizzly/baselines/ if you want shared local baselines across your team.
Background server
Start the server once and leave it running:
npx vizzly tdd start --openThe --open flag launches the dashboard in your browser. The server stays running until you stop it.
Now run your tests in watch mode:
npm test -- --watchEvery time tests run, comparisons appear in the dashboard. Change your code, tests re-run automatically, dashboard updates.
Stop the server when you’re done:
npx vizzly tdd stopCheck if it’s running:
npx vizzly tdd statusOne-off runs
Run tests once and see results:
npx vizzly tdd run "npm test"This starts the server, runs your test command, shows comparison results, then exits. The dashboard is available at http://localhost:47392 while tests run.
The process exits with code 1 if any comparisons fail. Good for pre-commit hooks or local CI checks.
Dashboard views
The dashboard has four sections:
- Comparisons (
/) - See all screenshots with pass/fail status, filter by status or search by name - Stats (
/stats) - Summary of total comparisons, pass rate, failure breakdown - Settings (
/settings) - Download baselines from cloud builds, configure comparison threshold - Projects (
/projects) - Connect to cloud projects for OAuth-based baseline downloads
Working with baselines
First run
When you first run tests, you won’t have baselines. TDD mode creates them automatically:
npx vizzly tdd run "npm test"All screenshots show as “new” because there’s nothing to compare against. These initial screenshots become your baselines. The next run will compare against them.
Accepting changes
When you change something and comparisons fail, you can accept the new screenshots as baselines:
In the dashboard:
- Click a failed comparison to see the diff
- Click “Accept as baseline” if the change is correct
- The comparison updates to “passed” immediately
Accept everything at once:
npx vizzly tdd run "npm test" --set-baselineThis overwrites all baselines with the current screenshots. Use it when you’ve updated designs across many screenshots.
Using cloud baselines
Instead of local baselines, you can compare against screenshots from a cloud build:
npx vizzly tdd start --baseline-build abc123defThis downloads baselines from build abc123def to .vizzly/baselines/ and compares your tests against them. You need an API token for this to work - run npx vizzly login first.
You can also download baselines from the dashboard Settings page. Enter a build ID and click Download.
Comparison threshold
Vizzly uses CIEDE2000 Delta E for color difference. The default threshold is 2.0. Comparisons with differences below the threshold pass, differences above fail.
Adjust the threshold if you’re seeing false positives or want stricter matching:
npx vizzly tdd start --threshold 5.0Or in vizzly.config.js:
export default { comparison: { threshold: 5.0 }}Lower values are stricter. Higher values are more forgiving.
Common workflows
Feature development
# Start server with production baselinesnpx vizzly tdd start --baseline-build abc123def --open
# Run tests in watch modenpm test -- --watch
# Make changes, see diffs in dashboard# Accept correct changes in the UI# Fix incorrect changes and re-run tests
# When done, stop the servernpx vizzly tdd stopPre-commit check
# Verify no visual regressions before committingnpx vizzly tdd run "npm test"
# Exit code 1 if anything fails, 0 if all passUpdating designs
# You've updated styles across many componentsnpm test
# See all the failures in dashboard# Verify they look correct
# Accept all at oncenpx vizzly tdd run "npm test" --set-baselineNext steps
- CLI Commands - Full command reference for TDD mode
- SDK Integration - Connect your test framework to send screenshots
- CI/CD Setup - Upload results from TDD mode to Vizzly for team review