-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make jest-snapshot less jest/jasmine-specific #1413
Conversation
Sorry I haven't rebased this yet, I'll try to get to that sometime this week. |
BREAKING CHANGE: jest-snapshot no longer exports getSnapshotState, use createSnapshotState and patchJasmine instead
7ef891b
to
78e2db7
Compare
Current coverage is 63.31% (diff: 16.66%)@@ master #1413 diff @@
==========================================
Files 96 98 +2
Lines 3608 3617 +9
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 2284 2290 +6
- Misses 1324 1327 +3
Partials 0 0
|
This is ready for review 😃 |
LGTM. I'm looking forward to this merged to use snapshots with plain Jasmine and https://github.com/turadg/lazyspec |
@suchipi yeah absolutely, we just had absolutely no time at all to think about this or review code. I'm sorry. We'll get back to this soon and are working on merging the snapshot feature into the new matchers and I'll take a look at your PR. |
No worries, I understand you guys are doing a lot right now. 👍 |
Hey @suchipi, I'm sorry I let this diff sit for an entire month. This is not ok and not our usual behavior. We were occupied with the Jest 15 release and @DmitriiAbramov took on the work to rewrite our snapshot implementation to work with Jest and also to work better with external frameworks. It goes a bit further than this diff here and lays the groundwork for future additions to snapshots. See #1721. This means that your PR is no longer applicable to Jest. I apologize that we aren't going to merge your code even though you did all this work. I hope we don't lose you as a future contributor given that the work @DmitriiAbramov did was entirely inspired by the discussion you started. I hope to have more discussions with you on where to take the snapshot feature in the future. You are welcome to join us on discord (see facebook.github.io/jest/support.html ) |
No worries; what is right is more important than who is right. I'm not offended :) |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
WIP - DO NOT MERGE (yet)
Work in progress as per discussion in #1341. I still need to add some tests (around
processSnapshot
(aka the "raw matcher") andcreateSnapshotState
), but wanted to get some feedback first.processSnapshot
,createSnapshotState
, andpatchJasmine
processSnapshot
performs all the business logic of creating, updating, and comparing snapshots, then returns either{pass: true}
or{pass: false, expected: any}
.createSnapshotState
creates a SnapshotState object for a given file pathpatchJasmine
is the same function that was previously defined inindex.js
getSnapshotState
export from jest-snapshot, which created a snapshot state and then patched jasmine with it.createSnapshotState
andpatchJasmine
instead ofgetSnapshotState
.Edit 8/22/16: I changed the interface of
processSnapshot
a bit from my original PR, so I have updated the description to match.