Skip to content

Use image-utils for snapshot tests - #3059

Merged
seveibar merged 15 commits into
mainfrom
fix/remove-sharp-dependency
Aug 7, 2026
Merged

Use image-utils for snapshot tests#3059
seveibar merged 15 commits into
mainfrom
fix/remove-sharp-dependency

Conversation

@seveibar

@seveibar seveibar commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • migrate core snapshot helpers from direct looks-same@9 usage to @tscircuit/image-utils
  • rasterize SVG snapshots with resvg before comparing PNG pixels
  • write image-utils diff buffers to disk explicitly
  • use exact differing-pixel fractions for SVG and 3D tolerance checks
  • keep @tscircuit/image-utils and bun-match-svg as development-only dependencies, with no image-utils peer requirement
  • rebaseline snapshots that the previous matcher silently accepted because it used an invalid percentage denominator

Paired with tscircuit/graphics-debug#227, which removes the consumer-facing transitive sharp path from clean @tscircuit/core installs. Core development installs retain bun-match-svg and its transitive image tooling.

Verification

  • bunx tsc --noEmit
  • bun run build
  • bun run smoke-test:dist
  • bunx @tscircuit/dependency-check
  • representative raw SVG, circuit, simulation, and 3D snapshot tests
  • added coverage proving equivalent SVG markup is compared by rendered pixels

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tscircuit-core-benchmarks Ready Ready Preview Aug 7, 2026 10:59pm

Request Review

@seveibar

seveibar commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

/us

@tscircuitbot

tscircuitbot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

📸 Update Snapshots

❌ Snapshot update failed. Please inspect workflow logs.

🔗 Workflow: View run

…ndency

# Conflicts:
#	tests/features/__snapshots__/autoroutingphase-connection-phase-index-arrays-horizontal-first.snap.svg
#	tests/features/__snapshots__/autoroutingphase-connection-phase-index-arrays-vertical-first.snap.svg
#	tests/features/__snapshots__/autoroutingphase-connection-phase-index-horizontal-first.snap.svg
#	tests/features/__snapshots__/autoroutingphase-connection-phase-index-vertical-first.snap.svg
#	tests/features/__snapshots__/autoroutingphase-connection-reroute-connections-array.snap.svg
#	tests/features/__snapshots__/autoroutingphase-connection-reroute-single-connection.snap.svg
…ndency

# Conflicts:
#	tests/repros/__snapshots__/repro-gameboy-direct-subcircuit-routing-pcb.snap.svg
@seveibar seveibar changed the title Remove sharp from snapshot tests Use image-utils for snapshot tests Aug 7, 2026
@seveibar

seveibar commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

/usf

@tscircuitbot

tscircuitbot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

📸 Update Snapshots (focused)

⚠️ Snapshot updates were committed to c6b737f, but not all tests passed.
Focused verification exited with code 1.

Focused test files:

  • tests/components/primitive-components/schematic-section-manual-placement-5.test.tsx

Source failure run: https://github.com/tscircuit/core/actions/runs/31222127433

🔗 Workflow: View run

@seveibar

seveibar commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

/usf

@tscircuitbot

tscircuitbot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

📸 Update Snapshots (focused)

✅ Snapshot updates committed to 76ac9dd.

Focused test files:

  • tests/components/primitive-components/schematic-section-manual-placement-2.test.tsx

Source failure run: https://github.com/tscircuit/core/actions/runs/31223186102

🔗 Workflow: View run

@seveibar

seveibar commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

/us

@tscircuitbot

tscircuitbot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

📸 Update Snapshots

⚠️ Snapshot updates were committed to c2621c0, but not all tests passed.
Snapshot update test exited with code 1.

🔗 Workflow: View run

…ndency

# Conflicts:
#	tests/components/primitive-components/__snapshots__/copperpour-multiple-outlines-pcb.snap.svg
#	tests/repros/__snapshots__/repro-gameboy-direct-subcircuit-routing-pcb.snap.svg
…ndency

# Conflicts:
#	tests/repros/__snapshots__/repro-gameboy-direct-subcircuit-routing-pcb.snap.svg
@seveibar
seveibar merged commit b026f22 into main Aug 7, 2026
17 checks passed
@seveibar
seveibar deleted the fix/remove-sharp-dependency branch August 7, 2026 23:05
@tscircuitbot

Copy link
Copy Markdown
Contributor

Thank you for your contribution! 🎉

PR Rating:
Impact: Tiny

Track your contributions and see the leaderboard at: tscircuit Contribution Tracker


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.

3 participants