-
Notifications
You must be signed in to change notification settings - Fork 4
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
Adapt tool for jest #14
Comments
Could you help me understand your project goal? Do you want to keep the syntax of jasmine-mock-factory but use jest instead of jasmine for assertion and mocking? |
Yes. Currently I'm using NestJS (nodejs backend framework) and architecture of NestJS is similar to Angular. I realized that using built-in jest mocking features is not very convenient in some cases, in those cases jasmine-mock-factory will more suitable. Namely, creating mock object from class. I cannot switch to jasmine testing framework, because jest has many other good built-in stuff (assertions, etc.) So, I want to combine best from both worlds. |
I see. I agree that it's probably better for you to stick to jest. The jasmine-mock-factory as its name suggestions, was designed to work hand-in-hand with jasmine. Jest, on the other hand, has its own opinion on how to automatically mock classes, as described in its documentation. I noticed that the getter and setter mocks in Jest are lacking. You can track and up-vote this issue. I feel wrapping jasmine-mock-factory around jest isn't the best solution, because
In your case, I wonder if you can write a simple test utility to just "polyfill" the getter/setter issue with jest. |
Unfortunately, this helper does not work for jest.
But there are few place to fix.
Maybe possible detect environment in runtime and call appropriate methods? Or it is better to create separate module for jest...
The text was updated successfully, but these errors were encountered: