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 8.1.0 to 8.1.1

test/fixtures/dummy.txt

4

package.json
{
"name": "avvio",
"version": "8.1.0",
"version": "8.1.1",
"description": "Asynchronous bootstrapping of Node applications",

@@ -34,3 +34,3 @@ "main": "boot.js",

"devDependencies": {
"@types/node": "^16.0.0",
"@types/node": "^17.0.0",
"express": "^4.17.1",

@@ -37,0 +37,0 @@ "pre-commit": "^1.2.2",

@@ -152,12 +152,14 @@ 'use strict'

if (err) {
debug('rejecting promise', this.name, err)
this._promise.reject(err)
} else {
debug('resolving promise', this.name)
this._promise.resolve()
}
this._promise = null
process.nextTick(() => {
if (err) {
debug('rejecting promise', this.name, err)
this._promise.reject(err)
} else {
debug('resolving promise', this.name)
this._promise.resolve()
}
this._promise = null
process.nextTick(cb, err)
process.nextTick(cb, err)
})
})

@@ -164,0 +166,0 @@ this.q.resume()

@@ -7,2 +7,4 @@ 'use strict'

const sleep = promisify(setTimeout)
const fs = require('fs').promises
const path = require('path')

@@ -251,3 +253,3 @@ test('await after - nested plugins with same tick callbacks', async (t) => {

t.ok(firstLoaded, 'first is loaded')
t.notOk(secondLoaded, 'second is not loaded')
t.ok(secondLoaded, 'second is loaded')
t.notOk(thirdLoaded, 'third is not loaded')

@@ -285,2 +287,52 @@ t.notOk(fourthLoaded, 'fourth is not loaded')

test('without autostart and sync/async plugin mix', async (t) => {
const app = {}
boot(app, { autostart: false })
t.plan(11)
let firstLoaded = false
let secondLoaded = false
let thirdLoaded = false
app.use(first)
await app.after()
t.ok(firstLoaded, 'first is loaded')
t.notOk(secondLoaded, 'second is not loaded')
t.notOk(thirdLoaded, 'third is not loaded')
const contents = await fs.readFile(path.join(__dirname, 'fixtures', 'dummy.txt'), 'utf-8')
t.equal(contents, 'hello, world!')
app.use(second)
await app.after()
t.ok(firstLoaded, 'first is loaded')
t.ok(secondLoaded, 'second is loaded')
t.notOk(thirdLoaded, 'third is not loaded')
await sleep(10)
app.use(third)
await app.after()
t.ok(firstLoaded, 'first is loaded')
t.ok(secondLoaded, 'second is loaded')
t.ok(thirdLoaded, 'third is loaded')
await app.ready()
async function first () {
firstLoaded = true
}
async function second () {
const contents = await fs.readFile(path.join(__dirname, 'fixtures', 'dummy.txt'), 'utf-8')
t.equal(contents, 'hello, world!')
secondLoaded = true
}
async function third (app) {
await sleep(10)
thirdLoaded = true
}
})
test('without autostart', async (t) => {

@@ -287,0 +339,0 @@ const app = {}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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