How garris/backstopjs works
BackstopJS is a visual-regression testing tool: users configure scenarios and viewports, capture test screenshots, compare them with reference images, inspect reports, and approve accepted changes. The CLI and optional remote service enter the command runner; comparison and reporting produce the reviewable result, while the browser UI supports inspection and approval. Capture engines, config processing, comparison, reporting, and the report UI are shown as distinct subsystems. Some core files and integrations were not sampled, so links to those are omitted where their callers are not evidenced.
Main entry points: command/index.js Command dispatcher · App.js Report application · runner.js Command runner · compare/index.js Image comparison
Components 26
Entry points
- CLI
cli/index.js - Remote service
remote/index.js - Command runner
core/runner.js - Command dispatcher
core/command/index.js
Test workflow
- Config assembly
core/util/makeConfig.js - Test command
core/command - Reference command
core/command/reference.js - Approve command
core/command/approve.js - Reference images
- Test images
Capture engines
- Screenshot capture
core/util/createBitmaps.js - Playwright engine
core/util/runPlaywright.js - Puppeteer engine
core/util/runPuppet.js - Capture hooks
capture/engine_scripts
Comparison and reports
- Image comparison
core/util/compare/index.js - Diff worker
core/util/compare/compare.js - Report generation
core/command/report.js - Report data
- Browser report
compare/output/index_bundle.js
Report interface
- Report application
compare/src/components/App.js - Test results list
compare/src/components/ecosystems/List.js - Scenario details
compare/src/components/organisms/TestCard.js - Image scrubber
compare/src/components/atoms/ImageScrubber.js - UI state store
compare/src/store.js - UI actions
compare/src/actions/index.js
Other components
- User
Connections 29
- User → CLI: runs command
- CLI → Command runner: invokes
cli/index.js - Remote service → Command runner: invokes
remote/index.js - Command runner → Config assembly: builds config
core/runner.js - Command runner → Command dispatcher: dispatches command
core/runner.js - Command dispatcher → Test command: executes
core/command/index.js - Command dispatcher → Reference command: executes
core/command/index.js - Command dispatcher → Approve command: executes
core/command/index.js - User → Reference command: creates baseline
- Reference command → Reference images: writes images
- User → Test command: runs tests
- Test command → Screenshot capture: captures screenshots
- Screenshot capture → Test images: writes images
- Test images → Image comparison: compares against
- Reference images → Image comparison: compares against
- Image comparison → Diff worker: dispatches image pair
core/util/compare/index.js - Image comparison → Report generation: returns results
core/command/report.js - Report generation → Report data: writes report data
core/command/report.js - Report generation → Browser report: copies report UI
core/command/report.js - Browser report → Report application: provides interface
- Report application → Test results list: renders
compare/src/components/App.js - Test results list → Scenario details: renders
compare/src/components/ecosystems/List.js - Report application → Image scrubber: renders modal
compare/src/components/App.js - Report application → UI state store: uses state
- UI state store → UI actions: manages actions
- User → Approve command: approves changes
- Approve command → Reference images: promotes test images
- Playwright engine → Capture hooks: loads scripts
- Puppeteer engine → Capture hooks: loads scripts