Skip to content
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

Add aliases for Expect@1.x in the transformer #74

Open
Justkant opened this issue Sep 5, 2017 · 7 comments
Open

Add aliases for Expect@1.x in the transformer #74

Justkant opened this issue Sep 5, 2017 · 7 comments

Comments

@Justkant
Copy link

Justkant commented Sep 5, 2017

Hi,

It would be nice to take into account the aliases for every functions that are map in the transformer for Expect.

Ex: https://github.com/mjackson/expect#toinclude

I don't know if there would be some collision problems because of the same function name present but with different behavior.

@skovhus
Copy link
Owner

skovhus commented Sep 5, 2017

Hi @Justkant

Thanks for reporting this. I thought we already did this... Do you have a specific case that is not transformed?

@Justkant
Copy link
Author

Justkant commented Sep 6, 2017

Yes maybe it's really special but we were using the old toContain alias of toInclude (link) with an object as parameter and I think that we should use the new toContainEqual (link) for this case.

@skovhus
Copy link
Owner

skovhus commented Sep 10, 2017

@Justkant thanks. So toContain should already be supported...

Did you get an error after using jest-codemods?

@Justkant
Copy link
Author

Hi @skovhus
Yes but toContain in some cases cannot be used as the old one.
Expect was using the isEqual module for toContain and so it was doing a deep equality check on objects and arrays.
This is not the case anymore, the new toContain is doing a strict equality check.
I think that we should use toContainEqual in those situations.

@skovhus
Copy link
Owner

skovhus commented Sep 21, 2017

@Justkant is this not relevant anymore? Else let us keep it open. : )

@Justkant
Copy link
Author

Oh yes, my bad.

We used jest-codemods to update our tests. Because some of them were using toContain (the old alias) we had to manually edit them.
And so now we don't need really the support for those aliases but you're right that it could be useful to other people.

Thanks for your work on this.

@Justkant Justkant reopened this Sep 21, 2017
@skovhus
Copy link
Owner

skovhus commented Sep 21, 2017

Sure. I'm happy it was useful to you! : )

Let me know if you find other issues or have ideas for improving the codemod.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants