test-server: exit when child process failed

Improve handling of errors reported by the spawned child:
 - include more info in the error message printed to console
 - exit the process (it is kept alive by the http server)
npm test: remove dependency on global karma-cli

The npm module karma does not expose the "karma" binary via package.json
bin scripts, developers are advised to install global karma-cli.

To make the life of CI server easier, the "npm test" script is modified
to "./node_modules/karma/bin/karma" instead of "karma".
Merge pull request #31 from strongloop/feature/fix-jenkins-build

Feature/fix jenkins build
Template refactoring: extract ngdocForMethod

Extract the template of ngdoc comment for a resource method into
a function.

No changes of functionality.
Support internal and @deprecated methods in ngdoc
Allow e2e tests to run custom setup code on server

Sample usage:

// data for the POST /setup request
JSON.stringify({
  models: {
    Product: { properties: { name: 'string' } },
  },
  setupFn: (function(app, cb) {
    app.models.Product.create(
      { name: 'a-product' },
      function(err, product) {
        if (err) return cb(err);
        cb(null, { productId: product.id }
      });
  }).toString()
})

The server will run the provided function and wait until the callback
is called. Data passed to the callback are exposed to browser tests
as "testData" and can be accessed via the angular injector:

  $injector.get("testData").productId
Prevent reuse of model classes between tests

The LoopBack keeps all models in a static registry. When two tests
are using the same model name, some of the model classes may get shared,
causing bugs difficult to debug.

This commit modifies "/setup" handler to reset the static registry
to the initial state every time a new application is created.
Support hasAndBelongsToMany scope methods

The relation "Product hasAndBelongsToMany Category" creates a scope
property on the Product model with three methods: get, create, delete.

At the Angular side, these methods are defined on the Product $resource,
therefore they return the result as Product instead of Category.

The solution presented in this commit has two parts:

 1. The Category $resource has internal methods calling remote (REST)
    Product.categories.* methods. This way the result is returned
    as Category.

 2. The Product $resource has extra properties (methods) with hand-coded
    implementation delegating to the internal Category methods.

Methods & delegations:
  Product.categories()
    -> Category['::get::Product::categories']()

  Product.categories.create()
    -> Category['::create::Product::categories']()

  Product.categories.destroyAll()
    -> Category['::delete::Product::categories']()

The original scope methods (e.g. prototype$__get__{scope}) are marked
as deprecated, the deprecation text includes the name of the new method
to use.
sharedCtor arguments in ngdoc of prototype methods

The URL of prototype methods includes sharedCtor parameters like ":id",
for example

  GET /api/Products/:id/categories

Because all $resource actions are static (non-prototype) in ngResource,
callers has to include sharedCtor parameters in the arguments.

  Product.categories({ id: productId });

This commit modifies the generated ngdoc to include sharedCtor
parameters in actions for prototype methods.