Comparing version 7.0.0-alpha.2 to 7.0.0-alpha.3
11
boot.js
@@ -151,4 +151,9 @@ 'use strict' | ||
debug('root plugin ready') | ||
this.emit('preReady') | ||
this._root = null | ||
try { | ||
this.emit('preReady') | ||
this._root = null | ||
} catch (prereadyError) { | ||
err = err || this._error || prereadyError | ||
} | ||
if (err) { | ||
@@ -161,4 +166,4 @@ this._error = err | ||
this.booted = true | ||
this._readyQ.resume() | ||
} | ||
this._readyQ.resume() | ||
}) | ||
@@ -165,0 +170,0 @@ } |
{ | ||
"name": "avvio", | ||
"version": "7.0.0-alpha.2", | ||
"version": "7.0.0-alpha.3", | ||
"description": "Asynchronous bootstrapping of Node applications", | ||
@@ -46,5 +46,5 @@ "main": "boot.js", | ||
"debug": "^4.0.0", | ||
"fastq": "^1.6.0", | ||
"fastq": "^1.6.1", | ||
"queue-microtask": "^1.1.2" | ||
} | ||
} |
@@ -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') | ||
}) | ||
}) |
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
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
124153
4201
37
Updatedfastq@^1.6.1