Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generated build function for test setup doesn't load/autoload plugins #628

Open
2 tasks done
cherifGsoul opened this issue May 24, 2023 · 0 comments
Open
2 tasks done

Comments

@cherifGsoul
Copy link

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the regression has not already been reported

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

const app = await helper.build(argv, await config())

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

  • 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
}
  • An error should be thrown

Expected Behavior

The plugin function results should be returned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant