Sospetto che in realtà non stai chiamando test.done()
In quel secondo test. Mettere a console.log()
Chiama lì per verificare che stai effettivamente effettuando quella chiamata.
FWIW, ho riprodotto il problema descritto usando una versione semplificata del test, di seguito. Se ometti il on('error', function() {...})
Handler, quindi il secondo test non riesce a completare. Quindi, la mia teoria è che la tua /push
L'endpoint sta innescando un comportamento diverso nel modulo REDify. IE sei tu sicuro Restrify sta invocando il tuo callback con un err
proprietà lì o sta facendo qualcosa di diverso? ... come, ad esempio, emettere un evento come http.get
fa, di seguito.
var http = require('http');
exports.test1 = function (test) {
test.expect(1);
http.get({hostname: "www.broofa.com", path: "/"}, function (res) {
test.equal(res.statusCode, 200, 'got 200');
test.done();
});
};
exports.test2 = function (test) {
test.expect(1);
http.get({hostname: "www.no-such-domain.com", path: "/"}, function (res) {
test.equal(res.statusCode, 200, 'got 200');
test.done();
}).on('error', function() {
// Comment line below out to repro the "Undone tests" error
test.done();
});
};