I really enjoyed Istanbul and experimented with other Node.js coverage libraries, but I have a problem. Almost all of my unit tests are HTTP calls for my API:
it('should update the customer', function (done) { superagent.put('http://myapp:3000/api/customer') .send(updatedData) .end(function (res) { var customer = res.body; expect(res.statusCode).to.equal(200); expect(customer.name).to.equal(updatedData.name); done(); }); });
Unlike the actual request of the customers.js file and a direct call to updateCustomer . Endpoint testing makes a lot more sense to me, because it's not only updateCustomer tests, but also routes, controllers, and everything else.
This works great, but the problem is that I see no way to recognize these tests for any code coverage tool. Is there any way for Istanbul or something else to recognize these Mocha tests? If not, what is the convention? How do you test endpoints and still use code coverage tools?
source share