javascript - How to intercept error when expect fails? Jasmine and frisby -
I'm making a HTTP test with frisby.js which works on top of jasmine.js.
I have also made some mongodibi objects to test against it. The problem is that when I want to clear these DB objects. When one of the expectations fails, I want to stop it and call my own cleanup function. This is what it means. Is then failed each test, I do not support does not afterEach function work properly will not be able to remove the objects tested dB
Jasmine and Jasmine afterall or beforeAll So far That's why I have them today as made test
This (function "with the correct userID and expect the return userform test", () {var innerUserId = userID ;. Frisby.create ( 'right userform must retrieve and return 200 when using a valid userID') .Get (url.urlify ( '/ API / userform', {id: innerUserId})) .expectStatus ( 200) .afterJSON (function (userform) {// If any of these fails, then the function will not run after. // I want to stop the error so that I can make sure Koo that cleanup does not work every function is called after the //. I () var useridJSON = userform.UserId.valueOf (); var firstnameJSON = userform.firstname.valueOf (); var surnameJSON = userform.surname .valueOf (); hope (firstnameJSON) .toMatch (testUser.firstName); hope (surnameJSON) .toMatch (TestUser.surname); hope (useridJSON) .toMatch (innerUserId);}). then (function () {Cleanup (InnerUserIDID);}). Toss ();});
If there is so much that I can make a call to the first exit to your own cleaning tasks "expect" Frisby is a way to intercept the error of jasmine I am thinking.
Full example
"Before exiting", how about it:
process.on ('uncaughtException', function (err)) {console.error ('caught exception:' + fault);});
Comments
Post a Comment