Error [FastifyError]: Plugin must be a function or a promise. Received: 'object'

I wanted to add a test to my Fastify project, but I encountered this error:

Error [FastifyError]: Plugin must be a function or a promise. Received: 'object'

Initially, based on the error message, I confirmed that my new plugins were functioning correctly. However, I soon realized that I had placed the test file in the same directory as the routes (which are plugins!), and those routes are automatically loaded by @fastify/autoload. Moving the test file outside the directories that are automatically loaded resolved the issue.

It may not seem like a big deal, but it could potentially save both of us a few minutes in the future.