Comparing version 6.3.0 to 6.3.1
@@ -147,3 +147,8 @@ 'use strict' | ||
debug('root plugin ready') | ||
this.emit('preReady') | ||
try { | ||
this.emit('preReady') | ||
} catch (prereadyError) { | ||
err = err || this._error || prereadyError | ||
} | ||
if (err) { | ||
@@ -156,4 +161,4 @@ this._error = err | ||
this.booted = true | ||
this._readyQ.resume() | ||
} | ||
this._readyQ.resume() | ||
}) | ||
@@ -160,0 +165,0 @@ } |
{ | ||
"name": "avvio", | ||
"version": "6.3.0", | ||
"version": "6.3.1", | ||
"description": "Asynchronous bootstrapping of Node applications", | ||
@@ -8,3 +8,3 @@ "main": "boot.js", | ||
"typescript": "tsc --project ./test/types/tsconfig.json", | ||
"test": "standard && tap -j4 test/*test.js && npm run typescript" | ||
"test": "standard && tap --no-esm -j4 test/*test.js && npm run typescript" | ||
}, | ||
@@ -11,0 +11,0 @@ "precommit": "test", |
@@ -321,1 +321,40 @@ 'use strict' | ||
}) | ||
test('preReady errors must be managed', (t) => { | ||
t.plan(2) | ||
const app = boot() | ||
app.use((f, opts, cb) => { | ||
cb() | ||
}) | ||
app.on('preReady', () => { | ||
throw new Error('boom') | ||
}) | ||
app.ready(err => { | ||
t.pass('ready function is called') | ||
t.equal(err.message, 'boom') | ||
}) | ||
}) | ||
test('preReady errors do not override plugin\'s errors', (t) => { | ||
t.plan(3) | ||
const app = boot() | ||
app.use((f, opts, cb) => { | ||
cb(new Error('baam')) | ||
}) | ||
app.on('preReady', () => { | ||
t.pass('preReady is executed') | ||
throw new Error('boom') | ||
}) | ||
app.ready(err => { | ||
t.pass('ready function is called') | ||
t.equal(err.message, 'baam') | ||
}) | ||
}) |
@@ -10,3 +10,5 @@ 'use strict' | ||
} else { | ||
import('./esm.mjs').catch((err) => { | ||
// Import is not allowed syntax in Node 8 | ||
// eslint-disable-next-line | ||
new Function('module', 'return import(module)')('./esm.mjs').catch((err) => { | ||
process.nextTick(() => { | ||
@@ -13,0 +15,0 @@ throw err |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
106710
3597
2