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

Use named import from pretty-format, not default #11360

Merged
merged 2 commits into from Apr 30, 2021

Conversation

IanVS
Copy link
Contributor

@IanVS IanVS commented Apr 29, 2021

Summary

Similarly to #11359, I was trying to run expect in snowpack / webtestrunner, and got errors about

TypeError: (0 , _prettyFormat.default) is not a function

This is because pretty-format exports both a default export and named exports. This confuses babel+rollup, but it sounded like it was an intentional decision in #10515 to keep both. So, this PR does not remove the default export, but it changes all of the existing default imports throughout jest into named imports instead. This seems to compile to cjs in such a way that rollup can successfully turn it back into esm.

Test plan

Same as in #11359, I built jest and used it in my app, and the errors were resolved.

@@ -6,8 +6,11 @@
*/

import chalk = require('chalk');
import getType = require('jest-get-type');
import prettyFormat, {plugins as prettyFormatPlugins} from 'pretty-format';
import getType from 'jest-get-type';
Copy link
Member

Choose a reason for hiding this comment

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

rebasing on master should fix this

@IanVS
Copy link
Contributor Author

IanVS commented Apr 30, 2021

Hmmm, I rebased and I don't understand why one of the tests failed. Maybe it's a flakey test? I also don't think I can restart it.

@SimenB
Copy link
Member

SimenB commented Apr 30, 2021

Yep, looks like flake to me 👍

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

👍

@SimenB SimenB merged commit 7c6cea2 into jestjs:master Apr 30, 2021
@IanVS IanVS deleted the pretty-format-named branch April 30, 2021 14:11
@IanVS
Copy link
Contributor Author

IanVS commented Apr 30, 2021

Thanks for the speedy reviews and merges! 🎉

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants