In my TypeScript Node.js application, I am implementing Dependency Injection using Inversify. The functionality works perfectly during the app's execution.
However, I encountered an issue with the @injectable()
annotation when running tests. An error message popped up stating:
TypeError: Reflect.hasOwnMetadata is not a function
This problem seemed familiar, and I found a helpful solution in another Stack Overflow response:
Despite trying to import inversify.config
, the error persisted in my tests. Removing the @injectable()
annotation from the test class allowed the tests to pass.
Since Dependency Injection is unnecessary for testing purposes, disabling it temporarily could be an acceptable workaround.
If anyone has encountered this issue before, any insights would be greatly appreciated.