-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
chore(breaking): remove regenerator-runtime injection #7595
Conversation
Why do we need the regenerator runtime at all? If it's our own code, shouldn't the babel transform add whatever it needs to transpile |
As for the test failures, the changed stack trace looks awesome! Not sure about the automock ones, I'll take a look |
I think it's there for historic reasons, to make Jest "just work" with Babel's generators but I'd need @cpojer to back this up. With Babel 6 it required globally available |
See #7599 |
Now that node 8+ supports |
Yup, agreed |
25ccdfd
to
f3ca428
Compare
9fd72dd
to
6abd74f
Compare
Should update the title of this PR, as well as update the changelog (marking it as breaking, I guess) |
6abd74f
to
3db5e9f
Compare
00d0931
to
1c72e35
Compare
Codecov Report
@@ Coverage Diff @@
## master #7595 +/- ##
==========================================
- Coverage 68.24% 68.16% -0.08%
==========================================
Files 251 251
Lines 9639 9634 -5
Branches 5 5
==========================================
- Hits 6578 6567 -11
- Misses 3059 3065 +6
Partials 2 2
Continue to review full report at Codecov.
|
Woo, green 😀 |
I'm ok with this change. @thymikee is indeed right, this was for making Babel and async/await work out of the box in the past. If this works fine with babel 7, I'm ok with it. Just make sure that if people compile async/await down to ES5 + regenerator runtime in their setup, this change won't break them (alternatively ask them to just drop the transform in the test environment, but it may require setup). |
Adding (just make sure to set module.exports = {
plugins: [
'@babel/plugin-transform-regenerator',
'@babel/plugin-transform-runtime',
],
sourceType: 'script',
}; An alternative to setting I'll push a test with that as an integration test |
…m-runtime * upstream/master: add missing truncate comment to recent blog posts (jestjs#7655) use raw serializer for e2e output snapshots (jestjs#7651) chore: use a Set for reserved words list in `jest-mock` Fix automock for numeric function names (jestjs#7653) Update docs re: `moduleFileExtensions` to add ordering note (left-to-right) (jestjs#7616)
* feat: use @babel/plugin-transform-runtime instead of regenerator-runtime * fix async example * add changelog * add babel/core and babel-jest to all examples * fix native async test * chore: dedupe lockfile * remove babel from native transform test * add test for async regenerator
i am kind of stuck on this error, i have searched through many stackoverflow issues, and other github repos issues, couldn't find issue to resolve here is what i am trying to do, const isTest = String(process.env.NODE_ENV) === 'test' and here is my jest test component file import React from 'react'; test('test common page test', () =>{ after running npm test it throw tried many solutions but couldn't reach to solution {"name": "primer-react", Sorry for bad formatting i am new i couldn't make it better then this |
Thanks Allah my issue is fixed,
and added this in
|
@hanzlahabib Think you may have accidentally left out the word plugin in the library. Following this for steps:
Install
Then chuck this into your babel configuration:
|
I don't understand in what circumstance "@babel/plugin-transform-runtime" needs to be included? This error occurs for us when using react-table's useAsyncDebounce inside a jest test, but I don't know if the correct way to address this issue is to install transform-runtime, or to make some alterations to which node we are targeting - what exactly is the set of tooling/configuration that we should have where this issue does not occur? |
When you transpile Either leave Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions. |
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. |
Summary
An attempt to get rid of
regenerator-runtime
addition insetupFiles
. It's currently not working, but wanted @SimenB to see what can be wrong.Test plan
Fix automock test failures