test(share): guards share card rendering against package bumps - #3151
Merged
Conversation
|
|
Overall Grade |
Security Reliability Complexity Hygiene Coverage |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| JavaScript | Aug 18, 2026 3:47p.m. | Review ↗ | |
| Code coverage | Aug 18, 2026 3:47p.m. | Review ↗ |
Code Coverage Summary
| Language | Line Coverage (Overall) |
|---|---|
| Aggregate | 69.2% [▲ up 0.3% from main] |
| Javascript | 69.2% [▲ up 0.3% from main] |
➟ Additional coverage metrics may have been reported. See full coverage report ↗
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
Drives the actual card, with the existing Silo mapped mocks, through the same ImageResponse pipeline the endpoint uses, once per variant. Renders to png rather than svg so resvg runs too, matching what the endpoint produces. Changing the card does not require touching this test, which was the problem with asserting on markup shape: that only encodes what we know satori accepts today. The assertion is that a package bump cannot introduce complaints. Satori reports rejected values on console.warn rather than throwing, so the spies require silence. MSW lines are filtered out because yoga fetches its wasm as a data uri, which MSW logs as an unhandled request. Failures are unwrapped to satori's own message, otherwise ImageResponse reports an unhelpful "Failed to generate SVG". Satori has no default font and refuses to lay out text without one, even when every string is blank, so a face has to come from somewhere. Rather than vendor a font, maintain a list of paths, or make every contributor install fontconfig, this runs on CI only and the test job installs it. The gate is process.env.CI, not font availability, so a CI runner without fontconfig fails loudly instead of quietly skipping the one test that is supposed to catch this. Dimensions are mocked at half scale, which cuts rasterisation from 6.6s to 2.6s. Shrinking only the canvas is not an option: the card derives its own boxes from SHARE_TYPE_DIMENSIONS, so the content would overflow and resvg dies on it. Halving the whole set keeps the layout proportional. A third scale saves only another 0.6s, since fixed overhead dominates below half.
seferturan
force-pushed
the
test/satori
branch
from
August 18, 2026 15:47
65cf95a to
ab4f1fa
Compare
rudf0rd
approved these changes
Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎶 Notes 🎶
console.warnrather than throwing, so the spies require silenceImageResponsereports an unhelpful "Failed to generate SVG"Invalid value "265" for "height"process.env.CI, not font availability, so a runner without fontconfig fails loudly instead of quietly skipping the one test meant to catch thisSHARE_TYPE_DIMENSIONSso the content overflows and resvg dies🤔 Worth knowing 🤔
resolve.conditions: ['browser']stopsImageResponsetaking the component directly. Closing that gap needs a separate vitest project with node conditions