Skip to content

Commit f26de5d

Browse files
authored
fix: amend error codes for latest avvio v8.3.0 (fastify#5309)
* Fix tests for latest avvio Signed-off-by: Matteo Collina <[email protected]> * fixup Signed-off-by: Matteo Collina <[email protected]> --------- Signed-off-by: Matteo Collina <[email protected]>
1 parent 42cf27c commit f26de5d

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

lib/errors.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,5 +464,6 @@ module.exports.AVVIO_ERRORS_MAP = {
464464
AVV_ERR_PLUGIN_NOT_VALID: codes.FST_ERR_PLUGIN_NOT_VALID,
465465
AVV_ERR_ROOT_PLG_BOOTED: codes.FST_ERR_ROOT_PLG_BOOTED,
466466
AVV_ERR_PARENT_PLG_LOADED: codes.FST_ERR_PARENT_PLUGIN_BOOTED,
467-
AVV_ERR_READY_TIMEOUT: codes.FST_ERR_PLUGIN_TIMEOUT
467+
AVV_ERR_READY_TIMEOUT: codes.FST_ERR_PLUGIN_TIMEOUT,
468+
AVV_ERR_PLUGIN_EXEC_TIMEOUT: codes.FST_ERR_PLUGIN_TIMEOUT
468469
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@
204204
"@fastify/error": "^3.4.0",
205205
"@fastify/fast-json-stringify-compiler": "^4.3.0",
206206
"abstract-logging": "^2.0.1",
207-
"avvio": "^8.2.1",
207+
"avvio": "^8.3.0",
208208
"fast-content-type-parse": "^1.1.0",
209209
"fast-json-stringify": "^5.8.0",
210210
"find-my-way": "^8.0.0",

test/hooks.on-ready.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ t.test('onReady cannot add lifecycle hooks', t => {
295295
t.ok(error)
296296
t.equal(error.message, 'Root plugin has already booted')
297297
// TODO: look where the error pops up
298-
t.equal(error.code, 'AVV_ERR_PLUGIN_NOT_VALID')
298+
t.equal(error.code, 'AVV_ERR_ROOT_PLG_BOOTED')
299299
done(error)
300300
}
301301
})

test/plugin.4.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test('pluginTimeout', t => {
2222
"fastify-plugin: Plugin did not start in time: 'function (app, opts, done) { -- // to no call done on purpose'. You may have forgotten to call 'done' function or to resolve a Promise")
2323
t.equal(err.code, 'FST_ERR_PLUGIN_TIMEOUT')
2424
t.ok(err.cause)
25-
t.equal(err.cause.code, 'AVV_ERR_READY_TIMEOUT')
25+
t.equal(err.cause.code, 'AVV_ERR_PLUGIN_EXEC_TIMEOUT')
2626
})
2727
})
2828

@@ -40,7 +40,7 @@ test('pluginTimeout - named function', t => {
4040
"fastify-plugin: Plugin did not start in time: 'nameFunction'. You may have forgotten to call 'done' function or to resolve a Promise")
4141
t.equal(err.code, 'FST_ERR_PLUGIN_TIMEOUT')
4242
t.ok(err.cause)
43-
t.equal(err.cause.code, 'AVV_ERR_READY_TIMEOUT')
43+
t.equal(err.cause.code, 'AVV_ERR_PLUGIN_EXEC_TIMEOUT')
4444
})
4545
})
4646

@@ -60,7 +60,7 @@ test('pluginTimeout default', t => {
6060
"fastify-plugin: Plugin did not start in time: 'function (app, opts, done) { -- // default time elapsed without calling done'. You may have forgotten to call 'done' function or to resolve a Promise")
6161
t.equal(err.code, 'FST_ERR_PLUGIN_TIMEOUT')
6262
t.ok(err.cause)
63-
t.equal(err.cause.code, 'AVV_ERR_READY_TIMEOUT')
63+
t.equal(err.cause.code, 'AVV_ERR_PLUGIN_EXEC_TIMEOUT')
6464
})
6565

6666
t.teardown(clock.uninstall)

test/pretty-print.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ test('pretty print - empty plugins', t => {
220220
fastify.ready(() => {
221221
const tree = fastify.printPlugins()
222222
t.equal(typeof tree, 'string')
223-
t.match(tree, 'bound root')
223+
t.match(tree, /root \d+ ms\n bound _after \d+ ms/m)
224224
})
225225
})
226226

0 commit comments

Comments
 (0)