[X] I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.x.x
Plugin version
No response
Node.js version
20.10.x
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
14.2.1
Description
I tried to generate a fastify plugin use the CLI but encountered few small issues.
The goal is to provide a list of problems and quick solutions to make it work smoothly.
Prerequisites
Fastify version
4.x.x
Plugin version
No response
Node.js version
20.10.x
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
14.2.1
Description
I tried to generate a fastify plugin use the CLI but encountered few small issues. The goal is to provide a list of problems and quick solutions to make it work smoothly.
Steps to Reproduce
Generate a new plugin using the following steps
1. Missing
tap
moduleRun unit tests, failing for missing tap module
Proposed solution: Install tap
2. Tap 18.x not working with current .taprc
Proposed solution: Either downgrade to tap@16 or update
.taprc
to the breaking changes added in tap@183. fastify-tsconfig throw error
Extending the
fastify-tsconfig
inside the tsconfig.json makes the project throw.Proposed solution: remove
extends: 'fastify-tsconfig'
insidetsconfig.json
4. Missing
fastify
andfastify-plugin
dependenciesProposed solution: add both dependencies to
package.json
while generating the project5. plugin is async while placeholder test is not waiting the registration
This could mislead the user making tests to randomly failing if the registration does not complete before the app readiness.
Proposed solution: just add
await app.register(require('..'))
to example testExpected Behavior
To me, the example plugin should pass the tests smoothly to provide a good user experience.