Emotion: Make jest-utils able to take in any `sheet` instance.

Created on 24 Jun 2017  路  4Comments  路  Source: emotion-js/emotion

If we can implement this feature, users of emotion will be able to use these utils as well.

expect.addSnapshotSerializer(serializer)
expect.extend(matcher)
expect.addSnapshotSerializer(serializer(sheet))
expect.extend(matcher)

This is the reason I had to fork https://github.com/kentcdodds/jest-glamor-react for the utils.

See my issue in that repo https://github.com/kentcdodds/jest-glamor-react/issues/5. I couldn't figure out how to do this without changing the api. We do not have that restriction in the repo so it can be accomplished in whatever way that works.

Most helpful comment

That's been merged and will be released in a minute. Enjoy!

All 4 comments

I think this is actually possible without breaking the api.

https://github.com/mitchellhamilton/jest-glamor-react/blob/master/src/serializer.js

I'll probably open a PR once I write tests and fix it up a bit.

That's been merged and will be released in a minute. Enjoy!

@kentcdodds thank you for keeping us updated.

I will port the tests over after #23 is merged.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

acnebs picture acnebs  路  3Comments

mattfysh picture mattfysh  路  3Comments

rockmandash picture rockmandash  路  3Comments

artooras picture artooras  路  3Comments

mitchellhamilton picture mitchellhamilton  路  3Comments