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

Cleanup @emotion/jest entrypoints #1920

Merged
merged 4 commits into from
Jul 2, 2020
Merged

Cleanup @emotion/jest entrypoints #1920

merged 4 commits into from
Jul 2, 2020

Conversation

Andarist
Copy link
Member

@Andarist Andarist commented Jun 27, 2020

  1. make @emotion/jest/serializer & @emotion/jest/enzyme-serializer primarily useful for https://jestjs.io/docs/en/configuration#snapshotserializers-arraystring , they now contain only 2 exports needed for that: test & serialize
  2. use preconstruct to create @emotion/jest/serializer
  3. removed the default export from @emotion/jest, it only exports serializer factories now (and matches) - i believe that in presence of @emotion/jest/serializer this makes more sense and ultimately is a little bit less confusing as the same thing is not exported from different entrypoints using different export specifiers

@Andarist Andarist requested a review from emmatown June 27, 2020 12:12
@changeset-bot
Copy link

changeset-bot bot commented Jun 27, 2020

🦋 Changeset is good to go

Latest commit: 77a7c7d

We got this.

This PR includes changesets to release 1 package
Name Type
@emotion/jest Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 27, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 77a7c7d:

Sandbox Source
Emotion Configuration

@Andarist Andarist force-pushed the cleanup-jest-entrypoints branch 2 times, most recently from b53a662 to c3f28b1 Compare June 28, 2020 21:03
Copy link
Member

@emmatown emmatown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a changeset ofc but other than that, LGTM

@Andarist
Copy link
Member Author

Andarist commented Jul 2, 2020

@mitchellhamilton I've added changesets, could you take a final look?

'@emotion/jest': major
---

`@emotion/jest/serializer`'s main purpose is compatibility with Jest's `snapshotSerializers` option, so it no longer has a default export. You can import `createSerializer` from the root entry (`@emotion/jest`) and create your own serializer if needed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume import * as serializer from '@emotion/jest/serializer' would work?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if so, in this changeset and the one for enzyme stuff, explain that they're individual exports now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume import * as serializer from '@emotion/jest/serializer' would work?

Yes, it is used like that somewhere in our tests.

And if so, in this changeset and the one for enzyme stuff, explain that they're individual exports now.

Done - gonna go ahead and merge this PR, but if you have any other comments then please leave them here and I will make sure to address them.

@Andarist Andarist merged commit cd77efb into next Jul 2, 2020
@Andarist Andarist deleted the cleanup-jest-entrypoints branch July 2, 2020 20:56
@github-actions github-actions bot mentioned this pull request Jul 2, 2020
louisgv pushed a commit to louisgv/emotion that referenced this pull request Sep 6, 2020
* Cleanup @emotion/jest entrypoints

* Do not use strict-export-declare-modifiers rule in TS tests

* Add changesets

* Tweak changesets
@github-actions github-actions bot mentioned this pull request Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants