-
Notifications
You must be signed in to change notification settings - Fork 161
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
Can't access plugin inside tests #622
Comments
I have the same problem, cannot access to any "global" plugin. |
I've notice that the |
I noticed the same, Wrapping the app into fastify-plugin was just randomly removed in #446 with this change 6dfee4e#diff-d422baf24ac606e8462ae86c1d33235f3c9299defa513b127d36661e3d766e9dL20-R24. @Eomm why was this feature removed while confusingly keeping the comment that is clearly no longer correct? FWIW I found a viable workaround by adding the following to the end of app.js, and then setting if (process.env.NODE_ENV === "testing") {
// Ensure tests can access all decorators
app[Symbol.for("skip-override")] = true;
} |
If @Hornwitser found the issue, would you like to send a Pull Request to address this issue? Remember to add unit tests. |
I'm not sure how to solve this issue, I'm rather unfamiliar with fastify. |
@Eomm I would like to work on this issue. |
Go for it! |
Prerequisites
Issue
I've generated the project using the cli and then I modified my app.ts file so that it looks like this:
The problem is that when i try to use the pg plugin inside a test I get an error
Cannot read properties of undefined (reading 'query')
, which makes me believe that the plugin hasn't been registered, but I don't know how to do it.The text was updated successfully, but these errors were encountered: