-
Notifications
You must be signed in to change notification settings - Fork 25
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
Adding jest support #99
Comments
👋🏼 I’m using jest with shallow-render on multiple projects (both personal and work related) and it works perfectly fine. Is there anything specific you need help with? |
It seems to be related to when I use the This is also an issue: https://github.com/getsaf/shallow-render/blob/a30d987633530c442ef6480e7985599094826747/lib/models/mock-of-provider.ts |
Yeah, so I hadn't used Jest for Angular tests before but I have been using it more in other projects. I just learned that Jest ships with a "monkeypatched" version of Jasmine which means Jasmine spys work with Jest out-of-the-box. I think this means that Shallow already supports Jest because it uses Jest-compatible Jasmine spys (as @kylecannon pointed out). @kreatemore, It seems that there's no work to do on this one unless you have experienced any quirks on your end. |
I tried running Jest today on a project that was using .mock and it was failing using jest.
Some jasmine methods work out of the box but not all. |
Seems right, this reproduces the above: https://github.com/kreatemore/shallow-render-hammerjs/blob/master/src/app/app.component.spec.ts#L9 I've found similar code in one of our private projects (with more dependencies, like Edit: Probably these are incompatible with jest:
|
@getsaf I'm going to have quite a busy weekend, but I'd still like to give this a go - if you don't mind of course |
Please do. I wonder if if we could auto-detect if jest or Jasmine are
available and use the whichever one we find.!
…On Thu, Apr 4, 2019, 6:44 PM ***@***.***> wrote:
@getsaf <https://github.com/getsaf> I'm going to have quite a busy
weekend in front of me, but would you mind if I'd give this a go?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#99 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKDPnFdEPyd0gZOCVmEy-q16u9XUz_Yqks5vdoBYgaJpZM4cdhmA>
.
|
ts-mockery handles this nicely. Taking a look at it might not be a bad idea. |
Also would be preferable to avoid pulling in additional packages if we can
…On Thu, Apr 4, 2019, 6:44 PM ***@***.***> wrote:
@getsaf <https://github.com/getsaf> I'm going to have quite a busy
weekend in front of me, but would you mind if I'd give this a go?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#99 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKDPnFdEPyd0gZOCVmEy-q16u9XUz_Yqks5vdoBYgaJpZM4cdhmA>
.
|
I did see that in #76 that you were thinking about adding Jest support. Is this something that is on the roadmap?
The text was updated successfully, but these errors were encountered: