-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/fastify/avvio into next
- Loading branch information
Showing
9 changed files
with
118 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ jobs: | |
with: | ||
lint: true | ||
license-check: true | ||
node-versions: '["18", "20", "21", "22"]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict' | ||
|
||
/* eslint no-prototype-builtins: off */ | ||
|
||
const { test } = require('tap') | ||
const boot = require('../boot') | ||
|
||
test('onReadyTimeout', async (t) => { | ||
const app = boot({}, { | ||
timeout: 10, // 10 ms | ||
autostart: false | ||
}) | ||
|
||
app.use(function one (innerApp, opts, next) { | ||
t.pass('loaded') | ||
innerApp.ready(function readyNoResolve (err, done) { | ||
t.notOk(err) | ||
t.pass('first ready called') | ||
// Do not call done() to timeout | ||
}) | ||
next() | ||
}) | ||
|
||
await app.start() | ||
|
||
try { | ||
await app.ready() | ||
t.fail('should throw') | ||
} catch (err) { | ||
t.equal(err.message, 'Plugin did not start in time: \'readyNoResolve\'. You may have forgotten to call \'done\' function or to resolve a Promise') | ||
// And not Plugin did not start in time: 'bound _encapsulateThreeParam'. You may have forgotten to call 'done' function or to resolve a Promise | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict' | ||
|
||
/* eslint no-prototype-builtins: off */ | ||
|
||
const { test } = require('tap') | ||
const boot = require('..') | ||
|
||
test('do not load', async (t) => { | ||
const app = boot({}, { timeout: 10 }) | ||
|
||
app.use(first) | ||
|
||
async function first (s, opts) { | ||
await s.use(second) | ||
} | ||
|
||
async function second (s, opts) { | ||
await s.use(third) | ||
} | ||
|
||
function third (s, opts) { | ||
return new Promise((resolve, reject) => { | ||
// no resolve | ||
}) | ||
} | ||
|
||
try { | ||
await app.start() | ||
t.fail('should throw') | ||
} catch (err) { | ||
t.equal(err.message, 'Plugin did not start in time: \'third\'. You may have forgotten to call \'done\' function or to resolve a Promise') | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters