Socket
Socket
Sign inDemoInstall

avvio

Package Overview
Dependencies
Maintainers
2
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

avvio - npm Package Compare versions

Comparing version 7.0.0-alpha.4 to 7.0.0-alpha.5

2

boot.js

@@ -141,3 +141,3 @@ 'use strict'

this._doStart = null
this._root = new Plugin(this, root.bind(this), opts, noop, 0)
this._root = new Plugin(this, root.bind(this), opts, false, 0)
this._root.once('start', (serverName, funcName, time) => {

@@ -144,0 +144,0 @@ const nodeId = this.pluginTree.start(null, funcName, time)

{
"name": "avvio",
"version": "7.0.0-alpha.4",
"version": "7.0.0-alpha.5",
"description": "Asynchronous bootstrapping of Node applications",

@@ -5,0 +5,0 @@ "main": "boot.js",

@@ -76,7 +76,10 @@ 'use strict'

try {
this.server = this.parent.override(server, func, this.opts)
} catch (err) {
debug('override errored', name)
return cb(err)
if (!this.isAfter) {
// Skip override for after
try {
this.server = this.parent.override(server, func, this.opts)
} catch (err) {
debug('override errored', name)
return cb(err)
}
}

@@ -83,0 +86,0 @@

@@ -297,3 +297,3 @@ # avvio

3. If two parameters are given to the callback, the first will be the `error` object, the second will be the `done` callback.
4. If three parameters are given to the callback, the first will be the `error` object, the second will be the top level `context` unless you have specified both server and override, in that case the `context` will be what the override returns, and the third the `done` callback.
4. If three parameters are given to the callback, the first will be the `error` object, the second will be the top level `context` and the third the `done` callback.

@@ -300,0 +300,0 @@ In the "no parameter" and "one parameter" variants, the callback can also

@@ -334,3 +334,3 @@ 'use strict'

await app.use(async (app) => {
t.is(app.count, 5) // 5 because there are 2 after()
t.is(app.count, 3)
})

@@ -337,0 +337,0 @@

@@ -294,1 +294,50 @@ 'use strict'

})
test('after trigger override', t => {
t.plan(8)
const server = { count: 0 }
const app = boot(server)
let overrideCalls = 0
app.override = function (s, fn, opts) {
overrideCalls++
const res = Object.create(s)
res.count = res.count + 1
return res
}
app
.use(function first (s, opts, cb) {
t.equals(s.count, 1, 'should trigger override')
cb()
})
.after(function () {
t.equals(overrideCalls, 1, 'after with 0 parameter should not trigger override')
})
.after(function (err) {
if (err) throw err
t.equals(overrideCalls, 1, 'after with 1 parameter should not trigger override')
})
.after(function (err, done) {
if (err) throw err
t.equals(overrideCalls, 1, 'after with 2 parameters should not trigger override')
done()
})
.after(function (err, context, done) {
if (err) throw err
t.equals(overrideCalls, 1, 'after with 3 parameters should not trigger override')
done()
})
.after(async function () {
t.equals(overrideCalls, 1, 'async after with 0 parameter should not trigger override')
})
.after(async function (err) {
if (err) throw err
t.equals(overrideCalls, 1, 'async after with 1 parameter should not trigger override')
})
.after(async function (err, context) {
if (err) throw err
t.equals(overrideCalls, 1, 'async after with 2 parameters should not trigger override')
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc