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 babel-transform-runtime to browser builds #3476

Merged
merged 1 commit into from
May 5, 2017

Conversation

skovhus
Copy link
Contributor

@skovhus skovhus commented May 5, 2017

Summary

Related to #3360.

#3421 introduced additional es5 builds of speciic Jest packages meant for use in browsers. But as async/await is used some places (and possibly other ES6 feature), the transpilation was missing transform-runtime in order to work for consumers.

Alternatives to this solution

  • stop using async/await (and possibly other es6 features) in packages like jest-matchers
  • make consumers provide the babel global runtime (but gives a pretty bad DX)

Should be noted that this proposed solution needs the consumer to install babel-runtime. This should be documented when browser support is made public.

Test plan

Do a beta build and test on ReactTraining/react-media#61

@codecov-io
Copy link

Codecov Report

Merging #3476 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3476   +/-   ##
=======================================
  Coverage   62.23%   62.23%           
=======================================
  Files         181      181           
  Lines        6692     6692           
  Branches        5        5           
=======================================
  Hits         4165     4165           
  Misses       2525     2525           
  Partials        2        2

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 e9e7772...4ff0fbc. Read the comment docs.

@cpojer cpojer merged commit 4b91e92 into jestjs:master May 5, 2017
@cpojer
Copy link
Member

cpojer commented May 5, 2017

Seems reasonable :)

@skovhus skovhus deleted the browser-support-v2 branch May 5, 2017 07:39
@skovhus
Copy link
Contributor Author

skovhus commented May 5, 2017

@cpojer will you do a beta release of this?

@cpojer
Copy link
Member

cpojer commented May 5, 2017

Published jest@19.3.0-alpha.85402254 just for you.

@SimenB
Copy link
Member

SimenB commented May 5, 2017

@thymikee
Copy link
Collaborator

thymikee commented May 5, 2017

If I remember correctly, the problem is that chalk and ansi-styles assume they have process global available. This is how they handle it on Prettier docs (prettier uses jest-validate with chalk included) – https://github.com/prettier/prettier/blob/master/docs/rollup.config.js.

@skovhus
Copy link
Contributor Author

skovhus commented May 6, 2017

So should we actually do a rollup build instead of babel for es5/browser? That might solve these issues. And make the babel runtime dependency hidden.

@SimenB
Copy link
Member

SimenB commented May 6, 2017

We should also add a test to this repo that runs in a browser

@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 13, 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.

6 participants