In my case, I needed this in the test setup to use the ORM fastify plugin I'm using to generate db schema and remove in teardown.
Steps to Reproduce
Generate a new app with fastify-cli
Try to access a plugin function inside the build function itself eg: app.someSupport()
async function build (t: Test) {
// you can set all the options supported by the fastify CLI command
const argv = [AppPath]
// fastify-plugin ensures that all decorators
// are exposed for testing purposes, this is
// different from the production setup
const app = await helper.build(argv, await config())
app.someSupport()
// Tear down our app after we are done
t.teardown(() => void app.close())
return app
}
Prerequisites
Last working version
4.x
Stopped working in version
5.7.1
Node.js version
v18.16.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Ubuntu 22.04.2 LTS
💥 Regression Report
Generated app, in the test build function, I believe
const app = await helper.build(argv, await config())
doesn't load/autoload plugins, Am I missing something? The issue is about the following line https://github.com/fastify/fastify-cli/blob/f111b25b96d9f29d42c9a8f5ced4108f56a073d0/templates/app-ts/test/helper.ts#L24 app.register app.ready work perfectly before.In my case, I needed this in the test setup to use the ORM fastify plugin I'm using to generate db schema and remove in teardown.
Steps to Reproduce
Try to access a plugin function inside the build function itself eg:
app.someSupport()
Expected Behavior
The plugin function results should be returned.