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

TypeError: classLoader is not a function when executing Jest Test #875

Open
jgotty777 opened this issue Feb 8, 2023 · 1 comment
Open

Comments

@jgotty777
Copy link

Hi there. I tried to follow the example found here to build a simple Jest test for my project. Running the test gives the following error message:

68c86f8c-5891-4a35-b14f-66db670545c7

To be honest, I just started using fastify and decorators, so I honestly have no idea what information might be needed to assist. Attached are the controller file and the service file (note for the services my team decided to split the service into a service file and a repo file (holds only database logic), but I think both are just service objects).

Repository
image

Service (uses Repository)
image

Controller
image

Controller Test:
image

If you need anything else I will do my best to provide it.

Thanks!

@JazielGuerrero
Copy link

I had the same issue of TypeError: classLoader is not a function when executing Jest Test. In my case I was using fastify-decoratos v3.15.0 but the jest configuration I followed was for v4. After I updated to fastify-decoratos v4.0.0-next.4 the test work and the error went away.

Test doc for v3.15.0 can be found here
Test doc for v4 can be found here

Hope this helps.

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

2 participants