Open Rebaiahmed opened 1 year ago
It interferes with ng-mocks? it provides mocking only for services? it can be used for mocking components/modules I mean adapt it for Angular development
I wrote ts-mockery and ng-mocks as separate libraries because they have separate responsibilities.
ng-mocks is what you will use for mocking angular components, directives, and maybe modules. ts-mockery allows for mocking of typescript objects in a completely type-safe way with adapters for spy support.
In an angular world you would maybe use ts-mockery to create the mock services that are then dependency injected into your angular component/directive for instance. It could also be used to mock inputs and such but there is no set playbook of how the two have to be used together.
Okay thanks for the update, I found this package https://github.com/NagRock/ts-mockito which provides same options and features for mocking services and I'm confused which one we should choose for our Angular unit tests
Hi @Rebaiahmed, Are there any migration guides or schematics to migrate from ts-mocks (jasmine) to ts-mockery (jest)?
This library is web and test framework agnostic with TypeScript as the only dependency so I would imagine it still works w the latest Angular.
In the past I've used it w Angular w jasmine, react w jest, node servers w jest, plus if you want to use a different testing framework you can write your own adapter.