Merge branch 'release/2.6.2' into production
This commit is contained in:
commit
bb98472965
|
@ -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
|
||||
=========================
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "loopback-boot",
|
||||
"version": "2.6.1",
|
||||
"version": "2.6.2",
|
||||
"description": "Convention-based bootstrapper for LoopBack applications",
|
||||
"keywords": [
|
||||
"StrongLoop",
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue