문제

I'm setting up an Express / AngularJS project. Express will serve the static assets for AngularJS and act as an API server. I want to unit test my express controllers and endpoints.

I may have some scenarios as well that need to be tested (like first create a user, then login, etc). I also want code coverage. Oh, did I mention that it's all in CoffeeScript as well?

I'm using karma and jasmine for my Angular tests. I'd like to stick to similar frameworks for the node.js layer.

Any suggestions on getting started?

도움이 되었습니까?

해결책

supertest is great for this. You should be able to use it with jasmine or mocha easily. supertest-session can help with mocking out a logged-in user.

Have a look at some of these mocha + supertest tests if you need an example: https://github.com/focusaurus/peterlyons.com/tree/master/test/application

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top