Let's suppose you wrote a SailsJS Controller and a SailsJS Service. You got them to work together, and now you want to mock the service while testing your controller.
The problem is that SailsJS magically injects Services -- and Models, and everything else -- into the Controller, making it difficult to simply call HelloController.index() without lifting SailsJS. We need the dependencies to be in place (otherwise we will get a bunch of ugly undefined is not a function kind of errors.
Fortunately, lifting SailsJS in code is almost as easy as running sails lift on your command line, and that is exactly what we are going to do in order run our tests.
Via Jan Hesse