Repository navigation
fix(bridge): fail a missing image snapshot in CI mode instead of writing it - #249
Open
YevheniiKotyrlo wants to merge 2 commits into
Open
YevheniiKotyrlo wants to merge 2 commits into
YevheniiKotyrlo wants to merge 2 commits into
Conversation
|
@YevheniiKotyrlo is attempting to deploy a commit to the Callstack Team on Vercel. A member of the Team first needs to authorize it. |
YevheniiKotyrlo
force-pushed
the
fix/missing-image-snapshot-on-ci
branch
from
October 20, 2026 20:03
dfeedaf to
41af5b7
Compare
YevheniiKotyrlo
marked this pull request as ready for review
October 20, 2026 20:50
YevheniiKotyrlo
marked this pull request as draft
October 20, 2026 21:28
YevheniiKotyrlo
marked this pull request as ready for review
October 21, 2026 17:30
…ing it In Jest's CI mode, toMatchImageSnapshot fails when its snapshot does not exist and saves the received image beside it as <name>-actual.png, where it wrote the snapshot and passed. The Jest session hands the bridge Jest's updateSnapshot state; a bridge context that names none writes a missing snapshot as before. The received and diff images take the whole snapshot name, and toMatchImageSnapshot refuses .not, which would turn the failure into a pass. The playground commits the baselines CI's Android emulator, iOS simulator and Chromium capture for its screenshot and out-of-bounds specs and ignores the failure images saved beside them. The UI testing guide and the CLI's UI skill say how snapshots are created in CI mode, and the CLI reference lists --ci.
YevheniiKotyrlo
force-pushed
the
fix/missing-image-snapshot-on-ci
branch
from
October 21, 2026 17:50
659f68b to
ad57c9e
Compare
# Conflicts: # packages/bridge/src/__tests__/image-snapshot.test.ts # packages/bridge/src/image-snapshot.ts # packages/bridge/src/server.ts # packages/runtime/src/expect/matchers/toMatchImageSnapshot.ts
V3RON
marked this pull request as draft
October 26, 2026 07:11
V3RON
marked this pull request as ready for review
October 26, 2026 07:11
This branch has not been deployed
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.
What is this?
In Jest's CI mode (
--ci, on by default when Jest detects a CI environment),toMatchImageSnapshotnow fails when its snapshot does not exist, and saves the received image beside it as<name>-actual.png. Until now it wrote the snapshot and passed on CI too, so a run without committed snapshots compared nothing and a wrong capture could not fail it (#198). WithCI=trueand no committed snapshots, the playground's web suite passes onmainand writes both specs' snapshots; on this branch the two specs fail with:How does it work?
The session hands the bridge Jest's
updateSnapshotstate. When it is"none", CI mode's value, a missing image snapshot is not written and the match fails; outside CI mode, or with--ci=false, it is written as before, and so it is for acreateHarnessBridgecontext that names no state. The received and diff images take the whole snapshot name, so a name holding.pngkeeps it. Like Jest's own snapshot matchers and jest-image-snapshot,toMatchImageSnapshotnow refuses.not, which would turn that failure into a pass. The UI testing guide gets a "Creating snapshots" section and says.notis refused, the CLI reference lists--ci, and the repository ignores the failure images saved beside committed snapshots.The playground's
screenshotandout-of-boundsspecs need committed baselines now, so this PR adds the ones CI's Android emulator, iOS simulator and headless Chromium capture. Android'sout-of-boundsbaseline shows the row's ten squares, which the app draws with one copy ofreact-nativein the bundle, as it has since #227. On my fork, CI's E2E jobs on the currentmainwith this PR pass both specs against these baselines on Android (run) and web (run); GitHub found no macOS runner for the iOS job, which last passed them on9a505a8(run).Why is this useful?
A CI run now fails where it used to pass while comparing nothing: a snapshot that was never committed, or a capture that went wrong, shows up as a failed test with the received image saved for review.
Fixes #198