We are observing frequent test failures on Windows CI, where PhantomJS
cannot start because there are no free handles available. Finding
and fixing the process leaking handles is non-trivial and will take
long time.
This commit disables Karma tests on Windows CI machines to prevent
build failures that we are ignoring anyways.
This fixes the following error on io.js:
Fatal error: Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
at String.match (native)
at Object.exports.fromSource (node_modules/karma-browserify/node_modules/convert-source-map/index.js:109:19)
at updateSourceMap (node_modules/karma-browserify/lib/bro.js:326:23)
at Browserify.<anonymous> (node_modules/karma-browserify/lib/bro.js:351:9)
at Browserify.g (events.js:257:16)
at emitTwo (events.js:92:20)
at Browserify.emit (events.js:169:7)
at node_modules/karma-browserify/lib/bro.js:263:11
at node_modules/browserify/index.js:758:13
at ConcatStream.<anonymous> (node_modules/browserify/node_modules/concat-stream/index.js:36:43)
Refactor the core implementation of current context from
server/middleware/context.js into server/current-context.js.
Expose new public API:
- loopback.runInContext
- loopback.createContext
The new location allows developer to use the following identifiers
when loading the middleware using the new declarative style:
app.middlewareFromConfig(
require('loopback/server/middleware/rest'),
{ phase: 'routes' });
app.middlewareFromConfig(
require('loopback/server/middleware/url-not-found'),
{ phase: 'final' });
- Move configuration of Karma unit-tests from `Gruntfile.js` to a
standalone file (`test/karma.conf.js`).
- Add a new Grunt task `karma:unit-ci` to run Karma unit-tests in
PhantomJS and produce karma-xunit.xml file that can be consumed
by the CI server.
- Add grunt-mocha-test, configure it to run unit-tests.
- Add `grunt test` task that runs both karma and mocha tests,
detects Jenkins to produce XML output on CI server.
- Modify the `test` script in `package.json` to run
`grunt mocha-and-karma` (an alias for `grunt test`).
The alias is required to trick `sl-ci-run` to run `npm test`
instead of calling directly `mocha`.
- Add `es5-shim` module to karma unit-tests in order to provide
ES5-methods required by LoopBack.
- Fix `mixin(source)` in lib/loopback.js to work in PhantomJS.
`Object.getOwnPropertyDescriptor()` provided by `es5-shim` does not
work in the same way as in Node.