Use done.fail(e) instead of done(e) for forced failures#2199
Use done.fail(e) instead of done(e) for forced failures#2199jamesreggio wants to merge 2 commits intoapollographql:jest-fixesfrom
Conversation
|
@jamesreggio, thanks for your PR! By analyzing the history of the files in this pull request, we identified @jbaxleyiii, @Slava and @calebmer to be potential reviewers. |
Generated by 🚫 dangerJS |
|
oh no! That's no good at all! Thank you for bringing this up! I'll take a look! |
|
@jamesreggio this also explains why the jest 21 build was failing. jest 21 supports throwing via done(error). |
|
@jamesreggio I'm going to close this in favor of the jest 21 PR but THANK YOU for bringing this up! |
Codecov Report
@@ Coverage Diff @@
## master #2199 +/- ##
==========================================
- Coverage 84.4% 83.99% -0.42%
==========================================
Files 35 35
Lines 1949 1949
Branches 458 458
==========================================
- Hits 1645 1637 -8
- Misses 298 306 +8
Partials 6 6
Continue to review full report at Codecov.
|
|
Actually jest 21 appears to not respect the enumerability of object keys so it broke nearly all of our store related tests 👎 So I think we have to stay at jest 20 for now which stinks because 21 has a nice perf jump |
|
Wow... I can't believe that they're going to change the semantics of If the existing For example, the event argument received by the I'd keep a careful eye on whether they waffle and retract that semantic change, because I think many Jest users are in for a world of hurt. |
|
I'm pretty inclined to agree! I'm frustrated as well by the change in the |
|
I shared this FUD on the most relevant Jest PR I could find, over here: jestjs/jest#4016 (comment) And just for notice, I didn't use a In fact, my main concern is the relative un-greppability of the bare usage of ...wherein the payload to the All that to say, just keep an eye out for things I may have missed. |
|
cherry picked and moved to #2213 |
I hate to be the harbinger of bad news, but it looks like some of the tests have been failing silently.
I'm not 100% certain about this, but it appears that Jest and Jasmine have different semantics for the
donefunction, used with async tests. Specifically, while Jasmine recognizesdone(e)to be a failure, Jest just views any invocation ofdoneto be a success, regardless of the presence of an argument.From what I can tell, to force a failure in Jest you have to use, sigh, an undocumented method:
done.fail(e). I only discovered this after finding jestjs/jest#1801 after a fair bit of Googling. Any Jest experts are welcome to suggest an alternative.I've manually transformed all of the sites I could find within the
apollo-clientpackage, but the same needs to be done for all of the other packages in the repo.