test: fail on missing per-kind snapshot instead of auto write#21027
Conversation
|
|
This PR is packaged and the instant preview is available (c61c649). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@c61c649
yarn add -D webpack@https://pkg.pr.new/webpack@c61c649
pnpm add -D webpack@https://pkg.pr.new/webpack@c61c649 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #21027 +/- ##
==========================================
- Coverage 91.59% 91.58% -0.01%
==========================================
Files 573 573
Lines 59541 59541
Branches 16077 16077
==========================================
- Hits 54534 54530 -4
- Misses 5007 5011 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Merging this PR will improve performance by 36.1%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
Summary
Improve local development DX. Previously a local compile error silently wrote
errors.snapand passed; now a missing snapshot fails (like CI) unless you regenerate it with -u.What kind of change does this PR introduce?
matchKindSnapshotbuilt the per-kindSnapshotStatewithupdateSnapshot: parentState._updateSnapshot, which is"new"in a normal local run. Under"new", a missingerrors.snap/warnings.snapis silently written and the test passes on its first run, so a newly introduced compile error/warning is only caught in CI (where the mode is"none").This forces the mode to
"none"unless snapshots are explicitly being updated (-u→"all"). A missing or changed per-kind snapshot now fails in local runs too; recording or refreshing one requiresyarn jest -u.Before: running a test locally that hit a compilation error passed, silently auto-generating
errors.snap.After: such a test now fails when the snapshot is missing (matching CI behavior), unless you run with
-uto generate it.cc @xiaoxiaojx
Did you add tests for your changes?
Existing
Does this PR introduce a breaking change?
Nothing
If relevant, what needs to be documented once your changes are merged or what have you already documented?
n/a
Use of AI
Partial