Skip to content

fix(testing/unstable): report descriptive error when inline snapshot update fails#7191

Open
minato32 wants to merge 1 commit into
denoland:mainfrom
minato32:fix/6746-inline-snapshot-error
Open

fix(testing/unstable): report descriptive error when inline snapshot update fails#7191
minato32 wants to merge 1 commit into
denoland:mainfrom
minato32:fix/6746-inline-snapshot-error

Conversation

@minato32

Copy link
Copy Markdown

Closes #6746.

When assertInlineSnapshot() is run with --update and the post-update deno fmt subprocess fails (e.g. the test was run without --allow-run), the original error was thrown from inside the unload handler and surfaced through the test runner as error: null, giving the caller no clue what went wrong.

The unload handler now catches errors from updateSnapshots() and re-throws them wrapped in an Error whose message is prefixed with assertInlineSnapshot: failed to update snapshots: and whose cause is the original error, so both the runner output and any tooling reading cause get the real reason.

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 25.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.55%. Comparing base (cdf74a8) to head (3b81700).

Files with missing lines Patch % Lines
testing/unstable_snapshot.ts 25.00% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7191      +/-   ##
==========================================
- Coverage   94.57%   94.55%   -0.02%     
==========================================
  Files         636      637       +1     
  Lines       52142    52157      +15     
  Branches     9401     9402       +1     
==========================================
+ Hits        49315    49319       +4     
- Misses       2249     2259      +10     
- Partials      578      579       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] assertInlineSnapshot() fails on write with error: null

1 participant