I am using Jasmine 2.10.1. The following spec execution results in the afterAll method not being called:
var http = require('http');
describe("simple server tests:", function() {
afterAll(function(done) {
console.log('after all');
});
it("throws an error because server is not running", function(done) {
http.get("http://127.0.0.1:8080", function(res) {
res.on('data', function(data) {
done();
});
});
});
});
The console shows:
[23:25:24] Starting 'test'...
events.js:85
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED
at exports._errnoException (util.js:746:11)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)
My expectation would be that the afterAll is called, irrespective of the error thrown in the test method. I really don't want to put a try catch around my tests. Please let me know if this is an issue with Jasmine or my usage of Jasmine. Thanks.
Aucun commentaire:
Enregistrer un commentaire