CKGrafico / inversify-props

Wrapper of Inversify to inject your dependencies in the components, made with TypeScript and compatible with Vue, React and other component libraries.
MIT License
85 stars 9 forks source link

[Question] How to use Jest #96

Open bobo-k2 opened 2 years ago

bobo-k2 commented 2 years ago

I am wondering if there is a way to use Jest for mocking dependencies instead write custom mock classes and use mockSingleton or mockTransient?

Suryadeep-bhujel commented 10 months ago

I am using jest , vue3 , typescript and inversify-props, jest is for unit testing, while using, import {container} from "inversify-props" container.get('ServiceClass') this is working in project run command "npm run serve" while I run npm test this is throwing error.

Also I tried to use containerBuilder() but that is no exists in inversify-props but given in documentation to use for testing.

CKGrafico commented 10 months ago

This repo is really old and I cannot continue updating without help, I'm sorry. To be compatible with jest this will need help from a PR