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

Move jest-get-type to ESM named exports #11359

Merged
merged 2 commits into from
Apr 30, 2021
Merged

Conversation

IanVS
Copy link
Contributor

@IanVS IanVS commented Apr 29, 2021

Summary

I tried using jest's expect together with snowpack (which converts everything to esm via rollup/plugin-commonjs), and it mostly worked okay except I was getting

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

I traced this down to a problem in how rollup/babel (or the combination of them) deal with mixed default and named exports. The rollup docs specifically talk about avoiding mixing the two, as well. I see that all of the other jest packages (except for pretty-format, which also causes me errors) are using either default or named exports, so I chose to use named exports and convert jest-get-type to esm.

Test plan

I built the code, copied all of the newly built files to my node_modules, and my error went away. Also, existing tests continue to pass.

@codecov-commenter
Copy link

Codecov Report

Merging #11359 (b28c92c) into master (4c3643c) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #11359   +/-   ##
=======================================
  Coverage   64.16%   64.16%           
=======================================
  Files         308      308           
  Lines       13515    13515           
  Branches     3294     3294           
=======================================
  Hits         8672     8672           
  Misses       4129     4129           
  Partials      714      714           
Impacted Files Coverage Δ
...ckages/jest-config/src/ReporterValidationErrors.ts 11.76% <ø> (ø)
packages/jest-diff/src/index.ts 82.75% <ø> (ø)
packages/jest-matcher-utils/src/Replaceable.ts 100.00% <ø> (ø)
packages/jest-validate/src/errors.ts 81.81% <ø> (ø)
packages/expect/src/matchers.ts 96.88% <100.00%> (ø)
packages/expect/src/spyMatchers.ts 81.79% <100.00%> (ø)
packages/jest-get-type/src/index.ts 90.32% <100.00%> (ø)
packages/jest-matcher-utils/src/index.ts 86.81% <100.00%> (ø)
packages/jest-snapshot/src/printSnapshot.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c3643c...b28c92c. Read the comment docs.

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.

thanks!

@SimenB SimenB merged commit dae3641 into jestjs:master Apr 30, 2021
@IanVS IanVS deleted the jest-get-type-esm branch April 30, 2021 12:06
@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.

4 participants