I try to use jasmine-node tests to test some external API tests. But running the entire test suite does only make sense if the basic connectivity works. So this basically means that I need to hand over that information from a simple ping test to all the others.
That's what I tried but this doesn't succeed even if the first test passes:
var canConnect = false;
describe("The API client", function () {
it("can connect server", function (done) {
api.ping(function (err) {
expect(err).toBeNull();
canConnect = true;
done();
})
});
// pointless the run these if the ping didn't work
if (canConnect) describe("connected clients", function () {
it("can use the API", function (done) {
api.someOtherRequest(function(err) {
expect(err).toBeUndefined();
done();
});
})
});
})
Any suggestions? Maybe even a way to solve this smarter?
Cheers