Merge branch 'release/2.6.2' into production

This commit is contained in:
Miroslav Bajtoš 2015-01-13 10:34:44 +01:00
commit bb98472965
4 changed files with 19 additions and 15 deletions

View File

@ -1,3 +1,9 @@
2015-01-13, Version 2.6.2
=========================
* Don't swallow error when a sub-dependency doesn't resolve. (Samuel Reed)
2015-01-12, Version 2.6.1
=========================

View File

@ -230,7 +230,7 @@ function runScripts(app, list, callback) {
var functions = [];
list.forEach(function(filepath) {
debug('Requiring script %s', filepath);
var exports = tryRequire(filepath);
var exports = require(filepath);
if (typeof exports === 'function') {
debug('Exported function detected %s', filepath);
functions.push({
@ -257,19 +257,6 @@ function runScripts(app, list, callback) {
}, callback);
}
function tryRequire(modulePath) {
try {
return require.apply(this, arguments);
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
debug('Warning: cannot require %s - module not found.', modulePath);
return undefined;
}
console.error('failed to require "%s"', modulePath);
throw e;
}
}
function setupMiddleware(app, instructions) {
if (!instructions.middleware) {
// the browserified client does not support middleware

View File

@ -1,6 +1,6 @@
{
"name": "loopback-boot",
"version": "2.6.1",
"version": "2.6.2",
"description": "Convention-based bootstrapper for LoopBack applications",
"keywords": [
"StrongLoop",

View File

@ -175,6 +175,17 @@ describe('executor', function() {
expect(app.models.Customer._modelsWhenAttached).to.include('UniqueName');
});
it('throws on bad require() call inside boot script', function() {
var file = appdir.writeFileSync('boot/badScript.js',
'require("doesnt-exist"); module.exports = {};');
function doBoot() {
boot.execute(app, someInstructions({ files: { boot: [file] } }));
}
expect(doBoot).to.throw(/Cannot find module \'doesnt-exist\'/);
});
it('instantiates data sources', function() {
boot.execute(app, dummyInstructions);
assert(app.dataSources);